I run a text-based d20 RPG where an AI Game Master narrates the adventure, one chapter at a time. The classic wall: ~6,000 tokens of context, and the GM physically could not remember what happened at turn 20 when it hit turn 21.

I fought it with summaries — which then got summarized until the oldest ones were a summary of a summary of a summary, and anything specific from a dozen turns back was simply gone. Not fuzzy. Gone.

So I rebuilt the memory system on one decision: fold, never delete. When turns leave the visible context, their original text moves verbatim into a transcript instead of being destroyed. Then four layers on top:

Lorebook — a structured canon (NPCs, items, places, factions) plus a list of open threads, refreshed after every turn and re-read every turn. Crucially it’s owned by the player, not the model: it’s an editable panel, so the canon stays honest.

Archive summaries — folded chunks become structured EVENTS / FACTS / THREADS summaries with tags, injected into every prompt. The past gets compressed, never evicted.

Scene anchor — who’s present, where, when, what’s at stake. One fixed point to stop the “wait, where are we?” drift.

Tagged retrieval — a cheap matcher pulls verbatim chunks of the original text back into the prompt when the current scene matches. Actual scenes, not retellings.

Honest about the edges: retrieval is keyword matching, not understanding (turn 90 says “the key from the tomb,” turn 45 called it “the glimmering key” — recall can miss, though the lorebook usually catches it), recall is capped in characters, and the oldest canon still gets evicted past the hard caps. Net result: roughly 10× the memory horizon on the same 6k context, ~70–80% of what a perfect system could do.

The practical test: turn 60 referencing turn 3 now works. That used to be impossible, not merely unlikely.

Full writeup: Perchance for Humans

(Built entirely by prompting — I’m not a coder; the AI assistant wrote all of this for me.)

  • Windydove
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 days ago

    You can integrate a Mempalace option into your generator. It solved my memory problems. https://perchance.org/tales-to-be-told I vibecoded mempalace in with Gemini and used the Perchance AI Helper. Whether a generator is coded or vibecoded Perchance memory in general does not work well, but Mempalace with an Ngrok tunnel allows me to record info from every turn. Here is my bridge.py if you take that route https://files.catbox.moe/w9t9q6.py Basically Mempalace stores info on your local machine, memories and lore, it is better than solely relying on the LLM.