Files
tiny-worlds/HANDOFF.md
T

217 lines
13 KiB
Markdown
Raw Normal View History

# 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 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. All test runs are deleted; **no runs exist; the server is
stopped**. 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).
- Nothing has been *played* yet — every session so far was a test.
The story starts with the next session: `create la-caramba <id>`,
window one, for real.
- 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,
story-dated wraps.
- **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
`<lost>`/`<gained>` deltas, non-blocking, `<conflict>` 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 `<status>` 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 <package> <run-id>` copies the
package wholesale into `runs/<id>/` (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/<id>/`
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. **Prompt split DONE (2026-11-14, GM's cut).** system.md = opening +
guards (glossary, purpose, input validation — repo-fed, per-project);
invariants.md = substrate (syntax, tools, memory, records, the
paper + its gate — repo-fed, travels with the code); handbook.md =
craft copy (shape of play, purview, time skips, stance, hard limits
— copied per run). The clerk's create copies handbook.md +
housekeeper.md only. Assembly confirmed: one system message,
system.md → invariants.md → the run's handbook.md, then the bundle
as GM messages. Housekeeper aligned to the invariants paper
boundary (acute states on the paper; relational shifts recorded as
the facts behind them). Watch item: "never open a scene with world
narration" was cut as superfluous (GM, 2026-11-14) — reinstate if
narrative-discipline drift shows in testing.
2. **Server (phase 2) DONE (2026-11-14, mock-proven).** `server/` —
zero-dep node:http REST spine per the ROADMAP sketch; per-run
session machine with ask_gm pause/resume (whole batch waits, so
pairing stays sound); view renderer (thinking-strip, tool-result
elision with ask answers exempt, old status/conflict blocks
stripped); boot-rebuild from the typed jsonl; lazy seed + turn-0
ingestion at window-open (with the #21 refuse-with-override guard);
usage tracking + context meter; tool-pairing validation; `--mock`
scripted model. Smoke: create → open → roll → ask pause → answer →
paper deltas → restart → rebuild → live turn. The clerk gained
`--json` (packages/runs/status). **tool/bridge.mjs deleted at
mock-parity.** **Live API proven same day (run `live-smoke`):** the
upstream /models listing works (13 models carried), the assembled
prompt produces right-format turns in her voice, paper deltas
applied both turns, usage/context meter live (~4.6K prompt tokens,
2% of window). Not yet exercised live: ask_gm in flow (the model
just made its choices — by design), the conflict-carry path,
records tools (la-caramba has none), housekeeping (phase 3).
3. **Housekeeping job (phase 3) DONE (2026-11-14, mock + live).**
`server/housekeeping.mjs`: trigger ends the window and runs the
chain async (transcript with labeled thinking -> housekeeper on a
fresh context with run state injected -> manifest saved (raw output
too, if unparseable) -> clerk apply (validates, writes the window
log, snapshots `dumps/<window>.sql`) -> `state.json`
`lastHousekeptSession` -> autorestart). Rejection holds the restart
and surfaces why; `POST .../housekeeping/apply` is the recovery
path (hand-edited manifests, also the manual-relay close). The
first real wrap ran on `live-smoke`: window
`2026-11-18-beach-arrival`, two ring-B inserts, two correct
touches, clean voice — the manifest and log are in the run dir for
review.
4. **SPA (phase 4) DONE (2026-11-14).** `web/` — index.html, style.css,
app.mjs; no build step, vanilla ES modules, served by the server
from `/`. Transcript renders the three registers by the ruled
markers (plain speech, *italics* narration incl. multi-line blocks,
single-paren OOC with lone-paren skip), the bundle as a collapsed
card with turn-0 as the opening GM turn, paper tags as chips,
status/conflict extracted to the pane, machinery muted. Run
selector + new-run form, window-open (with the #21 override
confirm), GM line input (Enter sends), ask modal (re-presents on
refresh via detail.pendingAsk), status pane, context meter (hot
past 85%), housekeeping button with confirm → 3s poll → log
display → autorestart. Found and fixed in testing: `.mjs` MIME
(module scripts enforce it), multi-line narration parsing. One
prompt fix: housekeeper.md now teaches story dates (the second
real wrap dated itself with the wall clock otherwise).
5. First la-caramba run: `create la-caramba <id>` (seed rides along,
editable until the first window-open), then window one — through the
API or the SPA, whichever is ready when the GM is. The live-endpoint
caution transfers intact: the first real session is the loop's first
live integration test (GLM tool-call edge cases; no `strict` mode,
so clerk-side validation is the safety net). Housekeeping after the
window runs through the job (phase 3), not the manual paste.
## 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/<story>/db/memory.db` then `init`.
`--force` flags are only for disposable pre-story states.
- Sessions log to `packages/<story>/sessions/<stamp>.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.