Skip to main content

Cairntir

Persistent memory for AI coding agents — one local memory shared by Claude Code, OpenAI Codex, Cursor, Qwen Code, and every MCP client.

Cairntir is an open-source, local-first memory MCP server. It preserves project decisions, facts, outcomes, and unfinished work across chats and across coding agents, so a new session can recover the real context instead of asking you to explain the project again.

Release candidate: Cairntir 1.9.0 · Changelog · Acceptance record

Latest published: Cairntir 1.8.0 · PyPI

PyPI version PyPI downloads Python 3.11+ CI License: MIT MCP compatible

Why Cairntir exists

AI coding assistants start each session cold. They forget architectural decisions, repeat failed approaches, and lose the reason behind unusual code. Static instruction files help with rules, but they are not searchable project memory and they do not record what happened.

Cairntir gives coding agents durable, cross-session memory in a SQLite database you own. Writes remain verbatim. Every memory carries provenance. Retrieval is budgeted so the agent receives complete evidence it can use, not a flood of truncated context.

The result is simple: reopen a project weeks later and walk into a lit room.

Install

pip install --upgrade cairntir
cairntir setup

Restart the configured agents, then verify the installation:

cairntir version
cairntir doctor

cairntir setup creates the local store, detects installed hosts, and connects every supported agent it can find. Missing CLIs are skipped rather than treated as failures. For one host or one project, use:

cairntir init --host codex
cairntir init --host all --user

New to MCP or terminal tools? Start with the plain-English setup guide.

What changed in 1.9.0

Cairntir 1.9.0 makes repair and learning evidence fail closed:

  • Bounded hotfix ledgers preserve cited recommendations, exact authority, one-attempt execution receipts, independent verification, rollback, and a terminal result without giving Cairntir execution power.
  • Reason-loop boundary validation rejects blank, cross-scope, mismatched, incomplete, or falsely idempotent adapter output before it can become evidence.
  • Verdict and surprise stay independent. Explicit delta survives through Outcome, replay, recipes, adapters, and all shipped CLI reasoning paths.
  • Discovery uses exact evidence pairs. Only uniquely bound predictions and observations in the same room count toward a human-reviewed candidate.

Read the complete 1.9.0 changelog and release acceptance record.

How persistent memory works

  1. Write. cairntir_remember stores a verbatim drawer with its project, topic, retrieval layer, source host, model, trust level, and optional code anchors.
  2. Store. One local SQLite + sqlite-vec database remains authoritative. The schema migrates forward with backup-first safety.
  3. Read. cairntir_handoff(wing) returns whole relevant drawers under a hard character budget. Semantic and structural recall handle deeper search.
  4. Close. Prediction-bound drawers record claim → expected outcome → actual outcome → surprise. Settlements append evidence instead of rewriting history.

Nothing is silently summarized at write time. A drawer is returned whole or named for deliberate retrieval; it is never cut in half to fill a context window.

Cross-session and cross-agent memory

Integration Support
Automatic host setup Claude Code, Cline, Codex CLI, Copilot CLI, Cursor, Gemini CLI, OpenCode, Qwen Code
Bounded transcript recovery Claude Code, Codex, Qwen Code
Generic MCP connection Claude Desktop, Windsurf, Zed, and other stdio MCP clients
Shared storage Every configured host reads and writes the same local store with per-write provenance

Cursor is a first-class configured host. Transcript recovery remains unsupported there because Cursor does not publish a stable transcript schema; Cairntir reports that limit instead of guessing at private data.

Core capabilities

Capability What it does
Budgeted handoff Restores recent decisions, open work, and anchored evidence without truncation
Semantic recall Searches the memory store by meaning with sqlite-vec
Structural recall Finds memories attached to the files a code change touches
Cross-wing recall Searches every project while preserving project provenance
Prediction tracking Scores whether recorded claims and expected outcomes held
Discovery Ledger Exposes evidence-backed patterns through a reviewed lifecycle
Bounded hotfix ledger Orders evidence, exact authority, one-attempt execution receipts, independent verification, and terminal settlement
Portable memory Exports and imports content-addressed, signed JSONL envelopes
Transcript recovery Recovers unfinished requests without automatic storage
Local-first operation Keeps the authoritative memory database on your machine

Common commands

cairntir handoff myproject
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
cairntir calibration --wing myproject
cairntir hotfix status --wing myproject --case-id hf-abc123
cairntir export memories.jsonl

For recovered transcript text, storage requires explicit consent:

cairntir recover --host codex --wing myproject --write 1

