substrate: server, housekeeping job, spa - the mvp complete

- prompt split, GM's cut: system.md = opening + guards (glossary, purpose, input validation; repo-fed, per-project); invariants.md = substrate (syntax markers, tools, memory, records, the paper + its three-part 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). One system message: system -> invariants -> the run's handbook. OOC is a single open paren, closing optional, match the GM's style; a lone paren is an empty OOC line, skipped by the parser. housekeeper.md aligned: the paper holds acute states, relational shifts are recorded as the facts behind them, and dates are story dates (follow the rings' calendar, never the wall clock - the seed is 2069 now, per canon)
- server/ (phase 2, zero-dep node:http): REST spine per the sketch, per-run session machine with ask_gm pause/resume (the whole tool-call batch waits, 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 unhousekept refuse-and-override guard, usage tracking + context meter, tool-pairing validation, scripted mock model. The clerk gained --json (packages/runs/status); tool/bridge.mjs deleted at mock-parity per the retirement decision
- housekeeping job (phase 3, server/housekeeping.mjs): trigger ends the window and runs the chain async - transcript with labeled thinking, run-state injection (records availability; the ring views stay pure memory), housekeeper on a fresh context, manifest saved (raw output too if unparseable), clerk apply (writes the window log, snapshots dumps/<window>.sql), state.json lastHousekeptSession, autorestart. Rejection holds the restart and surfaces why; the apply endpoint is the recovery path and the manual-relay close. Live-proven twice: both manifests sound (ring-B classification, first-person voice, precise touches, story-dated)
- spa (phase 4, web/ - no build, vanilla es modules, served at /): three-register transcript per the ruled markers incl. multi-line narration blocks, bundle as a collapsed card with turn-0 as the opening GM turn, paper tags as chips, status pane with conflict surfacing, context meter hot past 85 percent, gm line input, ask modal re-presented from pendingAsk, housekeeping button with two-click arm + poll + inline log. No js alert/confirm (they block the embedded pane) - in-page banner instead. Driven end to end through the ui on a disposable live run
- seed: date fixed to the 2069 story calendar (was a real-world date; real dates never surface to the player)
- docs: README goal states the mvp is complete, layout covers server/ and web/, protocol and substrate sections rewritten for the server; ROADMAP phases 0-4 done, harness decisions current; QUESTIONS #4 #7 #10 #12 #16-mechanism #19a #20 #21 resolved; HANDOFF is the handoff map; AGENTS carries the working lessons (tokens are free, no screenshots - not multimodal, no js dialogs, external state survives rewinds)
This commit is contained in:
2026-11-14 03:15:53 +00:00
parent 530170224f
commit ba72d2ed1f
22 changed files with 2418 additions and 838 deletions
+110 -54
View File
@@ -9,26 +9,36 @@ file is the "where did we leave off" map.
## Where we are
- All machinery is built and mock-tested. **Nothing has been played yet.**
No real session, no real housekeeping.
- Live endpoint probed and healthy (glm-5.3 via llm.exan.tech): all four
roles accepted; multiple and mid-stream system messages honored; full
tool round-trip; no assistant-prefill semantics; `reasoning_content`
round-trips safely in input. The bridge loop itself is still mock-only.
- The run is renamed `prisoners` → `la-caramba` (config default included);
the branch is renamed `master` → `mistress`; the runs directory is
renamed to `packages/`.
- `system.md` opens with an input-validation section (IC/OOC buckets,
injection guards). The loop (today in the bridge) tags every tool with
its output channel ([IC]/[OOC]), sends the opening bundle as per-role
messages — `system.md` the sole system message; backdrop, character,
ring-b, ring-a, then `turn-0.md` on a new game, all as GM messages —
and logs the whole bundle into the session transcript. (Status left
the bundle: the paper rides every GM turn as a `<status>` block once
the server lands.) **The bridge is retired by decision
(2026-11-13) before ever going live**: REST + SPA is the MVP; the
loop is extracted into the server, the file is deleted at server
mock-parity, the `--mock` discipline survives as a server mode.
- **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);
@@ -38,11 +48,16 @@ file is the "where did we leave off" map.
- 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). 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.
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
@@ -80,24 +95,65 @@ file is the "where did we leave off" map.
## Immediate next steps, in order
1. system.md split extraction (ruled 2026-11-13, ROADMAP "The
harness"): substrate facts into `invariants.md`, security guards
into `guards.md` (both repo-fed at assembly), the per-run craft
copy keeps everything else, hard limits included. Drafts get the
GM's red pen; must land before the first run is created so no run
copies what the substrate feeds. (Prose deferred by the GM — not
blocking the server build.)
2. **Server (phase 2):** loop core from the bridge, `node:http` REST
spine per the ROADMAP sketch, per-run session machine with ask_gm
pause/resume, view renderer, boot-rebuild, lazy seed + turn-0
ingestion orchestrated at window-open (with the #21 guard),
thinking-strip, usage tracking, mock, tool-pairing validation. The
API is the operable surface — testable standalone, on request,
while the SPA waits.
3. **Housekeeping job (phase 3):** manual trigger, transcript with
labeled thinking, auto-apply, autorestart on success, per-wrap dump
snapshots.
4. **SPA (phase 4):** downstream, per the resolved v1 scope.
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
@@ -146,15 +202,15 @@ are open questions for the drafting session with the GM).
## Not yet exercised (expect first-use friction)
- The loop-side phase-0 surface: `<status>` blocks riding GM turns,
thinking-strip, usage tracking. (The clerk side — delta apply,
`<conflict>` reporting, prelude ingestion, prior-content journaling —
is CLI-smoke-tested but never yet exercised in flow.)
- The bridge loop against the live API (mock only so far; the endpoint
itself is probed — see "Where we are").
- A real housekeeping invocation with a real model's manifest.
- `seed` on a real (reviewed) seed file, applied lazily at a run's
first window-open.
- Real-data `dump`/`restore` and the snapshot-diff review flow.
- 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) —
becomes measurable with the first real session.
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.