← Cope Labs

Developer Tooling

Cairn

Runtime signal capture and distillation for AI coding agents. Instruments your Python code, distills failure patterns, and feeds them into agent context so the next session knows what broke.

# install pip install cairn-ai # with margin-powered health analysis pip install cairn-ai[health]

The problem

AI coding agents start every session cold. They can read your code, but they don't know what failed last week, which patterns keep recurring, or whether the last fix held. The context window resets. Manual context documents go stale.

What Cairn does

Cairn captures structured signal from your running Python code and distills it into agent context that compounds over time:

Signal gets normalized into TruthRecords, distilled into named patterns, and injected into your agent's context before the next session.

code runs ↓ signal captured (pytest, sys.monitoring, AST, git) ↓ patterns distilled (clustered, named, confidence-decayed) ↓ agent context injected (MCP server or static markdown) ↓ agent writes better code → richer signal → repeat

Health analysis

With margin installed (pip install cairn-ai[health]), each pattern cluster gets:

Agent integration

Cairn exposes an MCP server with tools for Claude Code, Cline, or any MCP-compatible agent:

Zero-config pytest plugin. Auto-distillation via git hooks. Per-project SQLite stores. AGPL-3.0.