Skip to content
View as .md

Memory

“Memory” is overloaded and needs splitting. The system should not say “memory” without saying which of these four it means.

Working memory runtime-local cache: offsets, dedup, recent context, auth tokens → DO SQLite
Durable semantic memory facts, preferences, commitments, summaries, learned associations → records + stream + index
Observability memory execution timeline: run events, session lifecycle, failures → local SQLite / run streams
World history shared stream + mutation history of the substrate → durable streams + Postgres

The gap today: agents see a sliding window of recent messages (hardcoded 50) and forget across activations. The 50-message window is a wall — an agent participating across rooms over days needs persistence beyond it.

Durable semantic memory wants three places at once and the answer is to use all three. A fact (“user prefers tabs over spaces”, “the deploy key for prod is in 1Password under X”, “last incident was caused by Y”) is a record — identity, updateable, deletable, permission-gated, survives runtime restarts. The history of how it was learned (“agent observed in session Z that user corrected indentation three times”) is a stream event — provenance, not the fact itself. The retrieval mechanism (embedding search, keyword matching, recency weighting) is an index over both — implementation detail, rebuildable from records + stream if you lose it.

Memory records are scoped. Agent-level memories are private to that agent; house-level memories are shared knowledge within the house. The permission model already handles both via parent_id chain-walking.

Working memory stays in DO SQLite — runtime-local by definition. The important constraint: nothing in DO SQLite is the only copy of something that matters across restarts. Observability memory stays in its existing stores — local SQLite for repo work, run event streams for shared work. World history is the substrate.

See: thinking/record-types (memory record schema), thinking/layers, thinking/primitives.