Skip to main content

Agent Commit

Version control for AI reasoning.

Every LLM turn — messages, tool calls, results, reasoning — gets a content-addressed, queryable commit ID. Like git, but for what your agent is thinking.

pip install agent-commit

The problem

Agents re-derive the same context over and over. Agent A figures out the project structure, then Agent B starts from scratch and does it again. With 5 agents sharing a task, that's 5x the reasoning cost for the same work. Even a single long-running session pays this tax — context window fills up, summarization kicks in, history gets lost.

Reasoning is ephemeral. Once a conversation ends, the chain of thinking is gone. You can't ask "what was Agent A's reasoning on step 3?" — it's buried in a flattened transcript with no structure.

No branching means no experimentation. Want to try a different approach? Restart the whole session or manually piece together context — no way to fork, compare, or merge reasoning paths.


How it works

Agent Commit records every agent turn as an immutable commit with a SHA-256[:16] ID. Commits form a parent chain — giving you a browsable history, instant equivalence checks, and branching/merging for free.

from agent_commit import agent_commit_tool

# Record a turn
result = agent_commit_tool(
    action="commit",
    messages=[{"role": "user", "content": "Build a REST API"}],
    tool_calls=[{"id": "1", "name": "terminal", "arguments": {"command": "pip install fastapi"}}],
    tool_results=[{"id": "1", "result": "Installed fastapi-0.115.0"}],
    reasoning="Start with the scaffold, then add auth",
    metadata={"model": "claude-sonnet-4", "turn": 1},
    agent_id="agent-1",
    task_id="build-rest-api",
)
commit_id = json.loads(result)["id"]  # e.g. "a1b2c3d4e5f6g7h8"

# New agent asks: "what was the last reasoning state?"
ctx = agent_commit_tool(action="reference", commit_id=commit_id)

# Compare two paths
diff = agent_commit_tool(action="diff", commit_a_id="a1b2c3d4", commit_b_id="b2c3d4e5")

# Fork a new approach from an existing commit
branched = agent_commit_tool(
    action="branch",
    commit_id=commit_id,
    new_task_id="build-graphql-api",
)

What you get

Reference — Inject the full reasoning state from any prior commit into a new session. No re-derivation cost.

Diff — See exactly what changed between two commits: tools added/removed, message count delta, reasoning drift.

Branch — Fork from any commit to try an alternative approach. Parent chain stays intact; both paths are explorable.

Audit log — Full timestamp, agent ID, and tool/message state for every turn. Replay or hand off to a human.


MCP server

Works with any MCP-compatible agent — Claude Code, Codex, OpenCode, Hermes, and more — via the built-in stdio adapter:

{
  "mcpServers": {
    "agent-commit": {
      "command": "python",
      "args": ["-m", "agent_commit.mcp_server"]
    }
  }
}
python -m agent_commit.mcp_server

No accounts, no external services. SQLite on disk by default.


Project structure

src/agent_commit/
├── core.py          # CommitStore, tool handler, schema
├── mcp_server.py    # MCP stdio adapter
└── __init__.py      # Public exports

tests/
└── test_agent_commit.py   # 24 passing tests

pyproject.toml      # zero external dependencies
  • Storage: SQLite at ~/.agent_commit/agent_commit.db (or $AGENT_COMMIT_HOME)
  • IDs: SHA-256 of canonical turn serialization, truncated to 16 chars
  • Thread-safe: RLock per store, WAL mode
  • Dependencies: Python standard library only

Release files for agent-commit 0.1.0

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

Source distribution (sdist)

Source distribution for agent-commit 0.1.0
File Size Uploaded
agent_commit-0.1.0.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-commit 0.1.0
File Interpreter ABI Platform
agent_commit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / agent_commit-0.1.0.tar.gz

Download URL agent_commit-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e89a0e0d492942dab61a2d515018c3124d825b3094ba193a893cc48960ddca6d
BLAKE2b-256 checksum
How to use checksums
943e7673902cffe4b5a150a53128560d31705ae604accd190d5bdebfc9ae4dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / agent_commit-0.1.0-py3-none-any.whl

Download URL agent_commit-0.1.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46e8f778844915fa6d49ff725b8ae0d38015428547e1bf277a52d29123ceaa09
BLAKE2b-256 checksum
How to use checksums
b30891482f1ddbd8dc7678c4b18c444b93102f3615841eea52a2c3811bc79e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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