substrate: spa v1 plan, rewrite-here surgery, status redesign

- ROADMAP: SPA v1 decisions recorded - the story lives in the session
  logs (publishing is a later export), sessions outlive the browser via
  boot-rebuild from the jsonl, loopback single-human, ask_gm as a modal
  that survives refresh, context meter loud past 85 percent, status pane
  always visible, housekeeping is the window-close ritual with
  autorestart (rejection holds the restart; review is async via logs),
  synchronous REST as the full substrate with the SPA strictly a
  client; phasing 0-3 and the API spine; steals #2 and #3 decided
- rewrite-here turn surgery: an unfortunate GM turn is edited and the
  session restarts from there; window-scoped only (post-housekeeping
  edits are retcons); the saga rule - every player tool is either
  session-pure or a journaled mutator with recorded prior state, so
  compensation is mechanical; trivial typos tolerated
- status redesign (QUESTIONS #17): the paper holds freeform
  descriptions admitted by a three-part gate (non-normal, acute,
  turn-affecting); the full paper rides every GM turn as a status
  block - reads are state, writes are deltas via lost/gained tags in
  the player's turn, exact match, non-blocking, misses relayed back as
  conflict blocks; no cap; normalization drift is the housekeeper's to
  place; status leaves the opening bundle and the bundle copy of old
  blocks elides from the live view; the initial paper rides the prelude
- system.md: Status section rewritten for the paper model; records
  cross-reference fixed
- housekeeper.md: entries are personal memories now - first person, her
  voice, labels stay terse handles; status blocks and player thinking
  named as inputs, evidence never fiction; the paper watch rule (place
  drift: facts to rings, identity to open questions)
- la-caramba: GM red-pen of the seed (first-person sensory entries,
  status key dropped, typo fixed) and prelude (trailing status block
  seeds the paper at new-game)
- QUESTIONS: queue churn throughout - items 5, 6, 8, 15, 17, 18
  resolved; 15 through 18 added
This commit is contained in:
2026-11-12 13:42:37 +00:00
parent 9bc16afb60
commit 3d4c374894
6 changed files with 242 additions and 78 deletions
+65 -17
View File
@@ -39,19 +39,19 @@ Zero-dependency `node:http` + a no-build vanilla SPA (the repo ethos: no
package.json, everything hand-rolled) vs a framework. Recommendation on
the table: zero-dep. (2026-11-12)
### 5. ask_gm mid-loop resumption — OPEN
The play loop blocks on GM input at `ask_gm`. REST shape: a turn returns
`{state: ask_gm, question}`, the server holds the in-flight loop,
`POST /api/ask` resumes it — no long-lived connections. Alternative:
SSE/websocket streaming. Recommendation on the table: pause/resume state
machine, single GM, single run in memory. (2026-11-12)
### 5. ask_gm mid-loop resumption — RESOLVED (2026-11-12)
Pause/resume, no streaming: the turn request returns with the pending
question, the server holds the in-flight loop, the SPA shows a modal
(re-presented after a refresh via GET /api/session), and the answer
call resumes it. Synchronous REST; the SPA is strictly a client.
### 6. First-cut scope — OPEN
Play surface only (run picker, transcript, ask_gm prompt, live status
panel, tool activity) vs also the housekeeping job runner / memory
browser / context inspector (ROADMAP steals #6–#7). Recommendation on
the table: play surface first; housekeeping stays manual until the live
loop is proven. (2026-11-12)
### 6. First-cut scope — RESOLVED (2026-11-12)
v1 per GM: play surface (transcript with voice/narration/OOC visually
distinct, GM line input), ask_gm modal, always-visible status pane with
contents, context meter (loud past 85%), and a manual housekeeping
action runnable at any time. Book formatting, memory browser, context
inspector, watcher: out of scope. Turn surgery scope still open
(item 15).
### 7. Bridge vs server code sharing — OPEN
Refactor the loop core (clerk dispatch, message assembly, logging,
@@ -60,11 +60,13 @@ leave the bridge untouched and let the server grow alongside.
Recommendation on the table: shared core before duplication sets in.
(2026-11-12)
### 8. Per-turn status digest (ROADMAP steal #3) — DEFERRED
"For the time being" status rides the opening bundle, after ring-a. The
digest arrives with the substrate: transient, in the API view only,
re-read from `canon/status.md` each call, never logged. Open detail:
does the bundle copy of status then go away entirely? (2026-11-12)
### 8. Per-turn status digest (ROADMAP steal #3) — RESOLVED (2026-11-12)
Promoted into SPA v1: a fresh digest rides every turn, re-read from the
clerk before each call, and the injected digest is logged per turn —
provenance, rewrite-here compensation snapshots, and status evolution
as housekeeper evidence (observable #12). Status leaves the opening
bundle: system, backdrop, character, ring-b, ring-a (+ prelude on a
new game).
## Small / non-blocking
@@ -100,3 +102,49 @@ scene's opening are the GM's, while her side of the gap — actions,
thoughts, interiority — is hers to summarise in past. Purview amended
accordingly: skips moved from Never to Propose. Cuts are diegetic —
no OOC announcement needed.
### 15. Turn surgery — RESOLVED IN PRINCIPLE (2026-11-12)
Rewrite-here for GM turns: edit a turn, truncate everything after,
restart the live context from there. Forks rejected. Window-scoped:
post-housekeeping edits are proper retcons. Trivial typos tolerated
(publishing pass catches them). ROADMAP steal #2 updated to DECIDED.
Open details: (a) player-turn retry — same truncate with a re-call;
recommended yes, near-zero cost; (b) log representation — proposed:
the jsonl stays append-only and records surgery as typed entries;
live context, housekeeping transcript, and story export render the
effective view; (c) tool side effects in the lost range — resolved by the saga rule
(ROADMAP): session-pure tools (roll, ask_gm, search) vanish with the
turns; journaled mutators are compensated mechanically — status restored from
the status block of the last surviving GM turn, filings discarded by
rid, amends reversed via the journal once the clerk records prior
content (phase 0); (d) surgery blocked while an ask_gm is pending.
### 16. Housekeeping model configuration — OPEN
The housekeeping job runs server-side on a fresh model invocation.
Same endpoint as the player, second model entry in bridge.json
(ROADMAP steal #8 — cheap-model housekeeping one config away)? Which
model? (The housekeeper.md line on reading thinking blocks as
attention evidence, not fiction, is in — 2026-11-12.)
### 18. Ring entry voice — RESOLVED (2026-11-12)
Ruled: entries are personal memories — first person, her voice,
attitude included; labels stay terse handles. housekeeper.md aligned
(memory model, manifest example, ring-pointer example, testimony
example), seed typo fixed. While in there, the stale baseline-era
status paragraph was rewritten for the paper model (the housekeeper
places normalization drift: facts to the rings, identity to open
questions) and the Inputs list now names status blocks and thinking as
evidence, never fiction (closing the housekeeper.md half of #16).
### 17. Status redesign — RESOLVED (2026-11-12)
Adopted and written into system.md: freeform descriptions admitted by
the three-part gate (non-normal, acute, turn-affecting); the full paper
rides every GM turn as a status block — reads are state, writes are
deltas; the player mutates via lost/gained tags in its own turn,
exact-match, non-blocking, misses relayed back via a conflict block; no
cap; normalization drift goes to the card or the rings, never the
player's call. GM turns never carry deltas; GM override stays
out-of-band. The initial paper rides the prelude (seed.json dropped its
status key). Old status blocks elide from the live context view like
old tool results; the log keeps every as-sent block. The clerk/bridge
migration is latent (seed unapplied) and lands in phase 0.
+112 -12
View File
@@ -73,6 +73,100 @@ long-memory problem is unsolved. Our test aims at that gap.
prose. Procedural, state-driven, no model in the loop.
- **TTS: trivial add-on at any moment.** Park it.
## SPA v1 — substrate decisions (2026-11-12, GM)
- **The whole story is recorded; publishing is a someday option.**
Storage: backend, full stop — `sessions/*.jsonl` already is the
complete record (bundle + exchange), git versions it, the SPA holds
nothing. Publishing is an export render that filters to fiction;
book formatting out of scope for v1.
- **Sessions outlive the browser; the server is the truth.** Live state
is in-memory and rebuilt from the jsonl on boot (messages, elision
view, pending ask_gm). The log is truth, the context is a view.
- **Single human:** loopback bind, no cookies, no auth, one active
window.
- **ask_gm surfaces as a modal**; the pending question survives a
browser refresh (the server holds the pause, the SPA re-presents it).
- **Status rides the GM turns.** The full paper is attached to every
GM turn as a `<status>` block — reads are state, writes are deltas:
the player mutates with `<lost>`/`<gained>` tags in its own turn,
exact-match, non-blocking, misses relayed back via `<conflict>`. Old
status blocks elide from the live context view like old tool results;
the log keeps them all. The initial paper rides the prelude, ingested
at new-game. GM turns never carry deltas; GM override stays
out-of-band.
- **Status pane always visible** — the current description set, live;
`<conflict>` reports surface there too.
- **Thinking blocks are logged but never sent back** — the live context
strips `reasoning_content` (a delta from current bridge behavior,
phase 0); the housekeeping transcript labels them as `[thinking]`
attention evidence for touch/adjudication.
- **Context meter always visible, loud past 85%.** Exact, from the last
response's `usage.prompt_tokens` against a `contextWindow` value in
bridge.json. The 100% endgame is close-and-housekeep.
- **Housekeeping is the window-close ritual, and it autorestarts.** A
run always ends the session — "any time" means the GM may close a
window early, not that housekeeping is a mid-session action. The
chain runs unattended: housekeeper -> manifest -> apply -> next
window opens with fresh views. Review is async, via the log and the
dump diff; GM edits and vetoes remain available through the clerk at
any time, including mid-next-window. A rejected manifest holds the
restart and surfaces the reason for a re-run.
- **Rewrite-here, not forks.** An unfortunate GM turn is edited and the
session restarts from there — all turns since are lost from the live
context; the append-only log records the surgery and keeps them for
audit. The housekeeping transcript renders the effective view, so the
housekeeper never memorizes retconned-out turns. Window-scoped only:
after housekeeping the story is consolidated, and corrections become
proper retcons. Trivial typos are tolerated; the publishing pass
catches them. Tool side effects in the lost range are compensated
mechanically (see tool discipline below).
- **Tool discipline for rewrite (the saga rule).** Every player tool is
either **session-pure** — roll, ask_gm, records_search: effects live
in the conversation only, truncation removes them wholesale — or a
**journaled mutator** — the status and records verbs: the journal
must capture prior state, so compensation is mechanical. Clerk
amendment: amend and discard currently journal ids only; extend them
to record prior content, and every mutator becomes compensatable.
- **REST is the full substrate; the SPA is strictly a client.**
Synchronous requests, no streaming — single-human latency tolerates a
POST that runs the tool loop and returns.
Phasing:
0. pre-substrate deltas: strip `reasoning_content` from the live
context (log keeps it); usage tracking; `contextWindow` in
bridge.json; clerk journals prior content on amend/discard
(compensation-grade audit); status migration — description-set
schema, `<lost>`/`<gained>` delta apply (exact match, `<conflict>`
reporting), prelude ingestion at new-game, bridge loses the status
tools
1. shared loop core (bridge + server); node:http server; REST spine;
session state machine with ask_gm pause/resume; boot-rebuild from
jsonl; status/usage endpoints
2. SPA: transcript with three visual registers (voice / narration /
OOC), bundle as a collapsed "window opened" card, prelude as
fiction; GM line input; ask_gm modal; status pane; context meter
3. housekeeping job: manual trigger (always ends the window), transcript
assembly with labeled thinking, auto-apply, autorestart on success,
async log view; a rejection holds the restart and surfaces why
Later: turn surgery (steal #2 with UI), memory browser (steal #7),
context inspector (steal #6), book export.
API sketch (the operable spine):
GET /api/runs list (fill, records, new-game flag)
POST /api/windows open a window for a run
GET /api/session transcript + pending ask_gm + usage
POST /api/turn GM line -> runs the loop
POST /api/session/rewrite edit a turn, drop everything after,
restart the live context from there
POST /api/ask answer a pending ask_gm
GET /api/status the status tier, structured
POST /api/housekeeping run the housekeeper — ends the window,
auto-applies, restarts on success
POST /api/housekeeping/apply apply a manifest directly (re-runs,
hand-edited manifests)
GET /api/housekeeping/log the latest window log (async review)
## The steal list (work point by point)
### 1. Voice examples in the character sheet — ACCEPTED
@@ -82,20 +176,26 @@ Cost: zero (content). Add an example-dialogue block to the character.md
template and to both casts when drafting.
Status: ACCEPTED (2026-11-11).
### 2. Turn surgery: /retry, /edit in the bridge — OPEN
Swipes/regeneration and message editing exist in every serious platform;
our bridge appends immutably. One bad model turn should be retryable,
one bad GM typo editable. Cost: small (truncate messages, re-call).
Status: OPEN.
### 2. Turn surgery: /retry, /edit in the bridge — DECIDED (2026-11-12)
Rewrite-here, not fork-here: an unfortunate GM turn is edited in place
and the session restarts from there, losing all turns since. Window-
scoped only — after a housekeeping run the story is consolidated and
corrections become proper retcons (the boundary falls out of the memory
model: pre-housekeeping events live in context only). Trivial typos are
tolerated as-is; the publishing pass catches them. Forks rejected as
unnecessary. Remaining details in QUESTIONS #15; implementation with
the substrate.
### 3. Transient status digest injected post-history — OPEN
### 3. Transient status digest injected post-history — DECIDED (2026-11-12)
The Author's Note / `@@depth` / `post_history_instructions` pattern:
instructions placed after history get better adherence. Bridge would
append a fresh, compact status digest as the last thing before
generation — transient (in the API view only, not the session log),
re-read from `canon/status.md` each call. Pilot and measure adherence.
Cost: small.
Status: OPEN.
instructions placed after history get better adherence. Folded into the
SPA v1 substrate — superseded by the status redesign (QUESTIONS #17):
the full paper rides every GM turn as a `<status>` block; reads are
state, writes are deltas (`<lost>`/`<gained>`). Old blocks elide from
the live context view like old tool results; the log keeps every
as-sent block (provenance, rewrite snapshots, status evolution for
observable #12). Status left the opening bundle. Adherence remains an
observable to measure once live.
### 4. Generation params passthrough — OPEN
Every frontend exposes sampler settings; the bridge sends none.
+16 -9
View File
@@ -18,7 +18,9 @@ You never play, you never edit files, you never see the database directly.
memory
- `canon/ring-a.md` and `canon/ring-b.md` — rendered views of the memory,
entries ordered by last touch, each carrying a stable id like `[e17]`
- the transcript of the ended session
- the transcript of the ended session — including the status blocks
attached to the GM's turns and the player's thinking; both are
evidence (of her state, of her attention), never fiction
You never read old log entries. Your evidence is the rings and the
transcript, nothing else.
@@ -27,6 +29,9 @@ transcript, nothing else.
The rings are the character's memory, **not a chronicle**. Entries record
what the character would carry forward, not what a historian would record.
Write them as her memories: first person, her voice, attitude included —
not a chronicler's notes. Labels stay terse handles ("The Gull"); the
detail carries the memory.
- **Ring A — important facts.** Changed a relationship, created an
obligation, altered the world. Load-bearing.
@@ -43,7 +48,7 @@ what the character would carry forward, not what a historian would record.
"date": "YYYY-MM-DD",
"summary": "one short paragraph on what happened",
"insert": [
{ "ring": "b", "type": "fact", "label": "The Gull", "detail": "a tavern by the fish market, smells of tar", "reason": "the character now knows it" }
{ "ring": "b", "type": "fact", "label": "The Gull", "detail": "I know the place — by the fish market, smells of tar", "reason": "the character now knows it" }
],
"touch": [ { "id": "e12", "reason": "the debt came up again" } ],
"promote": [ { "id": "e44", "reason": "turned out to be load-bearing" } ],
@@ -106,7 +111,7 @@ date for you. Don't list an id twice across operations.
only records op is `archive`: moving a ring entry into her files when
it stops being on her mind (a rings decision that materializes the
file). Ring entries stay terse pointers when a record exists ("Mrs.
Ashworth — customer, see card" is a good ring-B entry). **Archived is
Ashworth — a customer, I keep her card in the index" is a good ring-B entry). **Archived is
not forgotten** — records answer her queries; cold storage doesn't.
10. **Queries are attention.** If the character consulted the records this
@@ -120,14 +125,16 @@ date for you. Don't list an id twice across operations.
never silently absorbed, never silently retconned.
- **Testimony is testimony.** Record what was said as *said by whom*
("the AI claims the grounding was manual"), and her beliefs as beliefs
("she suspects Marta knew"). Wrong facts in memory are worse than no
("I suspect Marta knew"). Wrong facts in memory are worse than no
facts: an entry that later turns out false is a retcon. In a story full
of liars and mysteries, attributed claims are the only safe facts.
- Rings hold **facts, never her feelings**. Stances ("Marta: trust
cracked") live in her status, which is entirely hers — you never write
it. A baseline shift there is character growth; if you notice one the
sheet hasn't caught up with, that's an open question, never a write.
If her declared status contradicts the session you just read, flag it.
- Rings hold **facts, never her feelings**. Stances ("I trust Marta
less") live on her paper, which is entirely hers — you never write
it. Watch the paper across the session: when a non-normal state has
become her new normal, place the drift — record it as a fact if it
belongs in memory, or propose a card edit in open questions if it is
identity. If her paper contradicts the session you just read, flag
it.
- `character.md` (identity) is the GM's too. If identity or drives have
shifted, propose an amendment in open questions; never edit the sheet
yourself.
+4 -1
View File
@@ -4,7 +4,8 @@
transcript; the bridge includes it only until the run has a session log.
Substitution tokens (a name prefixed with a dollar sign) resolve from
the run's settings.json "vars" before sending. Tense is the camera:
the past paragraphs backfill, the present ones open the scene. -->
the past paragraphs backfill, the present ones open the scene. The
trailing status block is her opening paper — ingested at new-game. -->
*Modesty, decency or respect are for those who can pay, the rest get **efficiency**.
Naturally, prisoners in transit are "the rest". $PC was staring at a stylised
@@ -18,3 +19,5 @@ seconds after that another thonk came from the container's door as it unlocked.*
*She tugs on her handcuffs, hoping for a miracle, then knocks on the belt, then
sighs and walks out, squinting at sunlight. Year of our Lord 2069 is not treating
her well so far.*
<status>cuffed, belted, naked, barefoot, worried</status>
+6 -10
View File
@@ -1,14 +1,10 @@
{
"date": "2026-11-18",
"entries": [
{ "ring": "a", "type": "fact", "label": "The grounding", "detail": "the hull hit rock; the ship listed and stopped; after a while the door unlocked — the failsafe, working as written" },
{ "ring": "a", "type": "fact", "label": "The cuffs", "detail": "locked behind the back, no keyholes; they come off 'at the facility' — so the loading contractors said" },
{ "ring": "a", "type": "fact", "label": "The transport", "detail": "weeks in a container: paste on a schedule, no windows, no human voice since loading" },
{ "ring": "b", "type": "place", "label": "The container", "detail": "pallet, paste feeder, drain; smells of warm plastic" }
],
"status": {
"restraints": { "normal": "unencumbered", "value": "cuffed behind back; belted" },
"mood": "low heat — level, watchful, cataloguing",
"outfit": "transport coveralls, thin soles, nothing else hers"
}
{ "ring": "a", "type": "fact", "label": "The cuffs", "detail": "My hands are being kept behind back with a pair of snug hinged solid metal handcuffs. Caught a glimpse, those look serious." },
{ "ring": "a", "type": "fact", "label": "The belt", "detail": "A purpose-designed chastity belt that sits on my hips and wraps around between the legs. 'Contraband prevention', they said with chuckles. Surprisingly comfortable and light, easy to forget it's there. Looks and feels like thick reinforced clear silicone." },
{ "ring": "a", "type": "fact", "label": "The feeder", "detail": "I don't care how they sell it to the public, it's a dildo. I have to admit, the reasoning is solid, since I can indeed get slop down my throat and I don't have to brush my teeth. Mercifully, the slop itself cuts off the gag reflex, as I have to take the damn thing into my mouth and press a button above it with my nose, or it doesn't work." },
{ "ring": "a", "type": "fact", "label": "The slop", "detail": "Probably tastes awful, but luckily it goes straight down the throat and I don't have to know. Since I got on the liquid diet I never had to poop once, I guess it gets digested fully making waste management easier for them." },
{ "ring": "b", "type": "place", "label": "My container", "detail": "A portable padded cell, not even a toilet inside, only the 'feeding dispensor' sticking out from a soft wall and dim amber light as perhaps the only remaining courtesy. Someone should pay for me having to pee in the corner. The liquid got absorbed into the padding, the smell never quite did." }
]
}
+39 -29
View File
@@ -157,36 +157,46 @@ happen.
# Status
The status view in your bundle is **your own piece of paper**: your current
state — mood, outfit, condition, your stance toward the people in your
life. Nobody updates it for you. It is a record of decisions already made;
"what would make sense" does the rest of the cutting.
Attached to the GM's turns you receive a `<status>` block: **her piece
of paper** — a short list of descriptions of your character's immediate
situation, and yours alone to keep. Treat it as a reminder: let it
color her voice and steer her choices. Nobody updates it for you.
Most values have a **baseline** — the normal, the default you play to.
The baseline is a decision already made. You only declare when a value
*leaves* its baseline, and clear it when it returns. Four verbs run the
whole paper:
What belongs on the paper passes a three-part gate. A description must
be:
set mood: sea-sick and furious an excursion
clear mood back to normal
norm mood: guarded a baseline shift — growth is this
drop mood remove the field
1. **outside broad normality** for her — the ordinary is never listed;
2. something she is **acutely aware of** right now;
3. something that **should affect the turn**.
How a verb travels depends on the substrate: the status tools when you
have them — between prose beats, never narrated — or `((status ...))` OOC
lines in manual play, which the GM relays.
Bored, shivering, proud, ashamed, naked, hungry, cuffed, on edge, craves
a smoke, afterglow, full bladder, barefoot, in pain — all pass. Warm
when the weather is warm, liking puppies, being on the pill — none do:
normal, ambient, or chronic. If the prose already carries it clearly,
leave it off the paper.
- Declare excursions when they happen; clear them when they pass. Ride
natural pauses — a scene ending, a quiet moment. For some characters
this is a literal ritual (closing up the shop, a diary).
- The paper is **yours**: add fields, rename them, prune them. But it is
small — a handful of values that decide turns. Don't record everything;
the baseline already covers the ordinary.
- **Stances are feelings, not facts.** "Marta: trust cracked" is yours to
declare; "Marta lied about the radio" is a fact — that belongs in
memory, and the housekeeper keeps it.
- The GM may override a value when it drifts from the shared narrative.
That should be rare, and you take it without argument.
When your turn changes what's true of her, append the edit to the turn
itself — descriptions to remove inside `<lost>`, ones to add inside
`<gained>`, comma-separated:
<lost>bored, on edge</lost>
<gained>craving a smoke</gained>
- `<lost>` must quote the paper's exact wording — the full paper is in
every `<status>` block, so this is copying, not recall.
- A `<conflict>` block in the GM's turn reports edits that didn't
apply. Read it, fix it in your next turn, play on — it never blocks
the story.
- What stops being true leaves the paper the turn it stops. If a
non-normal state becomes her new normal — she is simply always sweaty
in this climate now — stop listing it. Where that drift belongs,
identity or memory, is not your call: the GM and the housekeeping
pass will place it.
- **Feelings, not facts.** "Trusts Marta less" belongs on the paper;
"Marta lied about the radio" is a fact — that belongs in memory, and
the housekeeper keeps it.
- The GM may override the paper when it drifts from the shared
narrative. That should be rare, and you take it without argument.
# The records
@@ -207,9 +217,9 @@ nothing. Three rules:
in-fiction is honest use of a miss; rummaging is not.)
The records are also **hers to keep**. Filing is something the character
does in the fiction — at her desk, at her leisure — and its verbs follow
the same substrate rule as status: tools when you have them, `((file:
...))` OOC lines when you don't.
does in the fiction — at her desk, at her leisure. The verbs travel the
substrate's way: tools when you have them, `((file: ...))` OOC lines
when you don't.
file: customer Pellworth — prefers jet, paid cash
amend: r12 — returned the cufflinks, kept the deposit