continuum
<p align="center">
<img src="docs/logo.png" alt="Continuum" width="190" />
</p>
<h1 align="center">Continuum</h1>
<p align="center"><b>Cross-agent session continuity for AI coding agents.</b></p>
<p align="center">
<a href="https://anasnafees1802.github.io/continuum/">Website</a> ·
<a href="#install">Install</a> ·
<a href="https://github.com/AnasNafees1802/continuum/releases">Releases</a> ·
<a href="LICENSE">MIT</a>
</p>
Switch from Codex to Claude to Antigravity, or come back tomorrow after hitting a usage limit -
and your agent already knows *what you're building, where you are, and what's next.* No re-explaining.
<p align="center">
<a href="https://github.com/AnasNafees1802/continuum/blob/main/docs/continuum-promo.mp4">
<img src="docs/continuum-demo.gif" alt="Continuum demo" width="640" />
</a>
<br /><em>▶ Click for the full 35-second demo: the problem, the catch-up, and global memory.</em>
</p>
---
## The problem
You're building with one AI coding agent. You ship a couple of features, then the **daily limit
hits** and it stops. You switch to another agent, but it knows *nothing*. You burn time and tokens
re-explaining the project, and you lose the thread of *why* things were done a certain way.
Each agent keeps its own private history (Claude Code in `~/.claude/projects/`, others elsewhere),
and none of them share. The context is trapped in a silo.
## The solution
Continuum puts a small, structured **memory ledger inside your project** at `.aicontext/`, and
teaches *every* agent the same simple protocol:
> **Read it when you start. Update it before you stop.**
Because the memory lives in the repo, not in any one agent's silo, context survives the switch.
Any agent, any day, picks up exactly where the last one left off.
```
your-project/
├── .aicontext/ # 📦 the portable memory (gitignored, machine-local)
│ ├── STATE.md # ⭐ where we are right now, read this first
│ ├── TASKS.md # in progress / backlog / done
│ ├── DECISIONS.md # append-only: why we chose what we chose
│ ├── JOURNAL.md # append-only: per-session handoff log
│ ├── manifest.json # metadata (last agent, session count, …)
│ └── PROTOCOL.md # the full spec agents follow
├── CLAUDE.md # auto-loaded by each agent; carries the
├── AGENTS.md # "read/update .aicontext/" instruction block
├── .windsurfrules # (Codex/Antigravity/Windsurf/Gemini read AGENTS.md)
├── .claude/
│ ├── settings.local.json # ⚙️ Claude Code hooks (machine-local, gitignored)
│ └── skills/continuum/
│ ├── SKILL.md # full protocol as a Claude Code skill
│ └── bin/ # the `continuum` helper CLI (.ps1 + .sh)
```
## Which agents?
- **Claude Code**, via `CLAUDE.md` + the `continuum` skill.
- **Codex, Antigravity, Windsurf, Gemini CLI, Cursor, Zed, …**, via **`AGENTS.md`**, the
[emerging cross-agent standard](https://agents.md) read by 60k+ projects.
- **Windsurf**, also gets a native `.windsurfrules` for belt-and-suspenders coverage.
Any agent that reads one of those files participates automatically.
## Works over MCP too
Beyond native hooks, Continuum ships a **local MCP server** (`bin/continuum-mcp.py`, Python stdlib,
zero dependencies). Any MCP client — Cursor, Windsurf, Copilot, Claude Code, Codex — can pull the
project context and your global memory, and call tools directly: `continuum_catchup` (optionally
with a task, subsystem, symbol, or file-path query),
`continuum_status`, `continuum_remember`, `continuum_recall`, `continuum_forget`, `continuum_import`,
`continuum_save`, and `continuum_spec`. Ten read resources expose STATE, JOURNAL, TASKS, DECISIONS,
global memory, and the five structured spec files.
The global installer registers it automatically for **Claude Code** (user scope, so it shows in
`/mcp`), **Codex** (its `config.toml`), **Cursor**, **Windsurf**, and **Gemini**. Registration is
safe: it preserves every other key in your config, tolerates a byte-order mark, backs the file up
first, writes atomically, and refuses to touch a config it cannot parse. For any other MCP client,
add one block:
```json
{
"mcpServers": {
"continuum": {
"command": "python",
"args": ["~/.continuum/bin/continuum-mcp.py"]
}
}
}
```
No account, no cloud, no per-seat fee. The server is a thin adapter over the same helper the hooks use,
so hooks and MCP always agree.
**Coverage, stated honestly:** Claude Code, Codex, Cursor, Windsurf, and Gemini run local stdio MCP
servers, so they get Continuum over MCP *and* via native hooks / `AGENTS.md`. Antigravity gets a
global Agent Skill plus the `AGENTS.md` honor-protocol fallback.
ChatGPT's connectors are remote-HTTP only and cannot launch a local server, so Continuum reaches it
through `AGENTS.md` and web bundles rather than MCP. One ledger, reached whichever way each tool allows.
## Structured project context
Agents don't just need *where you left off*; they need *what to build against*. Run `continuum spec init`
to seed `.aicontext/spec/` with five plain-markdown files you own and version in git:
- `features.md` — features and specs in plain language
- `data-models.md` — entities and fields, so the agent stops guessing your schema
- `business-rules.md` — the logic agents must honor and tests must assert
- `test-cases.md` — Given / When / Then acceptance criteria
- `design-tokens.md` — colors, typography, spacing for consistent UI
An agent reads it before building a feature with `continuum spec`, the `continuum_spec` MCP tool, or the
`continuum://spec/*` resources. Catch-up only *points* to the store so the briefing stays short. It's a
store any producer writes into — you, an agent, or another tool — not a second app to log into. This is
the local, versioned, no-account answer to hosted spec tools.
## 🧠 Global memory — tell one agent, every agent remembers
Continuum carries the **project**; it also carries **you**. Alongside the per-project ledger, it keeps a
small personal memory at `~/.continuum/memory/` — your **durable, cross-project preferences** — and
injects it into *every* agent, in *every* project, at session start.
```text
You (once, in any tool): "I don't like purple in my websites."
Agent: continuum remember "Avoid purple in web UIs" --scope web
…tomorrow, a different project, a different agent…
Agent (already knows): picks a non-purple palette, no reminder needed.
```
Either you say *"remember this,"* or the agent proposes it when it notices a standing preference (and
confirms first). It's plain, human-readable markdown you can read, edit, and delete — `continuum memory`
to list, `continuum forget <id>` to remove. Native memory in Claude/Codex/Gemini follows you inside *one*
vendor; this follows you across *all* of them, because it rides the same hook Continuum already installs
into every agent.
## Saves tokens, not just time
Continuum saves real money, not just typing:
- **No re-explaining.** Catch-up injects a bounded summary instead of requiring you to re-paste the project into every fresh session. Actual token use depends on the ledger and model.
- **No redone work.** A session killed by a usage limit is reconstructed, not repeated, which is the most expensive kind of waste there is.
- **Bounded context.** Catch-up gives STATE, recent JOURNAL and DECISIONS, in-progress TASKS, and global memory separate character budgets. A truncated section points to its full source. Compaction moves complete old entries into lossless archives.
- **Focused recall.** `continuum context --query "billing retry src/payments"` searches current tasks,
specs, decisions, journals, and archived history, then includes the five strongest matches with source
paths. Scoped preferences require stronger query matches; global preferences always remain.
- **Large spec trees.** The five standard files remain the entry points, but large repositories can
split supporting Markdown under `.aicontext/spec/<area>/`. Focused recall scans that tree recursively.
## Install
### 🤖 Easiest: let your AI agent install it
Paste this into Claude Code, Codex, Cursor, Gemini or any coding agent. It runs the installer for you (it will ask you to approve the command first, then you are done):
```text
Install "Continuum" globally on my machine. It's an open-source (MIT) tool that gives AI coding agents a shared memory so they keep context across sessions and tools: https://github.com/AnasNafees1802/continuum
1. Detect my operating system.
2. On Windows, run in PowerShell:
irm https://raw.githubusercontent.com/AnasNafees1802/continuum/main/bootstrap.ps1 | iex
On macOS or Linux, run in bash:
curl -fsSL https://raw.githubusercontent.com/AnasNafees1802/continuum/main/bootstrap.sh | bash
3. When it finishes, tell me which agents it set up and remind me to restart any open agent sessions.
Do not change anything else.
```
### ⚡ One line, no clone
Installs Continuum into **every AI agent on your machine, once**, applies to all your projects:
```powershell
# Windows / PowerShell
irm https://raw.githubusercontent.com/AnasNafees1802/continuum/main/bootstrap.ps1 | iex
```
```bash
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/AnasNafees1802/continuum/main/bootstrap.sh | bash
```
That downloads the repo to a temp folder, runs the global installer, and cleans up. Variations:
| Goal | Windows | macOS / Linux |
|------|---------|---------------|
| Force **all** known agents | `$env:CONTINUUM_ALL='1'; irm …/bootstrap.ps1 \| iex` | `curl -fsSL …/bootstrap.sh \| CONTINUUM_ALL=1 bash` |
| **Per-project** ledger in current dir | `$env:CONTINUUM_MODE='project'; irm …/bootstrap.ps1 \| iex` | `curl -fsSL …/bootstrap.sh \| CONTINUUM_MODE=project bash` |
> Piping a script from the internet to your shell runs remote code. That's standard for installers,
> but you should trust the source, read [`bootstrap.ps1`](bootstrap.ps1) / [`bootstrap.sh`](bootstrap.sh)
> first if you like. Prefer not to pipe? Use the clone method below.
---
### Or clone and run the installer yourself
```bash
git clone https://github.com/AnasNafees1802/continuum.git
cd continuum
```
#### Option A, Global: install once, for every agent (recommended)
Wires the Continuum protocol into each agent's **global** config so *every* project you open in
*any* agent follows it automatically (when that project has a `.aicontext/` folder). Run it once
from the cloned folder:
```powershell
# Windows / PowerShell (-ExecutionPolicy Bypass avoids the unsigned-script block)
powershell -ExecutionPolicy Bypass -File .\install-global.ps1 # detected agents only
powershell -ExecutionPolicy Bypass -File .\install-global.ps1 -All # force all known agents
```
```bash
# macOS / Linux
bash ./install-global.sh # detected agents only
ALL=1 bash ./install-global.sh # force all known agents
```
It installs the shared helper once to `~/.continuum/bin/`, then for each agent it detects writes the
protocol into that agent's global instruction file **and** wires its native hooks:
| Agent | Global instruction file | Hooks wired into |
|-------|-------------------------|------------------|
| Claude Code | `~/.claude/CLAUDE.md` + skill `~/.claude/skills/continuum/` | `~/.claude/settings.json` |
| Codex | `~/.codex/AGENTS.md` | `~/.codex/hooks.json` |
| Gemini CLI | `~/.gemini/GEMINI.md` | `~/.gemini/settings.json` |
| Antigravity | `~/.gemini/config/skills/continuum/` + `~/.gemini/AGENTS.md` fallback | n/a |
| Cursor | (User Rules / `AGENTS.md` in-repo) | `~/.cursor/hooks.json` |
| Windsurf | `~/.codeium/windsurf/memories/global_rules.md` | `~/.codeium/windsurf/hooks.json` |
Hook merges are idempotent and preserve any hooks you already have. After this, the only per-project
step is creating the `.aicontext/` ledger, which any agent will do for you on request (Claude
self-bootstraps; or run Option B).
#### Option B, Per-project: set up the ledger + adapter files in one repo
Run from the cloned folder, pointing at the project you want continuity for:
```powershell
# Windows / PowerShell
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Target C:\path\to\my-project
```
```bash
# macOS / Linux
bash ./install.sh /path/to/my-project
```
This creates `.aicontext/` and drops `CLAUDE.md` / `AGENTS.md` / `.windsurfrules` adapters in the repo
root. Useful when you *haven't* done the global install, or want the adapters committed for teammates.
> All installers are **idempotent**, re-run any time to refresh without touching accumulated context.
> The per-project installer takes `-Force` (PS) / `FORCE=1` (sh) to also reset the ledger.
## How it stays reliable
A memory ledger is only as good as the discipline that keeps it current. The naïve version -
"agent, please read this at start and update it before you stop", breaks in exactly the case
Continuum exists for: **when a usage limit or crash kills the session, there's no chance to write
the handoff.** So Continuum doesn't rely on remembering. It wires **native hooks** into every agent
that has them and uses a **shared helper CLI** for the bookkeeping:
- **Guaranteed catch-up**, a session-start hook injects `STATE.md` (plus recent journal + drift
notes) into context every session. Catching up stops being something the agent might forget.
- **Handoff before context loss**, a pre-compaction hook fires right as the context window is about
to compact and prompts the handoff *then*, while the detail still exists.
- **A gentle safety net, not a nag**, a stop hook reminds you *once per session* if you changed
files but never saved, or if you *committed* code but never recorded the decision behind it. Once,
never twice. (Keeps `TASKS.md`/`DECISIONS.md` honest too, not just `STATE.md`.)
- **Reconstruction for hard kills**, if a session ends with no handoff (limit/crash), the next
session detects the gap and `continuum import --from auto` rebuilds a draft handoff from the last
agent's own transcript **plus** a git-based view. The one moment a hook *can't* capture is
recovered after the fact, even across a tool switch (Codex → Claude, or back).
- **Never trust a stale ledger**, catch-up compares the saved git commit to `HEAD` and flags drift
("12 commits + uncommitted changes since last save"), so the agent verifies against `git` instead
of confidently briefing you from an out-of-date snapshot.
- **Grounded state**, point `continuum verify` at your own check (`verify --set "npm test"`) and it
stamps pass/fail against the commit. Catch-up then flags "STATE says done, but the last verified run
failed / was 3 commits ago", so a "done" claim nothing actually checked gets treated with suspicion.
- **Quarantined imports**, reconstructed transcript content is tagged `[unverified-import]` and treated
as untrusted data, not instructions, until confirmed, so scraped pages or tool output can't ride into
the ledger and get trusted by every future session.
- **Self-updating**, after a `git push` every install updates itself via a throttled (once/24h), background self-update, so fixes reach everyone with no manual reinstall. Opt out with `CONTINUUM_NO_AUTOUPDATE=1`.
- **Bounded cost**, `continuum save` keeps at most 20 journal entries, 100 decisions, and 50 completed
tasks active. Journal and decision files also have 128 KiB and 512 KiB ceilings, while retaining at
least 3 and 10 recent entries. Complete older entries move to `.aicontext/archive/`, where focused recall can still find them.
The helpers use PowerShell on Windows or Bash on macOS/Linux, plus Git. Bash manifest writes
require Python or jq; Bash hook installation and transcript reconstruction require Python.
The MCP server uses Python's standard library; safe Codex TOML registration requires Python 3.11+.
The helpers only do mechanics -
timestamps, `manifest.json`, git checks, transcript parsing, rotation. **The agent still writes the
actual prose**; that judgment isn't something to automate away.
### What's automated, per agent
| Agent | Catch-up (start) | Handoff prompt | Stop nudge | Transcript recon | Status |
|-------|:---:|:---:|:---:|:---:|:---:|
| Claude Code | ✅ `SessionStart` hook | ✅ `PreCompact` | ✅ `Stop` | ✅ native | ✅ verified |
| Codex | ✅ `SessionStart` hook | ✅ `PreCompact` | ✅ `Stop` | ✅ native (cwd-matched) | ✅ verified |
| Antigravity | ✅ skill + honor-protocol¹ |, |, | git-based² | ✅ verified |
| Gemini CLI | ✅ `SessionStart` hook | ✅ `PreCompress` |, | ✅ native | 🧪 beta |
| Cursor | ✅ `sessionStart` hook | ✅ `preCompact` | ✅ `stop` | git-based | 🧪 beta |
| Windsurf | ✅ first per-turn hook |, |, | git-based | 🧪 untested |
<sub>**Status** = has it been confirmed on a real session? ✅ verified · 🧪 not yet. ¹ Antigravity has no
Continuum hook integration, so catch-up runs through its Agent Skill or the honor-protocol fallback.
² Its transcripts are binary, so reconstruction uses the git floor.</sub>
> **Universal floor:** even where native hooks or transcript parsing aren't available, the
> **git-based reconstruction** (`--from git`, always included in `auto`) rebuilds "what changed" from
> `git log`/`git diff`, and the honor-protocol in each agent's instruction file (`AGENTS.md` /
> `GEMINI.md` / `CLAUDE.md` / rules) still drives read-at-start, save-before-stop. Continuity never
> fully fails, on any tool. Verified end-to-end on real Claude Code, Codex, and Antigravity sessions;
> Gemini/Cursor rely on the same mechanisms and the floor, pending a real-session pass.
## How it works in practice
1. **Day 1, Codex:** you build a feature. Before the limit hits, Codex updates `STATE.md` and
appends a `JOURNAL.md` entry: *"Built auth flow, left off at wiring the token refresh."*
2. **Day 1, later, Claude Code:** you open the project. Claude reads `.aicontext/STATE.md`, says
*"📍 Caught up: building the auth flow, next is token refresh,"* and continues, no re-explaining.
3. **Day 2, Antigravity:** same thing. Everyone shares one brain.
## Design choices
- **Gitignored by default**, `.aicontext/` is machine-local, not pushed. The adapter files *are*
committed, so the protocol travels with the repo and each clone re-inits its own local ledger.
(Want it shared with your team? Remove `.aicontext/` from `.gitignore` and commit it.)
- **Plain Markdown + JSON**, no service or proprietary storage. The ledger remains readable and editable without running the helpers.
- **`STATE.md` is living; `JOURNAL.md`/`DECISIONS.md` are historical**, so you always have both a
fast current snapshot and the exact active plus archived record. New entries go on top; old entries
move intact during compaction.
## Roadmap
### Reliability and validation
Run `python test/regression.py` (Python 3.11+) and `bash test/smoke.sh` from the checkout.
Regression tests use temporary homes and repositories, disable auto-update, and exercise both
Windows PowerShell and Bash when available. GitHub Actions runs on Windows, Linux, and macOS.
Platform-specific tests report skips explicitly.
Installers refuse malformed configuration rather than replacing it. Changed configuration is
backed up to `.continuum.bak` and written through a temporary file. TOML merges are parsed before
and after modification and checked for preservation of unrelated values. Unusual layouts such
as an inline `mcp_servers` object are left untouched with an error; use ordinary TOML tables.
CLI memory writes and ledger bookkeeping use a shared exclusive-create lock with a 10-second
wait limit. If a writer is killed, its `.write-lock` file can remain under `.aicontext/` or
`~/.continuum/memory/`; remove it only after checking that no writer is running, then retry.
These locks do not serialize direct edits made by editors or agents to Markdown files.
Catch-up budgets are 10,000 characters for STATE, 6,000 for recent JOURNAL, 3,000 for TASKS,
4,000 for recent DECISIONS, and 4,000 for global memory, plus labels and diagnostics. A query may
add up to 8,000 characters of matched history. These are character limits, not exact token counts;
full text remains available on demand. MCP resource reads are limited to 1 MiB per active file.
Stop reminders fingerprint Git metadata and one blob hash per changed or untracked file, excluding
the ledger itself. They do not build full binary diffs in memory. A failed verification returns a
nonzero exit status.
Automatic updates still trust the upstream `main` branch. For controlled installations, set
`CONTINUUM_NO_AUTOUPDATE=1` and update from a reviewed checkout. Signed releases and rollback
support remain future work; the tests do not certify every live client's hook integration.
### Planned work
- ✅ ~~Deterministic capture~~, shipped: native session-start / pre-compaction / stop hooks on Claude
Code, Codex, Gemini and Cursor (Windsurf via its per-turn hook).
- ✅ ~~History importer~~, shipped: `continuum import --from auto` reconstructs a missed handoff from the
last agent's transcript (Claude/Codex/Gemini native parsers) plus a universal git-based view.
- ✅ ~~Drift detection~~, shipped: catch-up flags commits/changes since the ledger was last saved.
- ✅ ~~One-line remote install~~, shipped (see [One line, no clone](#-one-line-no-clone-recommended)).
- **Native transcript parsers for Cursor/Windsurf** (SQLite `state.vscdb`), today they use git-based reconstruction.
- **Team mode**, optional shared (committed) ledger with conflict-resistant per-session journal files.
## Author
Built by **[Anas Nafees](https://www.linkedin.com/in/anas-nafees/)**.
Continuum is open source and contributions are welcome, open an issue or PR at
[github.com/AnasNafees1802/continuum](https://github.com/AnasNafees1802/continuum).
If it saves you from re-explaining your project to yet another agent, a ⭐ is appreciated.
## License
[MIT](LICENSE) © Anas Nafees, free to use, modify, and distribute. Use it everywhere.
TDQS
Scored across 8 tools
Each tool has a distinct focus: status reports ledger health/drift, catchup returns a session brief, remember/recall/forget handle global memory CRUD, save stamps a handoff, import reconstructs a crashed session, and spec reads structured project context. The only mild overlap is status vs catchup, both surfacing drift/gap warnings, but their descriptions clearly separate health-reporting from content-retrieval.
All tools share the consistent 'continuum_' prefix and lowercase snake_case form. The suffix mixes nouns (status, spec) with verbs (remember, recall, forget, save, import, catchup), which is a minor deviation but still highly readable and predictable.
Eight tools is well-scoped for a cross-agent memory/continuity server. Each tool maps to a distinct operation (read health, read brief, memory CRUD, handoff, import, spec) with no obvious redundancy or padding.
The surface covers the core lifecycle: reading status/brief/spec, storing/listing/removing global memory, saving handoffs, and reconstructing lost sessions. Minor gaps exist—no explicit edit/update for an existing memory and no tool to write spec files (read-only by design)—but agents can work around these.