Memory & recall
Files truth. SQLite cache. Drop DB, rebuild, survive.
Memory engine: filesystem is law. SQLite is derived. Chunks, FTS, embeddings, queues —
throw away and rebuild with reindex. That is feature. Not emergency only.
Contract
- Journal first. Append + flush before file changes. Crash mid-write leaves intent.
- Files truth. Agents, skills, macros, transcripts = files.
- Index disposable. Schema change = drop + rebuild. No fragile migration drama.
packages/memory imports zero Expo, zero Node APIs. Adapters injected. Same code phone
and laptop.
Chunks + embeddings
File → ordered chunks (path + ordinal). Each chunk has body, sha256, optional pin.
Pinned = always in candidate pool. User-confirmed facts live here.
Embedding contract fixed so re-embed is a query not archaeology:
- Model:
text-embedding-3-small - Dim:
768
sqlite-vec present → vectors. Missing → lexical only. Still works. Degraded, not dead.
Recall modes
| Mode | What | When |
|---|---|---|
fast | FTS + recency + pins. No network. Few ms. | Voice. Immediate context. |
deep | Fast + embed query + vector neighbors, RRF fuse | Want better. Embedder up. |
Voice fires fast first. Upgrades to deep if deep finishes before model needs context.
Deep asked, embedder dead? Result marked degraded. Turn still goes.
Hits say score + which retriever found them (lexical, vector, recent, pinned). You
can ask “why this memory” and not get shrug.
Agent memory files
In home:
memory/facts.md— durable factsmemory/notes/— longer notes- Dreams stuff finished chats into these (Dreams)
Attachments
Images, video, audio, files → content-addressed blobs: blobs/<ab>/<sha256>. Sha is
identity. Filename is decoration. Two-char fanout so one folder not 50k files.