Ctxdiff Brings Git-Style Diffing to LLM Agent Context Windows
Ctxdiff is a local-first, open-source tool that applies git-style diffing to LLM agent context windows, turn by turn.
Ctxdiff is a local-first debugging tool that lets engineers inspect exactly what an LLM agent saw, turn by turn, inside its context window. A one-line wrapper around OpenAI, Anthropic, Gemini, Bedrock, or LangChain/LangGraph clients captures every call's full context into a single-file SQLite .ctrace, using content-hashed, deduplicated blocks so a stable system prompt isn't stored 40 times over.
The tool targets the questions raw JSON logs and standard tracing dashboards can't answer well: what changed between turn 7 and turn 8, which characters broke a prompt-cache prefix, and how much unused tool schemas are silently costing per call. Features include git-style turn diffing, token attribution with schema-bloat detection, cache-break profiling, a percent-of-context-window indicator with an 80% warning threshold, and tagging that flags when a previously injected RAG chunk got evicted from context.
Ctxdiff also ships CI checks that fail a pull request when context budgets regress, an MCP server so coding agents like Claude Code or Cursor can query traces directly, and native multi-agent support that attributes calls to specific agents without misreading hand-offs as cache breaks.
Unlike observability platforms such as LangSmith, Langfuse, or Phoenix — which aggregate snapshots across a fleet of calls for monitoring health over time — Ctxdiff is scoped to one run, showing the delta between turns rather than a list of requests. Everything stays on the developer's machine by default, though pluggable storage backends allow routing traces to PostgreSQL or MySQL. Python and JavaScript/TypeScript SDKs both write the same .ctrace format, so traces are interchangeable across languages.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work