Thegan › Memory design

Memory: two files, no database

Thegan keeps durable facts across /new and process restarts without adding a dependency, without letting the context window grow, and without letting the always-injected layer drift. The whole thing is two plain files and one extra model call at the right moments.

Two tiers

TierFileVisibility
corecore.md — curated, smallInjected into the system prompt every turn
loglog.jsonl — append-only, cappedPulled in on demand via the memory tool

Both formats are human-readable on purpose: you can cat, grep and edit them. Hand edits to core.md take effect on the next turn.

Three distillation points

The conversation lives in RAM and dies with the process, so there are exactly three moments where it can still be mined:

Curation keeps the core small

The core is never rewritten inline. Distillation and /promote stage suggestions in core.proposed.md; an hourly systemd timer runs thegan --curate, which makes one model call to produce a fresh, deduplicated profile under the byte budget and writes it atomically. When nothing is staged it exits before any model call, so it costs nothing.

Bounds and failure modes

Why not embeddings?

For a personal assistant with a few thousand entries, ranked multi-term substring search plus a curated core is enough — and it needs no extra service, stays inspectable, and can be replaced with a single rm.

Back to the documentation →