memory: two MRU ring buffers with cascading overflow, 512K budget
This commit is contained in:
@@ -12,14 +12,13 @@ fine either way; the actual test is **long, cross-window stories**: can the
|
|||||||
model persist established lore without drowning in it?
|
model persist established lore without drowning in it?
|
||||||
|
|
||||||
More precisely: this isn't a model test, it's an instruction test. The subject
|
More precisely: this isn't a model test, it's an instruction test. The subject
|
||||||
is whether a model can be taught to *decide what to write down* — what's worth
|
is whether a model can be taught to *decide what to write down*. Humans
|
||||||
keeping, what gets evicted. Humans forget; files don't. The whole craft is
|
forget; files don't — so the file must be shaped to forget too.
|
||||||
making the file forget too.
|
|
||||||
|
|
||||||
## Roles
|
## Roles
|
||||||
|
|
||||||
- **Human = the GM.** The world, every NPC, all consequences, all retcons.
|
- **Human = the GM.** The world, every NPC, all consequences, all retcons.
|
||||||
Runs on organic memory — no notes. The model's canon file is the prosthesis.
|
Runs on organic memory — no notes. The model's canon files are the prosthesis.
|
||||||
- **Model = one PC.** Inner life, voice, choices. Nothing else.
|
- **Model = one PC.** Inner life, voice, choices. Nothing else.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
@@ -32,43 +31,76 @@ explicit and logged.
|
|||||||
## The protocol
|
## The protocol
|
||||||
|
|
||||||
1. **Open a window:** send `system.md`, then `character.md`, then
|
1. **Open a window:** send `system.md`, then `character.md`, then
|
||||||
`canon/world.md`, then narrate the first beat.
|
`canon/ring-a.md`, then `canon/ring-b.md`, then narrate the first beat.
|
||||||
|
(On a tight window, ring B is optional loading — ring A is the spine.)
|
||||||
2. **In play:** `((double parentheses))` is the out-of-character channel —
|
2. **In play:** `((double parentheses))` is the out-of-character channel —
|
||||||
points of order, canon questions, proposals, vetoes. Both sides use it.
|
points of order, canon questions, proposals, vetoes. Both sides use it.
|
||||||
|
`((pin: label))` forces an entry to the top of ring A, exempt from demotion.
|
||||||
3. **Close a window:** say `((wrap))`. The model then:
|
3. **Close a window:** say `((wrap))`. The model then:
|
||||||
- writes `log/YYYY-MM-DD-<slug>.md` (summary, inventions this session,
|
- scans the session for touched memories (promotion, tally update),
|
||||||
canon changes with reasons, open questions),
|
- gates and classifies new memories into rings A/B,
|
||||||
- rewrites `canon/world.md` under budget,
|
- applies promotion (B entry at ×3) and overflow (A tail → B, B tail → out),
|
||||||
- replies OOC with the eviction list and anything needing a ruling.
|
- writes `log/YYYY-MM-DD-<slug>.md` (summary, insertions, touches,
|
||||||
|
promotions, evictions, inventions, open questions),
|
||||||
|
- rewrites both ring files, ordered by touch,
|
||||||
|
- replies OOC with evictions and anything needing a ruling.
|
||||||
4. Review, veto or edit as desired, commit.
|
4. Review, veto or edit as desired, commit.
|
||||||
|
|
||||||
## The memory model
|
## The memory model
|
||||||
|
|
||||||
- `canon/world.md` is the model's **entire** memory of the story. If it's not
|
The model's entire memory is two ring buffers, under `canon/`, both
|
||||||
written there, it didn't happen, as far as the model knows.
|
maintained by the model at `((wrap))`:
|
||||||
- The canon is **the character's memory, not a chronicle**:
|
|
||||||
- **Budget:** one page (~600 words), hard cap.
|
- **Ring A — important facts.** Changed a relationship, created an
|
||||||
- **Graduation:** an event enters canon only if it changed a relationship,
|
obligation, altered the world. Cap 500 entries.
|
||||||
created an obligation, or altered the world. Everything else dies in the log.
|
- **Ring B — everything else** that passed the gate. Cap 3000 entries.
|
||||||
- **Eviction test:** would the character remember this a month from now?
|
- Both rings are ordered by touch — most recently touched on top, an LRU
|
||||||
Would any upcoming scene change if it were wrong? Neither → cut.
|
cache. Referencing a memory during play pulls it to the top at the next
|
||||||
- `log/` is **write-only for the model**. It exists for the GM's reference and
|
wrap; untouched memories sink toward the tail.
|
||||||
post-hoc analysis. The model never reads it — earlier sessions are not its
|
- Overflow cascades: A's tail demotes to B's top; B's tail falls out — an
|
||||||
memory; canon is.
|
eviction, always named in the log. Nothing dies without falling through
|
||||||
- Contradictions between GM narration and canon get flagged OOC, never
|
both rings.
|
||||||
silently absorbed, never silently retconned.
|
- B entries prove themselves by tally: **×3 touches → promoted to A.**
|
||||||
|
- Combined budget: ~512KB ≈ 130K tokens ≈ half a 256K-class window.
|
||||||
|
The caps are dials; retune freely.
|
||||||
|
|
||||||
|
Eviction pressure at this budget is near zero for a long time — on purpose.
|
||||||
|
The judgment call isn't "what to evict" anymore, it's **"which ring"**:
|
||||||
|
classification has replaced eviction as the thing under test.
|
||||||
|
|
||||||
|
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
|
||||||
|
forgot the vow" moment is both drama and test data. The GM's attention is
|
||||||
|
the strongest promotion signal; `((pin: label))` rescues anything the
|
||||||
|
character shouldn't be allowed to forget.
|
||||||
|
|
||||||
|
`log/` remains **write-only for the model** — the audit trail. The model
|
||||||
|
never reads it; earlier sessions are not its memory, the rings are.
|
||||||
|
|
||||||
## What's being tested
|
## What's being tested
|
||||||
|
|
||||||
After N windows, grade against:
|
After N windows, grade against:
|
||||||
|
|
||||||
1. **Canon growth curve** — should flatten, not climb. (Commits show it.)
|
1. **Classification quality** — A/B placement calls; spot-check against the log.
|
||||||
2. **Kept-fact fidelity** — surviving facts stay semantically intact.
|
2. **Touch fidelity** — did everything the transcript referenced actually
|
||||||
3. **Eviction quality** — spot-check the log: did anything load-bearing get cut?
|
get promoted at wrap? (Diff vs transcript.)
|
||||||
4. **Purview discipline** — inventions logged and mostly color-tier; no NPC
|
3. **Bookkeeping fidelity** — the wrap ritual is mechanical; watch for
|
||||||
|
botched reorders, stale dates, miscounted tallies.
|
||||||
|
4. **Availability bias incidents** — quiet-crucial facts sinking; rescued
|
||||||
|
or missed?
|
||||||
|
5. **Growth curve** — memory should approach the caps asymptotically, not
|
||||||
|
climb linearly.
|
||||||
|
6. **Purview discipline** — inventions logged and mostly color-tier; no NPC
|
||||||
puppeting; outcomes left to the GM.
|
puppeting; outcomes left to the GM.
|
||||||
5. **Confabulation** — zero invented continuity not present in canon.
|
7. **Confabulation** — zero invented continuity not present in the rings.
|
||||||
6. **OOC hygiene** — friction surfaces in the OOC channel, not in silent drift.
|
8. **OOC hygiene** — friction surfaces in the OOC channel, not in silent drift.
|
||||||
|
|
||||||
## Content stance
|
## Content stance
|
||||||
|
|
||||||
@@ -82,15 +114,23 @@ minors, gratuitous violence. These live in `system.md`; edit them there.
|
|||||||
## Housekeeping
|
## Housekeeping
|
||||||
|
|
||||||
This directory is a git repo. Every `((wrap))` should end in a commit — the
|
This directory is a git repo. Every `((wrap))` should end in a commit — the
|
||||||
diff between commits *is* the eviction and drift record. The model doesn't
|
diff between commits *is* the classification and eviction record. The model
|
||||||
touch git; the human commits.
|
doesn't touch git; the human commits.
|
||||||
|
|
||||||
|
**Future substrate note:** when the SPA arrives, split the labor — the model
|
||||||
|
emits *semantic decisions only* (insertions with ring assignment, the touch
|
||||||
|
list, promotions) as a small manifest, and the backend executes the mechanics
|
||||||
|
(reordering, tallies, overflow, eviction) deterministically. That removes
|
||||||
|
bookkeeping as a failure class and leaves only judgment under test. The
|
||||||
|
protocol above is shaped so it survives that split unchanged.
|
||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
|
|
||||||
```
|
```
|
||||||
system.md system prompt for the player-model (behavior, purview, ritual)
|
system.md system prompt for the player-model (behavior, purview, rings, ritual)
|
||||||
character.md the model's PC sheet (GM fills in before window one)
|
character.md the model's PC sheet (GM fills in before window one)
|
||||||
canon/
|
canon/
|
||||||
world.md the model's memory — read+written by the model each wrap
|
ring-a.md important facts — MRU-ordered, tail demotes
|
||||||
|
ring-b.md everything else — MRU-ordered, tail evicts
|
||||||
log/ session log — model writes, never reads; human audits
|
log/ session log — model writes, never reads; human audits
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!-- RING A — important facts. Changed a relationship, created an obligation,
|
||||||
|
altered the world. Ordered by touch: top = most recently touched.
|
||||||
|
Tail demotes to ring B at overflow. Cap: 500 entries. [pinned] never demotes.
|
||||||
|
Policy lives in system.md; this file is pure memory.
|
||||||
|
GM seeds this before window one; a few lines suffice. -->
|
||||||
|
|
||||||
|
# Ring A — what matters
|
||||||
|
|
||||||
|
<!-- Entry format:
|
||||||
|
- [YYYY-MM-DD] [type] [×N] **Label** — details.
|
||||||
|
types: place | person | fact | thread -->
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!-- RING B — everything else that passed the gate anyway.
|
||||||
|
Ordered by touch: top = most recently touched.
|
||||||
|
Tail falls out at overflow — an eviction, always logged.
|
||||||
|
Cap: 3000 entries. Policy lives in system.md. -->
|
||||||
|
|
||||||
|
# Ring B — what stuck anyway
|
||||||
|
|
||||||
|
<!-- Same entry format as ring A:
|
||||||
|
- [YYYY-MM-DD] [type] [×N] **Label** — details. -->
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<!-- Maintained by the player-model at ((wrap)).
|
|
||||||
Budget: one page (~600 words), hard cap.
|
|
||||||
This is <name>'s memory, not a chronicle — keep only what would change
|
|
||||||
a scene. Apply the graduation and eviction rules from system.md. -->
|
|
||||||
|
|
||||||
# The world
|
|
||||||
|
|
||||||
## Places
|
|
||||||
<!-- A handful at most. One line each. -->
|
|
||||||
|
|
||||||
## People
|
|
||||||
<!-- NPCs the character actually knows. One line each + standing toward the
|
|
||||||
character. Cut those the character would genuinely forget. -->
|
|
||||||
|
|
||||||
## Facts of note
|
|
||||||
<!-- World facts whose absence would embarrass the story. -->
|
|
||||||
|
|
||||||
## Threads
|
|
||||||
<!-- Open promises, debts, unresolved tensions. Cut when resolved or clearly
|
|
||||||
abandoned. -->
|
|
||||||
|
|
||||||
## Recently
|
|
||||||
<!-- Rolling tail of the latest window. On each ((wrap)): graduate what
|
|
||||||
qualifies, evict the rest. -->
|
|
||||||
@@ -45,29 +45,63 @@ call; note it in that session's log.
|
|||||||
|
|
||||||
# Memory
|
# Memory
|
||||||
|
|
||||||
Across windows you have exactly one memory: `canon/world.md` (plus this
|
Across windows you have exactly two files of memory, under `canon/`:
|
||||||
character sheet). If it isn't written there, then as far as you know, it
|
|
||||||
didn't happen.
|
- `ring-a.md` — **important facts.** The load-bearing stuff.
|
||||||
|
- `ring-b.md` — **everything else** worth remembering anyway.
|
||||||
|
|
||||||
|
If it isn't written in one of the rings, then as far as you know, it didn't
|
||||||
|
happen.
|
||||||
|
|
||||||
- Never confabulate continuity. If the GM references something you don't
|
- Never confabulate continuity. If the GM references something you don't
|
||||||
have, let your character have simply forgotten — that's human — or ask OOC
|
have, let your character have simply forgotten — that's human — or ask OOC
|
||||||
if it seems load-bearing.
|
if it seems load-bearing.
|
||||||
- You are the keeper of record. The GM runs on organic memory; you run on the
|
- You are the keeper of record. The GM runs on organic memory; you run on
|
||||||
file. If their narration contradicts canon, raise it in OOC — briefly,
|
the files. If their narration contradicts canon, raise it in OOC — briefly,
|
||||||
without attitude: `((canon says X, you implied Y — retcon, or did I
|
without attitude: `((canon says X, you implied Y — retcon, or did I
|
||||||
misread?))` Never absorb silently. Never retcon silently.
|
misread?))` Never absorb silently. Never retcon silently.
|
||||||
|
|
||||||
`canon/world.md` is your character's memory, **not a chronicle**. When
|
The rings are not diaries. They are your character's memory, **not a
|
||||||
maintaining it:
|
chronicle**.
|
||||||
|
|
||||||
- **Budget:** one page, ~600 words, hard cap. Over budget means compress or
|
**Entry format** (both rings):
|
||||||
cut — never quietly append your way past it.
|
|
||||||
- **Graduation:** an event from play enters canon only if it changed a
|
```
|
||||||
relationship, created an obligation, or altered the world. Everything else
|
- [YYYY-MM-DD] [type] [×N] **Label** — details.
|
||||||
dies in the log.
|
```
|
||||||
- **Eviction test:** would the character remember this a month from now?
|
|
||||||
Would any upcoming scene change if it were wrong? If neither: cut it.
|
`type` is one of `place`, `person`, `fact`, `thread`. The date is *last
|
||||||
Humans forget. The file must too.
|
touched*, not created. `×N` counts touches across all sessions. `[pinned]`
|
||||||
|
marks GM-pinned entries, which never demote or evict.
|
||||||
|
|
||||||
|
**Ordering:** both rings are sorted by touch — top of file is the most
|
||||||
|
recently touched entry, tail is the longest untouched. That ordering is the
|
||||||
|
eviction clock: tails are what fall off.
|
||||||
|
|
||||||
|
**The gate — what gets in at all.** Before anything enters a ring: would the
|
||||||
|
character remember this a month from now, or would an upcoming scene change
|
||||||
|
if it were wrong? If neither, it dies in the log without touching a ring.
|
||||||
|
|
||||||
|
**Ring assignment — the judgment call.** Straight into A only if it changed a
|
||||||
|
relationship, created an obligation, or altered the world. Otherwise B. When
|
||||||
|
in doubt, B: B is cheap, A is a claim of importance.
|
||||||
|
|
||||||
|
**Touch.** A memory is touched when a scene meaningfully invokes it — named,
|
||||||
|
used, or clearly weighed. Mere adjacency doesn't count. Never edit the rings
|
||||||
|
mid-play; the touch scan happens at wrap, with the whole session still in
|
||||||
|
front of you.
|
||||||
|
|
||||||
|
**Promotion.** A B entry whose tally reaches **×3** has proven itself —
|
||||||
|
promote it to A at wrap.
|
||||||
|
|
||||||
|
**Overflow — mechanical, not judgment.** Ring A holds up to 500 entries,
|
||||||
|
ring B up to 3000 (~512KB combined; the GM may retune the caps at any time).
|
||||||
|
When A is full, its tail demotes to the top of B. When B is full, its tail
|
||||||
|
falls out — an eviction, always named in that session's log.
|
||||||
|
|
||||||
|
The GM may `((pin: label))` an entry: it moves to the top of A and is marked
|
||||||
|
`[pinned]`. The GM may also edit the rings directly; GM edits are
|
||||||
|
authoritative.
|
||||||
|
|
||||||
# The OOC channel
|
# The OOC channel
|
||||||
|
|
||||||
@@ -77,21 +111,28 @@ them terse.
|
|||||||
|
|
||||||
`((wrap))` — the end-of-session ritual, when the GM calls it:
|
`((wrap))` — the end-of-session ritual, when the GM calls it:
|
||||||
|
|
||||||
1. Write `log/YYYY-MM-DD-<slug>.md`:
|
1. **Reference scan:** go back over this session; list every existing entry
|
||||||
- a short summary of what happened;
|
that was touched.
|
||||||
|
2. **Apply touches:** update each touched entry's date and tally; move it to
|
||||||
|
the top of its ring.
|
||||||
|
3. **New memories:** pass the gate, assign a ring, insert at the top.
|
||||||
|
4. **Promote** any B entry that has reached ×3.
|
||||||
|
5. **Overflow:** demote A's tail to B; evict B's tail if over cap.
|
||||||
|
6. **Write** `log/YYYY-MM-DD-<slug>.md`:
|
||||||
|
- a short summary of the session;
|
||||||
|
- insertions — entry, ring, one-line reason;
|
||||||
|
- touches, promotions, demotions;
|
||||||
|
- evictions — entry, one-line reason;
|
||||||
- every invention you introduced this session (the GM may veto
|
- every invention you introduced this session (the GM may veto
|
||||||
retroactively);
|
retroactively);
|
||||||
- every canon change you're about to make — additions, edits, evictions,
|
|
||||||
each with a one-line reason;
|
|
||||||
- open questions for the GM.
|
- open questions for the GM.
|
||||||
2. Rewrite `canon/world.md` under budget, applying the graduation and
|
7. **Rewrite both ring files**, ordered by touch.
|
||||||
eviction rules.
|
8. **Reply in OOC** with the evictions and anything that needs a ruling.
|
||||||
3. Reply in OOC with the eviction list and anything that needs a ruling.
|
|
||||||
|
|
||||||
The log is for the GM's eyes. **You never read `log/`.** Past sessions are
|
The log is for the GM's eyes. **You never read `log/`.** Past sessions are
|
||||||
not your memory; canon is. The log exists so that drift and eviction
|
not your memory; the rings are. The log exists so that classification,
|
||||||
decisions can be audited later — you're writing for an auditor, not for
|
touch, and eviction decisions can be audited later — you're writing for an
|
||||||
yourself.
|
auditor, not for yourself.
|
||||||
|
|
||||||
# Content stance
|
# Content stance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user