Skip to main content

Context-io

Resume any coding session in a new AI agent for under 500 tokens — not the 20,000+ you'd burn replaying full history.

CI PyPI Python 3.10+ License: MIT

You already know this problem: you switch from Claude Code to Codex, or your session hits auto-compact, and the agent suddenly has no idea what you were doing. So you paste in three paragraphs of "here's what we've built so far," burn a few thousand tokens re-explaining it, and hope the summary is accurate.

Context-io writes your session's context to plain Markdown as you work, then hands a new agent a capped, ≤500-token snapshot instead of your full history — no LLM calls involved in generating it, just git and a few rules. And as of v0.1.0, you don't even need to remember to trigger it: commits and Claude Code's own session lifecycle do it for you.

See it for yourself

$ ctx save "set up FastAPI project skeleton" -d "routers/, models/, main.py"
Saved: set up FastAPI project skeleton

$ ctx save "added JWT auth middleware" -d "using python-jose, refresh token rotation"
Saved: added JWT auth middleware

$ ctx checkpoint "auth flow working end to end" --next "add rate limiting, write integration tests"
Checkpoint: auth flow working end to end

$ ctx handoff
── Context-io receipt ──────────────────
Handoff frame:  96 tokens (cap: 500)
Full log:       161 tokens
Savings:        40.4%
────────────────────────────────────────
Written to .context-io/context.current.md

That's a real run, not a mockup — and an early one. In a 500-entry stress test, the full log grew to ~143,000 tokens while the handoff frame stayed at 40 tokens: a 99.97% reduction, still comfortably under the cap. The longer the session, the better this gets.

Zero-effort capture

A git hook that needs no agent at all:

$ ctx hooks install
Installed git post-commit hook -> .git/hooks/post-commit
Every commit now lands in the session log automatically.

$ git commit -m "fix refresh-token bug"
[main 4f2a1c9] fix refresh-token bug
# ^ that commit alone just wrote an entry to .context-io/session.full.md

Claude Code hooks that remove the manual paste:

$ ctx claude-hooks --install
Wrote Claude Code hooks -> .claude/settings.local.json
SessionStart now auto-loads the handoff; PreCompact auto-checkpoints before compaction.

SessionStart means a brand-new session already has the handoff before you type anything. PreCompact means a checkpoint gets written the moment before Claude Code's own compaction would otherwise erase detail. Both commands merge into whatever hooks already exist — safe to run more than once, and won't touch other tools you have installed.

How it works

Three plain Markdown files, all under .context-io/:

File What's in it Size
session.full.md Every save/checkpoint, append-only Unbounded
session.checkpoints.md Milestones + "what's next" Small
context.current.md The handoff snapshot ≤500 tokens, enforced

Extraction is rule-based: git branch, diff, uncommitted files, file tree — never an LLM call. session.full.md and session.checkpoints.md are meant to be committed; they're project memory your teammates can read too, not just scratch output for an agent. context.current.md is regenerated every time, so ctx init gitignores it automatically — nobody has to figure that out by trial and error.

Install

pip install ctxio

Python 3.10+. Zero runtime dependencies — clipboard support and the hooks above shell out to tools already on your system instead of adding new ones.

CLI

ctx save "<summary>" -d "<detail>"       # append to the session log
ctx checkpoint "<summary>" --next "…"    # record a milestone
ctx handoff [--copy] [--cap N]           # build the capped snapshot
ctx status                               # token counts for all three files
ctx hooks install                        # git auto-capture on every commit
ctx claude-hooks --install [--shared]    # Claude Code SessionStart + PreCompact
ctx doctor                               # is everything actually wired up?

No ctx init required — the first save / checkpoint / handoff initializes everything for you.

Cross-agent sync (non-MCP tools)

```console $ ctx sync Created AGENTS.md Created CLAUDE.md ```

SessionStart/PreCompact hooks only help if you're in Claude Code. Most other tools — Cursor, Codex, Aider, Devin, Copilot, Gemini CLI, Windsurf — don't speak MCP, but nearly all of them do read AGENTS.md, the Linux Foundation-stewarded open standard for giving coding agents project context. ctx sync inserts one short, idempotent block into AGENTS.md and CLAUDE.md pointing at the live handoff — it does not dump the whole dynamic snapshot into them. Those files are meant to be stable, curated project context, not something that churns on every commit; .context-io/context.current.md is the one meant to change constantly. Creates either file if missing, and leaves any existing content in them completely untouched.

Agent integration (MCP)

python -m ctxio.mcp_server

Exposes ctx_save, ctx_checkpoint, ctx_handoff, ctx_status, and ctx_install_hooks over stdio — the last one means you can just tell your agent "set up automatic checkpointing" and it wires up both hooks above by itself. See examples/ for ready-to-paste Claude Code and Claude Desktop config.

When this isn't the right tool

If what you need is resuming a session by parsing that same tool's own transcript format across a dozen different agents, that's a different, and already fairly well-served, problem. Context-io doesn't try to compete on cross-tool format breadth. It's for people who want project memory that's plain text, git-native, human-readable, and works with any MCP-capable agent without needing to know that agent's private storage format at all.

Contributing

Issues and PRs welcome. The whole thing is a few hundred lines of stdlib-only Python, one file per concern:

  • ctxio/extract.py — git-derived context
  • ctxio/budget.py — token estimation + the hard cap
  • ctxio/store.py — the three-file store
  • ctxio/hooks.py — automatic capture (git + Claude Code)
  • ctxio/cli.py / ctxio/mcp_server.py — the two interfaces, one code path
pip install -e .
pytest

License

MIT

Metadata

Release files for ctxio 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctxio 0.1.1
File Size Uploaded Provenance Actions
ctxio-0.1.1.tar.gz 22.5 kB Without provenance Details for ctxio-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctxio 0.1.1
File Interpreter ABI Platform Actions
ctxio-0.1.1-py3-none-any.whl Python 3 none any Details for ctxio-0.1.1-py3-none-any.whl

Total release size: 42.4 kB

Release files / ctxio-0.1.1.tar.gz

Download URL ctxio-0.1.1.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
766c40934cc906d9a8d29af2b67884547b7aec3efe5b6d3a357d61709d417cf2
BLAKE2b-256 checksum
How to use checksums
529e8f7ba8bfbe6cc80cd17db648e9871482bde853a0194d61a4cfae707d0994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / ctxio-0.1.1-py3-none-any.whl

Download URL ctxio-0.1.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
006fd00318571c47e2c87b3da4cff67b440dc3585d99544ce52dac2c22ca78d9
BLAKE2b-256 checksum
How to use checksums
58ae1f242fc5578bb710aaeeebff5636ea6625b9e83e4de0126e4cd0e06d353a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for ctxio 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page