bridge: thin player session with native tools, session logging, result elision, mock-tested

This commit is contained in:
2026-11-11 21:14:50 +00:00
parent a099dfb297
commit 1a4dcf9a2e
7 changed files with 319 additions and 15 deletions
+24 -12
View File
@@ -98,8 +98,9 @@ Two interleaved stories calibrate the memory system against itself:
end-of-session duties.
5. **Housekeep (fresh model, new context):** send `housekeeper.md`, then
the run's `backdrop.md` and `character.md`, then both ring views, then
the session transcript. Save its manifest to
`runs/<story>/manifests/<window>.json`.
the session transcript — pasted, or the latest
`runs/<story>/sessions/*.jsonl` when playing through the bridge. Save
its manifest to `runs/<story>/manifests/<window>.json`.
6. **Apply:** `node tool/memory.mjs apply runs/<story>/manifests/<window>.json`
— the tool validates, applies, handles overflow, writes the run's
`log/<window>.md`, re-renders the views. A rejected manifest changes
@@ -260,15 +261,22 @@ as provenance — exactly what the models were sent — and `log/` +
The housekeeper may be a different model than the player — cheaper, or more
pedantic, whatever housekeeping needs. The two prompts are independent.
**Substrate note:** the future SPA is a UI and a session runner wrapped
around exactly these moving parts — the DB, the manifest, `apply`, `render`.
Nothing gets redesigned; the SPA just stops the copy-pasting. Player writes
become native tool calls (her PC *is* the UI). Query results get elided
from history — stubbed as `[consulted the files: r1, r4 — sapphire buyers]`
— so context stays clean while the housekeeping transcript keeps the
attention signal. If player-side status maintenance proves too costly for
the player-model's attention, the fallback is a dedicated status-keeper
agent reading transcripts — same pattern as the housekeeper, smaller job.
**Substrate:** `tool/bridge.mjs` is the thin bridge — a player session with
native tools, no UI. It assembles the bundle from the run's files (views
refreshed), offers the player tools (status always; records only when the
run's gate allows — the tool list is the capability surface), executes
model tool calls against the clerk, logs the full exchange to
`runs/<story>/sessions/<stamp>.jsonl` (the housekeeping transcript), and
elides old tool results to stubs in the live context (use-and-discard).
Config: copy `bridge.example.json` to `bridge.json` — any OpenAI-compatible
endpoint, key via the env var it names. `--mock` runs a scripted fake model
that proves the loop without a key. The SPA is the bridge plus a
fiction-first UI, a GM console, and the housekeeping job runner — and the
tool-calling part is the smallest component, because the provider does the
structured emission and the clerk already speaks function-shaped. If
player-side status maintenance proves too costly for the player-model's
attention, the fallback is a dedicated status-keeper agent reading
transcripts — same pattern as the housekeeper, smaller job.
## Layout
@@ -281,11 +289,15 @@ tool/
revive, file, amend, discard, search, unarchive, set, norm,
clear, unset, pick, dump, restore, status
(--run <name>; --gm for GM writes; --force for migrations)
bridge.mjs the thin bridge: player session with native tools, session
logging, tool-result elision; --mock for a scripted model
bridge.example.json copy to bridge.json (gitignored) — endpoint + model + key env
db/
schema.sql entries, records, status, events journal (shared)
runs/
prisoners/ one story: backdrop.md, character.md, seed.json, settings.json,
gm.md (GM-private — never in any bundle), db/, dumps/,
canon/ (status.md, ring-a.md, ring-b.md), log/, manifests/
canon/ (status.md, ring-a.md, ring-b.md), log/, manifests/,
sessions/ (bridge transcripts)
boutique/ same shape — records enabled (the shopkeep's PC)
```