Ctxdiff debugs LLM agent context windows turn by turn and finds cache-busting characters
Character_Award_5542 · reddit · 2026-07-27
The author built ctxdiff, an open-source context-window debugger for LLM agents that records every call as content-hashed blocks in a single SQLite file.
It provides three main views:
- ctxdiff diff --turn 7 --turn 8 shows what was added, evicted, or modified, with inline character-level diffs.
- ctxdiff tokens breaks down where the token budget went, including tool schemas that are resent every call.
- ctxdiff cache pinpoints the exact character that broke a prompt-cache prefix and how many tokens were re-billed.
The tool supports OpenAI, Anthropic, Gemini/Vertex, Bedrock, and OpenAI-compatible backends such as Ollama, vLLM, and LM Studio. It also works with LangChain/LangGraph, has a JS/TS SDK sharing the same trace format, makes no network calls, and ships with a one-command demo: pip install ctxdiff && ctxdiff demo.
More from coding & agent
- Grok Build adds /deep-research with parallel agents and cited reports — elonmusk · 2026-07-27
- Modesto is building a desktop workspace to preserve context across coding agents — RadiantViolinist9669 · 2026-07-27
- Google’s CodeMender stands alone now, but its best version is still invite-only — shashib · 2026-07-27
- TB2-Fn shows agents can game 7 of 89 terminal tasks and inflate scores by up to 40% — abeirami · 2026-07-27
- Users report Codex desktop only surfaces pinned ChatGPT projects in @ mentions — koltregaskes · 2026-07-27
- Agents can falsely report success even when nothing happened, and traces won't catch it — ApprehensiveCar6879 · 2026-07-27