How Kairn Works
The local index, session ledger, context governor, and delivery paths.
Kairn is a context runtime for coding agents.
It sits between retrieval and the agent, governing what context enters the working session.
RAG vs Kairn
RAG retrieves candidate context.
Memory systems help persist useful context.
Kairn governs context during execution. Relevance is not the same as readiness: Kairn decides what reaches the model now, what should be compressed, what should wait, and when more evidence is needed before spending tokens.
Local index
Kairn builds a local view of the repo so it can reason about source structure without uploading code.
The index stays on your machine.
Session ledger
Kairn records what source context has already been established in the current session.
That lets it avoid repeating unchanged context every turn.
Context governor
Before speaking, Kairn decides whether context would help the next turn or just add noise.
It can:
- route source
- shrink context
- suppress noisy context
- request one missing piece of evidence
Delivery paths
Codex CLI session mode is the most-tested public beta path.
MCP is the portable path for editor and extension workflows.
Privacy
Source, prompts, diffs, paths, filenames, repo names, branch names, and raw outputs stay local by default.
Opt-in telemetry is aggregate-only.