C context0

git-scoped session state

Your AI context follows your git branch.

Save where you left off. Resume in any AI tool — Claude Code, Cursor, Codex — on the same repo and branch, automatically.

What is context0?

AI coding sessions have no memory between tools. context0 stores compact checkpoints in local SQLite, scoped to your git repo and branch. With MCP configured, the agent saves and resumes automatically — no commands to run, nothing to learn.

Automatic

Say “save context” or “I’m switching” — the agent does the rest. No commands to memorize.

Local

No cloud, no account, no signup. Data stays on your machine at ~/.context0/context0.db.

Scoped

Context key is repo_root + branch — each branch stays completely isolated.

Quickstart

With MCP — recommended

Set it up once. After that, just say “save context” or “I’m switching” — the agent handles everything. No commands to run, no docs to read.

  1. Install
    curl -fsSL https://raw.githubusercontent.com/SyedSibtainRazvi/context0/main/install.sh | sh

    Windows: download the .zip from Releases and add the binary to your PATH.

  2. Install rule files (once per project)
    context0 init-rules

    Writes CLAUDE.md, .cursor/rules/context0.mdc, and AGENTS.md into the current project.

  3. Add MCP config to your tool
    # Claude Code (run once in terminal)
    claude mcp add context0 context0 mcp-server
    
    # Cursor / Codex — use full path (editors don't inherit PATH)
    # First run: which context0
    # Then add to ~/.cursor/mcp.json or ~/.codex/config.json:
    {
      "mcpServers": {
        "context0": {
          "command": "/Users/your-username/.local/bin/context0",
          "args": ["mcp-server"]
        }
      }
    }

    See the MCP setup section below for per-tool details.

CLI only — no MCP required

Save and resume manually from any terminal. No config needed.

context0 save --done "wired auth middleware" --next "fix integration tests"

Resume: context0 resume  ·  context0 resume --json

Commands

save

Write a checkpoint for the current repo + branch.

context0 save \
  --done "implemented OAuth flow" \
  --next "add refresh token logic" \
  --blockers "waiting on API key" \
  --tests "cargo test auth::" \
  --files src/auth.rs --files src/middleware.rs

resume

Print the latest checkpoint for the current repo + branch.

context0 resume
context0 resume --json

log

Show recent checkpoints in reverse chronological order.

context0 log --limit 20

mcp-server

Run MCP over stdio so tools can read/write context directly.

context0 mcp-server

init-rules

Install agent rule files for Claude Code, Cursor, and Codex. Run once per project.

context0 init-rules

clear

Delete all checkpoints for the current repo + branch.

context0 clear

completions

Generate shell completions for bash, zsh, or fish.

context0 completions zsh >> ~/.zshrc
context0 completions bash >> ~/.bashrc
context0 completions fish > ~/.config/fish/completions/context0.fish

MCP setup

Add context0 mcp-server to your editor’s MCP config. The agent then calls get_context, save_context, and list_context automatically.

claude mcp add context0 context0 mcp-server

Run once in any terminal. Claude Code resolves the binary from your PATH automatically.

{
  "mcpServers": {
    "context0": {
      "command": "/Users/your-username/.local/bin/context0",
      "args": ["mcp-server"]
    }
  }
}

File: ~/.cursor/mcp.json (global) or .cursor/mcp.json (project). Cursor doesn’t inherit your shell PATH — use the full binary path. Run which context0 to find yours, then restart Cursor.

{
  "mcpServers": {
    "context0": {
      "command": "/Users/your-username/.local/bin/context0",
      "args": ["mcp-server"]
    }
  }
}

File: ~/.codex/config.json  ·  Use the full path from which context0.

Storage and overrides

Default database

~/.context0/context0.db

Custom database

context0 --db /path/to/custom.db resume

Override repo or branch

context0 --repo /path/to/repo --branch feature/x resume

Useful in monorepos or scripts running outside the target directory.