ctxrot¶
Alpha
ctxrot currently supports only DSPy>=3.1.3 and may produce mis-aligned output. Please report any issues you encounter — the API may change.
Install¶
What it does¶
- Records every LM call and tool call from your DSPy agent into a local SQLite database via a drop-in
CtxRotCallback. - Detects repetition and efficiency degradation — the two signals of context rot — without making any LLM calls of its own.
- Visualizes sessions in a Textual TUI dashboard with growth curves, per-iteration metrics, and an RLM tree view.
- Exports sessions to JSONL in the opentraces
TraceRecordshape (or a native format), ready to share or archive. - Deep-analyzes a session with an RLM agent that produces a structured rot report — optional, requires Deno + an API key.
Next steps¶
- Quickstart — attach the callback, run your agent, open the dashboard.
- Concepts — what context rot is and the metrics ctxrot uses to detect it.
- CLI reference —
dashboard,analyze,export,deep-analyze,reset. - Python API —
CtxRotCallback,CtxRotStore,analyze_session,run_deep_analysis.