Memory

Code check: the old doc said the DB key sits in the OS keychain. The code keeps it in AGENT_DB_KEY or data/db.key (see Next). Vectors are plain BLOBs, not sqlite-vec.

Goal: the assistant knows the person deeply, but the prompt never grows without limit.

Three stores

StoreHoldsEdited by
Raw logEvery message, tool result, event. Append only.Nobody. Never deleted by jobs. Only a user "forget" removes items.
InboxNotes the model saved during turns.Model writes, dreaming empties.
Memory DBClean, labeled, sorted entries.Dreaming, and the user.

A fourth kind of data, rolling conversation summaries, is kept per thread. The model writes it and it is rebuilt as needed. "Forget" cleans it too.

All stores live in one SQLite database, encrypted at rest (SQLCipher). The key is kept in the OS keychain.

Every raw log item carries a trust label set by the core: user (typed by the user), outside (tool results, mail, web, triggers), or assistant (the model's own words). The model cannot set or change it.

Before anything goes into the raw log, the core removes known secret values and common secret patterns (API keys, tokens, passwords in URLs).

Memory entry

id                stable, never reused
owner_id          for future multi-user
title             short
summary           1 to 3 sentences, the "index line" source
detail            full text, loaded on demand
topic_path        e.g. travel/2026-11, people/sam, private/health
tags              list; includes `sensitive` when needed
people, places    linked names
time_range        when it happened or applies (stored in UTC, with the user's timezone)
importance        0 to 1
confidence        0 to 1
source_trust      user | inferred | outside
status            current | outdated | disputed
sources           ids of raw log items
supersedes        ids of entries it replaces
created, updated, last_used
embedding         vector for search (optional)
embedding_model   name and version of the model that made it

Search combines: topic path, tags, time range, keywords (FTS5), and vectors when an embedding model is set (see Search by meaning).

Source trust

Where a fact came from matters more than when.

LevelExampleStarting confidence
userThe user said "my birthday is May 2"high
inferredThe model guessed a habit from calendar eventsmedium
outsideAn email says "John's new number is ..."low

Reading memory in a turn

  1. Model sees basic data + index.
  2. It loads an entry by id, or calls search_memory.
  3. Loaded entries use detail. Lists of results show summary only.
  4. Entries with source_trust: outside are wrapped as outside content.
  5. last_used is updated. This feeds dreaming's importance score.

Folders

Profiles keep everything

A person, place or thing has its own folder (People/lee) with a profile: header lines Relation, Owner, Birthday, Likes, Dislikes, Groups, then Facts:, then Before:. The core merges every write (remember, src/remember.rs):

People, dates and groups (added Nov 2026):

src/links.rs works links out from what is saved; there is no second copy to drift.

LinkFrom
relationRelation: is who they are to the user, so it links to the user's own folder (the profile whose relation is "me, the user"). A relation naming someone else (dog, Robin's) links there.
ownerOwner:, or a fact like "My dog" when there is no relation.
fieldpeople and places on any entry in the folder.
mentiona saved line that names another known person, place or thing (whole words, 3+ letters).

One link per pair; the strongest wins. A loaded entry ends with Linked: (name, dir: path, why). search_memory hits carry linked. The Mind map draws them. Entries with outside trust never add words to these lists.

remember returns linked and a hint when a file links to nothing; dreaming's kickoff lists such files to fix. core.md leads with the user's own profile (who they are, then their top facts), then the rest by score.

Search by meaning

src/embed.rs. Off unless AGENT_EMBED_MODEL is set (for example nomic-embed-text); AGENT_EMBED_URL defaults to http://127.0.0.1:11434/v1 (any OpenAI-compatible /embeddings) and must be a loopback http address, so memory text never leaves the computer.

User control

Forget

"Forget" is the one case where raw data is deleted. It is a full sweep:

  1. The entry and every version in its history.
  2. Its raw log sources (whole items, or only the matching parts if the user picks that).
  3. Other entries built from those sources: they are rewritten without the fact, or removed if nothing is left.
  4. Lines in core.md and the index.
  5. Embeddings.
  6. Rolling conversation summaries that mention it.
  7. Pending inbox notes about it.
  8. Action log entries that hold the data (tool arguments and results), and stored SSE events (the replay copy).
  9. Backups made by the engine are rotated; the user is told how long old backups keep it (default 7 days).
  10. Planned, with the Full activity log: matching activity rows and model_calls.thinking values. Not built yet.

Forget cannot take back what a model provider already received in earlier prompts. The user is told this. Exports the user already saved are also out of reach.

Forget writes a tombstone (id and time, no content) so dreaming does not learn the fact back from the same sources. It needs an owner token. It cannot be undone.

Open risks

Dreaming, the job that sorts memory, is in Dreaming. Recipes are in Recipes.