Cairn
Stop your AI coding agent from confidently undoing decisions you made on purpose. A fresh session has no memory of why your code is the way it is — Cairn gives it that memory, so the next traveler doesn't re-derive (and reverse) yesterday's reasoning.
Under the hood: a self-compacting, code-indexed decision graph built on git and Lore-compatible decision records, served to agents over MCP.
Git is a perfect record of what changed and an amnesiac about why. Cairn captures the reasoning behind code as work happens, stores it in git itself, and hands a fresh agent session the answer to "why is this code the way it is?" — bound to the specific decision that touched the code, not to a file, a folder, or a chat log.
Cairn does not invent a format and does not run a backend. It emits Lore-compatible commit trailers, keeps a compacted graph in a refs/notes/cairn git-notes namespace, and serves two read tools over the Model Context Protocol. It is single-player and local.
Cairn — a cairn is a stack of stones hikers build to mark a trail, left so the next person to come through can find the way the last one already worked out. That is exactly the job here: leave a durable marker of the reasoning behind a piece of code, so the next traveler — usually an agent with no memory of yesterday — doesn't have to re-find the path from scratch.
The loop
plan approved / /cairn:decision ─▶ opens a decision (intent + alternatives)
agent edits a file ─▶ durable journal entry in .git/cairn/ [synchronous, no model call]
you commit ─▶ consolidate: journal ─▶ Lore trailers on the commit
+ decision atoms in refs/notes/cairn
compaction / session end|start ─▶ flush journal ─▶ notes graph, then dream: compact the store if over budget
fresh session ─▶ cairn MCP ─▶ why(file) | recent(n)
A decision opens two ways: automatically when you approve a plan (the plan is the richest statement of intent there is), or manually with /cairn:decision "<intent>". Consolidation runs at every inflection point — at a commit it writes Lore trailers onto the commit and updates the notes graph; at compaction / session end / session start there is no commit to amend, so it promotes the journal to the notes graph only, making in-flight reasoning queryable across sessions before it is committed.
At those same idle boundaries (or on demand via cairn dream), Cairn also dreams: when the whole stored graph has grown past a budget, it folds the oldest decisions into compact rollups so the store stays bounded as history accrues — the self-compacting "memory" step, run at sleep-time rather than inline. See DESIGN.md.
Capture is split from persistence on purpose. The reasoning is journaled the instant a file changes, so a /clear, a crash, or a compaction can't erase it. Turning that raw journal into clean Lore records happens later, at a commit. Durability never waits for a commit and never depends on catching a teardown event — a missed trigger loses nothing, because the journal survives and the next commit picks it up.
Why Cairn is different
Every individual capability here already exists somewhere. The unoccupied space is the intersection, and Cairn occupies exactly that and nothing wider:
- Decision-record tools (Lore, Contextual Commits, ADRs) are git-native and code-adjacent, but have no compaction and mostly no protocol — they grow until they're noise, and they never reach the agent.
- The memory layer (mem0, Letta, Zep, native model-lab memory) is self-compacting and agent-served, but problem- or conversation-indexed: it remembers what you talked about, not why a specific line looks the way it does.
- Context platforms (Sourcegraph, Augment, Unblocked) are automatic and agent-served, but are managed retrieval engines over many sources, not git-native decision graphs.
What nobody has shipped as one thing is the full intersection — and that is Cairn:
| Axis | Cairn |
|---|
| Capture | Automatic, at decision-time and edit-time — not a manual writeup step. |
| Index | Bound to the decision that touched specific code — not a file, a folder, or a chat session. |
| Size | Self-compacting under a per-agent token budget, so a month of work still fits a cold session. |
| Storage | Git itself — Lore trailers + refs/notes/cairn. No backend; it travels with the repo. |
| Delivery | Served to agents over MCP. |