Debugging LLM agents has always felt like trying to find a needle in a haystack made of token probabilities. But a new open-source tool called ctxblame is changing that by applying the logic of git blame to agent decision-making. Released on November 28, 2026, and currently at version 0.2.2, ctxblame allows developers to replay recorded LLM requests while systematically removing specific context chunks to see which one actually caused the model to make a particular decision.
Counterfactual Replay and Statistical Rigor
The core innovation here is moving beyond the model's own explanations, which are often unreliable. Instead, ctxblame relies on counterfactual replay. It re-sends a recorded request multiple times with pieces of context removed, then uses statistical tests to determine if the decision flips. The tool supports both Anthropic Messages and OpenAI Chat Completions formats, making it compatible with a wide range of models including Claude, GPT, Qwen, and Llama. In a real-world test using Qwen3-14B on local vLLM, the tool successfully identified redundant context carriers that other methods missed, certifying its findings with a p-value of 1.9e-6.
Outperforming Existing Attribution Methods
The project's documentation highlights significant performance gains over existing context attribution techniques. On real agent traces, ctxblame achieved an F1 score of 92%, compared to just 29% for ContextCite and 46% for self-explanation methods. It specifically addresses the problem of redundant context, where multiple chunks back each other up, making them invisible to simple leave-one-out tests. The tool also distinguishes between workflow preconditions (which enable an action) and choice carriers (which decide the specific action), a nuance that previous tools failed to capture accurately.
Key Takeaways
- ctxblame uses counterfactual replay to identify the specific context chunk responsible for an LLM agent's decision.
- The tool achieves 92% F1 on real agent traces, significantly outperforming ContextCite (29%) and self-explanation (46%).
- It supports both Anthropic and OpenAI wire formats, working with models like Claude, GPT, Qwen, and Llama.
- Current version 0.2.2 adds 'forced action' testing to distinguish between rules that trigger behavior and rules that steer specific outcomes.
The Bottom Line
For agent developers drowning in opaque token streams, ctxblame offers the first real 'blame' tool that actually works. Itβs a game-changer for debugging complex agent workflows without relying on the model's often-hallucinated self-explanations.