Skip to main content

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.

CI PyPI Python License: MIT

uvx contextrot

No config. No API keys. No uploads. contextrot reads the agent transcripts already sitting on your 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 ────────────────╮
│                                                                    │
│  Deep-context failure rate: 31.4% vs 14.9% in fresh context        │
│  (2.1×, statistically separated)                                   │
│  Your degradation threshold: ~60% context fill                     │
│  Est. spend on degraded steps: $23.40 of $148.02 total             │
│                                                                    │
╰────────────────────────────────────────────────────────────────────╯

           Failure-signal rate by context fill
   Fill    Rate                                            n   95% CI
  0–10%     9%  ████████                                 214   6%–13%
 10–20%    12%  ███████████                              308   9%–16%
 20–30%    14%  █████████████                            257  10%–18%
 ...
 60–70%    29%  ███████████████████████████              121  22%–37%
 70–80%    34%  ████████████████████████████████          87  25%–44%

What "context rot" is — and why a benchmark can't tell you

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 in those transcripts carries token accounting and behavioral evidence:

  • edit failures — the agent tried to edit code and missed
  • retry loops — the same tool call repeated after an error
  • re-reads — the agent re-reading files it already read (it lost track)
  • self-corrections — "I apologize, let me fix that"
  • tool errors — any failed tool call

contextrot extracts these signals per step, computes context fill at that moment, and correlates the two — with Wilson 95% confidence intervals, per-signal breakdowns, and honest n-counts. Then it estimates what degraded steps cost you and emits prescriptions quantified from your own data.

Full method: docs/methodology.md.

What contextrot is not

Be suspicious of any tool that won't tell you this, so:

  • Not a spend meter. ccusage is excellent at "how much did I spend" — use it, it's complementary. contextrot answers "where does my agent degrade and why."
  • Not Claude Code's /context. That's a point-in-time composition snapshot. contextrot correlates fill with outcomes across your whole history.
  • Not an observability platform. Langfuse/Phoenix/MLflow instrument apps you build. contextrot needs zero instrumentation and analyzes the agent you use.
  • Not a controlled experiment. It's an observational diagnostic on your own data, with the statistical caveats printed right on the report.

Install & use

uvx contextrot            # zero-install run
# or
pip install contextrot
contextrot                        # full report, last 30 days
contextrot --days 90              # widen the range
contextrot -p myproject           # one project only
contextrot --html report.html     # shareable single-file report (still local)
contextrot --json                 # machine-readable
contextrot sessions               # list what was parsed

Supported agents: Claude Code (today). Codex CLI, OpenCode, Gemini CLI, and OpenTelemetry GenAI spans are next — an adapter is one small file, and writing one is the paved first-contribution path.

Privacy

contextrot makes zero network calls. It reads local transcript files, prints to your terminal, and optionally writes a local HTML file. Nothing leaves your machine. Grep the codebase for http — you won't find a client.

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, documented schema, aggregate-only)

Contributing

See CONTRIBUTING.md. The most valuable first PR: an adapter for the agent CLI you use.

License

MIT

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

contextrot-0.1.1.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contextrot-0.1.1-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file contextrot-0.1.1.tar.gz.

File metadata

  • Download URL: contextrot-0.1.1.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contextrot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4722852491db04fd806f24c6d73edb92672f9f91a0addf3e9d225777068dc2f8
MD5 17b2061bcf97a71ce01765a81b81359a
BLAKE2b-256 7dbdbd8844e66a208745ea5ac4ad8d6b194b740eee59dcfa765f22e81b01b4de

See more details on using hashes here.

Provenance

The following attestation bundles were made for contextrot-0.1.1.tar.gz:

Publisher: release.yml on Priyanshu-byte-coder/contextrot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file contextrot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: contextrot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contextrot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e74891a449d0ad57535d5cd15a8aa5d73715cf9870772c14e40ea65e91d42a8
MD5 26d5be4d243756e3edf2bfaebc84639e
BLAKE2b-256 1c960f8b4b79b3d3714d946f74bcc1b64f23ecbb0e83b9ca8169fd9955c6fcf5

See more details on using hashes here.

Provenance

The following attestation bundles were made for contextrot-0.1.1-py3-none-any.whl:

Publisher: release.yml on Priyanshu-byte-coder/contextrot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page