# cairntir [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/pnmcguire480/cairntir  
**GitHub Stars:** 7  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cairntir

## Description
Local-first persistent memory MCP server for Claude Code, Codex, Cursor, Qwen Code, and AI coding agents. Cross-session, cross-agent SQLite memory.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/pnmcguire480/cairntir), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
pip install --upgrade cairntir
```

2. Configure:

```sh
cairntir setup
```

## Documentation

## What cairntir does

cairntir gives coding agents a persistent memory store that remains available across chats, sessions, and supported hosts. Memories are organized into wings, rooms, and drawers: a wing represents a project, a room represents a topic, and a drawer holds one verbatim memory. The store can contain decisions, facts, unfinished work, predictions, and observed outcomes.

The authoritative data store is local SQLite using sqlite-vec. Embeddings are generated locally, so semantic retrieval can work without sending memory content to an external service. The first embedding operation may download the selected embedding model. Cairntir is a memory system, not an execution sandbox for the agent.

## How it works

The MCP server communicates over stdio and exposes 22 tools. Agents can save project knowledge, request a budgeted handoff, search by meaning, retrieve memories associated with a file, recover bounded transcript context, and inspect memory cost. A handoff returns complete drawers when they fit the requested character budget and identifies drawers left out when they do not. It also includes recent default-layer writes, open predictions, and optional code anchors.

Settlements add observed outcomes to existing predictions rather than rewriting the original prediction. Transcript recovery is opt-in, read-only, separately budgeted, and limited to bounded tails that a host has actually persisted. Recovered requests require explicit selection before being written to memory.

Cairntir supports portable JSONL evidence with content hashes and optional HMAC signatures through its Python API. Scoped sharing can restrict access through owner-issued grants, while evaluated procedures use holdout evidence and local approval.

## Setup and configuration

Install the package with Python 3.11 or newer, then initialize it:

```bash
pip install --upgrade cairntir
cairntir setup
```

Setup initializes the local store and configures supported hosts it detects. Restart the agent after setup. Use `cairntir version` and `cairntir doctor` to inspect the installation and configuration. For a single host or project, `cairntir init --host codex` can create configuration at project scope; add `--user` for user scope.

Cursor’s global User Rule requires a manual paste of the rule printed by setup. A configured MCP entry does not by itself confirm a live connection, so verify operation with an actual save receipt and retrieval in a fresh chat. The CLI also provides commands such as `handoff`, `recall`, `recall-for-change`, `recover`, and `cost`.

## Tools and capabilities

- Save and retrieve cross-session project memories.
- Create budgeted handoffs containing whole memory drawers.
- Search semantically and by file or code anchor.
- Recover bounded transcript tails from supported hosts.
- Append observed outcomes to predictions.
- Export and import portable evidence formats.
- Apply scoped sharing and inspect memory cost.

Host setup covers Claude Code, Cline, Codex CLI, Copilot CLI, Cursor, Gemini CLI, OpenCode, and Qwen Code. Transcript recovery is supported for Claude Code, Codex, and Qwen Code. Other MCP clients can use the `cairntir-mcp` stdio command manually.

## Limitations and notes

Cursor transcript recovery is unsupported, although Cursor can use the MCP server and its setup flow. Transcript data is untrusted and cannot restore text that the host never saved. Cairntir does not automatically treat imported files or recovered transcript content as authoritative.

Optional update checks contact PyPI, and explicitly selected LLM adapters may contact their provider. Version 1 cannot safely import source-local history references; a database backup is recommended for linked history. The CLI treats imported JSONL as untrusted and does not verify signatures, while export and import enforce restrictions on external URLs.

After upgrading from an earlier release, semantic search and saving may require a reindex operation before they work again. The project’s upgrade documentation should be followed before relying on those features.

_Full upstream README: https://allmcps.com/mcp/cairntir/readme_

