Memory & ODIN

HEADING OS does not have "a memory." It has six distinct mechanisms, each tuned to a different shape of recall, plus ODIN — a curated, opinionated long-term brain. All storage resolves under the private data overlay via the data-root seam; the engine never holds real data.

The mental model

Auto-memory is sticky notes that always load; the memory-index is associative recall that finds things by meaning; ODIN is a curated, opinionated long-term brain; the knowledge base is a second brain of atomic notes; threads are live operational state; and dream / memory-hygiene are the maintenance crew.

#MechanismWhat it isAuto-loaded?
1Auto-memoryOne-fact-per-file persistent facts + a MEMORY.md indexYes — index injected every session
2Semantic recall / memory-indexLocal hybrid (dense + BM25) associative indexNo — invoked via /recall
3ODIN brainCurated principles, positions, episodes, sourcesNo — invoked via /odin
4Knowledge base / ZKZettelkasten second brain of atomic notesNo — invoked via /zk
5ThreadsOperational registry of ongoing situationsActive-thread list injected each session
6Dream + memory-hygieneConsolidation and rot-detection passesNo — invoked via /dream, /memory-hygiene

How they relate. The memory-index (2) is the connective tissue: it indexes across auto-memory, the ODIN brain, threads, CRM, context, reference, plans, knowledge, and deliverable outputs, so /recall answers by meaning over everything. ODIN's own recall mode is a brain-scoped slice of the same engine. Dream (6) consolidates auto-memory (1); memory-hygiene (6) audits both auto-memory and the ODIN brain.

1. Auto-memory — file-based persistent facts

The always-on cross-session memory. Each durable fact is a single Markdown file with YAML frontmatter, and a flat index (MEMORY.md) lists every fact as a one-line pointer. The index is injected into context at the start of every session, so the assistant orients on prior learnings without reading any file body until it needs the detail.

Where it lives: <data-root>/auto-memory/, indexed by auto-memory/MEMORY.md (pointers only, kept under a line budget).

---
name: console-first-no-web-dependency
description: "One-line description — specific enough to judge relevance"
metadata:
  type: feedback        # user | feedback | project | reference
---

The fact, in prose. For feedback/project facts, follow with
**Why:** and **How to apply:** lines.
TypeHolds
userFacts about the operator — role, preferences, identity, how they want to be addressed.
feedbackStanding guidance on how to do the work — corrections and confirmed-good practices.
projectOngoing work, decisions, deadlines, infrastructure state.
referencePointers to external systems and resources.

What NOT to store: code patterns / architecture (derivable by reading the project), git history (authoritative on its own), one-off debugging fixes (the fix is in the code), anything already in a CLAUDE.md, and ephemeral task detail. Memory is for what you cannot re-derive. Fact bodies carry an age banner — memories are point-in-time observations, not live state.

2. Semantic recall / memory-index — associative memory

A local, zero-API-cost associative-memory index (scripts/memory-index.py) that finds notes by meaning — including cross-lingual — where grep finds only exact words. Recall is hybrid: a dense channel (embedding cosine similarity via the local bge-m3 model through Ollama) fused with a sparse channel (SQLite FTS5 BM25) using Reciprocal Rank Fusion, then re-ranked by a weighted blend of relevance, recency, and importance.

It is the "hippocampus": a rebuildable cache, never the source of truth. The notes ("neocortex") stay in git; the index is gitignored.

Air-gap is structural: denied paths (the _secure/ prefix and any personal path segment) are never read, so they can never be retrieved — enforced in code, not just config.

First build is slow — and that is normal A full memory-index.py build takes ~85 minutes on CPU (~7,300 chunks at ~0.7s each). It commits per file with + path [NN%] progress and resumes if interrupted; later runs are incremental and fast. A daily refresh timer keeps both stores current.

Recall in practice (/recall)

uv run python scripts/memory-index.py build                          # refresh (incremental)
uv run python scripts/memory-index.py query "<question>" --json       # default --collection content
#   --collection code   skills/rules     --collection all   both      --layer NAME   pin one layer

The /recall skill reads the top cited files and composes an answer grounded only in what those files say, citing each claim by file path. If the engine reports a gap (nothing above the salience threshold), /recall says so plainly — "not in memory" — and never pads or answers from general knowledge.

Use /recall for workspace-wide recall; /odin recall for brain-scoped only; Grep for exact-string search; /osint for external/world intel (not memory).

3. ODIN brain — the curated long-term advisor

