# Cairn

> agent wayfinding. temporal knowledge store in one sqlite file. no neo4j, no cloud, no lock-in.

- **Type:** MCP server
- **Install:** `agentstack add mcp-valtors-cairn`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [valtors](https://agentstack.voostack.com/s/valtors)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [valtors](https://github.com/valtors)
- **Source:** https://github.com/valtors/cairn
- **Website:** https://valtors.github.io/cairn/

## Install

```sh
agentstack add mcp-valtors-cairn
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# cairn

[](https://github.com/valtors/cairn/actions/workflows/ci.yml)
[](./LICENSE)
[](https://www.rust-lang.org/)
[]()
[](https://crates.io/crates/cairn-memory)

agent wayfinding. temporal knowledge store in one sqlite file. no neo4j, no cloud, no lock-in.

[landing](https://valtors.github.io/cairn/) - [github](https://github.com/valtors/cairn)

## what

cairn is a new category. not "memory" or "knowledge graph." agent wayfinding - agents that can find their way back to what they know.

a cairn is a pile of stones hikers stack to mark a path. agents leave cairns to mark what they learned and where they've been. each fact is a stone. the pile is the path.

MCP gave agents tools. cairn gives them a path.

## why

every agent memory system today is either a walled garden (mem0, zep cloud) or a heavy dependency (neo4j, postgres). none of them talk to each other. your memory is locked into whichever platform you picked first. cairn is the opposite: one binary, one file, zero dependencies, works with any agent that speaks MCP.

| | mem0 | zep | neo4j | cairn |
|---|---|---|---|---|
| setup | pip + api key | docker + api key | docker + cypher | one binary |
| dependencies | python, redis | docker, postgres | jvm, 2gb+ ram | sqlite |
| protocol | rest api | rest api | cypher/bolt | MCP |
| temporal queries | no | limited | no | yes |
| forgetting | no | no | no | yes |
| federated sync | no | no | no | yes |
| works offline | no | no | yes | yes |

## how it works

cairn stores facts as temporal triples: subject, predicate, object, with validity windows.

```
tamish --uses_os--> macos    (valid: 2024-01-01 to 2025-07-15)
tamish --uses_os--> linux     (valid: 2025-07-15 to now)
```

when a new fact contradicts an old one, the old fact is closed (not deleted). you can query the past: "what did we know about tamish in march?"

### five things cairn does that nobody else does together

1. **bi-temporal tracking without a graph database.** every fact carries two timestamps: when it was true in the world, and when the system learned it. contradicted facts get closed, not deleted. all in sqlite.

2. **extraction without burning LLM calls.** the agent calls `remember()` as an MCP tool during its normal response. no separate extraction pipeline. no extra API calls. a pattern-based post-turn hook catches 80% of facts for free.

3. **forgetting as a first-class operation.** facts decay by confidence, access frequency, and age. stale facts get tombstoned (soft delete with reason). forgetting is auditable. memory gets better over time, not just bigger.

4. **federated sync.** your phone agent and laptop agent share a brain. peer-to-peer sync via vector clocks. conflict resolution is deterministic. no server required.

5. **query by meaning, not by query language.** the agent says `recall("what do you know about tamish's setup")` and gets back a subgraph. no cypher, no SQL. semantic similarity finds entry points, graph traversal follows relationships, ranking returns what matters.

## architecture

```
cairn/
  crates/
    store/        temporal sqlite engine, validity windows, conflict resolution
    traverse/     graph traversal, depth-limited
    forget/       decay scoring, garbage collection, tombstones
    query/        semantic entry points + traversal + ranking
    extract/      pattern-based fact extraction (no LLM)
    sync/         vector clocks, peer sync, conflict resolution
    mcp/          MCP server exposing remember/recall/forget/export
  bin/
    cairn/        CLI + MCP server entry point
```

one sqlite file. one binary. zero external services.

## install

```bash
cargo install cairn-memory
```

or build from source:

```bash
git clone https://github.com/valtors/cairn
cd cairn
cargo build --release
cp target/release/cairn /usr/local/bin/
```

## usage

```bash
# run as MCP server (any MCP-compatible agent connects)
cairn serve

# or use directly
cairn remember --subject tamish --predicate uses_os --object linux
cairn recall "what os does tamish use"
cairn forget --older-than 30d
cairn export > my-memory.json
cairn import < my-memory.json
```

### with claude desktop

```json
{
  "mcpServers": {
    "cairn": {
      "command": "cairn",
      "args": ["serve"]
    }
  }
}
```

## tests

63 tests across 6 crates. all pass.

```bash
cargo test --workspace
```

## tech

`rust` `sqlite` `serde` `rusqlite` `MCP` `temporal triples` `vector clocks` `single binary` `zero runtime deps`

## contributing

see [CONTRIBUTING.md](CONTRIBUTING.md). we welcome contributions of all kinds - bug fixes, new patterns, transport support, docs.

good first issues are labeled `good first issue`.

## license

MIT. strictly open source. no cloud tier, no enterprise plan, no proprietary fork.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [valtors](https://github.com/valtors)
- **Source:** [valtors/cairn](https://github.com/valtors/cairn)
- **License:** MIT
- **Homepage:** https://valtors.github.io/cairn/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-valtors-cairn
- Seller: https://agentstack.voostack.com/s/valtors
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
