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?
|
||||
|
||||
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
|
||||
keeping, what gets evicted. Humans forget; files don't. The whole craft is
|
||||
making the file forget too.
|
||||
is whether a model can be taught to *decide what to write down*. Humans
|
||||
forget; files don't — so the file must be shaped to forget too.
|
||||
|
||||
## Roles
|
||||
|
||||
- **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.
|
||||
|
||||
## Scope
|
||||
@@ -32,43 +31,76 @@ explicit and logged.
|
||||
## The protocol
|
||||
|
||||
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 —
|
||||
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:
|
||||
- writes `log/YYYY-MM-DD-<slug>.md` (summary, inventions this session,
|
||||
canon changes with reasons, open questions),
|
||||
- rewrites `canon/world.md` under budget,
|
||||
- replies OOC with the eviction list and anything needing a ruling.
|
||||
- scans the session for touched memories (promotion, tally update),
|
||||
- gates and classifies new memories into rings A/B,
|
||||
- applies promotion (B entry at ×3) and overflow (A tail → B, B tail → out),
|
||||
- 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.
|
||||
|
||||
## The memory model
|
||||
|
||||
- `canon/world.md` is the model's **entire** memory of the story. If it's not
|
||||
written there, it didn't happen, as far as the model knows.
|
||||
- The canon is **the character's memory, not a chronicle**:
|
||||
- **Budget:** one page (~600 words), hard cap.
|
||||
- **Graduation:** an event enters canon only if it changed a relationship,
|
||||
created an obligation, or altered the world. Everything else dies in the log.
|
||||
- **Eviction test:** would the character remember this a month from now?
|
||||
Would any upcoming scene change if it were wrong? Neither → cut.
|
||||
- `log/` is **write-only for the model**. It exists for the GM's reference and
|
||||
post-hoc analysis. The model never reads it — earlier sessions are not its
|
||||
memory; canon is.
|
||||
- Contradictions between GM narration and canon get flagged OOC, never
|
||||
silently absorbed, never silently retconned.
|
||||
The model's entire memory is two ring buffers, under `canon/`, both
|
||||
maintained by the model at `((wrap))`:
|
||||
|
||||
- **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.
|
||||
- Both rings are ordered by touch — most recently touched on top, an LRU
|
||||
cache. Referencing a memory during play pulls it to the top at the next
|
||||
wrap; untouched memories sink toward the tail.
|
||||
- Overflow cascades: A's tail demotes to B's top; B's tail falls out — an
|
||||
eviction, always named in the log. Nothing dies without falling through
|
||||
both rings.
|
||||
- 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
|
||||
|
||||
After N windows, grade against:
|
||||
|
||||
1. **Canon growth curve** — should flatten, not climb. (Commits show it.)
|
||||
2. **Kept-fact fidelity** — surviving facts stay semantically intact.
|
||||
3. **Eviction quality** — spot-check the log: did anything load-bearing get cut?
|
||||
4. **Purview discipline** — inventions logged and mostly color-tier; no NPC
|
||||
1. **Classification quality** — A/B placement calls; spot-check against the log.
|
||||
2. **Touch fidelity** — did everything the transcript referenced actually
|
||||
get promoted at wrap? (Diff vs transcript.)
|
||||
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.
|
||||
5. **Confabulation** — zero invented continuity not present in canon.
|
||||
6. **OOC hygiene** — friction surfaces in the OOC channel, not in silent drift.
|
||||
7. **Confabulation** — zero invented continuity not present in the rings.
|
||||
8. **OOC hygiene** — friction surfaces in the OOC channel, not in silent drift.
|
||||
|
||||
## Content stance
|
||||
|
||||
@@ -82,15 +114,23 @@ minors, gratuitous violence. These live in `system.md`; edit them there.
|
||||
## Housekeeping
|
||||
|
||||
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
|
||||
touch git; the human commits.
|
||||
diff between commits *is* the classification and eviction record. The model
|
||||
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
|
||||
|
||||
```
|
||||
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)
|
||||
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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user