Cairntir
Persistent, local-first memory for AI coding agents. Claude Code, Codex, Cursor, Qwen Code, and other MCP clients share one searchable project history.
Cairntir stores decisions, facts, unfinished work, and outcomes as verbatim drawers in a SQLite database you own. A budgeted handoff restores complete drawers across sessions; semantic and file-anchored recall find deeper evidence.
Development candidate 1.11.0; published version 1.10.0. See the candidate evidence and changelog. Published downloads are on PyPI and GitHub Releases.
Install
pip install --upgrade cairntir
cairntir setup
Python 3.11+ is required. Setup initializes the store and configures supported hosts it detects. Restart your agent afterward.
cairntir version
cairntir doctor
For one host or project, use cairntir init --host codex; add --user for
user-scope configuration. Cursor's global User Rule requires a manual paste;
setup prints the rule and reports that step.
Follow the getting-started guide for configuration, verification, recovery, and troubleshooting.
Use
Ask your agent to remember a decision in your project's wing, then start the
next task with cairntir_handoff(wing="myproject"). A wing is a project, a
room is a topic, and a drawer is one verbatim memory.
cairntir handoff myproject
cairntir handoff myproject --task "repair cache invalidation" --budget 8192
cairntir recall "why did we choose Postgres?" --wing myproject
cairntir recall-for-change src/auth.py
cairntir recover --host codex --wing myproject
cairntir cost myproject
Handoff returns whole drawers or names those omitted by its character budget. It includes recent default-layer writes, open predictions, and optional code anchors. Settlements append observed outcomes without rewriting predictions.
Portable evidence preserves source identities and relationships across stores. Evaluated procedures require holdout evidence and local approval; scoped sharing limits access with owner-issued grants.
Host support
| Surface | Support |
|---|---|
| Setup | Claude Code, Cline, Codex CLI, Copilot CLI, Cursor, Gemini CLI, OpenCode, Qwen Code |
| Transcript recovery | Claude Code, Codex, Qwen Code |
| Other MCP clients | Configure the cairntir-mcp stdio command manually |
| Cursor transcripts | Unsupported; an explicit receipt explains the limitation |
Transcript recovery is opt-in, separately budgeted, read-only, and untrusted.
It reads bounded host-owned transcript tails; it cannot recover text the host
never persisted. Saving a recovered request requires explicit selection with
cairntir recover ... --write N. Memory is not automatically made
authoritative merely because it appeared in a transcript or imported file.
Data and safety
The authoritative store is local SQLite with sqlite-vec. Embeddings run
locally; first use may download the embedding model. Optional update checks
contact PyPI, and explicitly selected LLM adapters can contact their provider.
Cairntir is not a sandbox for the agent using it.
Portable JSONL verifies content hashes and optionally HMAC signatures through the Python API. The CLI imports as untrusted and does not verify signatures. Version 1 cannot safely import source-local history references; use a database backup for linked history. Export/import also enforce the format's external-URL restriction. See data handling for backup and trust boundaries.
Build and integrate
The MCP server exposes 21 tools over stdio. Stable Python protocols support custom backends; see the integration guide.
src/cairntir/
├── memory/ # SQLite storage, embeddings, retrieval
├── mcp/ # stdio server and backend
├── reason/ # prediction, experiment, observation
├── recipes/ # composable workflows
└── cli.py # cairntir setup | init | handoff | recover | recall | replay | hotfix | doctor | export | import
tests/ # unit, integration, contract, property, evaluation
docs/ # guides, architecture, recipes, release evidence
Contributing documents the locked development environment and required checks. Tests enforce at least 80% coverage of the measured surface; transport entrypoints are excluded and tested separately. The LongMemEval subset is a regression gate, not a general benchmark claim.
Documentation
- Getting started
- Concepts and data handling
- Multi-host architecture
- Recipes: CodeGlass, Decision Replay, Signal Reader, Bounded Hotfix, and Finalization Mode
- Roadmap
- Security policy · release policy
- Design principles · lineage
Cairntir (CAIRN-teer) combines a cairn, a waypoint of stacked stones, with a seeing-stone. Maintained by Patrick McGuire. MIT licensed.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cairntir-1.11.0.tar.gz.
File metadata
- Download URL: cairntir-1.11.0.tar.gz
- Upload date:
- Size: 939.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f25ab1153598694a8d6aaed497a4146e5f539728dc9844e3d7bec1d82af2408
|
|
| MD5 |
8c356c8834e0def27f34dd0f5fd75d9d
|
|
| BLAKE2b-256 |
8f133a2fbd0a4b7f5278ac352b68fb10d8931782b7c8d2b0e73465366b01033a
|
Provenance
The following attestation bundles were made for cairntir-1.11.0.tar.gz:
Publisher:
release.yml on pnmcguire480/cairntir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cairntir-1.11.0.tar.gz -
Subject digest:
1f25ab1153598694a8d6aaed497a4146e5f539728dc9844e3d7bec1d82af2408 - Sigstore transparency entry: 2748787252
- Sigstore integration time:
-
Permalink:
pnmcguire480/cairntir@d88beabdf5407b03c72cf60d9d59ca0908630999 -
Branch / Tag:
refs/tags/v1.11.0 - Owner: https://github.com/pnmcguire480
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d88beabdf5407b03c72cf60d9d59ca0908630999 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cairntir-1.11.0-py3-none-any.whl.
File metadata
- Download URL: cairntir-1.11.0-py3-none-any.whl
- Upload date:
- Size: 286.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0a3dd536bae60081ee7eff97590fbfd63bf76c31a9ccefa7a860c5a791ccaf7
|
|
| MD5 |
8d87f3a72891c171047eb2454ab292bc
|
|
| BLAKE2b-256 |
0a9d850772bfd18da11de4844d7e5a3cb3121407fa46112280997c9c0a7d8a5c
|
Provenance
The following attestation bundles were made for cairntir-1.11.0-py3-none-any.whl:
Publisher:
release.yml on pnmcguire480/cairntir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cairntir-1.11.0-py3-none-any.whl -
Subject digest:
c0a3dd536bae60081ee7eff97590fbfd63bf76c31a9ccefa7a860c5a791ccaf7 - Sigstore transparency entry: 2748787285
- Sigstore integration time:
-
Permalink:
pnmcguire480/cairntir@d88beabdf5407b03c72cf60d9d59ca0908630999 -
Branch / Tag:
refs/tags/v1.11.0 - Owner: https://github.com/pnmcguire480
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d88beabdf5407b03c72cf60d9d59ca0908630999 -
Trigger Event:
push
-
Statement type: