Memory Brain
Memory Brain stores facts from your sessions on this machine and injects the relevant ones on later turns. Open it with the title-bar brain icon, or Knox: View Memory.
Tabs: Overview, Memories, Sessions, Graph, Recipes, Settings.


Everything lives in sqlite under ~/.knoxcoder (override KNOX_GLOBAL_DIR). There is no cloud memory, no embeddings, no vector database, and no neural / LLM rerank of memories. Knox-MS in the Docs tab is a different product.
How recall works
Retrieval is local and lexical:
- sqlite FTS (BM25)
- Trigrams for fuzzy overlap
- Rule-based synonym groups (longest matching phrase wins) — for example invoice/tax → money, icon-only → a11y
- A knowledge graph walk for related entities
- Chinese: overlapping CJK bigrams in FTS so a Chinese query hits sqlite, not a vector index
Memories rows and Overview can show why a row was injected last turn, for example injected last turn · lexical: jwt.
That is ordinary score math, not a model call.
What is stored
- Facts, preferences, and decisions you Remember, Create, or that chat extracts (a stated preference/decision can land without you saying “we decided”)
- Session summaries (for Use as context)
- Graph entities and edges
- Optional recipes (experimental, off)
Text is redacted before it is stored (API keys, PEM, KEY=value, …). Filler chat still stores nothing.
The agent tool builtin_memory can only store / recall / search / delete / build_context / pin / unpin. Admin actions (heal, export, run_pipeline, …) error and do not run. Export / wipe stay on the command palette.
Caps
| Cap | Default | Override |
|---|---|---|
| Injected memory per turn | 8000 tokens | KNOX_MEMORY_INJECT_CAP |
brain.sqlite (+ WAL) | 256 MB (268435456 bytes) | knoxchat.memoryBrain.maxBytes or KNOX_BRAIN_MAX_BYTES (0 = disable the cap) |
When the size cap is exceeded, oldest episodic turns are pruned; curated facts are kept. Enforced on open and on each consolidation tick.
Off switches
| Switch | Scope |
|---|---|
knoxchat.memoryBrain.enabled | Global. Off skips retrieval, auto-consolidation, and new writes. The file stays on disk. |
knoxchat.memoryBrain.workspaceEnabled | This folder (workspace setting) |
KNOX_BRAIN_ENABLED=0 | Process override for the global switch |
Knox: Export Memory Brain / Knox: Wipe Memory Brain from the command palette.
Settings tab
Product knobs (on/off, scope, auto-extract, recipes, enhanced semantic, inject cap) stay on the Memory Settings tab. λ / fusion / budget / compression / mode multipliers sit behind collapsed Expert retrieval, with reset-to-defaults.
Recipe switches are not on the chat gear (Agent Settings). Use Memory → Settings.
Memory Brain and Knox-MS
Both follow bounded context, unbounded memory: what goes into one prompt is capped, what is stored is not (beyond the disk cap below), and retrieval is lexical plus a graph, never embeddings. Hosted Knox-MS 2.0 also measures recall as history grows. See the Knox-MS 2.0 developer documentation.
| Memory Brain (this page) | Knox-MS 2.0 (hosted knox/knox-ms) | |
|---|---|---|
| Where | sqlite on this machine | Your Knox account |
| Retrieval | FTS / BM25, trigrams, synonyms, graph walk | BM25, ripgrep, graph (personalized PageRank), summary tree, fused by rank |
| Per-turn injection cap | 8000 tokens (KNOX_MEMORY_INJECT_CAP) | Memory budget W_mem, 4,000 tokens by default without a routed model, derived from the model window otherwise |
| Forgetting | Delete a memory, or wipe from the command palette | Propagating erase with a tombstone (see the Knox-MS docs) |
Memory Brain does not (yet) use the Knox-MS parameter set; the two stores are separate and never sync.