# Handoff — working state A living document: trim items as they complete. Durable decisions live in `README.md` (architecture, protocol, observables), `ROADMAP.md` (SOTA review, steals, extension points), and the prompts (`system.md`, `housekeeper.md`). Unanswered questions live in `QUESTIONS.md`, the decision queue; the agent's own working notes live in `AGENTS.md`. This file is the "where did we leave off" map. ## Where we are - **The GM surface rework is complete and live-proven (2026-11-14).** Home lists runs by display name with live state; new run walks a package picker into a naming form (package display name + a dictionary-rolled, per-package-unique pc name, names-female.txt); setup is a full-assembly editor (system.md/invariants.md read-only first, then the editable craft in bundle order — handbook, backdrop, character, seed, turn-0 — then read-only config; sigil/var highlighting; $TOKENs declared by the prompts surface as inputs and gate start; drafts two-click deletable); start opens the window and sends turn-0 as the first GM turn. Play carries: the GM notepad (gm.md — auto-saved, never model-facing), the paper as a compact comma block with a GM edit button (paper-set, journaled), housekeeping with a dry-run replay button, diagnostics on both sides of the wire (server request log + a sessionStorage event log behind the header's "log" button), busy indicators, and hardened failure modes (no throw-to-home — only a real 404 leaves, loudly; failed sends restore the line). Identity: @PC/@Package are identity sigils (settings pc/name — a distinct class from $TOKENs, which the prompts declare and setup collects); run ids are anonymous hex; display is "La Caramba / Rell". Postulates: female PCs only; boutique dormant AND defunct. Exposure rule: bundle parts are inspectable read-only; agent prompts (housekeeper.md, repo-fed at wrap, never copied) are never exposed. - **Dates left the rings (GM, 2026-11-14).** No model-facing surface renders a date — the old rendered date was the touch stamp (referencing a memory rewrote its "when"), and records search leaked real dates too. Manifest and seed carry no date keys; stamps are internal and mechanical (LRU, overflow, "what's sinking" — GM-facing only). Story time lives in prose. Live-proven: the real housekeeper produced a clean dateless manifest first try. - **The first real story is live: "La Caramba / Irene"** (run 4f261452, gitignored state). Window one open, 44+ exchanges at ~23K prompt tokens — 9% of the window; the economy holds because thinking never goes back, old status rides strip, and the bundle floor is ~4.2K tokens. The GM ran the wrap dry-run on it: works mechanically, output not yet as expected — housekeeper.md review pending (the GM has not read the prompt yet). - **The MVP substrate is complete (2026-11-14): all four phases built, mock-proven, and live-proven.** Clerk (paper model, presets/runs), server (REST spine, session machine, view renderer), housekeeping job (async chain with autorestart), SPA (full v1 scope). The tool/ bridge is deleted. Two real housekeeping wraps ran clean (both manifests sound: correct ring-B classification, first-person voice, precise touches); a full session was driven through the UI end to end. **The server is stopped** (state as of this commit). Start it: `node server/main.mjs [--mock]`, SPA at http://127.0.0.1:7350/ (see AGENTS gotchas: check port 7350 first; POST from PowerShell via Invoke-RestMethod). - Live endpoint proven in-flow (glm-5.3 via llm.exan.tech, 13 models carried on /models): right-format turns in her voice first try, paper transport both directions, usage/context meter live. - **Prompt split in force (GM's cut, 2026-11-14):** `system.md` = opening + guards (glossary, purpose, input validation — repo-fed, per-project); `invariants.md` = substrate (syntax markers, tools, memory, records, the paper + its gate — repo-fed, travels with the code); `handbook.md` = craft copy (shape of play, thoughts, purview, time skips, continuity, stance, hard limits — copied per run, editable to taste). One system message: system → invariants → the run's handbook; then the bundle as GM messages (backdrop, character, ring-b, ring-a, turn-0 on a fresh run). OOC is a single open paren, closing optional; the SPA parses registers by that plus plain/italic. `housekeeper.md` aligned (paper = acute states; relational shifts recorded as the facts behind them; story dates taught). - Prompt-side settled (2026-11-13): the content stance is the GM's final form — erotica is not a special bucket (makes sense, isn't the point, no pressure, never play anticipated leads to please the GM); the adjudication philosophy is that the test is a review, not a number (README). ROADMAP gained steal #11 (prompt re-injection) and the projection principle (context is a projection, not a ledger). - Red pen largely done (2026-11-13): new PC (shop girl, conviction by association with a burnt decker), ten-state voice corpus (steal #1 done), gm notes recast (the ship-AI La Caramba, Missy, Pinky; pink ice as licensed corpo firewall; mechanical feeders; the slop quantified). Name call resolved: keep "Rell". Optional seed voice touch-up may be revisited (QUESTIONS #19c, non-blocking). The seed is authored but NOT applied — it rides the run copy at creation and applies lazily at the first window-open. - Build history in brief (details in ROADMAP phasing): phase 0 clerk paper migration (2026-11-13), phase 1 preset/run split (2026-11-13), phase 2 server (2026-11-14), phase 3 housekeeping job (2026-11-14), phase 4 SPA (2026-11-14). The clerk's `--json` serves the server; `tool/bridge.mjs` deleted at mock-parity. - **Phase 0 (clerk side) DONE (2026-11-13):** the paper model is live in `memory.mjs` — description-set schema (`paper` table), `paper` / `paper-set` / `paper-apply` / `paper-ingest` verbs (exact-match ``/`` deltas, non-blocking, `` reporting, prelude ingestion), amend/discard journal prior content (the saga rule), seed rejects a status key loudly. Smoke-tested end to end (delta misses, no-op re-adds, prelude ingest, dump/restore round-trip, seed apply); both dbs reset clean. Loop-side items (status tools gone from the tool list, per-turn `` ride, thinking-strip, usage tracking) land with the server. - **Phase 1 (preset/run split) DONE (2026-11-13):** packages are authored-only (backdrop, turn-0, character, seed, settings, gm — all six state dirs removed); `create ` copies the package wholesale into `runs//` (shared prompts included, run.json lineage + optional model override) and inits state; `--run` addresses runs; `packages`/`runs` list; `bridge.json` → `server.json` (bind, endpoint, models, contextWindow, params; example committed, key carried over, gitignored); `config.json` now names the default package. Smoke-tested: create → seed → turn-0 ingest → delta apply → status, re-seed refuses, smoke run deleted. `prelude.md` renamed `turn-0.md` by the GM (comment dropped); clerk and docs follow. - Boutique: dormant — a stub that never reached its design step (concept brief in `packages/boutique/gm.md`). - No runs exist in this deployment yet; both packages render clean as presets (`packages` lists them). - **Substrate design round complete (2026-11-13)** — rulings recorded in ROADMAP ("The harness"): the stated goal (a usable RP harness; clone-and-run or invited instance, key on the backend, no secrets in the repo), repo ships code + authored content only (state is per-deployment), packages are presets copied wholesale into `runs//` at creation (editable everything, discipline on the GM), lazy seed at first window-open, per-run model selection with an upstream `/models` listing, audit as per-wrap dump snapshots inside the run (commit-per-wrap retired), zero-dep stack (QUESTIONS #4, #7 resolved). ## Immediate next steps, in order 1. **The first real wrap — the memory test begins.** Close-and- housekeep the Irene window when the GM is ready; review the manifest and the window log against the dump diff (the audit surface). Everything from the story so far (the shipwreck, Molly, the island) lives only in context and on the paper until this lands. 2. **Housekeeper prompt review (GM-led).** The GM's dry-run verdict: works mechanically, output not as expected, and the prompt itself is unseen so far. Iterate: read housekeeper.md, tweak, replay — the dry-run button re-runs the wrap over the session log with nothing applied. 3. ~~**Status discipline**~~ — RESOLVED BY REDIRECT (2026-11-14, QUESTIONS #32/#33): the paper's thread-tracking drift got its own channel. The agenda (``/``/``, cap-5 recency queue, invariants.md GM-written) is built end to end; the gate fight is over by design. The test is the next live window: watch cross-channel drift and drop off-by-ones alongside observables #12/#14. 4. **Keep playing.** Observables #12 (does the paper stay small and match the transcripts) and #14 (one thing per turn vs lengthening turns — completions grew 103 to 668 chars across window one) are live now. ## The multiuser build (2026-11-14) — DONE Design round closed (ROADMAP "The multiuser server", QUESTIONS #22-31); all four phases built and proven the same day: 1. **Storage + identity + auth spine** — `state/deployment.db` (users, invites; gitignored `state/`), `server/users.mjs`, bearer-token auth on every route except session/claim, bootstrap invite on the fresh-deployment condition, owner stamping at create, acting-user attribution in the request and LLM call logs. 2. **Ownership + fork + packages** — owner gating on every mutation and every model call; per-run activity locks (turn, ask, turn0, housekeeping job, fork); `POST /api/runs/:id/fork` (staged copy, atomic swap, owner replaced, `forked` stamped, window state mirrored); clerk learns the second packages root (`state/packages`) and `save-package`; user packages published to all. Ownership is resolved, never maintained (GM ruling): run.json keeps dead owner ids, the API reads them as absent; revocation is a db delete plus closing the revoked user's open windows. 3. **SPA** — claim view, identity in the header, superuser admin on home, spectator mode (read everything, mutate nothing, fork CTA), save-as-package on setup, origin in the package picker, garnish (owner, started/forked at second precision) on run names. 4. **Smoke + docs** — 34-step mock smoke plus a restart check, all green; UI verified text-safely in the browser (claim, home, admin, spectator on Irene, owner mode, fork click-through, picker, setup; zero console errors). README deployment section + layout updated; test state cleaned (Irene untouched). Post-verdict cut (GM, same day): sign-out removed — signing in is permanent and per-browser; the user lifecycle / auth story is a ROADMAP extension point for a later revisit. Gotcha learned while testing: the a11y snapshot races async renders — wait for text that only exists POST-render (a card name, the window-info line), never the static skeleton; and CSS text-transform still uppercases wait targets. Model selection wired (GM, same day): run.json now carries `models: {player, housekeeper}` per-run overrides (replacing the old singular `model` key — no run ever carried it), owner-settable via POST /api/runs/:id/model and the SPA (setup box for drafts, play-aside pane for started runs), falling back to the server.json defaults; the housekeeper call resolves per wrap. Smoke 42/42, UI verified (setup select + save, carried override visible on a fork's play view, spectator pane hidden). #16's open call is now only the DEFAULT. The agenda built (GM-designed, same day, QUESTIONS #32): the player's second paper — intentions, not states. `` rides every GM turn (numbered from the top, as cited), ``/`` deltas apply received -> drop -> add, cap 5 with bottom-eviction, GM override + SPA pane, housekeeping reads the deltas as evidence. Conflict delivery re-ruled mid-build: a conflict goes back as its own message (clean of prose), the model self-heals in the same exchange, capped at 3 heals a turn — the `conflict` pending-state is gone entirely. Same-verb blocks combine into one apply, never a sequence. The events journal CHECK was widened (one-time lazy migration — ran clean on Irene's db, all rows preserved). Invariants gained the substrate-tag syntax rule (any `` line is OOC; unknown tags reported to GM) — the SPA register parser follows it. Session-route fix rode along: /api/session returns the public user shape only (it was leaking the token hash). Smoke 56/56, UI verified end to end. The per-turn reminder built (GM-ruled, QUESTIONS #34, steal #11 DONE): `reminder.md` (repo-shared, agent-drafted extraction of the turn- composition protocol, awaiting the GM's edit + handbook cut) rides after every GM turn as its own system chunk; one live copy — older elide from the view, the SPA shows one collapsed card for the newest, housekeeping never sees it. Smoke 58/58 plus an elision unit check (log keeps 5, view carries exactly one, positioned at the freshest end). The next live window is the experiment for observable #14. ## Working agreements with the GM - **"I draft, you cut"** for all creative content. - Character and world work is done together, unhurried ("we'll get there together"). - The GM runs on organic memory and takes no notes — the system is the prosthesis. The GM's lever is narrative, never mechanical. - The GM answers point-by-point and expects pushback in both directions. - `gm.md` files are GM-private: never pasted to any model. - Rolls (`pick`) are legitimate at drafting time; rolled values are proposals with the alternates listed for easy swaps. - The play is uncensored; nothing lives in a special bucket — it makes sense, it isn't the point, no pressure (no playing to please the GM). Hard limits in `system.md` are absolute. ## Boutique creative brief Now recorded in `packages/boutique/gm.md` (era, specialty, cast, and seeding are open questions for the drafting session with the GM). ## Environment gotchas (learned the hard way) - The portable shell scanner is picky: **plain ASCII only in shell command strings.** Em-dashes in commit messages, here-strings, and `< NUL` redirection have all been rejected. For multi-line stdin tests, pipe an array of strings into node. - `node:sqlite` prints an ExperimentalWarning on every invocation — harmless; the clerk filters it in bridge context. - `server.json` (gitignored) holds the real key; it mirrors opencode's `dv` provider (config at `~/.config/opencode/opencode.jsonc`, auth at `~/.local/share/opencode/auth.json`). - Resetting a run: `Remove-Item packages//db/memory.db` then `init`. `--force` flags are only for disposable pre-story states. - Sessions log to `packages//sessions/.jsonl` — housekeeping's transcript, and the future watcher agent's food (see ROADMAP). - The `--mock` mode has caught two real bugs already (dump column rename, readline line-loss). Run it before any live first-use. ## Not yet exercised (expect first-use friction) - ask_gm in live flow (pause/resume is mock-proven; the live model simply made its own choices so far — by design), the conflict-carry path in flow, records tools through the server (needs a records-enabled run). - The housekeeping chain is live-proven once (see `live-smoke`); a rejection in live flow, and the recovery-apply path on a real manifest, remain first-use items. - The in-flow missed-update prediction (ROADMAP, system-1 entry) — measurable from the second real window on. The `live-smoke` run (2026-11-14) is the first real session: two turns + the first real wrap; window two is open on it now — the run is disposable but usable for a test drive.