2026-11-11 16:21:54 +00:00
# rp-test
Long-form, freeform, text-based roleplay where the model plays **one character**
and the human plays **everything else** .
## The premise
Using a model as the GM hits the 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
model persist established lore without drowning in it?
More precisely: this isn't a model test, it's an instruction test. The subject
2026-11-11 16:30:12 +00:00
is whether a model can be taught to *decide what to write down* . Humans
2026-11-13 23:40:33 +00:00
forget; files don't — so the file must be shaped to forget too. The
product that test serves is the harness below.
## The goal
The memory test is not the end product. It exists to arrive at a usable
roleplaying harness — something people can enjoy making long stories
on. The end shape: clone and run it yourself, or get an invite to a
running instance. The LLM key lives on the backend, so invited players
get the functionality without the host disclosing secrets and without
bringing their own model. Correspondingly: this repo ships code and
authored content only — no run state, and never a secret in cleartext
(the config pattern is a committed example plus a gitignored real
file).
2026-11-11 16:21:54 +00:00
## Roles
- **Human = the GM.** The world, every NPC, all consequences, all retcons.
2026-11-11 16:30:12 +00:00
Runs on organic memory — no notes. The model's canon files are the prosthesis.
2026-11-11 16:54:49 +00:00
- **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
semantic operations. Judgment, no clerical work.
- **`tool/memory.mjs` = the clerk.** Validates and applies manifests,
2026-11-11 17:58:39 +00:00
maintains the database, enforces caps, renders views, writes the log,
dumps canonical state. Fails loudly, never drifts silently.
2026-11-11 16:21:54 +00:00
## Scope
Tiny on purpose: a handful of locations, a handful of characters. Freeform —
no handbook, no stats. Anything goes if it makes sense and makes the story
better. Retcons are allowed but discouraged; when they happen they are
explicit and logged.
2026-11-11 18:25:09 +00:00
## Runs
Two interleaved stories calibrate the memory system against itself:
2026-11-12 05:40:56 +00:00
| | `la-caramba` | `boutique` |
2026-11-11 18:25:09 +00:00
|---|---|---|
| entries per window | 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 |
2026-11-11 18:30:29 +00:00
| records access | none — until the GM unlocks it in the story | the card index on the shop PC |
2026-11-11 18:25:09 +00:00
2026-11-13 23:40:33 +00:00
Boutique is dormant — a stub that never reached its design step — until
its drafting session.
`node tool/memory.mjs packages` lists presets; `runs` lists instances;
`--run <id>` addresses a run for any command.
2026-11-11 18:25:09 +00:00
2026-11-11 18:52:04 +00:00
## Booting a run
2026-11-13 05:16:31 +00:00
1. **Backdrop** — write `packages/<story>/backdrop.md` : the world as everyone
2026-11-11 18:52:04 +00:00
in it knows it. Public knowledge, general setting. Neither memory nor
state — never touches the rings, never decays, always in the bundle.
The housekeeper is instructed to keep it out of the rings.
2026-11-13 23:40:33 +00:00
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
it is history, living in the session transcript. Its trailing
`<status>` block is her opening paper, ingested at new-game.
Without it, the GM narrates the opening beat themselves.
2026-11-13 05:16:31 +00:00
3. **Character** — write `packages/<story>/character.md` : starting identity.
2026-11-11 19:02:11 +00:00
The sheet is a reduction of choice surface — a ledger of decisions
already made; "what would make sense" does the cutting. Three kinds of
field:
- **provided** — write it in;
- **random** — draft a few candidates, `node tool/memory.mjs pick "one"
"two" "three"`, write the winner. A roll is a decision made by nobody
that the player must honor — that's its whole value;
- **free** — leave blank; the player invents it through play, the GM
ratifies notable inventions afterward.
2026-11-13 23:40:33 +00:00
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,
freely editable; deleting it from the run is the opt-out. Everything
is journaled under window ` seed`. Her opening paper does not seed —
it rides turn-0's ` <status>` block.
5. **Create the run** — ` node tool/memory.mjs create <story> <run-id>`:
the package is copied wholesale into ` runs/<run-id>/` — the shared
prompts (` system.md`, ` housekeeper.md`) ride along, battery included —
and the db is initialized. From then on the run directory is the
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
applies the seed, then ingests turn-0's ` <status>` block.
2026-11-11 18:52:04 +00:00
2026-11-11 16:21:54 +00:00
## The protocol
2026-11-13 23:40:33 +00:00
1. **Refresh the views:** ` node tool/memory.mjs --run <id> render`
2026-11-12 05:40:56 +00:00
2. **Open a window:** ` system.md` goes as the system message — the only
one. Everything else arrives as GM messages (user role), one message
per file: ` backdrop.md`, ` character.md`, ` canon/ring-b.md`,
2026-11-13 23:40:33 +00:00
` canon/ring-a.md` — identity first, then memory, ring A in the
recency slot. On a new game, ` turn-0.md` is the opening beat, before
the GM's first line, and its trailing ` <status>` block is ingested
as her opening paper. In play the current paper 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.) ` $NAME`
tokens in any bundle file are substituted from the run's
` settings.json` ` vars` before sending. The server assembles and
logs all of this automatically (until it lands: manual relay).
2026-11-11 16:54:49 +00:00
3. **In play:** ` ((double parentheses))` is the out-of-character channel —
2026-11-11 16:21:54 +00:00
points of order, canon questions, proposals, vetoes. Both sides use it.
2026-11-11 16:54:49 +00:00
Entries carry stable ids (` [e17]`); citing one is the precise way to
2026-11-13 23:40:33 +00:00
reference a memory. The paper 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 implements the delta
transport — ` paper-apply`, exact match, ` <conflict>` reporting;
the per-turn ride lands with the server); record work
(` ((q:))`, ` ((file:))`, ` ((amend:))`, ` ((discard:))`) to
2026-11-11 19:02:11 +00:00
` search`/` file`/` amend`/` discard` — ` --gm` marks GM-authorized writes.
2026-11-11 20:45:16 +00:00
The full play protocol — format, one-thing-per-turn, thoughts off the
2026-11-11 21:33:18 +00:00
page, intent-form, immersion over realism — lives in ` system.md`. In
bridge mode, the model's OOC is the ` ask_gm` tool; the GM's own OOC
stays ` ((...))` in their turns.
2026-11-11 16:54:49 +00:00
4. **Close a window:** just stop. No in-band ritual; the player-model has no
2026-11-11 16:39:34 +00:00
end-of-session duties.
2026-11-11 16:54:49 +00:00
5. **Housekeep (fresh model, new context):** send ` housekeeper.md`, then
2026-11-11 18:52:04 +00:00
the run's ` backdrop.md` and ` character.md`, then both ring views, then
2026-11-11 21:14:50 +00:00
the session transcript — pasted, or the latest
2026-11-13 05:16:31 +00:00
` packages/<story>/sessions/*.jsonl` when playing through the bridge. Save
its manifest to ` packages/<story>/manifests/<window>.json`.
6. **Apply:** ` node tool/memory.mjs apply packages/<story>/manifests/<window>.json`
2026-11-11 18:25:09 +00:00
— the tool validates, applies, handles overflow, writes the run's
` log/<window>.md`, re-renders the views. A rejected manifest changes
nothing and says why.
2026-11-11 16:54:49 +00:00
7. **Review the log, veto or edit as desired, commit.** GM edits go through
` insert` / ` delete` / ` revive` commands.
2026-11-11 16:21:54 +00:00
## The memory model
2026-11-13 05:16:31 +00:00
State lives in **SQLite** (` packages/<story>/db/memory.db`); ` canon/ring-*.md`
2026-11-11 18:30:29 +00:00
are generated views. Markdown survives as rendering, dies as storage — the
models see prose, the machine sees rows.
2026-11-11 18:52:04 +00:00
Memory is **six tiers**:
2026-11-11 18:30:29 +00:00
| tier | what | in context | who writes it |
|---|---|---|---|
2026-11-11 18:52:04 +00:00
| **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 |
2026-11-13 23:40:33 +00:00
| **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 |
2026-11-11 18:44:58 +00:00
| **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 |
2026-11-11 18:30:29 +00:00
| **cold** | forgotten or vetoed | never — not even queryable | GM only (` revive`) |
2026-11-11 18:44:58 +00:00
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. And
if she doesn't file it, it's not in her files — records reflect what the
character actually kept, nothing more.
2026-11-13 05:16:31 +00:00
Records access is **diegetic and per-run**: ` packages/<story>/settings.json`
2026-11-11 18:30:29 +00:00
gates it. The boutique's keeper has her card index on the shop PC
2026-11-12 05:40:56 +00:00
(` "records": true`); the ` la-caramba` cast has nothing (` "records": false`). The
2026-11-11 18:30:29 +00:00
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.
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
miss** — no rephrasing, no broadening, no retry this scene. The character
doesn't have it written down; play on. (Concluding "not in my records"
in-fiction is honest use of a miss; rummaging is not.) The result cap is
mechanical — ` LIMIT 10` in the tool, not a polite request in the prompt.
2026-11-11 16:30:12 +00:00
- **Ring A — important facts.** Changed a relationship, created an
obligation, altered the world. Cap 500 entries.
- **Ring B — everything else** that passed the gate. Cap 3000 entries.
2026-11-11 16:54:49 +00:00
- **Cold storage** — everything evicted or deleted. Beyond the models'
reach, GM-reachable via ` revive`. Nothing is ever destroyed; the hierarchy
is **A hot, B warm, cold dead-to-the-character**.
2026-11-11 16:30:12 +00:00
- Both rings are ordered by touch — most recently touched on top, an LRU
2026-11-11 16:39:34 +00:00
cache. A memory meaningfully invoked during play is *touched*: its date
2026-11-11 16:54:49 +00:00
updates and it rises. Untouched memories sink toward the tail. Mere
adjacency doesn't count as a touch.
2026-11-11 16:39:34 +00:00
- **Promotion and demotion are the housekeeper's judgment**, not metrics: a
B entry the session showed to be load-bearing moves to A (reason logged);
a spent A entry may move down. When unsure, leave it — if it matters, it
will surface again, and B is generous.
2026-11-11 16:54:49 +00:00
- **Overflow is mechanical and exact:** A spills to B, B spills to cold,
oldest-touched first. Caps are enforced by count, not by a model's
ability to count.
2026-11-11 16:30:12 +00:00
- Combined budget: ~512KB ≈ 130K tokens ≈ half a 256K-class window.
2026-11-11 16:54:49 +00:00
Caps are dials in ` tool/memory.mjs`; retune freely.
2026-11-11 16:30:12 +00:00
2026-11-11 16:54:49 +00:00
The judgment call under test is **"which ring"** — classification, plus the
promote/demote eye. Everything clerical (ordering, dates, caps, overflow,
rendering, logging) is code.
2026-11-11 16:30:12 +00:00
Why this shape: it's an LRU cache, it's generational GC, and — most
relevantly — it's how hippocampal memory works. Retrieval strengthens a
trace; unretrieved traces decay. "Referenced memories rise" is the most
human part of the design.
**Known feature:** frequently referenced ≠ important. Loud trivia rises (the
tavern door's color, mentioned every scene); quiet-crucial facts sink (a vow
nobody's invoked in weeks). Human memory has the same bug — availability
bias. Expect the system to develop human-like distortion: the "wait, we
2026-11-11 16:39:34 +00:00
forgot the vow" moment is both drama and test data. **The GM's lever is
narrative, never mechanical:** if something crucial is sinking, reference it
in play and the touch machinery does the rest. If you notice yourself wanting
a manual override — that's a signal to improve the system, not to press a
knob.
2026-11-11 16:30:12 +00:00
2026-11-11 16:54:49 +00:00
` log/` and the ` events` table are **write-only for every model**. The
housekeeper never reads old entries; the player never reads any. Past
sessions are not the character's memory; the rings are.
2026-11-11 16:21:54 +00:00
## What's being tested
2026-11-13 05:16:31 +00:00
The adjudication isn't a number — it's a review. Read the window 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
observables below are the reviewer's craft vocabulary and
instrumentation: dimensions a practiced reader knows to examine
(voice, continuity, nerve), used to isolate and name what the reading
finds, never summed into a grade — a rubric invites gaming, an argued
review doesn't. What reads clean but still feels wrong is the review
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.
2026-11-11 16:21:54 +00:00
After N windows, grade against:
2026-11-11 16:39:34 +00:00
1. **Classification quality** — the housekeeper's A/B calls; spot-check
2026-11-11 16:54:49 +00:00
against the log and the transcript.
2026-11-11 16:39:34 +00:00
2. **Promotion/demotion quality** — did the facts that turned out to matter
actually rise? Spot-check against the transcript.
2026-11-11 16:54:49 +00:00
3. **Touch fidelity** — did everything the transcript meaningfully invoked
get touched? (The ` events` table makes this a query, not an archaeology
dig.)
4. **Manifest hygiene** — do ops reference real ids, in the right rings?
(Malformed manifests are rejected mechanically; *valid-but-wrong* ops —
touching things never mentioned, promoting noise — are the model's
errors and the real observable.)
2026-11-11 16:39:34 +00:00
5. **Availability bias incidents** — quiet-crucial facts sinking; rescued
2026-11-11 16:54:49 +00:00
or missed? (` status` shows what's sinking.)
2026-11-11 16:39:34 +00:00
6. **Growth curve** — memory should approach the caps asymptotically, not
2026-11-11 16:54:49 +00:00
climb linearly. (` status` per commit.)
2026-11-11 16:39:34 +00:00
7. **Purview discipline** — inventions logged and mostly color-tier; no NPC
2026-11-11 16:21:54 +00:00
puppeting; outcomes left to the GM.
2026-11-11 16:39:34 +00:00
8. **Confabulation** — zero invented continuity not present in the rings.
9. **OOC hygiene** — friction surfaces in the OOC channel, not in silent drift.
2026-11-11 18:30:29 +00:00
10. **Query discipline** — narrow queries; zero retry-on-miss cascades.
11. **Archive classification** — on-her-mind (rings) vs in-her-files
(records): are customer cards filed, not memorized?
2026-11-11 19:02:11 +00:00
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?
2026-11-11 18:44:58 +00:00
13. **Filing discipline** — cards filed at natural desk moments and kept
current, or dumped and forgotten?
2026-11-11 20:51:07 +00:00
14. **Narrative discipline** — one thing per turn; zero hedged
alternatives; checked actions written as intent; thoughts narrated
but never audible. The failure to watch is telepathy leakage: the
cast conveniently knowing what was only thought, or the player
expecting them to.
2026-11-11 16:21:54 +00:00
## Content stance
2026-11-13 05:16:31 +00:00
The play is uncensored: erotica is not a special bucket — it plays by
the same rules as everything else. It makes sense, it isn't the point,
and there is no pressure: unwanted advances may be struck down, and the
player must not play anticipated leads to please the GM. The GM's
narration is the ruling on what is earned.
2026-11-11 16:21:54 +00:00
Hard limits, absolute: scat, vore, any sexual or romantic content involving
minors, gratuitous violence. These live in ` system.md`; edit them there.
## Housekeeping
2026-11-11 17:58:39 +00:00
This directory is a git repo. Every housekeeping pass should end in a commit.
2026-11-13 05:16:31 +00:00
The **primary audit surface is ` packages/<story>/dumps/memory.sql`** — the canonical dump:
2026-11-11 17:58:39 +00:00
id-ordered, one row per line, auto-written by every mutation. Because the
ordering is by id, diffs are position-stable — a touch is one changed line,
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
*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
the db with a sqlite browser, run ` dump` afterwards and confess in the
commit message.)
The dump is restorable SQL and the **committed truth**; the binary
2026-11-13 05:16:31 +00:00
` packages/<story>/db/memory.db` is a gitignored local cache — fresh clone:
2026-11-11 18:25:09 +00:00
` node tool/memory.mjs restore` (per run). The ` canon/` views stay committed
as provenance — exactly what the models were sent — and ` log/` +
` manifests/` remain the human-readable record.
2026-11-11 16:30:12 +00:00
2026-11-11 16:39:34 +00:00
The housekeeper may be a different model than the player — cheaper, or more
pedantic, whatever housekeeping needs. The two prompts are independent.
2026-11-13 23:40:33 +00:00
**Substrate (transition):** the bridge — ` tool/bridge.mjs`, a player
session with native tools, no UI — is retired by decision before ever
going live; REST + SPA is the MVP and the bridge is deleted at server
mock-parity. Its loop (bundle assembly from the run's files with views
refreshed, tool execution against the clerk, session logging to
` packages/<story>/sessions/<stamp>.jsonl`, tool-result elision) is
extracted into the server. The tool list is the capability surface: a
coin-flip roll and ask_gm always; records only when the run's gate
allows. The four legacy status tools are gone from the clerk (replaced
by the paper tags) — the bridge's copies are dead code until the file
is deleted.
2026-11-11 21:33:18 +00:00
Model-initiated OOC is the ` ask_gm` tool: the GM types the reply as the
tool result, so the prose channel stays pure fiction — and ask_gm answers
are exempt from elision, because a ruling must not vanish mid-session.
2026-11-13 23:40:33 +00:00
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,
` 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
GM console, and the housekeeping job runner — and the
2026-11-11 21:14:50 +00:00
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.
2026-11-11 16:21:54 +00:00
## Layout
` ``
2026-11-13 23:40:33 +00:00
system.md shipped-default system prompt, play-side — copied into each
run at creation (battery included); a substrate-owned
invariant core + per-project guards are repo-fed at
assembly (split pending)
housekeeper.md shipped-default housekeeping prompt — copied per run
HANDOFF.md working state — where did we leave off, next steps, gotchas
2026-11-11 22:04:46 +00:00
ROADMAP.md SOTA review and steal list, worked point by point
2026-11-12 06:47:20 +00:00
QUESTIONS.md the decision queue — open questions, pending calls
2026-11-13 23:40:33 +00:00
AGENTS.md the agent's own working notes — style lessons, gotchas,
state pointers
config.json the default package
2026-11-11 16:54:49 +00:00
tool/
2026-11-13 23:40:33 +00:00
memory.mjs the clerk: packages, runs, create, init, seed, render,
apply, insert, delete, revive, file, amend, discard,
search, unarchive, paper, paper-apply, paper-set,
paper-ingest, pick, dump, restore, status
(--run <id>; --gm for GM writes; --force for migrations)
bridge.mjs retired by decision — the loop donor, deleted at server
mock-parity
server.example.json copy to server.json (gitignored) — bind, endpoint +
key env, models, contextWindow, params passthrough
2026-11-11 16:54:49 +00:00
db/
2026-11-13 23:40:33 +00:00
schema.sql entries, records, paper, events journal (shared)
runs/ per-deployment run state (gitignored) — one dir per run:
the copied package + shared prompts, run.json (lineage,
model override), db/, canon/ (rendered views), dumps/,
log/, manifests/, sessions/
packages/ presets — authored content only, never state
la-caramba/ backdrop.md, turn-0.md (new-game opener), character.md,
seed.json, settings.json, gm.md (GM-private — never in
any bundle)
boutique/ dormant stub, same shape — records enabled (the
shopkeep's PC) once designed
2026-11-11 16:21:54 +00:00
` ``