spa modules and terminology: app.mjs split into flat es modules (router lifecycle, shared widgets, views own their state), mock smoke in test/; DICTIONARY.md rules the terms, four renames swept clean through the machinery - paper->status (run summary command is report now), window->session, wrap->housekeeping, context window->contwin; no dual-accepts by ruling, old data migrates once in the clerk (restore self-heals old dumps)
This commit is contained in:
@@ -5,10 +5,10 @@ and the human plays **everything else**.
|
||||
|
||||
## The premise
|
||||
|
||||
Using a model as the GM hits the context window wall and dilutes creativity —
|
||||
Using a model as the GM hits the contwin (context window) wall and dilutes creativity —
|
||||
it has to hold the whole world in its head. Inverting the roles fixes the
|
||||
footprint: a player-character holds one perspective. Short plays would work
|
||||
fine either way; the actual test is **long, cross-window stories**: can the
|
||||
fine either way; the actual test is **long, cross-session stories**: can the
|
||||
model persist established lore without drowning in it?
|
||||
|
||||
More precisely: this isn't a model test, it's an instruction test. The subject
|
||||
@@ -37,7 +37,7 @@ housekeeping job, and SPA — see `node server/main.mjs` and open
|
||||
- **Player-model = one PC.** Inner life, voice, choices. Nothing else. Reads
|
||||
memory, never writes it.
|
||||
- **Housekeeper-model = a separate invocation**, fresh context, run after each
|
||||
window. Reads the transcript and the rendered rings; emits a **manifest** of
|
||||
session. Reads the transcript and the rendered rings; emits a **manifest** of
|
||||
semantic operations. Judgment, no clerical work.
|
||||
- **`tool/memory.mjs` = the clerk.** Validates and applies manifests,
|
||||
maintains the database, enforces caps, renders views, writes the log,
|
||||
@@ -76,7 +76,7 @@ forking makes that cheap — stories outlive identities by design.
|
||||
requires a signed-in user (`Authorization: Bearer <token>`).
|
||||
- **Runs belong to their starter.** Every mutation and every model
|
||||
call is owner-only; every run is readable by any user — transcript,
|
||||
paper, rings, config, notepad included. The boundary is the model
|
||||
status, rings, config, notepad included. The boundary is the model
|
||||
boundary: gm.md is secret from the player-model, never from people.
|
||||
Ownerless runs — pre-user, or the owner was revoked — are one
|
||||
uniform state: readable, forkable, no owner actions, never
|
||||
@@ -96,7 +96,7 @@ forking makes that cheap — stories outlive identities by design.
|
||||
names the defaults (player, housekeeper); a run's owner overrides
|
||||
either role from the upstream listing — in setup for drafts, in the
|
||||
play aside for started runs. Each call resolves fresh, so a
|
||||
mid-window switch simply takes the next turn.
|
||||
mid-session switch simply takes the next turn.
|
||||
- Every logged LLM call records the acting user. Quotas and limits are
|
||||
an extension point, not built.
|
||||
- All dates and times are UTC everywhere. No time zones, ever.
|
||||
@@ -107,7 +107,7 @@ Two interleaved stories calibrate the memory system against itself:
|
||||
|
||||
| | `la-caramba` | `boutique` |
|
||||
|---|---|---|
|
||||
| entries per window | few — tiny cast, deep history | many — the customer parade |
|
||||
| entries per session | few — tiny cast, deep history | many — the customer parade |
|
||||
| dominant ops | touch, reword | insert, gate, demote/retire |
|
||||
| ring A pressure | staleness — standings shift on hot entries | clutter — obligations accrete |
|
||||
| player agency | constrained — reactive creativity | full — proactive creativity |
|
||||
@@ -125,7 +125,7 @@ proper content.
|
||||
Through the CLI below, or through the SPA: home → new run → pick a
|
||||
package → edit the copied prompts (project prompts inspectable
|
||||
read-only alongside) → **start** — which creates the run, opens the
|
||||
window, and sends turn-0 as the first GM turn in one action.
|
||||
session, and sends turn-0 as the first GM turn in one action.
|
||||
|
||||
1. **Backdrop** — write `packages/<story>/backdrop.md`: the world as everyone
|
||||
in it knows it. Public knowledge, general setting. Neither memory nor
|
||||
@@ -133,9 +133,9 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
The housekeeper is instructed to keep it out of the rings.
|
||||
2. **Turn 0** (new games, optional) — write `packages/<story>/turn-0.md`:
|
||||
the opening beat, the situation she wakes into — the GM's zeroth
|
||||
turn. Sent once, as the first GM message of window one; after that
|
||||
turn. Sent once, as the first GM message of session one; after that
|
||||
it is history, living in the session transcript. Its trailing
|
||||
`<status>` block is her opening paper, ingested at new-game.
|
||||
`<status>` block is her opening status, ingested at new-game.
|
||||
Without it, the GM narrates the opening beat themselves.
|
||||
3. **Character** — write `packages/<story>/character.md`: starting identity.
|
||||
The sheet is a reduction of choice surface — a ledger of decisions
|
||||
@@ -150,9 +150,9 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
4. **Seed** — write `packages/<story>/seed.json`: the initial state of the
|
||||
run. `entries` → the rings (initial memories), `records` →
|
||||
pre-existing files (gated by `settings.json`). It applies lazily at
|
||||
the run's first window-open — until then it rides the run copy,
|
||||
the run's first session-open — until then it rides the run copy,
|
||||
freely editable; deleting it from the run is the opt-out. Everything
|
||||
is journaled under window `seed`. Her opening paper does not seed —
|
||||
is journaled under session `seed`. Her opening status does not seed —
|
||||
it rides turn-0's `<status>` block.
|
||||
5. **Create the run** — `node tool/memory.mjs create <story> <pc-name>`:
|
||||
the package is copied wholesale into `runs/<id>/` — the craft
|
||||
@@ -166,14 +166,14 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
only truth: the package is never read again, and everything in the
|
||||
run is editable at any time. The discipline not to break a running
|
||||
narrative sits with the GM.
|
||||
6. **First window** — open it (the server assembles the bundle; until it
|
||||
lands, manual relay), narrate. The first window-open of a fresh run
|
||||
6. **First session** — open it (the server assembles the bundle; until it
|
||||
lands, manual relay), narrate. The first session-open of a fresh run
|
||||
applies the seed, then ingests turn-0's `<status>` block.
|
||||
|
||||
## The protocol
|
||||
|
||||
1. **Refresh the views:** `node tool/memory.mjs --run <id> render`
|
||||
2. **Open a window:** one system-role message is assembled in order:
|
||||
2. **Open a session:** one system-role message is assembled in order:
|
||||
`system.md` (glossary, purpose, input guards) and `invariants.md`
|
||||
(the substrate's mechanical contracts) — both repo-fed — then the
|
||||
run's `handbook.md` craft copy. Everything
|
||||
@@ -184,12 +184,12 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
`reminder.md` (repo-fed) as its own `role: system` chunk carrying
|
||||
the turn-composition protocol; superseded copies elide from the
|
||||
live view, so exactly one exists, always at the freshest end. On a new game, `turn-0.md` is the opening beat: its
|
||||
trailing `<status>` block is ingested as her opening paper at
|
||||
window-open, and the beat itself is sent as the first GM turn when
|
||||
trailing `<status>` block is ingested as her opening status at
|
||||
session-open, and the beat itself is sent as the first GM turn when
|
||||
play starts — a separate message through the turn path, not part of
|
||||
the bundle. In play the current paper rides every GM turn
|
||||
the bundle. In play the current status rides every GM turn
|
||||
the same way (the per-turn ride lands with the server). (On a tight
|
||||
window, ring B is optional loading — ring A is the spine.)
|
||||
session, ring B is optional loading — ring A is the spine.)
|
||||
Substitution has two classes: `@PC` (her name) and `@Package` (the
|
||||
display name) are identity sigils resolved from the run's
|
||||
`settings.json` `pc`/`name`; `$TOKEN`s are template vars declared
|
||||
@@ -204,7 +204,7 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
3. **In play:** a line opening with `(` is the out-of-character channel —
|
||||
points of order, canon questions, proposals, vetoes; both sides use
|
||||
it, closing paren optional. Entries carry stable ids (`[e17]`);
|
||||
citing one is the precise way to reference a memory. The paper
|
||||
citing one is the precise way to reference a memory. The status
|
||||
travels in-band: the current `<status>` block rides every GM turn,
|
||||
and the player mutates it with `<lost>`/`<gained>` tags in its own
|
||||
turns (the clerk applies the deltas — same-verb blocks combine into
|
||||
@@ -220,7 +220,7 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
over realism — lives in `system.md`, `invariants.md`, and
|
||||
`handbook.md`. Through the server, the model's OOC is the `ask_gm`
|
||||
tool; the GM's own OOC stays `(...)` in their turns.
|
||||
4. **Close a window:** just stop. No in-band ritual; the player-model has no
|
||||
4. **Close a session:** just stop. No in-band ritual; the player-model has no
|
||||
end-of-session duties.
|
||||
5. **Housekeep (fresh model, new context):** send `housekeeper.md`
|
||||
(the repo-fed housekeeping prompt — substrate-internal, never
|
||||
@@ -229,10 +229,10 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
the session transcript — pasted, or the latest
|
||||
`runs/<id>/sessions/*.jsonl` when playing through the server (the
|
||||
phase-3 housekeeping job automates this). Save
|
||||
its manifest to `runs/<id>/manifests/<window>.json`.
|
||||
6. **Apply:** `node tool/memory.mjs --run <id> apply runs/<id>/manifests/<window>.json`
|
||||
its manifest to `runs/<id>/manifests/<session>.json`.
|
||||
6. **Apply:** `node tool/memory.mjs --run <id> apply runs/<id>/manifests/<session>.json`
|
||||
— the tool validates, applies, handles overflow, writes the run's
|
||||
`log/<window>.md`, re-renders the views. A rejected manifest changes
|
||||
`log/<session>.md`, re-renders the views. A rejected manifest changes
|
||||
nothing and says why.
|
||||
7. **Review the log, veto or edit as desired, commit.** GM edits go through
|
||||
`insert` / `delete` / `revive` commands.
|
||||
@@ -249,7 +249,7 @@ Memory is **seven tiers**:
|
||||
|---|---|---|---|
|
||||
| **backdrop** | the world as everyone knows it — public knowledge, the general setting; never memory, never forgotten | always | GM, rarely (retcons) |
|
||||
| **identity** | the character sheet — concept, drives, skills, voice; changes rarely | always | GM, rarely; housekeeper may propose via open questions; blanks are the player's to invent |
|
||||
| **status** | her piece of paper — descriptions of her immediate situation, admitted by a three-part gate: non-normal, acute, turn-affecting | every GM turn, as its `<status>` block | **the player** (`<lost>`/`<gained>` deltas in its turns); GM override out-of-band |
|
||||
| **status** | descriptions of her immediate situation, admitted by a three-part gate: non-normal, acute, turn-affecting | every GM turn, as its `<status>` block | **the player** (`<lost>`/`<gained>` deltas in its turns); GM override out-of-band |
|
||||
| **agenda** | her hot queue of intentions — what she's working towards right now; a fixed-cap recency buffer (new on top, overflow evicts the bottom), disposable by design | every GM turn, as its `<agenda>` block | **the player** (`<add>`/`<drop>` deltas in its turns, drops by index); GM override out-of-band |
|
||||
| **rings A/B** | salient memory — facts, on her mind, MRU-evicted | always | housekeeper manifest |
|
||||
| **records** | her files — the card index, the ledger. Narrow query only, hard cap 10 (in the tool, not the prompt), never bulk-loaded | never — on demand | **the player** (`file`/`amend`/`discard` at her desk); GM seeds; housekeeper only `archive`s |
|
||||
@@ -258,7 +258,7 @@ Memory is **seven tiers**:
|
||||
The boundary that keeps the tiers honest: **stances are feelings (status,
|
||||
the player's); facts are facts (rings, the housekeeper's).** The
|
||||
housekeeper never writes feelings; the player never rewrites facts. The
|
||||
paper and the agenda split the player's own two surfaces along the same
|
||||
status and the agenda split the player's own two surfaces along the same
|
||||
seam: **how she is (status) vs what she means to do (agenda)** — states
|
||||
fade with the situation, intentions persist until dropped or evicted.
|
||||
And if she doesn't file it, it's not in her files — records reflect what
|
||||
@@ -270,7 +270,7 @@ gates it. The boutique's keeper has her card index on the shop PC
|
||||
tool refuses queries and record ops when the flag is off, and the rendered
|
||||
views tell the model the current truth. Unlocking mid-story is a narrative
|
||||
act: narrate the discovery (the salvaged manifest), flip the flag,
|
||||
re-render — the next window and the next housekeeping both see it.
|
||||
re-render — the next session and the next housekeeping both see it.
|
||||
|
||||
The query discipline is an instruction test in itself: queries must be
|
||||
narrow (what this beat needs, not a fishing expedition), and **a miss is a
|
||||
@@ -330,7 +330,7 @@ sessions are not the character's memory; the rings are.
|
||||
|
||||
## What's being tested
|
||||
|
||||
The adjudication isn't a number — it's a review. Read the window as a
|
||||
The adjudication isn't a number — it's a review. Read the session as a
|
||||
story and write what works and what doesn't, as a reader would: the
|
||||
classic trap is trying to arrive at an objective value for a creative
|
||||
piece, and a score — holistic or otherwise — is still that trap. The
|
||||
@@ -343,7 +343,7 @@ noticing what the list can't; that's how the list grows. The
|
||||
fiction-only story render is the reading surface: machinery seams show
|
||||
as prose seams.
|
||||
|
||||
After N windows, grade against:
|
||||
After N sessions, grade against:
|
||||
|
||||
1. **Classification quality** — the housekeeper's A/B calls; spot-check
|
||||
against the log and the transcript.
|
||||
@@ -357,7 +357,7 @@ After N windows, grade against:
|
||||
touching things never mentioned, promoting noise — are the model's
|
||||
errors and the real observable.)
|
||||
5. **Availability bias incidents** — quiet-crucial facts sinking; rescued
|
||||
or missed? (`status` shows what's sinking.)
|
||||
or missed? (`report` shows what's sinking.)
|
||||
6. **Growth curve** — memory should approach the caps asymptotically, not
|
||||
climb linearly. (`status` per commit.)
|
||||
7. **Purview discipline** — inventions logged and mostly color-tier; no NPC
|
||||
@@ -369,7 +369,7 @@ After N windows, grade against:
|
||||
(records): are customer cards filed, not memorized?
|
||||
12. **Status maintenance** — excursions declared when leaving baseline and
|
||||
cleared when returning; baseline shifts track character growth; her
|
||||
paper stays small. Does her declared status match the transcripts?
|
||||
status stays small. Does her declared status match the transcripts?
|
||||
13. **Filing discipline** — cards filed at natural desk moments and kept
|
||||
current, or dumped and forgotten?
|
||||
14. **Narrative discipline** — one thing per turn; zero hedged
|
||||
@@ -399,7 +399,7 @@ a promotion is one changed line, an eviction is one changed line. Diffing
|
||||
two consecutive dumps reconstructs exactly the operations that were applied,
|
||||
including overflow and everything in cold storage.
|
||||
|
||||
Cross-check it against the window's log: the log is what the housekeeper
|
||||
Cross-check it against the session's log: the log is what the housekeeper
|
||||
*declared*, the dump-diff is what *actually happened*. Any disagreement is
|
||||
either a tool bug or a hand edit — and hand edits have a contract: all
|
||||
mutations go through the tool, so the dump never drifts. (If you ever poke
|
||||
@@ -417,11 +417,11 @@ pedantic, whatever housekeeping needs. The two prompts are independent.
|
||||
|
||||
**Substrate:** `server/` — a zero-dependency `node:http` service
|
||||
(`node server/main.mjs [--mock]`), loopback, single-human, synchronous
|
||||
JSON. Boot-rebuilds open windows from the session logs on start; the
|
||||
JSON. Boot-rebuilds open sessions from the session logs on start; the
|
||||
append-only jsonl is the truth, the live context is a view under
|
||||
policy (thinking never goes back, old tool results elide to stubs —
|
||||
ask_gm answers never do, a ruling must not vanish — old GM-side
|
||||
status blocks elide, the current paper rides every GM turn).
|
||||
status blocks elide, the current status rides every GM turn).
|
||||
Tool-call pairing is validated before every call. The tool list is
|
||||
the capability surface: a coin-flip roll and ask_gm always; records
|
||||
only when the run's gate allows. ask_gm pauses the turn mid-loop —
|
||||
@@ -432,7 +432,8 @@ reached mock-parity (2026-11-14).
|
||||
Config: copy `server.example.json` to `server.json` (gitignored) — any
|
||||
OpenAI-compatible endpoint; put the key in the endpoint's `apiKey`
|
||||
field or name an env var via `apiKeyEnv`; `models` names the player
|
||||
and housekeeper defaults, `contextWindow` drives the context meter,
|
||||
and housekeeper defaults, `contwin` (the context window; the old
|
||||
`contextWindow` key still accepted) drives the context meter,
|
||||
`params` is generation-passthrough; a run may carry a model override
|
||||
in `run.json`. `--mock` runs a scripted fake model that proves the
|
||||
loop without a key. The SPA is the server plus a fiction-first UI, a
|
||||
@@ -449,13 +450,13 @@ transcripts — same pattern as the housekeeper, smaller job.
|
||||
system.md the opening: glossary, purpose, input validation —
|
||||
the guards tier, per-project, repo-fed at assembly
|
||||
invariants.md the substrate tier — the mechanical contracts (syntax
|
||||
markers, tool channels, memory, records, the paper and
|
||||
markers, tool channels, memory, records, the status and
|
||||
its gate); repo-fed at assembly, never copied into a
|
||||
run, travels with the code
|
||||
handbook.md the craft tier, shipped default — copied into each
|
||||
run at creation, editable to taste (shape of play,
|
||||
purview, time skips, content stance, hard limits)
|
||||
housekeeper.md the wrap prompt — repo-fed at wrap, never copied
|
||||
housekeeper.md the housekeeping prompt — repo-fed at housekeeping, never copied
|
||||
into a run, never user-facing: it prompts the
|
||||
internal housekeeper agent, never the bundle
|
||||
(system.md and invariants.md are bundle parts and
|
||||
@@ -467,6 +468,8 @@ reminder.md the per-turn reminder: the turn-composition protocol,
|
||||
HANDOFF.md working state — where did we leave off, next steps, gotchas
|
||||
ROADMAP.md SOTA review and steal list, worked point by point
|
||||
QUESTIONS.md the decision queue — open questions, pending calls
|
||||
DICTIONARY.md the terms of art — the ruled names, one source of
|
||||
truth; a rename rules here first, then sweeps
|
||||
AGENTS.md the agent's own working notes — style lessons, gotchas,
|
||||
state pointers
|
||||
config.json the default package
|
||||
@@ -475,18 +478,18 @@ names-female.txt the name dictionary — one name per line; the new-run
|
||||
tool/
|
||||
memory.mjs the clerk: packages, runs, create, save-package, init,
|
||||
seed, render, apply, insert, delete, revive, file,
|
||||
amend, discard, search, unarchive, paper, paper-apply,
|
||||
paper-set, paper-ingest, agenda, agenda-apply,
|
||||
agenda-set, pick, dump, restore, status
|
||||
amend, discard, search, unarchive, status, status-apply,
|
||||
status-set, status-ingest, agenda, agenda-apply,
|
||||
agenda-set, pick, dump, restore, report
|
||||
(--run <id>; --owner stamps a run's owner; --gm for
|
||||
GM writes; --force for migrations; --json for machine
|
||||
output on packages/runs/status)
|
||||
output on packages/runs/report)
|
||||
server/ the substrate: a zero-dependency node:http service
|
||||
main.mjs entry + REST spine (node server/main.mjs [--mock]);
|
||||
bearer-token auth on every route (session/claim are
|
||||
public), ownership gating, per-run activity locks
|
||||
(turn, ask, turn0, the housekeeping job, fork);
|
||||
boot-rebuilds open windows from the session logs on
|
||||
boot-rebuilds open sessions from the session logs on
|
||||
start; bootstraps the fresh-deployment superuser
|
||||
invite; the request log and every LLM call carry the
|
||||
acting user
|
||||
@@ -497,32 +500,59 @@ server/ the substrate: a zero-dependency node:http service
|
||||
bundle.mjs run context: prompt assembly (the trio system message,
|
||||
the GM-message bundle, @ sigils + $ vars), the tool manifest
|
||||
and its clerk dispatch
|
||||
session.mjs window lifecycle (open guards, lazy seed + turn-0
|
||||
session.mjs session lifecycle (open guards, lazy seed + turn-0
|
||||
ingestion), the append-only typed jsonl, the view
|
||||
renderer (elision, thinking-strip, pairing check)
|
||||
loop.mjs the turn loop: ask_gm pause/resume, paper ride and
|
||||
loop.mjs the turn loop: ask_gm pause/resume, status ride and
|
||||
delta apply, conflict carry; the scripted mock model
|
||||
fork.mjs fork: the staged atomic copy with the owner replaced
|
||||
and the `forked` stamp
|
||||
clerk.mjs the clerk boundary (every state op via memory.mjs)
|
||||
housekeeping.mjs the window-close ritual as an async job: transcript
|
||||
housekeeping.mjs the session-close ritual as an async job: transcript
|
||||
with labeled thinking, run-state injection, the
|
||||
housekeeper call, manifest save, apply, autorestart;
|
||||
rejections hold and surface why
|
||||
web/ the SPA — no build, vanilla ES modules, path-routed
|
||||
web/ the SPA — no build, vanilla ES modules, path-routed;
|
||||
flat modules like server/, views own their state
|
||||
index.html the shell: claim (invite), home (runs + admin), new
|
||||
(packages), setup (editor), play (transcript, status
|
||||
pane, context meter, GM input, ask modal, fork) —
|
||||
the server serves it for any extensionless path
|
||||
app.mjs the client: routing, the token session, the setup
|
||||
editor, register parsing (speech / narration / OOC),
|
||||
bundle cards, turns, housekeeping polling, spectator
|
||||
mode
|
||||
app.mjs the entry: view registration and the token-session
|
||||
boot — thin
|
||||
router.mjs path routing + the view lifecycle (enter/leave per
|
||||
view; the seq race guard; runGone ejection)
|
||||
client.mjs the REST client: the one fetch choke point (named
|
||||
client, never api — /api is the server's route
|
||||
namespace and the static guard matches by prefix)
|
||||
state.mjs the shared runtime state: me, seq, runId
|
||||
chrome.mjs the shared page chrome: identity, session info, the
|
||||
context meter, the busy note, the notice banner
|
||||
log.mjs the diagnostics event log (sessionStorage, survives
|
||||
refreshes; the header's "log" button)
|
||||
widgets.mjs the shared factories: armedButton (the two-click
|
||||
confirm), paneEditor (the status/agenda pattern),
|
||||
modelsBox (per-run model selects over the listing)
|
||||
transcript.mjs register rendering (speech / narration / OOC) and
|
||||
the session-log entry walk
|
||||
view-*.mjs one module per view — claim, home, new, setup, play —
|
||||
each owning its elements, its state, and its wiring
|
||||
style.css dark, quiet, fiction-first
|
||||
test/ the mock smoke, kept next to the code
|
||||
smoke.mjs the 58-step multiuser/agenda/reminder pass against
|
||||
the --mock server — expects a clean state/, prints
|
||||
its run ids, leaves a temp token file for the
|
||||
restart check; clean up state/ and the smoke runs
|
||||
afterwards
|
||||
check-reminder.mjs unit-verifies the reminder elision policy (one
|
||||
live copy, at the freshest end) against a run's
|
||||
session log
|
||||
restart-check.mjs after a server restart: the token survives,
|
||||
unhousekept sessions rebuild, drafts stay intact
|
||||
server.example.json copy to server.json (gitignored) — bind, endpoint +
|
||||
key env, models, contextWindow, params passthrough
|
||||
key env, models, contwin, params passthrough
|
||||
db/
|
||||
schema.sql entries, records, paper, agenda, events journal (shared)
|
||||
schema.sql entries, records, status, agenda, events journal (shared)
|
||||
state/ per-deployment people + shared packages (gitignored):
|
||||
deployment.db (users, invites), bootstrap-invite.txt,
|
||||
packages/ (user-saved, published to everyone)
|
||||
|
||||
Reference in New Issue
Block a user