Kairn


Context-aware knowledge engine for AI assistants.

Status: pre-1.0. In daily use since February 2026, with a test suite that runs on Linux, macOS and Windows (see Development) and a published
LongMemEval-S benchmark (measured before 0.3.0). Interfaces may still change between
releases until 1.0. Feedback and issues welcome.
Other tools give your AI a memory. Kairn gives it a knowledge graph with intelligent context routing. It knows what to load, when to load it, and how much - so your AI stays focused, not overwhelmed.
pip install kairn-ai
kairn init ~/brain
kairn serve ~/brain
Claude Code and Codex each take one line; --init creates ~/brain and its database on first start, so this works even without kairn init:
claude mcp add kairn -- kairn serve --init ~/brain
codex mcp add kairn -- kairn serve --init ~/brain
Or install it as a one-click bundle, no Python setup required: download the
.mcpb file from the latest release
and open it with a bundle-aware app such as Claude Desktop.
For other clients, see Quick Start below. New to Kairn? Jump to First 5 Minutes.
Install routes
| Route | Who it is for | Command |
|---|
| PyPI | anyone with Python, and every MCP client | pip install kairn-ai |
MCP Bundle (.mcpb) | Claude Desktop and other bundle-aware apps; no Python install needed | download from Releases and open it |
| Claude Code | one line, uses the PyPI install | claude mcp add kairn -- kairn serve --init ~/brain |
| Codex | one line, uses the PyPI install | codex mcp add kairn -- kairn serve --init ~/brain |
The bundle carries no Kairn source of its own. It declares kairn-ai as a
dependency and the host resolves it with uv, so a bundle install and a
pip install run identical code. Where the database lives is configurable when
you install the bundle; it defaults to ~/.kairn and never leaves your machine.
Why Kairn?
Every AI conversation starts from scratch. Previous insights, decisions, and patterns - gone. Existing memory tools store flat key-value pairs that can't represent relationships or surface the right context at the right time.
Kairn is different:
- Context Router + Progressive Disclosure - Automatically loads relevant subgraphs based on keywords, starting with summaries and drilling into details only when needed. No other tool does this.
- Knowledge Graph with FTS5 - Not flat storage. Typed relationships (
depends-on, resolves, causes) between nodes with provenance tracking and full-text search across everything.
- Experience Decay + Auto-Promotion - Experiences lose relevance over time (biological decay model). Frequently-accessed experiences auto-promote to permanent knowledge. Your AI naturally forgets what doesn't matter.
- 22 MCP Tools - Works with Claude Code, Codex, Claude Desktop, Cursor, VS Code, Windsurf, and any MCP client. Includes
kn_judge for 5-verb relationship judgments and kn_doctor for read-only health diagnostics.
- Per-Workspace Isolation - Each workspace is its own isolated SQLite store. JWT auth and role-based access control (owner / maintainer / contributor / reader) ship for team deployments.
Quick Start
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows:
{
"mcpServers": {
"kairn": {
"command": "kairn",
"args": ["serve", "--init", "~/brain"]
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"kairn": {
"command": "kairn",
"args": ["serve", "--init", "~/brain"]
}
}
}
VS Code
Add to .vscode/mcp.json:
{
"servers": {
"kairn": {
"type": "stdio",
"command": "kairn",
"args": ["serve", "--init", "~/brain"]
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"kairn": {
"command": "kairn",
"args": ["serve", "--init", "~/brain"]
}
}
}
Restart your editor. Kairn's 22 tools appear in the MCP section.
First 5 Minutes
A guided first run, end to end: