Find out where your coding agent starts degrading. Personal context-rot analytics from your own agent sessions.
Project description
contextrot
Your coding agent gets worse as its context fills.
contextrot proves it on your own sessions — and tells you exactly what to change.
Quick start
uvx contextrot
That's it. No config, no API keys, no uploads. contextrot reads the session transcripts your agent CLI already keeps on disk and answers a question no other tool answers:
At what context fill does my agent start failing, what's causing it, and what is it costing me?
┌─────────────────── contextrot — your context rot report ────────────────────┐
│ │
│ ✗ Context rot detected: your agent fails 2.1× more often in deep context. │
│ │
│ Deep-context failure rate: 31.4% vs 14.9% in fresh context │
│ Your degradation threshold: ~60% context fill │
│ Token value burned in degraded steps: $23.40 of $148.02 total │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
Failure-signal rate by context fill
Fill │ Rate │ │ n │ 95% CI
10–20% │ 12% │ ███████████ │ 308 │ 9%–16%
20–30% │ 14% │ █████████████ │ 257 │ 10%–18%
40–50% │ 16% │ ███████████████ │ 198 │ 12%–21%
60–70% │ 29% │ ███████████████████████████ │ 121 │ 22%–37%
70–80% │ 34% │ ████████████████████████████████ │ 87 │ 25%–44%
Every report leads with a plain verdict — one of four honest answers:
| Verdict | Meaning |
|---|---|
| ✗ Context rot detected | your failure rate climbs significantly as context fills |
| ! Edge rot | flat until near the window limit, then it climbs — compact before you get there |
| ✓ No measurable rot | your failure rate stays flat; your setup is working |
| ? Not enough data | keep using your agent and re-run |
A tool that can say "you're fine" is a tool you can trust when it says you're not.
Why a benchmark can't tell you this
Research (Chroma's context-rot report, several 2026 papers) shows LLM output quality degrades as input context grows — even far below the window limit. But that research runs synthetic tasks in lab conditions. Your degradation point depends on your projects, your MCP setup, your model, your prompting style.
contextrot measures it where it actually matters: in your own sessions.
How it works
Agent CLIs like Claude Code log every session to local JSONL transcripts. Each step carries token accounting and behavioral evidence. contextrot extracts five independent failure signals per step and correlates them with context fill at that moment:
| Signal | What it catches |
|---|---|
| Edit failures | the agent tried to edit code and missed — the clearest "lost track of file state" event |
| Retry loops | the same tool call repeated after an error: paying twice for one action |
| Re-reads | re-reading files it already read — content scrolled out of effective attention |
| Self-corrections | "I apologize, let me fix that" |
| Tool errors | any failed tool call |
Statistics are kept honest: Wilson 95% confidence intervals, per-signal breakdowns, visible n-counts, and a degradation threshold that only gets declared when a bucket's confidence floor clears the baseline — one noisy bucket can't scare you. Full method: docs/methodology.md.
Commands
contextrot # full report, last 30 days
contextrot --days 90 # more history = tighter statistics
contextrot -p myproject # one project only
contextrot --html report.html # shareable single-file report (still 100% local)
contextrot --json # every number, recomputable
contextrot sessions # list what was parsed
How is this different from…
| Tool | Question it answers | What it can't tell you |
|---|---|---|
| ccusage | "How much did I spend?" | anything about output quality — use both, they're complementary |
Claude Code /context |
"What's in my window right now?" | no outcomes, no history, no correlation |
| Langfuse / Phoenix / MLflow | "How is the app I built behaving?" | require instrumentation; contextrot analyzes the agent you use, zero setup |
| Chroma's research | "Do models degrade on benchmarks?" | nothing about your workload — contextrot is the personal-data counterpart |
FAQ
The report says $2,000+ but I'm on a $20/month subscription. Is it broken? No — that figure is the token value of your usage priced at API list rates, labeled as such in the report. It exists because tokens are the resource that fills your context window and burns your rate limits, and dollars are the only unit everyone reads instantly. Two honest readings: it's what your usage would cost pay-per-token (enjoy your subscription), and the "burned in degraded steps" share is the fraction of that resource going to rework. It is not, and never claims to be, your bill.
Why is the token flow so large? Agents re-send the entire conversation to the model on every step. A 100-step session at 100k context ≈ 10M tokens flowing through — mostly cache reads. That's normal; it's also exactly why context bloat matters.
Correlation isn't causation, right? Right, and the report says so on its face. Deep-context steps are also later-in-task steps. contextrot is an observational diagnostic with conservative statistics, not a lab experiment — see methodology.
What about my privacy? contextrot makes zero network calls. Local files in, terminal/local HTML out. Grep the codebase for an HTTP client — there isn't one.
Supported agents
| Agent | Status |
|---|---|
| Claude Code | ✅ today |
| Codex CLI | planned — adapter wanted |
| OpenCode | planned — adapter wanted |
| Gemini CLI | planned — adapter wanted |
| OpenTelemetry GenAI spans | planned |
An adapter is one small file with a fixture and a test — it's the paved first-contribution path.
Roadmap
contextrot fix— apply prescriptions interactively (disable unused MCP servers, trim CLAUDE.md) with before/after measurement- More agent adapters + OTel ingestion
- Opt-in, anonymized aggregate stats → the State of Context Rot report: real-workload degradation curves across the community (off by default, aggregate-only, documented schema)
Contributing
See CONTRIBUTING.md. Most valuable first PR: an adapter for the agent CLI you use.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextrot-0.1.2.tar.gz.
File metadata
- Download URL: contextrot-0.1.2.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49e722b4dd2d183e4848f9b1d868219cf997c4f77b8c3bcb6c5d1d14080fc229
|
|
| MD5 |
2f21b8704281a54f01cf545a632a246d
|
|
| BLAKE2b-256 |
078a9e8eacaabf6a60f6d7857e645eacbfc0d389df046e38c3723d1b602ff487
|
Provenance
The following attestation bundles were made for contextrot-0.1.2.tar.gz:
Publisher:
release.yml on Priyanshu-byte-coder/contextrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextrot-0.1.2.tar.gz -
Subject digest:
49e722b4dd2d183e4848f9b1d868219cf997c4f77b8c3bcb6c5d1d14080fc229 - Sigstore transparency entry: 2048540124
- Sigstore integration time:
-
Permalink:
Priyanshu-byte-coder/contextrot@d07f23c9dc7f4d21ad35013e0e5806381ba45a63 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Priyanshu-byte-coder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d07f23c9dc7f4d21ad35013e0e5806381ba45a63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file contextrot-0.1.2-py3-none-any.whl.
File metadata
- Download URL: contextrot-0.1.2-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2636b05577c1b49b67636c67b3b8a09da558f4c99f50e4699f193d710cefd1e0
|
|
| MD5 |
56c61e606b8b4b26ed0fe174cf37f243
|
|
| BLAKE2b-256 |
54dbdba557c1b61a403c7a084f9aa2b539f40d927573d616804aa369706fc5ac
|
Provenance
The following attestation bundles were made for contextrot-0.1.2-py3-none-any.whl:
Publisher:
release.yml on Priyanshu-byte-coder/contextrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextrot-0.1.2-py3-none-any.whl -
Subject digest:
2636b05577c1b49b67636c67b3b8a09da558f4c99f50e4699f193d710cefd1e0 - Sigstore transparency entry: 2048540135
- Sigstore integration time:
-
Permalink:
Priyanshu-byte-coder/contextrot@d07f23c9dc7f4d21ad35013e0e5806381ba45a63 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Priyanshu-byte-coder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d07f23c9dc7f4d21ad35013e0e5806381ba45a63 -
Trigger Event:
push
-
Statement type: