cairn
Hand off work between AI agent sessions without re-explaining it.
When a Claude Code session stops (usage limit, account switch, /clear, tomorrow), the next
session loses the reasoning: the goal, what was decided and why, what was tried and failed,
and what comes next. Git keeps the code, not the reasoning. cairn keeps it.
- Save in one command.
/cairn:handoff has the agent write a structured handoff while it
still has the context. cairn validates it, blocks secrets, and attaches git facts.
- Resume with no command. A
SessionStart hook injects the open handoff into the next
session, together with a drift report of what changed since it was written.
- One handoff per task. Handoffs are keyed by ticket (
PROJ-268), so parallel tasks in one
workspace never overwrite each other.
- Worktrees and pipelines included. List them in the handoff; cairn records their branch
and HEAD and warns when they moved or disappeared.
- Local and plain. Markdown files under
~/.cairn, mode 0600. No database, no LLM calls,
no network except an optional gh lookup of pull requests; Python standard library only.
Status: 0.2.1, early release, used daily by its author. The file format and commands
may still change before 1.0.
Contents
Install
Requirements: macOS or Linux, git 2.31+, python3 3.9+ (the one shipped with macOS works).
| You use | Install with | You get |
|---|
| Claude Code (recommended) | claude plugin marketplace add sdc-ren/cairn
claude plugin install cairn@sdc-ren | Skills /cairn:handoff, /cairn:resume, the hooks, and the CLI inside Claude |
| A terminal | pipx install cairn-handoff (or uv tool install cairn-handoff) | The cairn command everywhere |
| A terminal, nothing installed | uvx --from cairn-handoff cairn <command> or npx github:sdc-ren/cairn <command> | A one-off run, e.g. uvx --from cairn-handoff cairn list |
| Claude Code without the plugin | the terminal install, then cairn init | Skills /cairn-handoff, /cairn-resume |
| Codex, Cursor or another agent | the terminal install, then cairn init --agent agents-md | Instructions in AGENTS.md |
After installing the plugin, start a new Claude Code session. To try a local checkout instead,
use claude plugin marketplace add /path/to/cairn, or link its bin/cairn into your PATH.
Every route, npx included, runs the same Python code, so python3 3.9+ must be installed.
Quick start
- Save. Near the end of a session, in Claude Code:
/cairn:handoff
or just say "save context", "running out of quota", "lưu ngữ cảnh". The agent replies with
the handoff ID, for example saved 20261109-083012-proj-268.
- Resume. Open a new session in the same project, on any account. cairn lists the open
handoffs; mention the task ("continue PROJ-268",
/tf:build PROJ-268) and that handoff is
loaded, then the agent summarises the goal, what is done and the next step.
- Look around from a terminal:
cairn list # what is saved for this project
cairn show PROJ-268 # the full handoff
Skills (inside Claude Code)
| Skill | Plugin name | Without plugin | What it does |
|---|
| handoff | /cairn:handoff [title] | /cairn-handoff | The agent writes the handoff from the conversation and saves it in one turn. It passes the ticket as the task when it sees one, fixes anything cairn rejects (up to 3 tries), and replies in at most 2 lines. |
| resume | /cairn:resume [task|clean] | /cairn-resume | Continue a handoff. With a task, opens it. Without one: shows every saved handoff (open = not resumed yet, resumed = already continued, and when) and asks which one. clean lists the resumed ones, asks, then deletes them. |
Both skills also trigger from plain language in English or Vietnamese ("handoff", "save
context", "sắp hết quota"; "continue where we left off", "làm tiếp", "còn task nào đang dở").
Hooks run by themselves: