Cairn
Persistent memory for AI agents and humans. Store, search, and discover patterns.
★ 5GPL-3.0search
Install
Config snippet generator goes here (5 client tabs)
README
<p align="center">
<img src="images/cairn-readme-banner.png" alt="Cairn — persistent memory for agents and humans" width="800">
</p>
<p align="center">
<a href="https://github.com/jasondostal/cairn-mcp/releases"><img src="https://img.shields.io/github/v/release/jasondostal/cairn-mcp?style=flat-square&color=blue" alt="Release"></a>
<a href="LICENSE"><img src="https://img.shields.io/github/license/jasondostal/cairn-mcp?style=flat-square" alt="License"></a>
<img src="https://img.shields.io/badge/MCP-compatible-brightgreen?style=flat-square" alt="MCP">
<img src="https://img.shields.io/badge/PostgreSQL-16%20%2B%20pgvector-336791?style=flat-square" alt="PostgreSQL">
</p>
---
Yet another MCP, right? Yeah, it's that. But here's why this one exists.
I'm a t-shaped engineer. PMP, SAFe Agilist, Certified Product Owner. But before any of that, I'm a systems person. Data centers, orchestration, automation. The kind of work that crosses 13 disciplines and stretches back to something you last touched 10 years ago.
I built Cairn for my workflow. At 1am, when I'm deep in something and I know the answer exists somewhere in the last three weeks of work but I don't want to spend 30 minutes digging and correlating. That emergency call, the panicked user coming to you as their only hope, and it's an issue buried in 6 systems you last touched in 2014.
Cairn is there.
*"Where did I put that singularity again? Let me just spawn a couple..."*
Sure, dedicated tools will probably beat a given Cairn feature when it's all they do. Cairn isn't built for single-purpose depth — but it still [scores 81.6% on LoCoMo](#benchmark). It's built for the systems person. The curious. The t-shaped. The ones who need a memory that works the way they do, across everything, all at once.
It's a self-hosted memory and orchestration layer for AI agents and humans. Store something once, find it later, across sessions, across projects. Four containers. `docker compose up`. Done.
<p align="center">
<img src="images/cairn-loop.jpg" alt="Cairn chat creating work items with agent dispatch" width="700">
<br>
<sub>Chat creates a work item. Agent breaks it into subtasks. You review from your phone.</sub>
</p>
## Quick Start
### 1. Pull and run
```bash
curl -O https://raw.githubusercontent.com/jasondostal/cairn-mcp/main/docker-compose.yml
docker compose up -d
```
Four containers start:
- **cairn** on port 8000 (MCP server + REST API)
- **cairn-ui** on port 3000 (web dashboard)
- **cairn-db** (PostgreSQL 16 + pgvector)
- **cairn-graph** (Neo4j 5, knowledge graph)
Migrations run on first boot. Ready in about a minute.
### 2. Connect your IDE
Add this to your MCP config:
```json
{
"mcpServers": {
"cairn": {
"type": "http",
"url": "http://localhost:8000/mcp"
}
}
}
```
Where that goes:
| IDE | Config file |
|-----|------------|
| **Claude Code** | `.mcp.json` in your project root |
| **Cursor** | `.cursor/mcp.json` |
| **Windsurf** | `.windsurf/mcp.json` |
| **Cline** | MCP settings panel in VS Code |
| **Continue** | `.continue/config.yaml` |
Or run the setup wizard — it walks you through everything: LLM backend, database, embeddings, auth, and IDE configuration:
```bash
git clone https://github.com/jasondostal/cairn-mcp.git && ./cairn-mcp/scripts/setup.sh
```
Pick a tier (local dev, recommended, enterprise, or custom) and the wizard collects only what that tier needs. Supports `--dry-run` and `--non-interactive` for CI.
### 3. Use it
Tell your agent to remember something:
> "Remember that we chose PostgreSQL for storage because it handles hybrid search without a separate vector DB."
Search for it later:
> "What did we decide about the storage layer?"
That's it. 23 tools available. The ones you'll use most:
| Tool | What it does |
|------|-------------|
| `store` | Save a memory with auto-enrichment. Supports `event_at` and `valid_until` for bi-temporal tracking |
| `search` | Find memories (vector + keyword + recency + tags). Temporal filters: `as_of`, `event_after`, `event_before` |
| `recall` | Get full content for specific memory IDs |
| `orient` | Boot a session with rules, recent activity, beliefs, and open work |
| `rules` | Load behavioral guardrails (global or per-project) |
| `beliefs` | Durable epistemic state — crystallize, challenge, retract knowledge with confidence tracking |
| `work_items` | Create, claim, and complete tasks with dependencies and gates |
| `working_memory` | Capture ephemeral thoughts — hypotheses, questions, tensions — with salience decay. Lives alongside crystallized memories; resolving graduates into permanent memories or beliefs |
| `projects` | Manage project docs (briefs, PRDs, plans) |
| `code_query` | Structural queries: dependents, impact, callers, callees, dead code, complexity, hotspots |
| `arch_check` | Validate architecture boundary rules against imports |
| `dispatch` | Dispatch work to a background agent — tracked, briefed, heartbeating |
The rest: `m