# roadmap When, in what order, gated by what. Why: [vision](vision.dj). How: [architecture](architecture.dj). What ships first: [plan/mvp.dj](plan/mvp.dj) (the app0.linji.at MVP, incl. per-concept rationale and the P.R.C. hosting rule). ## Phases **000 — Foundation.** Lexicons drafted; dev PDS; OAuth login; one hardcoded community; channels/topics/posts CRUD; delivery. Done when: two accounts hold a topical conversation. **001 — Dogfood.** Migrate 同喜班 off Zulip onto spaces hosted on linji.at. Multiple spaces, created from the web UI or CLI (S017); whether creation stays open to every member or gets admin-gated is a dogfood policy call. Members log in via OAuth with an account on any PDS (e.g. *.bsky.social); we host their space records on our zds, since their PDSes are not permissioned-data-capable (see architecture.dj "External members"). Hosting their data ourselves is what lets dogfooding start without waiting for proposal 0016. Chat runs member-only on spaces (same schema). Invite codes. AI bot in topics (questions on the 课文, 八步骤-style reflection prompts). Roles v0. Done when: the class holds one full 共修 session in linji.at and doesn't go back to Zulip to finish it. **002 — Multi-community.** (post-lock: proposal 0016 — permissioned data — stable and broadly adopted) One account, many communities; community creation by invitation (self-serve, replacing 001's admin-only CLI creation); moderator roles; managing-app access hooks (`checkUserAccess`); native space repos for members on space-capable PDSes — the 0016-dependent half; members on non-capable PDSes keep hosted records on our zds, as in 001. Done when: a second community runs for a month without the seed community's involvement. **003 — Open.** (post-lock) Public communities in records mode (any PDS); appview indexer over the firehose; directory; federation hardening. ## M001 (complete) One `linji` CLI, multiple logged-in accounts, one topic on local zds — **done and proven** (`app0/tests/scenario.zig`, 19 checkpoints). ``` linji login alice.test # OAuth loopback, adds to multi-account store linji login bob.test linji post --topic "课文讨论" "…" linji post --as bob.test --topic "课文讨论" "…" linji read # merged across member repos ``` Substrate: public records + `listRecords` (2–3 accounts need no indexer). Concepts touched: repo, record, collection, AT-URI, DID+handle, OAuth login. Nothing else. Proven: one binary holds alice + bob sessions; messages posted as each appear merged in one topic; the scenario drives the full exchange and then force-expires access tokens (`dev.zat.debug.expireTokens`) and shows each account transparently refreshing on its next write — per-account rotation asserted at the token-table level. Note: refresh scenarios use expireTokens, not setClock — rationale in [architecture](architecture.dj) (simulation rig). ## Slices - **S001** ✓ — app0 scaffold: build.zig + zat dep, `core/` layout, multi-account session store, `tools/sandbox.sh`. - **S002** ✓ — rig patch into the zds fork: clock centralization, setClock/getClock + expireTokens behind `ZDS_DEV_TOOLS`. - **S003** ✓ — `linji login`: OAuth loopback against zds (scripted consent for tests, browser URL for humans; multi-account store). - **S004** ✓ — `linji post` / `read` / `watch`: `at.linji.post` records (superseded by S007: posts file under threads, space-only). - **S005** ✓ — M001 scenario test, 19 checkpoints, PASS (retired in S007; scenario-space is the strict superset). - **S006** ✓ — member-only spaces end to end (zds fork policy fixes, `core/spaces.zig`, space CLI). [log](log/s006.dj) - **S007** ✓ — threads as `at.linji.thread` records; posts reference by AT-URI; grouped readSpace view. [log](log/s007.dj) - **S008** ✓ — edits, owner moderation (zds authority override), inline hashtags as the whole tag story. [log](log/s008.dj) - **S009** ✓ — BFF server: `linji serve` hosts OAuth + cookie sessions + JSON API + static PWA. [log](log/s009.dj) - **S010** ✓ — SolidJS PWA (`app0/web/`): login, join-by-URI, threads, messages, composer; manifest + SW. [log](log/s010.dj) - **S011** ✓ — export as Markdown; no in-app publishing, ever. [log](log/s011.dj) - **S012** ✓ — login UX + deploy: BYO handle from any PDS, invite-code login gate, PWA polish, dinit dev stack, Fly.io image. [log](log/s012.dj) - **S013** ✓ — CLI published for bot authors (README rewrite, install, headless OAuth flow, watch-loop bot example). AI bot deferred; the CLI IS the bot surface. [log](log/s013.dj) - **S014** ✓ — Web Push end to end: VAPID + RFC 8291 in `core/push.zig`, subscribe API, post-trigger fan-out (zds roster opened to members), PWA bell + SW handler. [log](log/s014.dj) - **S015** ✓ — SSE updates (`/api/events`, server watches zds as the session user; catches CLI-bot writes) + open-app notifications; closed-app delivery = best-effort. [log](log/s015.dj) - **S016** ✓ — Web UI behavior tests: Vitest + happy-dom in `app0/web/tests/` (fake in-memory BFF), 19 tests. [log](log/s016.dj) - **S017** ✓ — PWA feature parity (multi-space, members, edit/move/delete, export) + per-user data rights (own-data export + deletion). [log](log/s017.dj) - **S018** ✓ — space invite links end to end (zds simplespace.join / inviteInfo, BFF endpoints, join screen) + gruvbox UI redesign (light/dark, mobile drawer, English copy). [log](log/s018.dj) - **S019** ✓ — production deploy: zds.linji.at (PDS) + app0.linji.at (BFF+PWA) on Fly.io, real did:plc accounts, seeded tongxi space, invite flow verified end to end in prod, stateless session cookies. [log](log/s019.dj) - **S020** ✓ — external sign-in: any atproto handle (bsky.social included) logs into app0; app-level invite gate removed (handles are the sign-up credential, invite codes gate spaces only); bootstrap swaps home-PDS tokens for full-scope zds creds via getServiceAuth + zds service-auth createAccount + zds OAuth. [log](log/s020.dj) - **S023** ✓ — invite errors surfaced verbatim: the BFF forwards zds's structured `{error, reason}` on invite preview/join instead of collapsing every upstream failure into 403 "denied" (transport failures get a distinct 502); oauth.refresh serialized against the concurrent-401 replay race that split token families and locked the app out of zds. [log](log/s023.dj) - **S024** ✓ — the gate's gate: shared scenario harness (`app0/tests/harness.zig`) with L1 self-tests; scripted-fake rig (`fake-zds`/`fake-linji`/`fake-serve` + `tests/fixtures/*.tsv`) proving `zig build scenario-self` in both polarities (good fixtures PASS, broken fixtures FAIL at the checkpoint they break, a stuck CLI is reaped by the harness timeout); port + timeout isolation; `zig build scenario-isolation` for concurrent runs. The gate is now testable without the rig it gates. [log](log/s024.dj) ## Open questions (none open) ## Open follow-ups Aggregated from slice logs; a log's "Follow-ups" section isn't closed until copied here or done. Delete entries as they land. - zds logs a steady ~1.3Hz `bearer auth invalid: jwt parse/verify failed token_len=424` — foreign JWT on a bearer route, not our code; parked pending ZDS_LOG_LEVEL=debug path capture. (s020, s021) - Wildcard handle resolution: `*.zds.linji.at` A/AAAA + ACME CNAME not yet in DNS — new accounts' handles don't resolve externally. (s019) - alice/bob `.zds.linji.at` seed passwords lost; rotate via the s022 procedure when needed. - Expired-invite E2E not in the scenario suite (zds unit tests + vitest cover the reasons). (s018) - Invite revocation UI (deleting the invite record — CLI/API only). (s018) - Bootstrap invite code is a shared 500-use fly secret; revisit if sign-ups grow. (s020) - zds-linji runs an older binary than HEAD (2h access tokens, no replay-revocation path); redeploy to current source deliberately. (s023) Resolved: chat publicity (member-only spaces in phase 001, public records in phase 003); invitee PDS (hosted zds — load-bearing for spaces); stack (Zig + zat); codegen (zlex, post-M001); 0016 gate (moved from 001 to 002: dogfood hosts external members' records on our zds, so it no longer waits on permissioned data; native space repos still do); AI emphasis (2026-07-31: in-topic bot participant first, private 自修 companion later — bot participant itself deferred 2026-08-02, S013: the CLI is the bot surface); Android (2026-07-31: optional — PWA + Web Push is the notification plan, not a stopgap).