Context-budget evidence

On one real store measured 2026-08-02, the deterministic handoff used 44–52% fewer tokens than the older session-start path while returning complete drawers instead of truncated stubs:

Project session_start handoff Difference
cairntir 7,737 tokens 4,261 tokens −44%
detroit-clone 8,201 tokens 3,880 tokens −52%

These are dated measurements of two stores, not a universal benchmark. Run cairntir cost yourproject to measure your own corpus. CI separately enforces a LongMemEval R@5 regression floor; Cairntir does not reuse another project's benchmark as its own.

MCP server and library surface

The MCP server exposes 21 tools over stdio for exact memory, handoff, semantic and structural recall, audit, reasoning, calibration, discovery, and bounded hotfix records. Tool builders can use the stable Python Protocol surface with a custom backend; see the integration guide.

cairntir/
├── src/cairntir/
│   ├── contracts.py      # stable Store protocol
│   ├── memory/           # SQLite, sqlite-vec, belief scoring, consolidation
│   ├── mcp/              # host-neutral stdio server
│   ├── hotfix.py         # bounded append-only repair ledger
│   ├── reason/           # testable reasoning loop and ports
│   └── cli.py            # cairntir setup | init | handoff | recover | recall | replay | hotfix | doctor | export | import
├── tests/                # unit, contract, property, integration, evaluation
├── docs/                 # guides, architecture, recipes, release evidence
└── plans/                # live plans and dated decision history

Recipes

Recipes combine memory and the three core reasoning skills without expanding the primitive skill set:

  • Finalization Mode — finish a roadmap against frozen acceptance criteria and bounded repair rounds.
  • Bounded Hotfix — compare cited repair paths, bind one attempt to exact authority, independently verify it, and stop.
  • CodeGlass — turn unfamiliar code into durable, evidence-cited understanding.
  • Decision Replay — revisit a past prediction and record what reality taught you.
  • Signal Reader — convert AI news analysis into falsifiable, longitudinal evidence.

Cairntir compared with static memory files

Cairntir CLAUDE.md / rules files
Persistent across sessions Yes Yes
Shared across coding agents Yes Only when every host reads the same file
Semantic and structural search Yes No
Verbatim provenance Yes Manual
Outcome and calibration tracking Yes No
Automatic context budgeting Yes No
Local and inspectable Yes Yes

Rules files remain useful for instructions. Cairntir complements them with searchable evidence and history; it does not replace project policy.

Documentation

Name and principles

Cairntir combines cairn, a stack of stones marking a path, with palantír, a seeing-stone across time and distance. Pronounced CAIRN-teer.

The project is MIT-licensed, local-first, append-only where history matters, and built without telemetry. Read ETHOS.md and CONTRIBUTING.md before contributing.

A stack of stones that sees across time.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cairntir-1.9.0.tar.gz (893.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cairntir-1.9.0-py3-none-any.whl (250.7 kB view details)

Uploaded Python 3

File details

Details for the file cairntir-1.9.0.tar.gz.

File metadata

  • Download URL: cairntir-1.9.0.tar.gz
  • Upload date:
  • Size: 893.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cairntir-1.9.0.tar.gz
Algorithm Hash digest
SHA256 2cb1d001828cc85a90395f12d4c5ef0e84fbcf108ea487b3f78ccf5a4c37cdda
MD5 6bd04657de920ae84afcd45a20e54b9f
BLAKE2b-256 1203f0c178db54da65f99066aac115c568a2990e44b1b47166a8c05564865959

See more details on using hashes here.

Provenance

The following attestation bundles were made for cairntir-1.9.0.tar.gz:

Publisher: release.yml on pnmcguire480/cairntir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cairntir-1.9.0-py3-none-any.whl.

File metadata

  • Download URL: cairntir-1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 250.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cairntir-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 539bd2a5296515d2313516830108236de067829d45b4d317906b83e5a1efc900
MD5 3b0f7fe4010b803fe8a913be7ddf6abd
BLAKE2b-256 5893d51538776852e928999e4a4fc0ea9cbb70a09190545b69d0ecbe831aefc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cairntir-1.9.0-py3-none-any.whl:

Publisher: release.yml on pnmcguire480/cairntir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.12.3

2 files

1.12.2

2 files

1.12.1

2 files

1.11.0

2 files

1.10.0

2 files

This release

1.9.0 This release

2 files

1.8.0

2 files

1.7.1

2 files

1.7.0

2 files

1.6.2

2 files

1.6.1

2 files

1.6.0

2 files

1.5.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.2

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page