Every AI agent gets its own computer that never forgets.
Cairn is an open-source engine that gives each AI agent a private Linux workspace. The agent can save its workspace at any moment, resume it days later on another server, or copy it to try several ideas at once. It runs on your own servers.
Status: early development. The latest release runs on your laptop (below) and on a single Linux server; expect breaking changes before 1.0. Workspaces run on gVisor: see docs/compatibility.md for the known differences from a regular Linux machine.
- Start: the agent gets its own private Linux computer, walled off from everything else.
- Save: at any moment, everything is saved, including programs that are still running.
- Resume or copy: pick up exactly where it stopped, even days later, or make copies to try several ideas at once.
See it: move a running agent to another server. A full save goes to object storage, the first server is wiped, and the second brings back the same process with its memory intact, in under 2 seconds.
How the pieces fit together, on one page: docs/architecture.md.
- Your coding agent picks up where it left off. Files, installed tools and the running app are saved when the agent stops. Tomorrow it continues instead of starting over.
- Try several fixes at once. Save before a risky step, make copies, let each try a different fix, and keep the winner.
- Every one of your users gets their own computer. Each user's agent runs walled off from everyone else, with a usage limit you set. Hitting the limit saves the work instead of losing it.
- Your assistant waits for your answer. When an agent needs an approval or a password, its computer is saved and switched off until you reply.
- Agents that stay inside your walls. Install it on your own servers, on ordinary virtual machines, and nothing leaves your network.
Needs Docker (Docker Desktop, OrbStack or colima on macOS; Docker Engine on Linux).
curl -fsSL https://raw.githubusercontent.com/AQLD/cairn/main/install.sh | sh # or: go install github.com/AQLD/cairn/cmd/cairn@latest
cairn up # engine in Docker with real gVisor workspaces (under a minute the first time)From a checkout of this repository, go run ./cmd/cairn up --build builds the engine image locally instead of pulling it.
On Linux with gVisor's runsc installed, sudo cairn up runs the engine straight on the host instead of in Docker: a background cairnd from next to the CLI, with its workspaces, saves, log and pid file in /var/lib/cairn-up/cairn. sudo cairn down and sudo cairn down --purge work the same way, and the client config goes to your own ~/.config/cairn. --docker keeps the engine in Docker; an engine already running in Docker stays there.
cairn up writes ~/.config/cairn/config.json, so the CLI and the Python SDK find the engine with nothing to set. Then:
ws=$(cairn create) # python:3.12-slim by default
cairn exec $ws -- sh -c 'nohup python3 -m http.server 8000 >/dev/null 2>&1 &'
cairn exec $ws -- sh -c 'echo hello > note.txt'
save=$(cairn save $ws --full) # files, memory and the running server; it keeps running
cairn exec $ws -- sh -c 'echo broken > note.txt'
cairn resume $save # rewind: note.txt says hello, the same server still runs
cairn copy $save --count 3 # three independent copies to try three ideascairn down stops the engine and pauses every workspace (their processes come back on cairn up); cairn down --purge deletes everything. The engine container is privileged because gVisor builds each sandbox's namespaces and cgroups. Workspaces run on gVisor's own kernel, so agent code never reaches your machine's kernel directly; a flaw that let code escape gVisor would land in that privileged container, which is root on Docker's VM (macOS) or on the machine itself (Docker Engine on Linux).
cd ~/code/my-project
cairn setup --projectcairn setup finds the coding agents on your machine (Claude Code, Codex, pi and Cursor) and connects each one: it installs the Cairn skill where the agent loads Agent Skills and registers cairn mcp where the agent speaks MCP (pi uses the skill and the CLI). With --project it also gives the repository its own workspace with the code pushed in, and adds a short Cairn section to AGENTS.md (Claude Code's CLAUDE.md imports it) telling the agent to run builds, tests and servers there, save before risky steps, and rewind instead of repairing by hand. Run it again any time; it only changes what is out of date.
Inside the project, . names its workspace and cairn run copies your edits in before running:
cairn run -- pytest -q # local edits, run in the workspace
cairn save . --full # what an agent does before a risky step
cairn log . -f # watch everything the agent runs
cairn doctor # what is wrong, and the command that fixes itSee docs/agents.md for each agent, the MCP tools and other MCP clients.
For working on Cairn itself there is also a host runtime (make run) that runs commands directly on your machine with no isolation and no full saves; use it only with code you trust.
One command on a Linux server with systemd and cgroup v2 (tested on Ubuntu 24.04; x86_64 or arm64) installs gVisor, the engine as a service and the CLI, then checks it by running a command in a workspace:
curl -fsSL https://raw.githubusercontent.com/AQLD/cairn/main/install.sh | sudo sh -s -- --serverEvery download is checked: Cairn's against the release's SHA256SUMS (and its signature, when cosign is installed), gVisor's against its published SHA-512. The engine listens on 127.0.0.1:7420; its token and flags are in /etc/cairn/cairnd.env, its data in /var/lib/cairn, its log in journalctl -u cairnd. The user who ran sudo can use cairn straight away.
- Upgrade: run the same command again. Settings, the token, workspaces and their running processes are kept (the engine pauses them while it restarts).
- Options:
--version v0.3.1,--listen 0.0.0.0:7420(then put TLS in front, or set--tls-cert/--tls-keyincairnd.env),--data DIR,--save-store s3://…,--template NAME=IMAGEorNAME=/path/rootfs.tarfor servers without registry access,--dry-runto see every step first. - Remove:
sudo cairn-uninstall.shkeeps workspaces and saves for a reinstall;--purgedeletes them too.
- Workspaces with CPU, memory and disk limits, started from templates or registry images
- Run commands (including background servers), read and write files and folders, network on or off
- Quick save (files) and full save (memory and running processes), with saves in a local folder or S3-compatible storage; saves of templated workspaces hold only what changed
- Resume, rewind and copy from any save; list the files a step changed (
cairn diff) - Old saves pruned by policy (the newest 20 and anything under 7 days kept), pinned saves kept for good (
cairn pin) - A warm pool for instant creates (
cairnd --warm N), and workspaces that share their template read-only where the host allows it (on by default;cairnd --shared-templates=falsegives each its own copy) - A volume that fills never loses a workspace's write: below a reserve, writes wait until there is room
- Outbound allow-lists per workspace (
cairn create --allow pypi.org --allow '*.github.com'): only those names and ranges are reachable - Secrets a workspace uses but never holds (
cairn secret set GITHUB_TOKEN --host github.com, thensecretson create): it gets a placeholder, swapped for the value only on requests to the secret's hosts, so no disk, save or copy carries it - The API over HTTPS (
cairnd --tls-cert --tls-key, renewed certificates picked up without a restart; clients trust a private CA withCAIRN_CA_CERT) - REST API, CLI, MCP server and Python SDK;
cairn setupconnects Claude Code, Codex, pi and Cursor - Signed releases with a bill of materials (docs/verify.md)
- Runs on a laptop with Docker (
cairn up), on a Linux server, or on Kubernetes (deploy/helm)
Not yet: usage limits per user and project, a TypeScript SDK. ROADMAP.md has the order.
What Cairn protects, from whom, and where it stops: docs/threat-model.md. Report vulnerabilities privately: SECURITY.md.
Everything Cairn must handle is written down as a tree of end-goal scenarios in spec/catalog.go, from "a coding agent picks up where it left off" down to "a flipped byte in a save is caught". make test runs them; docs/test-plan.md shows which pass, and ROADMAP.md ties each milestone to the scenarios that gate it.
Cairn is built in the open, and contributions will be welcome once the first release is out. Start with CONTRIBUTING.md, which explains the layout, the scenario-first workflow and the rules the engine must never break. We use the Developer Certificate of Origin instead of a contributor license agreement: sign off your commits with git commit -s.
Cairn is licensed under the Apache License 2.0.
Cairn is built by aqld.