Working memory
Beta in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API
can still change within 3.x.
Postgres is the durable store. Redis sits in front of it for state that is short-lived or read often. Three pieces are wired in the server today.
| Layer | What it holds | Redis key | Lifetime |
|---|---|---|---|
| Working memory | Per-agent scratch values, such as the memory ids anticipated at session start | mnemo:{ws}:work:{agent}:{key} | TTL clamped to 1 to 60 minutes |
| Session buffer | The turns of open sessions and the set of active sessions | mnemo:{ws}:sess:{id}:turns, mnemo:{ws}:sess:active | 24 hours, at most 500 turns |
| Hot tier | A sorted set of recently recalled facts | mnemo:{ws}:hot:facts | Decayed hourly, rebuilt daily |
Sources: packages/core/src/session/working-memory.ts,
packages/core/src/session/session-buffer.ts and
packages/core/src/cognitive/recall-hot.ts.
No REST route or MCP tool reads or writes working memory directly. The server
uses it: for example, POST /session/start stages the anticipated memory ids
there for 30 minutes.
Caches in Postgres
Two caches live in Postgres, not in Redis, and are used by recall
(packages/core/src/cognitive/index.ts):
- Embedding cache. The embedding of a query text is stored by its hash, so the same text is not embedded twice.
- Result cache. A query whose embedding has a cosine of at least 0.95 with a query from the last five minutes reuses that query’s result ids. It only applies to default-shaped requests whose hits are all facts, and each cached fact is checked again before it is served.
When Redis is down
| Piece | Behaviour without Redis |
|---|---|
| Working memory | Falls back to an in-process map capped at 10 MB; evictions are logged |
| Session buffer | Reads and writes go to Postgres |
| Hot tier | Counts as a miss; recall continues with the pointer and cold tiers |
Without MNEMO_REDIS_URL the hot tier and rate limiting are off from the
start.