CONTINUUM
CONTINUUM: Verifiable semantic recovery for long-running AI agents. Semantic checkpoints (not conversation dumps), an idempotent action ledger that refuses duplicate side effects, and a hash-chained tamper-evident event log, all exposed as a deny-by-default MCP server. Framework-agnostic, Python 3.11+.
Documentation
CONTINUUM: Verifiable semantic recovery for long-running AI agents.
Semantic checkpoints (not conversation dumps), an idempotent action ledger
that refuses duplicate side effects, and a hash-chained tamper-evident event
log, all exposed as a deny-by-default MCP server. Framework-agnostic,
Python 3.11+.
If CONTINUUM helps your agents recover, please star the repo. It helps others discover it and keeps good first issues coming.
English | | | | |
Contents
Why · Quick Start · How it works · Where CONTINUUM sits · Features · Security Extension · Empirical Verification · MCP Integration · Framework Integration · Core Concepts · Architecture · API and CLI · Roadmap · What CONTINUUM Is Not · Related work · Status and limitations · Contributing · License
Why
Modern AI agents run long tasks (hundreds of LLM calls, tool invocations, file and database writes). When they crash, the usual response is to replay everything from scratch, which duplicates work, duplicates side effects, wastes tokens, and loses decisions.
CONTINUUM asks a narrower, harder question: can an agent resume from a compact semantic representation of its task state while independently verifying that state is still valid in the current environment? Its differentiator is three-part:
- Semantic checkpoints: a compact, versioned representation of what the agent needs to continue, not a conversation dump.
- Independent environment revalidation: every checkpoint component is verified against the current environment before resume, with staleness propagating through the dependency graph.
- Provenance-aware state: every fact traces to its origin, so agent-reported progress is never self-certifying.
Quick Start
Published to PyPI as `continuum-agent` 0.1.0 — `pip install continuum-agent` (`pip install continuum-agent==0.1.0` to pin). Release tags additionally ship built wheels attached to GitHub Releases.
Zero-setup paths (no clone, no install, nothing published anywhere):
| Path | How |
|---|---|
| Install from PyPI | `pip install continuum-agent==0.1.0` — then `continuum --help` |
| Watch crash recovery happen end to end | `docker run --rm ghcr.io/cyrax321/continuum` |
| Use the CLI through Docker | `docker run --rm ghcr.io/cyrax321/continuum continuum --help` |
| Run the CLI without cloning | `uvx --from git+https://github.com/Cyrax321/CONTINUUM.git continuum --help` |
| Windows PowerShell (from a clone) | `powershell -ExecutionPolicy Bypass -File .\try-it.ps1` or `powershell -ExecutionPolicy Bypass -File .\try-it.ps1 cli --help` |
| Full dev environment in the browser |  |
The Docker image is published to GHCR by CI on every push to `main` and every release tag (`.github/workflows/docker-publish.yml`). The Codespace is defined in `.devcontainer/`.
git clone https://github.com/Cyrax321/CONTINUUM.git
cd CONTINUUM
uv venv && source .venv/bin/activate # macOS / Linux; Windows: .venv\Scripts\activate
# Contributors (recommended): library + CLI + all test tooling + every adapter
uv pip install -e ".[dev]"
# Or pick only what you need: . (minimal), [mcp], [otel], [langgraph],
# [openai], [langchain], [attest], [postgres]
# Or skip the clone entirely:
uv pip install git+https://github.com/Cyrax321/CONTINUUM.git
uv pip install "continuum-agent[mcp] @ git+https://github.com/Cyrax321/CONTINUUM.git"> pip fallback: replace `uv pip install` with `pip install` in every command above.
Verify:
continuum --help # CLI entrypoint
continuum-mcp --help # MCP server entrypoint (needs [mcp] or [dev])
pytest -q # ~1,380 collected (exact count and skips vary by environment)
ruff check src/ tests/ examples/ && ruff format --check src/ tests/ examples/
mypy src/continuum # the three gates CI enforcesThe core library has one runtime dependency (`pydantic>=2.7`); everything else is opt-in. The full package map, extras matrix, Postgres test setup, and per-command verification are in references/install.md.
Wire a coding agent in two minutes
For Claude Code, Gemini CLI, or Codex, you do not write Python and do not need a prompt file:
continuum start my-task --goal "What the agent should do"
continuum hooks install claude-code --with-gate # also: gemini, codexFrom then on every file the agent writes is captured as hash-chained evidence, its session starts with an automatic status briefing, unclaimed side effects registered in `.continuum/gate.json` are refused before they fire, and a fresh session after any crash resumes with executable next steps. No CLAUDE.md required.
Minimal library example, record and recover:
from continuum import EventType, Run, SQLiteStorage, project
store = SQLiteStorage("agent.db")
store.create_run(Run(run_id="run_4821", goal="Analyze 10,000 documents"))
store.append_event("run_4821", EventType.RUN_STARTED, {"goal": "Analyze 10,000 documents", "total": 10_000})
for i, doc in enumerate(documents):
analyze(doc)
store.append_event("run_4821", EventType.WORK_COMPLETED, {"doc": i})
# After a crash, a new process picks up exactly where it stopped:
state = project("run_4821", store.read_events("run_4821"))
print(state.progress.completed) # already done, not repeated
print(store.verify_events("run_4821").ok) # True, chain intact after the crashRun the proof yourself:
python examples/crash_recovery_agent.py # real process kill, real side effect
python examples/context_compaction.py # transcript lost, checkpoint survives
python examples/model_switch.py # Model A dies, Model B resumes safely
python scripts/mcp_smoke.py # real subprocess, real JSON-RPC trafficThe `e2e-autonomy-test/` kit scripts a real invoice-batch task, a hard-kill mid-run, and a fresh resume session, then scores the outbox, ledger, and event chain out of band. Run 1 scored 7/7 mechanics against a real Claude Code session. Full walkthrough in references/e2e.md.
How it works
CONTINUUM separates LLM context (temporary) from durable task state (permanent). Instead of saving conversation history, it constructs a semantic checkpoint, the minimum verified information required to continue.
The detailed explanation, the projection model, and the recovery context are in references/architecture.md.
Where CONTINUUM sits
Four concerns overlap in every long-running agent. CONTINUUM owns only the last one and touches the other three through explicit seams. No competitor is named and no claim is made without a shipped module or a published suite that already prints it.
| Layer | Answers | How it connects (shipped modules or published output) |
|---|---|---|
| Harness | How does the agent call tools and make progress toward a goal? | Outside CONTINUUM. Wiring points ship in `src/continuum/adapters/generic.py` (`GenericAgentAdapter`), `src/continuum/adapters/thin.py` (CrewAI, AutoGen, Pydantic AI hooks), `src/continuum/mcp/server.py` (MCP stdio), `src/continuum/hooks.py` and `src/continuum/clienthooks.py` (coding-CLI lifecycle hooks), `src/continuum/gateway.py` (enforcing HTTP proxy for any language), and `src/continuum/otel.py` (OpenTelemetry bridge). Recipes are in `docs/recipes/` and `references/adapters.md`. |
| Durable execution | What happened before a crash and what can be replayed without losing work? | Hash-chained event log `src/continuum/events.py` with `verify()` and `trusted_through`, durable storage `src/continuum/storage/sqlite.py` (WAL, `synchronous=FULL`, schema v6) and `src/continuum/storage/postgres.py` plus `src/continuum/storage/migrations.py`, policy-driven checkpoints `src/continuum/checkpoint/manager.py` and `src/continuum/checkpoint/policy.py` that replay the gap on `restore()`. Walkthrough is in `docs/recovery_walkthrough.md` (output of `examples/recovery_walkthrough.py`). |
| Control plane | Which run is active, who may act on it, and where does output go? | Run registry and parent/child hierarchy `src/continuum/storage/` and `src/continuum/recovery/family.py` (`continuum tree`), allowlist authz `src/continuum/mcp/authz.py` (`CONTINUUM_MCP_MUTATING_CLIENTS` / `CONTINUUM_MCP_TOKEN`), presentation surfaces `src/continuum/dashboard/app.py` and `src/continuum/serve/server.py`, CLI `src/continuum/cli/main.py` (`continuum runs`, `continuum tree`, `continuum health`). |
| Verification substrate | Given the checkpoint at time T and the world as it is now, is it still safe and correct to continue? | `src/continuum/state/validator.py` (staleness `dependency -> evidence -> finding -> decision` plus `PlanStep.depends_on`), `src/continuum/provenance_map.py` (`Origin` to `REQUIRES_REVIEW` until `REVIEW_CONFIRMED`), `src/continuum/actions/ledger.py` with `src/continuum/actions/idempotency.py` and `src/continuum/gate.py` / `src/continuum/gateway.py` (claim-before-fire, refuses duplicates, raises `UnknownSideEffect` for reconciliation), `src/continuum/replayguard.py` (portable guard), `src/continuum/pinning.py` and `src/continuum/replay_similarity.py` (replay correctness), `src/continuum/budgets.py` (retry caps), `src/continuum/recovery/engine.py` + `src/continuum/recovery/contract.py` + `src/continuum/recovery/planner.py` + `src/continuum/recovery/observations.py` (max-severity `RESUME # records REVIEW_CONFIRMED, then re-assesses |
continuum resume # now reports RESUME
Over MCP the equivalent is the `continuum_confirm` tool followed by `continuum_resume`. Confirmation is a one-time, human-attested event: the escape hatch for the self-certification safety, so an externally-driven run is never permanently stuck.
## Core Concepts
The deep reference for each concept lives in [references/concepts.md](references/concepts.md).
- **Semantic Checkpoints** - a compact, versioned representation of what the agent needs to continue.
- **State Validation** - every component independently verified; staleness propagates through the dependency graph.
- **Idempotent Action Ledger** - external side effects tracked and de-duplicated; uncertain outcomes raise instead of silently retrying.
- **Recovery Modes** - `RESUME`, `REPAIR_AND_RESUME`, `ROLLBACK`, `WAIT`, `REQUEST_HUMAN`, `ABORT` (plus `REPLAN`).
- **Recovery Contract** - a deterministic, integrity-sealed, gated next action.
## Architecture
CONTINUUM is organised around one invariant: **every fact carries its origin, and trust is earned, never assumed.** Why this matters for a startup: an agent that runs for weeks must not lose work when its context is lost, and it must not waste tokens, cost, or fire a tool twice.
### System at a glance — universal adapter, one log, any harness
Any harness plugs into the same hash chained log. The same run can be written by Claude Code, resumed by LangGraph, inspected by the CLI, and approved on the dashboard. No framework cooperation is required.Claude Code ─┐
Gemini CLI ──┤
Codex ───────┤
LangGraph ───┼── 5 seams ──► One durable log ──► Recovery + Dashboard + CLI
LangChain ───┤ (hash chained, (sealed contract,
OpenAI SDK ──┤ provenance tagged, verify, health,
CrewAI ──────┤ exactly once) family)
Any HTTP ────┤
Any OTel app ┘
Seams: 1 In-process 2 MCP 3 CLI hooks 4 Gateway 5 OTel
### The three guarantees (the demo proves each one)
1. **No self-certification.** Agent reported state is `EXTERNAL_AGENT` and degrades to `REQUIRES_REVIEW` until a human `REVIEW_CONFIRMED`. Only trusted writers produce `DETERMINISTIC` state.
2. **Side effects require claims.** Every external effect is claimed in an idempotent ledger before it fires. Unclaimed effects are blocked at the boundary, duplicates are refused, uncertain outcomes raise for reconciliation.
3. **Recovery verifies against reality.** Resume checks file digests, dependency versions, and model identity before saying safe. Staleness propagates `dependency -> evidence -> finding -> decision` plus `PlanStep.depends_on` so only affected steps repair.
### Five integration seams
| Seam | How to connect | What it gives you |
|:--|:--|:--|
| 1 In-process | `GenericAgentAdapter.intercept_action(...)` and `wrap_tool(key_fn=...)` on LangChain, LangGraph, OpenAI Agents SDK | Python frameworks, trusted writes |
| 2 MCP server | `continuum-mcp` 12 tools over stdio (`continuum_record_progress`, `continuum_intercept_action`, `continuum_complete_action`, etc.) | Any MCP capable client, 3 read only + 8 mutating, allowlist `CONTINUUM_MCP_MUTATING_CLIENTS` |
| 3 CLI lifecycle hooks | `continuum hooks install claude-code --with-gate` also `gemini` and `codex` | Coding CLIs: `SessionStart briefing`, `PostToolUse observe`, `PreToolUse gate` — no CLAUDE.md needed |
| 4 Enforcing HTTP gateway | `continuum gateway --port 8765` with `.continuum/gateway.json` | Any language, any outbound HTTP must have a claim, gateway settles from real status code |
| 5 OpenTelemetry bridge | `make_span_processor(storage)` | Any traced app, spans become `TOOL_COMPLETED` evidence |
Thin hook surfaces for CrewAI, AutoGen, Pydantic AI live in `adapters/thin.py` with no SDK required.
### Enforcement pipeline — why no duplicate and no invalid call
The gate to observe pipeline closes the gap at the harness boundary. This is what saves tokens and cost and blocks invalid tool calls.PreToolUse hook PostToolUse hook
| |
v v
continuum gate continuum observe
| -- no claim? DENY (exit 2) | -- TOOL_COMPLETED event: |
|---|---|
| + instructions to claim | path, bytes, sha256 on disk now |
| -- live claim? ALLOW | -- disk checked status: |
| verified / changed / missing |
v
agent performs effect
|
v
continuum_complete_action (settled from reality, not from report)
|
v
ledger marked COMPLETED — next replay returns cached result, not a second fire
Unknown host is denied fail closed, not an open relay. Shell `Bash/curl` is the documented v1 blind spot.
### Recovery decision tree — weeks until done, correct and exactly
The engine takes the most cautious signal, so safety never loses to convenience.RESUME # semantic state
continuum validate --env dataset=v4 # validate, read-only
continuum resume --env dataset=v4 # recovery decision + contract + next steps
continuum checkpoint # force a checkpoint, mutates
continuum actions # external side effects
continuum reconcile # settle uncertain effects with probes
continuum complete # close a run as done, from the keyboard
continuum verify # re-audit the event hash chain
continuum budget # retry-budget usage per action type
continuum compact # archive pre-anchor log prefix
continuum tree # show parent + children with recovery states
continuum attest --key signer.pem # sign the chain head for an external verifier
All wiring is host-side; the model's cooperation is optional:continuum hooks install claude-code --with-gate # coding CLIs: evidence, briefing, gate
continuum gateway --port 8765 # enforcing HTTP proxy for everything else
provider.add_span_processor(continuum.otel.make_span_processor(storage)) # OTel to evidence
continuum-mcp # anything MCP-capable: the eleven-tool server
continuum briefing # session-start context injection
continuum budget # retry-budget usage report
continuum tree # multi-agent hierarchy view
Optional registries live beside your code and are data, not code: `.continuum/gate.json` (side-effect tools + stable-key templates), `.continuum/reconcilers.json` (probes that check external systems), `.continuum/gateway.json` (upstream routes).
Every command accepts `--json`, and read-only commands never write, so they are safe against a live database while an agent is mid-run. Exit codes are a safety contract (only a verified-safe run exits 0). Full command list, exit-code table, and state-diff output in [references/cli.md](references/cli.md).
## Roadmap
| Phase | Component | Status |
|:-----:|:--|:--|
| 1-11 | Data models, semantic state, persistence, checkpointing, validation, action ledger, recovery engine, CLI, crash-recovery examples, environment snapshots/diffs, framework adapters | Complete |
| 12 | Benchmark suite (CONTINUUM-Bench) | Complete (minimal harness) |
| 13 | Cloud API (FastAPI + PostgreSQL) | Partial: the PostgreSQL storage backend and the HTTP sidecar transport (`continuum serve --transport http`) are shipped and CI-tested; the hosted multi-tenant service is not started |
| 14 | Dashboard | Complete (`continuum dashboard`) |
| 15+ | Enforced durability: observation hooks, gate, session briefing, reconciler probes, enforcing gateway, OTel bridge, action index, executable guidance, multi-client installers, semantic replay detection, version pinning, retry budgets, log compaction, HITL surface, fork semantics, informed retry, multi-agent aggregation | Complete (see issue #213) |
| Next | Months-scale durability plane: milestone-anchored plans (#312), structured attempt memory (#313), atomic dual-state rewind (#292), public recovery-correctness benchmark (#293), webhook-out notifications (#305) | Planned (draft spec in [docs/UPGRADE_SPEC.md](docs/UPGRADE_SPEC.md)) |
Beyond the original plan: the MCP server, MCP authorization and caller-authentication layers, provenance and anti-self-certification, community files, schema versioning with forward migrations, a bounded recovery context, consumed-grant tracking, Ed25519 event-chain attestation, the native LangGraph checkpointer, and wheel artifacts on every push to `main` are shipped. See [STATUS.md](STATUS.md) for the verified-vs-believed breakdown and open correctness bugs.
## What CONTINUUM Is Not
| Not this | This instead |
|:--|:--|
| An LLM | A reliability layer for agents that use LLMs |
| An agent framework | A recovery layer that plugs into any framework |
| A vector database | Structured semantic state, not embeddings |
| A RAG system | Verified checkpoints, not retrieval-augmented memory |
| A workflow engine | A recovery layer, not an orchestrator |
The core abstraction: `semantic state + environment validation + action reconciliation = safe recovery`.
## Related work
CONTINUUM sits at the overlap of durable execution, idempotent side-effect tracking, and crash recovery for LLM agents. The closest neighbors are machine-checked resume contracts (Khan 2026), agentic transaction processing with constraint-gated admission (Mnemosyne 2026), checkpoint-rollback attack analysis (ACRFence 2026), and design-level prompt-injection defense (CaMeL 2025). The full annotated list, foundations, and citation audit are in [references/related-work.md](references/related-work.md).
## Status and limitations
- **Tested**: 1,360 passed + 23 skipped in a full run at the 2026-08-24 audit of this tree; CI enforces the suite on Python 3.11, 3.12, and 3.13, and counts vary by platform and optional services such as Postgres (see [STATUS.md](STATUS.md)). The MCP surface has also been audited adversarially over the live protocol; see [test.md](test.md).
- **On PyPI as `continuum-agent` 0.1.0** (`pip install continuum-agent`; clone still works via `pip install .` see Quick Start).
- **MCP caller authentication is opt-in per deployment.** When `CONTINUUM_MCP_TOKEN` is set, the server refuses every mutating tool unless the caller presents that shared secret in the `initialize` handshake's `_meta.authToken`; per-caller secrets are available via `CONTINUUM_MCP_CLIENT_TOKENS` (`name:secret` pairs). Without any token configured, authorization is by declared identity only (the historical default, preserved for local single-user use).
- **Confirming self-reported state over MCP requires a separate secret.** `continuum_confirm` refuses every caller until the operator sets `CONTINUUM_MCP_CONFIRM_TOKEN`, because an agent allowed to record progress must not also be able to confirm it. The default path stays human-driven: run `continuum confirm ` on the host.
- **Unbuilt components**: Cloud API (Phase 13).
- **Shell command enforcement gap**: the gate enforces claims for structured tool calls but cannot see inside Bash/curl commands. Documented as v1 scope refusal.
- **Framework adapters remain experimental.** All three framework adapters now carry live-model soft-resume and hard-crash proofs (OpenRouter, `gpt-4o-mini`), including the crash contract that blocks resume on an uncertain side effect, and now have crash-and-resume verification tests achieving parity with the generic facade (Refs #285). Prefer `GenericAgentAdapter` for production recovery.
- **Agent/MCP runs need an explicit confirm before auto-resume.** Externally-reported state is `REQUIRES_REVIEW`, so `continuum resume` returns `request_human` until a human confirms. By design, not a bug; see [Framework Integration](#framework-integration).
- **e2e autonomy test series** (issue [#6](https://github.com/Cyrax321/CONTINUUM/issues/6)): three full Claude Code runs scored 7/7 mechanics with unprompted recovery behavior observed. Further iterations across diverse prompt styles remain open.
## About
In early 2026 I saw long running agents fail on recovery, not reasoning. Checkpoints were treated as proof to continue, not evidence to verify. Surveying Temporal, LangGraph, ACRFence 2603.20625 and self conditioning 2509.09677, I found the gap was a portable verification substrate that asks, given the state at time T and the world as it is now, is it still safe to continue.
Over three weeks I built CONTINUUM from one invariant, every fact carries its origin. The result is a hash chained log with `verify()`, a ledger with stable key deduplication, a gate and gateway that block unclaimed effects, and a recovery engine that seals a contract. Five seams expose the same log to Claude Code, LangGraph, LangChain, OpenAI, HTTP and OpenTelemetry. Validated with real kills and 1380 tests, it prints `0 duplicates` where naive replay prints `50`.
CONTINUUM was created by **Anandhu P Shaji** ([@Cyrax321](https://github.com/Cyrax321) · [LinkedIn](https://www.linkedin.com/in/anandhupshaji/)) and is maintained by the original creator. It is open source under the [Apache-2.0](LICENSE) license. Community contributions are welcome via [CONTRIBUTING.md](CONTRIBUTING.md) and are credited in [AUTHORS.md](AUTHORS.md) and [graphs/contributors](https://github.com/Cyrax321/CONTINUUM/graphs/contributors).
## Contributing
This project is open source under Apache 2.0 and deliberately built to be extended: by researchers validating the recovery semantics, by engineers porting the ledger or MCP server to other frameworks or languages, and by anyone turning the planned roadmap into reality. A good place to start is the `good first issue` label on the [issue tracker](https://github.com/Cyrax321/CONTINUUM/issues), or the open correctness bugs listed in STATUS.md.
Open an issue before submitting large PRs. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contribution guide, including the [Code of Conduct](CODE_OF_CONDUCT.md).
### Contributors
## Sponsor
If CONTINUUM helps your agents recover reliably, consider sponsoring to support long term maintenance.
— GitHub Sponsors, or add FUNDING.yml custom link if you prefer another platform.
## License
Apache 2.0 - see [LICENSE](LICENSE).
---
Deep reference material:
- [references/install.md](references/install.md) - prerequisites, install levels, package map, verification
- [references/concepts.md](references/concepts.md) - semantic checkpoints, validation, ledger, recovery modes, contract
- [references/architecture.md](references/architecture.md) - data model, event log, projection, storage, checkpointing, recovery engine, security
- [references/adapters.md](references/adapters.md) - framework adapter usage and live-model validation results
- [references/api.md](references/api.md) - Python and adapter API
- [references/cli.md](references/cli.md) - full CLI command list, exit codes, state diff
- [references/mcp.md](references/mcp.md) - MCP server status, verification, open questions
- [references/bench.md](references/bench.md) - CONTINUUM-Bench design
- [references/quickstart.md](references/quickstart.md) - install, examples, the proof scripts
- [references/e2e.md](references/e2e.md) - end to end autonomy test walkthrough
- [references/testing.md](references/testing.md) - test suite layout and conventions
- [references/related-work.md](references/related-work.md) - annotated related work and citation auditFrequently asked questions
What is CONTINUUM?
CONTINUUM is CONTINUUM: Verifiable semantic recovery for long-running AI agents. Semantic checkpoints (not conversation dumps), an idempotent action ledger that refuses duplicate side effects, and a hash-chained tamper-evident event log, all exposed as a deny-by-default MCP server. Framework-agnostic, Python 3.11+.
How do I install CONTINUUM?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is CONTINUUM open source?
Yes — it is hosted on GitHub at https://github.com/Cyrax321/CONTINUUM and has 26 stars.
Related MCP tools
Open-source coding agent memory. Records issues, attempts, fixes and decisions, then warns your agent before it repeats an approach that already failed. Native MCP server for Claude Code, Cursor, Antigravity and Codex. 100% local, no cloud, no telemetry. MIT.
AI-powered OSINT agent with interactive REPL, MCP server, and CLI. 19 tools. Works with Claude, GPT-4, or local models. For authorized security research only.
Build effective agents using Model Context Protocol and simple workflow patterns Python-based implementation. Trusted by 7600+ developers.
An AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/gRPC APIs, exposing a unified endpoint with centralized discovery, guardrails and management. Optimizes Agent & Tool calling, and supports plugins.
Cut AI token costs 95%+ on code exploration. The leading MCP server for precise, symbol-level GitHub code retrieval via tree-sitter AST. Works with Claude Code, Cursor & any MCP client. 313B+ tokens saved.
Give your AI agents persistent, collective memory — with deduplicating absorb, supersession lineage, semantic search, and a graph UI. Speaks MCP.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP