diff --git a/AGENTS.md b/AGENTS.md index 5bb9f79..10dc9bb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,6 +26,15 @@ memory the agent owes itself across sessions. the system, flag ripples, name what works and why -- the verdict on creative content is theirs. GM-private files (gm.md) are never edited and only flagged. +- Standing agreements (folded from the handoff's working-agreements + section when it slimmed, 2026-11-15): 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, + their lever is narrative, never mechanical; they answer point-by-point + and expect pushback in both directions; gm.md is 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; hard limits in `system.md` are absolute. ## Writing prompt-bound text @@ -68,6 +77,20 @@ memory the agent owes itself across sessions. - `node:sqlite` prints an ExperimentalWarning on every clerk call -- harmless, filtered in bridge context. - Session logs, dumps, and views are generated; never hand-edit them. +- `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`). +- The repo lives at `C:\data\opencode\tiny-worlds` (renamed from + `rp-test` with the project name, 2026-11-15). The rename could not + happen in place -- the running app held the old dir -- so the move + was robocopy + session repoint; `C:\data\opencode\rp-test` is a + frozen snapshot awaiting deletion (its MOVED.txt says so). Always + launch from the new path. +- The test scripts: `smoke.mjs` expects a CLEAN state/ plus a running + `--mock` server, prints its run ids, and leaves a temp token file + for `restart-check.mjs`; `check-reminder.mjs` takes a run id; + `check-repo.mjs` needs no server. Clean up state/ and the smoke + runs afterwards -- only the real runs stay. ## State pointers @@ -199,7 +222,14 @@ memory the agent owes itself across sessions. lives inside a code fence with its own deeper indent -- byte-dump, the read display lies about depth there too. Deferred to ROADMAP: GM-input expansion, save-as-package beyond drafts, the carryover - editor. The variant round: roll + editor. The lint's blind side (bitten 2026-11-15, commit round): it + reads the git INDEX, so UNTRACKED files are invisible to it -- "ALL + CLEAN" before a commit does not cover never-staged files, and the + moment git add -A runs they enter scope (variants.mjs shipped + em-dashes through three green lint runs that way). Lint again after + staging. The checker exempts its own source from the rules that + name what they ban (text-transform, toLocale -- the patterns + themselves). The variant round: roll retired as a model tool, chance in play is variant literature (four ruled turn shapes), the loop picks one candidate at random on reception (crypto, pre-append strict parse, 422 on malformed), diff --git a/HANDOFF.md b/HANDOFF.md index 2a1b355..57be4c1 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -9,660 +9,69 @@ file is the "where did we leave off" map. ## Where we are -- **The dormant-session rework is BUILT AND SMOKE-PROVEN (2026-11-15, - evening) -- uncommitted, all checks green.** The full ruled plan - below is implemented end to end: the universal session lifecycle - (dormant -> live -> finished, per-session storage under - `sessions//`), move-at-stop, the start lint with the auto-send - rule, re-enterable housekeeping via rebase, turn-0 as a log - (`carryover.jsonl`), seed as `memory.json`, the draft-only - save-package. Verified this sitting: the full mock smoke (105 - steps, ALL PASS), restart-check, check-reminder (against the - smoke's fork), check-repo, and a text-safe browser pass (claim, - home -- pre-migration Irene lists honestly as "no sessions" -- - new run, setup editor with the carryover/memory slots, start, - play: the variants turn with pick note, the ask modal + ruling, - the deltas, two-click stop -> the dormant review window, re-run - housekeeping, start session 2, the carry rendering as ordinary - conversation, plays on; zero console errors). Test state cleaned; - Irene (4f261452) untouched. - Found and fixed en route (first-use friction, as predicted): - (1) `create --json` polluted stdout -- the rework made create - apply memory.json in-process, and renderAll printed the view - paths; `--json` now means stdout is JSON only, and the server's - create spawn passes `--quiet` like every other server->clerk - spawn. (2) The mock model's script counter reset on every GM - turn, so every direct reply landed on script position 0 (turn - two re-offered variants); the count is now cumulative across the - log, gated on exchanges. (3) The housekeeping job's `session` - field was overwritten with the manifest slug after apply; it - stays the numeric session now (the disk-derived jobState already - agreed). (4) agenda-apply's `added` report came out reversed - (the storage loop is reversed by design -- first item lands at - the top slot; the report keeps written order now). Smoke-side: - the reminder and story GM-turn counts (6 -> 5: the conflict - message is not a GM turn and stays out of both), save-package - moved onto a fresh ash draft (the draft-only ruling refuses the - played fork by design -- checked at the end), the carry check - was looking for an agenda item in the status list, and the - orphaned-tool-event step expected lint wording where the design - legitimately allows tool events in continuation carryovers - (moved tails carry whole exchanges; the pairing check catches - the orphan). The package renames are git-staged (the lint reads - the index); the rest of the tree is dirty as usual. -- **Irene is MIGRATED (2026-11-15, evening) -- the hand-migration - is done, both halves.** The ruled path (plan item 12) ran exactly: - a filesystem fork (9c3f01aa) mutated to the new layout first, - proven green END TO END against the mock (boot rebuild, reads, - a live turn, dry-run replay, stop -> dormant 2 with housekeeping, - the story whole across the move, start session 2, plays on); - then real Irene mutated identically and verified green on every - read surface with zero writes to her log. The moves, exactly: - `sessions/.jsonl` -> `sessions/1/log.jsonl`; - `db/memory.db` -> `sessions/1/db/memory.db`; backdrop, character, - handbook -> `sessions/1/bundle/`; canon/ and dumps/ -> - `sessions/1/canon|dumps/`; `sessions/1/session.json` written as - `{phase: live, ready: true}`. Her dead authored files (turn-0.md, - seed.json -- content long consumed into log and rings) moved into - `sessions/1/` under their own names as inert archival; nothing - reads them, and whether they stay is the GM's call. Her run.json - is untouched: ownerless until the op's hand-stamp (step 2), no - forked stamp. Her historical turn-0 event stays GM-attributed per - the layout-only ruling -- her opening prose reads as the first GM - turn in the story, which is how she actually ran. A pre-migration - backup (15 files, includes her gm.md) sits at - `%TEMP%\opencode\irene-pre-migration-backup` -- delete when - confident. The test fork and test state are cleaned; her live - window reads: 121 table entries, 53 GM + 53 player story turns, - no doubles, status/agenda intact. - -- **The entity round is DONE (2026-11-15): story / session / table, - and the carry between them -- ruled, built, mock-proven.** - (SUPERSEDED IN PART by the dormant-session plan below: the - copy-and-flag carry, the table dimming, and the autorestart die in - the rework; the flagless move replaces them.) The queue items "full story in the SPA" and "slidwin - compaction" both landed. The story (`GET /story`): the whole - deliverable read-only, non-dropped literature only, all sessions - in order, turn-0 to last recorded -- OOC, tools, verbs, thinking, - rings all out; load-bearing-in-OOC is a GM protocol violation the - story enforces by omission (README protocol now states the rule). - The table (`GET /table`, the renamed session projection): the open - session curated for play; the SPA's play view reads it, carried - turns dimmed behind a divider. The carry: the previous session's - tail rides into the new log behind the bundle, flagged -- the walk - contiguous and dumb (whole exchanges, nothing filtered), the - cutoff smart (only prose the model will see counts, against 96KB - ~ Irene's whole session), so the fresh contwin reads as the old - one continuing and the boundary is invisible from inside. The - housekeeper reads the session MINUS its live tail (an event files - exactly when it drops out of the window -- the rings never - overlap the carried prose); N+1's housekeeper reads the carried - turns as ordinary conversation. invariants.md's memory line - reworded by the GM ("the older story lives in the rings, the - recent exchange stays live conversation" -- no overlap mention, - because there is none). Smoke 79/79 incl. the housekeeping -> - carry -> story-no-doubles pass; reminder + restart checks green. - **Unexercised live: the carry against a real session boundary - (Irene's next open), the story read as the review surface, the - OOC-hole showing in practice.** - -- **Two format house rules, enacted and enforced (2026-11-15, GM -- - their operator's queue, worked by them).** (1) **ASCII bytes, - everywhere**: no unicode in any tracked file; the encoding is the - problem, never the visual -- glyphs that must render travel - ASCII-safe (the middle dot is `\u00b7` in JS strings, entities in - HTML), never verbatim. A one-time sweep converted 43 files (934 - em dashes -> `--`, arrows -> `->`, `...`, `>=`, and friends; - the cold ring's cap reads `none` now). reminder.md and system.md - were already clean. (2) **No text-mutating CSS**: rendered text - must match authored text -- text-transform (any value, inline - included), generated content (content:, before/after included), - and caps font variants are banned. The six uppercase declarations - are gone from style.css (headings and labels render in source - case -- "runs", "her status"), and the setup editor's dirty marker - moved from a css-generated "*" into the authored DOM. Both - enforced by - `test/check-repo.mjs` (scans git-tracked files; ALL CLEAN). Full - mock suite re-run green on the swept code. Historical records keep - their day's typography, as with renames. **The audit pass - (2026-11-15, GM-ordered) grew the check to nine rules** -- the - rest: no html comments in prose/prompt files (ruled 2026-11-14; - four were live, three stripped, boutique/gm.md left GM-private), - retired terms banned from living prose (caught README's "256K-class - window" -> contwin; ROADMAP's "rides the prelude" -> turn-0, fixed - by hand outside the lint's scope), zero-dependency imports, utc - discipline (no toLocale/getTimezoneOffset), web/ static names - never start with "api" (the route-guard gotcha), the bundle - boundary (bundle.mjs names neither gm.md nor housekeeper.md), - dateless seeds. All clean on the first full run after the fixes. - -- **The variant round is DONE (2026-11-15): ruled, prompted, built, mock-proven.** - roll is RETIRED as a model-facing tool (the clerk's `pick` survives - as the GM's drafting dice, CLI-only); chance in play is now variant - literature -- one of the four ruled turn shapes (literature, variant - literature, tool call, OOC message): several complete candidate - turns in one `` block, each carrying its own deltas, the - server picking one at random on reception. Random by GM ruling -- - genuine chaos over curation at every step; the cap is taught, not - enforced ("five should be enough"). Unpicked variants survive only - in the session log -- never the live view, never the housekeeping - transcript, never the SPA's story surface. GM rewrites: - reminder.md (the four shapes; the Variance section replaces the old - dice-tiebreak, completing the roll retirement end to end), - handbook.md (no-hedging points at variance). Agent: housekeeper.md - (deliberation over unpicked branches is attention evidence, never - fiction; the pick is final even when her thinking leaned elsewhere), - README (substrate + protocol + layout), DICTIONARY (variant - literature entry, roll RETIRED, the turn entry carries the four - shapes), ROADMAP (surgery's session-pure tool list). Machinery: - `server/variants.mjs` (strict parse -- malformed refuses loud - BEFORE anything is appended, nothing applies; the crypto pick; - the effective-content map), the loop (pick + typed pick note + - picked-only delta apply, `out.variants` on the turn response), - renderView + housekeeping transcript render the picked variant - only, a boot-time resolve for a crash between message and pick - note, `GET /api/runs/:id/story` (fiction-first projection: no - thinking, picked variant only, the variance metric -- picks, - offered, max) with the SPA's play view repointed (`/session` stays - raw as the audit surface), the mock's turn one is now a variants - turn. Smoke 69/69 (was 58), restart-check and reminder check green; - test state cleaned. **Unexercised live: everything variantary -- - the pick against a real model, the metric's curve, the - coin-flip-personality watchable.** - -- **DICTIONARY.md exists -- the terms of art, one source of truth - (2026-11-14, GM-ruled).** A rename rules there first, then sweeps. - The full round is DONE: **paper -> status, window -> session, wrap -> - housekeeping, context window -> contwin** -- swept on every surface - INCLUDING the machinery (element ids, routes, response fields, db - tables, journal ops), with one-time data-preserving migrations in - the clerk and **no dual-accepts** (the no-legacy convention is - recorded in the dictionary's Conventions). Two costs to remember: - the clerk's run summary is **`report`** now (`status` is the tier - verb, JSON), and Irene's pre-rename session log carries old-kind - notes that no longer render -- cosmetic, data intact. -- **The SPA is refactored into modules (2026-11-14, GM-ruled).** The - 1378-line app.mjs is gone; web/ is now flat ES modules like - server/: `app.mjs` (thin entry), `router.mjs` (path routing + the - view enter/leave lifecycle -- each view owns its teardown, show() - never hand-resets panes), `client.mjs` (the fetch choke point -- - named client, NOT api: a web file named api.mjs 404s, the static - guard matches the /api prefix), `state.mjs` (me/seq/runId only -- - everything else is module-local to its view), `chrome.mjs`, - `log.mjs`, `widgets.mjs` (armedButton -- the two-click confirm, - per-button arm state, fixing the shared-arm bug where arming one - user-revoke armed them all; paneEditor -- the status/agenda twins as - one factory, two instances; modelsBox -- the setup/play-aside - duplicate), `transcript.mjs`, and one `view-*.mjs` per view. The - mock smoke moved into the repo (`test/`). Verified: smoke 58/58, - reminder elision, restart check, and a full browser pass (claim, - home + admin, new run + name roll, setup editor + models box, - start, play: pane editors end to end, GM turn -> ask modal -> - answer, two-click housekeeping -> poll -> applied + log, the - auto-restarted session, spectator mode on Irene) -- zero console - errors. Found en route, pre-existing: **the dry-run replay button - is dead after a housekeeping pass** -- housekeeping auto-restarts - the next session, so the latest session (the replay default) is the - fresh empty one and the call 409s ("no exchange to review"). - RESOLVED BY PLAN (2026-11-15): the dormant-session rework kills - the autorestart, and during dormancy the latest log IS the - just-closed session -- the default never needed to move. -- **The multiuser server, the agenda, and the per-turn reminder are - built, mock-proven, and committed (2026-11-14, through `89a2c16`).** - Token identity with single-use invites (no usernames, no passwords, - no external IDPs; the bootstrap invite auto-mints on the fresh - deployment to state/bootstrap-invite.txt and the console); - owner-gated runs with fork (atomic copy, owner replaced, no - lineage); system/user packages; per-run model selection (player + - housekeeper over the server.json defaults); spectator mode (read - everything, mutate nothing); the agenda -- the player's second - status, ``/`` deltas over a cap-5 recency queue, with - conflicts self-healing as their own message; and the reminder -- the - GM-written turn-composition procedure riding every GM turn as its - own system chunk, one live copy. Design lives in ROADMAP ("The - multiuser server") and QUESTIONS #22-34, all resolved. **No users - exist yet:** the next server start mints the real bootstrap invite. - The server is stopped. -- **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 session and - sends turn-0 as the first GM turn. Play carries: the GM notepad - (gm.md -- auto-saved, never model-facing), her status as a compact - comma block with a GM edit button (status-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 emptied (placeholder only, 2026-11-15). Exposure rule: bundle parts are - inspectable read-only; agent prompts (housekeeper.md, repo-fed at - housekeeping, 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. +- **Everything is built, proven, and committed (through `fa3f23b`, + 2026-11-15).** The full scope, each round mock-proven end to end + and live-proven where live could reach: the MVP substrate (clerk, + server, housekeeping job, SPA), multiuser (token identity, invites, + fork, user packages, spectator), the agenda, the per-turn reminder, + the variant round (variant literature, the crypto pick), the entity + round (/story, /table, the slidwin carry), the dormant-session + rework (the universal session lifecycle, move-at-stop, the start + lint, rebaseable housekeeping, carryover.jsonl + memory.json + packages), and the format house rules (nine-rule check-repo). The + design record lives in README / DICTIONARY / ROADMAP; the build + history in the git log. - **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 contwin; the economy holds because - thinking never goes back, old status rides strip, and the bundle - floor is ~4.2K tokens. The GM ran the housekeeping 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 passes 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 status + 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 session-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, contwin, 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: emptied wholesale by the GM (2026-11-15) -- placeholder - files only, awaiting its design round. The clerk's completeness - check now requires non-empty files, so the listing shows the truth. -- One run exists: Irene (4f261452, see above). 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 session-open, per-run model selection with an upstream `/models` - listing, audit as per-pass dump snapshots inside the run - (commit-per-pass retired), zero-dep stack (QUESTIONS #4, #7 resolved). + 4f261452, gitignored state). Session one open, 53 GM + 53 player + story turns, ~23K prompt tokens -- single-digit percent of the + contwin. She is migrated to the new session layout (2026-11-15, + hand-migration per the ruling: fork proven end to end first, then + real her, zero writes to her log); her historical turn-0 event + stays GM-attributed, and her dead authored files (turn-0.md, + seed.json) sit in `sessions/1/` as inert archival -- whether they + stay is the GM's call. She is ownerless until the op's hand-stamp + (step 1). Her open session still carries her old handbook copy -- + craft edits land at session-open, so the clean reminder/agenda + experiment starts at her next session. +- **The housekeeping dry-run ran on her once:** works mechanically, + output not yet as expected -- the housekeeper.md review is pending + (step 3), and the GM has not read the prompt yet. +- **The server is stopped; state/ is fresh** (no users -- the next + start mints the real bootstrap invite to state/bootstrap-invite.txt + and the console). ## Immediate next steps, in order -1. **First start under multiuser (op, one-time).** The verification - round and the Irene migration are DONE (smoke 105/105, - restart/reminder/repo checks, browser pass, migration green both - halves -- see "Where we are"). Start the server on the real - deployment, claim the bootstrap invite - (`state/bootstrap-invite.txt` and the console both carry it), - then hand-stamp Irene's `run.json` with - `"owner": ""` -- the SPA header tooltip shows the - id. No migration code exists, by ruling; this is the op's one - manual act. -2. **First start under multiuser (op, one-time).** Start the server, +1. **First start under multiuser (op, one-time).** Start the server, claim the bootstrap invite (`state/bootstrap-invite.txt` and the console both carry it), then hand-stamp Irene's `run.json` with `"owner": ""` -- the SPA header tooltip shows the id. No migration code exists, by ruling; this is the op's one manual act. -3. **The first real housekeeping pass -- the memory test begins.** +2. **The first real housekeeping pass -- the memory test begins.** Close-and-housekeep the Irene session when the GM is ready; review the manifest and the session log against the dump diff (the audit surface). Everything from the story so far (the shipwreck, Molly, the island) lives only in context and in her status until this - lands. Note: with the rework landed, this pass ends in DORMANCY -- - the review window is the point (edit rings/prompts, then start). - Irene's OPEN session still carries her old handbook copy (craft - edits land at session-open) -- the clean reminder/agenda/agenda - experiment starts at her next session. -4. **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 housekeeping over the session log with - nothing applied. -5. **Keep playing -- and watch the experiments.** Observables #12 (the - status stays small and matches the transcripts) and #14 (turn + lands. The pass ends in DORMANCY -- the review window is the point + (edit rings/prompts, then start). +3. **Housekeeper prompt review (GM-led).** Iterate on + housekeeper.md: read it, tweak, replay -- the dry-run button + re-runs housekeeping over the session log with nothing applied. +4. **Keep playing -- and watch the experiments.** Observables #12 + (the status stays small and matches the transcripts) and #14 (turn lengthening -- the reminder is the countermeasure under test), plus - the fresh watchables: does thread-tracking move to the agenda; - drop off-by-ones; cross-channel drift; whether description-only - "empty turns" stay on her side of the purview line. Variantary: - the metric's curve (`/story` variance -- how often, how many + the fresh watchables: does thread-tracking move to the agenda; drop + off-by-ones; cross-channel drift; whether description-only "empty + turns" stay on her side of the purview line. Variantary: the + metric's curve (`/story` variance -- how often, how many candidates), coin-flip personality (choices offloaded to chance - that should be character), and whether her variants stay - same-turn alternatives rather than sequences. - -(Resolved en route: the status-discipline fight -- the agenda gave the -drift its own channel, QUESTIONS #32/#33.) - -## The dormant-session rework -- RULED IN FULL, BUILT (2026-11-15) - -Two design sessions (2026-11-15) closed every open call; the build is -done, verification in flight (see Where we are). This plan supersedes -the earlier draft in part (move-at-start, the journal as crash stash, -the not-editable carry, PENDING-vs-dormancy) and widened scope: -turn-0 and seed were refactored into the same shape, and the build -ends with a hand-migration of Irene. One refactor, one canonical -format after it. - -**The universal session lifecycle (GM's shape):** - -1. **A session is a stateful entity: dormant -> live -> finished.** - No contwin until live. Dormancy is a REAL record (the framing - call, resolved against the virtual lean: the dormant session owns - material -- bundle, rings, carryover -- so the record exists). - The old PENDING state and dormancy merge into this one state; the - draft state dies -- a new run is created with a dormant - session-1. - -2. **Every session gets a carryover, a rings db, and a bundle.** - Session-1's carryover is authored in the package; N+1's is the - moved tail. Session-1's rings come from memory.json applied at - creation; N+1's from housekeeping of N. The bundle is - session-specific prompt copies: from the package for session-1, - from N's frozen bundle for N+1, copied at stop. - -3. **Storage: sessions become directories.** - `sessions//{bundle files, rings db, carryover.jsonl, - log.jsonl}`; the dormant session has everything but the log. The - run keeps settings.json (identity, vars, models), gm.md, - run.json. Audit gain: every session's exact material is preserved - forever -- the bundle card never lies about what a past session - ran with. The clerk defaults edit verbs to the dormant session, - reads to the latest. - -4. **Freeze at live.** Prompts, rings, and the carryover are - editable only during dormancy, frozen once the session goes live. - Mid-session ring edits are ruled out (unnecessary and dangerous); - gm.md and the notepad stay mutable always. The status and agenda - are runtime state and carry via the db copy, not the bundle. - -5. **Stop (manual GM action):** (1) move N's tail into the new - dormant N+1 as its carryover; (2) freeze N; then the rest -- - bundle files copied from N, db copied from N's frozen db (status - and agenda carry; manifests are memory-only, rings are the - housekeeper's whole write surface), housekeeping of N runs and - applies into N+1's rings. The move is at STOP, not start (ruled: - the carryover is a first-class session part, not a crash stash -- - the move-at-start rationale died with that). tailStart is - computed once at stop (the smart 96KB visible-prose cutoff, - contiguous whole exchanges, dumb walk); N's log truncates there; - each line exists in exactly one jsonl, ever; no markers anywhere. - Crash-safe: the carryover is written before anything is touched; - a half-finished stop resumes idempotently at boot. Stop takes the - run's activity lock (refuses while a turn or ask is pending). - -6. **Housekeeping is re-enterable.** Each run -- first or re-run -- - rebases from a fresh copy of N's frozen db and applies its fresh - manifest: non-idempotent (a fresh LLM call each time) but never - double-applying. Hand edits (rings or status) made between runs - are overwritten -- fine by ruling; the armed two-click button - says so. The dry-run replay survives alongside (nothing applied). - -7. **Dormancy is the review window.** Prompts editable (the setup - editor), rings editable (the clerk), housekeeping re-runnable, - dry-run replays, the whole story readable. The carryover is - conversation history but NOT immutable during dormancy (a - reversed ruling); it renders raw and read-only until the editor - task (ROADMAP). The story projects the current -- possibly edited - -- carryover's raw lines like any log's, in session order. Raw in - storage, filtered on serve: thinking stripped, superseded status - and agenda blocks elide, picked variant only. With no - autorestart, the latest log after housekeeping IS the just-closed - session -- the replay-after-housekeeping tail resolves for free. - -8. **Start (manual GM action): lint first -- we only start clean.** - The lint refuses a bad opening with a GM-facing error and grows - as designed. Initial surface: event-schema validity; tool events - refused; an unpicked variants event gets its crypto pick at - start; authored assistant events are legitimate (no usage, no - thinking, no pick metadata); expansion errors refuse. Then: - freeze the bundle, consume the carryover into the new log, go - live. Opening flow: if the carryover ends on a GM turn, it is - sent automatically as the first request; otherwise the table - waits for GM input. No enforcement on the cut -- the dumb tail - carries as-is, and the opening flow follows from how the - carryover happens to end. - -9. **Expansion, ruled per surface.** The authored session-1 - carryover expands at start (the turn0() path generalized to the - whole log; sigils and $vars resolve, unfilled vars gate start as - today). A continuation carryover NEVER expands -- live prose may - contain literal $ tokens and expandVars would bomb the start. - Prompts expand at assembly as always. GM-input expansion (sigils - and vars on the GM's line at ingestion, errors refuse the turn, - the log records the expanded line) is a ROADMAP todo -- - deliberately out of this build. - -10. **Turn-0 is dead: it is a log, not a turn.** The package ships - `carryover.jsonl` -- a sequence of any valid jsonl events; the - initial status rides as a status event at the head. Caramba's - content is re-attributed as the MODEL's turn (the prose - describes her; it was never the GM addressing her), prose kept - as-is for now, the GM voice-edits later. It ends on her turn, - so a fresh caramba run waits for GM input at start. One - canonical format; no legacy turn-0 path survives the rewrite. - -11. **Seed is dead: memory.json.** Renamed so the name says - memory-only, reformatted as the mock housekeeper manifest from - the non-existent session-0 (all-insert ops), applied at run - creation through the standard apply path. The seed verbs - dissolve (apply rides creation; re-seed refusal collapses into - "the run already has its rings"). A package is the two - session-0 mock artifacts: memory.json (her starting memories) - and carryover.jsonl (her opening). - -12. **Migration: no code, the agent's hands.** Fork Irene as a - filesystem copy, mutate the layout until green end to end - against the new build, then mutate real Irene the same way, - then optionally fork the mutated her for a final test. - Layout-only: Irene's historical turn-0 event stays - GM-attributed (no structural invariant breaks; no history - rewrite). - -13. **Ripples.** What dies: the per-line carried flags, the story's - dedup check, the transcript's carried-filtering, the view's - carried-bundle guard, the table dimming and divider (the table - becomes a pure contwin mirror), the autorestart. What stays: - variants.mjs and the pick, /story and /table and the story view - (minus the flag check), the tailStart walk and the smart - cutoff, the slidwin terminology. applyAndRestart loses its - restart (the chain ends dormant); the play view's closed-state - UI becomes the dormant state (the session-open button becomes - the start button); the smoke's housekeeping section reshapes - (dormant asserted, then start, then the carry lands); the #21 - guard survives only as the explicit skip-housekeeping override - (the normal path cannot hit it -- N+1's rings do not exist - until housekeeping of N); fork unchanged (a directory copy); - save-as-package stays draft-only (the generalization is a - ROADMAP todo, all questions open); DICTIONARY rules the renames - first (turn-0 dies, seed dies -> memory, one carryover term), - then one sweep (package files, clerk verbs, the completeness - check, turn0(), the setup editor's slot, the docs); boutique's - placeholder files follow the renames. - -## 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, session 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 sessions. -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 -session-info line), never the static skeleton. (The text-transform -half of this gotcha is DEAD: all-caps CSS is banned by house rule -2026-11-15, waits match source text now.) - -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) 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. The -GM's rewrite superseded the agent's extraction draft: it is a -*procedure* (understand -> decide -> compose -> adjust your papers), -not a rule list -- new material throughout, including the per-class -turn budget (zero or one of thoughts/dialogue/actions) and the -dice-tiebreak. The handbook's "one thing per turn" was cut to "short -turns" in step (the budget lives in the reminder now). Smoke 58/58 -plus an elision unit check (the log keeps every copy, the view carries -exactly one, 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 - -Emptied wholesale by the GM (2026-11-15) -- placeholder files only. -The design round starts from scratch when it comes; the comparison -table in README's Runs section is the design intent. - -## 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 runs//db/memory.db` then `init`. - `--force` flags are only for disposable pre-story states. -- Sessions log to `runs//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. -- The mock smoke lives in the repo (`test/` -- the scripts moved in - from the temp dir at the GM's ask, 2026-11-14; no broader - test-infra ruling is attached): `smoke.mjs` (the 69-step - multiuser/agenda/reminder/variant pass), `check-reminder.mjs` (the elision - unit check), `restart-check.mjs` (post-restart rebuild). They - expect a CLEAN state/ plus a running `--mock` server; smoke prints - its run ids and leaves a temp token file for the restart check. - Clean up state/ and the smoke runs afterwards -- only the real runs - stay. `check-repo.mjs` needs no server: the format rules (ASCII - bytes, no all-caps CSS) over the tracked files. + that should be character), and whether her variants stay same-turn + alternatives rather than sequences. ## Not yet exercised (expect first-use friction) -- **First start under multiuser** (step 1 above) -- nothing live has +- **First start under multiuser** (step 1) -- nothing live has touched the auth spine, invites, fork, or spectator mode yet; all are mock-proven only. - ask_gm in live flow (pause/resume is mock-proven; the live model @@ -670,7 +79,12 @@ table in README's Runs section is the design intent. conflict path in live flow (mock-proven; capped at 3 heals a turn), the agenda and the reminder against a live model, records tools through the server (needs a records-enabled run). -- A live housekeeping rejection, and the recovery-apply path on a real - manifest, remain first-use items. +- The slidwin carry against a real session boundary in earnest + (Irene's first stop), the story read as the review surface, the + OOC-hole showing in practice, and everything variantary live: the + pick against a real model, the metric's curve, coin-flip + personality. +- A live housekeeping rejection, and the recovery-apply path on a + real manifest. - The in-flow missed-update prediction (ROADMAP, system-1 entry) -- measurable from the second real session on. diff --git a/README.md b/README.md index e9f4288..1e444a2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rp-test +# Tiny Worlds Long-form, freeform, text-based roleplay where the model plays **one character** and the human plays **everything else**. @@ -16,6 +16,11 @@ is whether a model can be taught to *decide what to write down*. Humans forget; files don't -- so the file must be shaped to forget too. The product that test serves is the harness below. +A corollary shapes everything downstream, and names the project: **each +package is a tiny world on purpose.** A small cast, one place, a few live +pressures. The smaller the scope, the easier her choices -- everything she +must weigh stays close, and the rings stay legible. + ## The goal The memory test is not the end product. It exists to arrive at a usable diff --git a/server/main.mjs b/server/main.mjs index 6842f14..16e8c1f 100644 --- a/server/main.mjs +++ b/server/main.mjs @@ -244,7 +244,7 @@ function requireOwner(user, runId) { // --- routes ------------------------------------------------------------------- route('GET', '/api', async () => ({ - service: 'rp-test', mock: MOCK, openSessions: ctx.sessions.size, + service: 'tiny-worlds', mock: MOCK, openSessions: ctx.sessions.size, // the live session inventory -- debugging state divergence at a glance sessions: [...ctx.sessions.entries()].map(([id, s]) => ({ run: id, session: s.n, pendingAsk: !!s.pendingAsk })), })); @@ -873,5 +873,5 @@ const server = http.createServer(async (req, res) => { const [host, port] = String(cfg.bind ?? '127.0.0.1:7350').split(':'); server.listen(Number(port), host, () => { - console.log(`rp-test server: http://${host}:${port} | ${MOCK ? 'MOCK model' : cfg.models?.player} | ${ctx.sessions.size} session(s) rebuilt`); + console.log(`Tiny Worlds server: http://${host}:${port} | ${MOCK ? 'MOCK model' : cfg.models?.player} | ${ctx.sessions.size} session(s) rebuilt`); }); diff --git a/test/restart-check.mjs b/test/restart-check.mjs index c98624a..f205500 100644 --- a/test/restart-check.mjs +++ b/test/restart-check.mjs @@ -9,7 +9,7 @@ import { join } from 'node:path'; import { tmpdir } from 'node:os'; const BASE = process.env.RP_BASE ?? 'http://127.0.0.1:7350'; -const [token, reforkId, secondId] = readFileSync(join(tmpdir(), 'rp-test-smoke-token.txt'), 'utf8').trim().split(' '); +const [token, reforkId, secondId] = readFileSync(join(tmpdir(), 'tiny-worlds-smoke-token.txt'), 'utf8').trim().split(' '); const call = async (path, tok) => { const res = await fetch(`${BASE}/api${path}`, { headers: tok ? { authorization: `Bearer ${tok}` } : {}, diff --git a/test/smoke.mjs b/test/smoke.mjs index 909e4de..d52feec 100644 --- a/test/smoke.mjs +++ b/test/smoke.mjs @@ -23,7 +23,7 @@ import { tmpdir } from 'node:os'; const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..'); const BASE = process.env.RP_BASE ?? 'http://127.0.0.1:7350'; -export const TOKEN_FILE = join(tmpdir(), 'rp-test-smoke-token.txt'); +export const TOKEN_FILE = join(tmpdir(), 'tiny-worlds-smoke-token.txt'); let failures = 0; const ok = (name, cond, extra = '') => { diff --git a/web/index.html b/web/index.html index 1f9d574..e49f551 100644 --- a/web/index.html +++ b/web/index.html @@ -3,12 +3,12 @@ -rp-test +Tiny Worlds
- rp-test + Tiny Worlds
diff --git a/web/style.css b/web/style.css index a97f712..3167675 100644 --- a/web/style.css +++ b/web/style.css @@ -1,4 +1,4 @@ -/* rp-test SPA -- dark, quiet, fiction-first. Three registers: speech is +/* Tiny Worlds SPA -- dark, quiet, fiction-first. Three registers: speech is plain, narration is italic (rendered dimmer), OOC is boxed. Machinery (tools, notes, deltas) stays small and muted. Home / setup views are workbenches: cards, a file editor, read-only context. */