A persistent, opinionated knowledge brain that ingests books, articles, videos, and documents, extracts principles, forms positions, records episodes (things that happened), detects conflicts, and gives referenced first-person advice that prioritizes learned knowledge over general reasoning. Full operating guide below.

Where it lives: <data-root>/knowledge/odin-brain/principles/, positions/, episodes/, sources/, conflicts/, and a regenerated INDEX.md with brain stats. Every write is sanitized, then both indexes refresh (brain INDEX.md + the memory-index).

4. Knowledge base / ZK — the second brain

A Zettelkasten second brain over <data-root>/knowledge/: atomic notes, wiki-links, a status lifecycle, and anti-dumping discipline. Driven by /zk with subcommands add | enrich | find | connect | distill | garden | stats | brief. In a single-operator deployment, prefer ODIN / threads / auto-memory; in a multi-user fleet, executives lean on /zk.

5. Threads — operational state as durable memory

An operational registry of ongoing situations, each a dated Markdown file with a ## Log of activity. Managed by /thread (open | log | close | hold | reopen | list | find). The active-thread list is injected into context each session. Lives in <data-root>/threads/business/ (and a personal tree, which is operator-only and excluded from the memory-index by the personal-segment air-gap). Use a thread for a live, multi-step situation with an open/closed lifecycle — not a single fact (auto-memory) or a generic note (/zk).

6. Dream + memory-hygiene — the maintenance crew

They split cleanly: /dream is the fixer (judgement), /memory-hygiene is the detector (mechanical only).

Working with ODIN

ODIN is a persistent AI advisor with his own knowledge brain. He forms opinions, defends them, and challenges weak thinking. Every consult answer is referenced (each claim links to its brain origin) and prioritizes learned knowledge over general reasoning.

Trigger discipline ODIN triggers only on "Odin" as a proper name or form of address/odin, "ask Odin", "what would Odin say". He must not trigger on odin used as the numeral "one" in other-language phrasing.

The principle / position / episode model

ODIN's knowledge is a three-tier ladder plus its raw inputs:

Conflicts are a fifth file type recording a direct contradiction for the human to resolve — ODIN never resolves a conflict silently. The ladder: episodes graduate into principles; principles cluster into positions. Notes are never deleted when superseded — temporal-validity fields mark history instead.

The 9 modes

Invoke as /odin [mode] [source-or-question]. With no arguments, ODIN shows a mode menu.

ModeWhat it doesExample
learnFull absorption of an external source — extracts/updates principles, cross-references the brain, classifies relationships, updates positions./odin learn https://youtube.com/watch?v=...
consult (default)Advice grounded in the brain with inline references, a mandatory Challenge section, a Sources table, and a brain-audit footer. Offers writeback to save a new synthesis./odin consult Should we pursue this deal?
recallDirect inventory query of what the brain holds — sources, principles, positions, episodes, conflicts, and gaps. Read-only w.r.t. the brain./odin recall antifragility
reflectODIN reviews his own brain for growth: clusters episodes into maturation candidates, finds orphan principles and stale positions. Graduation is human-confirmed./odin reflect
teachYou teach ODIN directly from experience — no external source. Writes a principle, flags any conflict with existing knowledge./odin teach In this market, speed beats perfection
logRecord an episode — a dated thing that happened. No confidence; light capture, not analysis. Matures later via reflect./odin log Their CTO pushed back hard on on-prem pricing
collectOn-demand, air-gapped scan of a business-only allowlist for dated happenings you forgot to log. De-dupes, presents candidates, per-candidate human approval, then writes through log. Never scheduled./odin collect --since 2026-05-19
compileUnified linting across the brain and the ZK knowledge base — cross-links, contradictions, gaps, temporal-validity errors./odin compile
skill-proposalTurn a reflection-derived how-to principle into a proposed checklist step inside a target skill — emits a unified diff for you to apply. Never edits a skill file itself./odin skill-proposal turn <principle> into a step in /proposal

ODIN's non-negotiable rules

  1. Knowledge priority is sacred — brain knowledge always comes before general reasoning.
  2. Challenge is mandatory on every consult — no exceptions.
  3. Never resolve conflicts silently — report and wait for human direction.
  4. Source everything; first person always ("I think", not "based on analysis").
  5. Honest about gaps — if the brain is empty, say so and offer to learn.
  6. All writes stay inside knowledge/odin-brain/, are sanitized, and refresh both indexes.
  7. The collect air-gap runs in code first — the personal/secure boundary is enforced before any text reaches the model, never delegated to it.