# Thoughts — Agent-First Daily Radar & Personal Thought Ledger Base URL: https://thoughts.mikechenwm.com Thoughts stores daily curated signal digests (X, HN, GitHub, Podcasts, Blogs) alongside Mike's personal keypoints, picked ("想写") items, and daily reflections in Cloudflare D1. ## Authentication Model - All READ endpoints (GET) are 100% public with no login required. - All WRITE endpoints (POST / PATCH / PUT / DELETE) require EITHER: - Header: `Authorization: Bearer ` - Or an `HttpOnly` session cookie obtained via `POST /api/auth/verify` - Every error returns structured JSON: `{ "ok": false, "error": "...", "hint": "..." }`. ## Public Read Endpoints - `GET /llms.txt` — This concise agent guide (text/plain). - `GET /api/schema` — Machine-readable JSON schema of all endpoints and payloads. - `GET /api/dates` — List all dates DESC with `itemCount`, `keypointCount`, `pickedCount`, `hasDailyNote`. - `GET /api/day/:date` — Full day view (YYYY-MM-DD): `digest` (with `items`), `customKeypoints`, `itemKeypoints`, `dailyNote`. - `GET /api/notes/all` — Aggregated notes & picked items across days. Query params: `?since=YYYY-MM-DD`, `?picked=true`, `?q=`, `?limit=`. - `GET /api/export/markdown?days=7` — Clean LLM-ready Markdown dump of recent digests, Mike's keypoints, and picked items. Optional params: `?days=7` (1-90), `?since=YYYY-MM-DD`, `?picked=true`. - `GET /api/stats` — Agent-learning analytics: channel/tag/source distribution of Mike's picked items & keypoints, top recurring sources, recent picked items & keypoints. - `GET /api/auth/status` — Check whether current request has write permission: `{ "ok": true, "writable": boolean }`. ## Protected Write Endpoints - `POST /api/auth/verify` — Body: `{ "token": "" }`. Sets 1-year HttpOnly cookie. - `POST /api/auth/logout` — Clears session cookie. - `POST /api/sync/digest` — Idempotent upsert of a daily digest. Body: `{ "date": "YYYY-MM-DD", "summary": "...", "picks": ["..."], "items": [{ "id": "1", "ch": "pod|x|hn|blog", "tag": "POD", "source": "...", "date": "12-05", "title": "...", "url": "...", "links": [{ "label": "...", "url": "..." }], "raw": "...", "why": "...", "angle": "..." }] }` Guarantee: preserves existing `picked` flags on items and NEVER deletes existing `keypoints` or `daily_notes`. - `POST /api/keypoints` — Create a standalone keypoint (`itemId: null`) or attach one under a digest item (`itemId: "1"`). Body: `{ "date": "YYYY-MM-DD", "keypoint": "...", "info": "...", "itemId": null, "tag": "关键点", "source": "...", "url": "...", "picked": false }` - `PATCH /api/keypoints/:id` — Partially update `keypoint`, `info`, `source`, `url`, `tag`, `picked`. - `DELETE /api/keypoints/:id` — Delete a keypoint by ID. - `PATCH /api/items/:date/:id` — Set or toggle `picked` flag on a digest item. Body: `{ "picked": true }` (or empty to toggle). - `PUT /api/daily-note/:date` — Upsert daily reflection/draft. Body: `{ "content": "..." }`. ## Quick Examples ```bash # Read recent 7 days as LLM-ready Markdown curl -s "https://thoughts.mikechenwm.com/api/export/markdown?days=7" # Study Mike's evolving taste & recurring sources curl -s "https://thoughts.mikechenwm.com/api/stats" # Sync a daily digest (idempotent) curl -X POST "https://thoughts.mikechenwm.com/api/sync/digest" \ -H "Authorization: Bearer $THOUGHTS_WRITE_TOKEN" \ -H "Content-Type: application/json" \ -d @digest.json # Add a keypoint curl -X POST "https://thoughts.mikechenwm.com/api/keypoints" \ -H "Authorization: Bearer $THOUGHTS_WRITE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"date":"2026-12-05","keypoint":"Model itself is the platform","info":"Key takeaway from Ode interview","source":"Latent Space","picked":true}' ```