Repository navigation
Description
Problem
Empirical evidence: autonomous agent success decays exponentially with task length, and the dominant practical failure in long runs is now context rot — quality degradation as input grows, even when the context window isn't full. The current template has 10 phases with no compression at boundaries; accumulated tool output and prior reasoning travel intact through the whole loop.
Motivation
Per RESEARCH.md §4 — Long-horizon agent runs decay exponentially; context rot is the practical limit:
- Ord 2025 (arXiv:2505.05115): constant per-minute failure hazard → exponential decay with task length.
- Chroma "Context Rot" 2025 (research.trychroma.com/context-rot): 18 frontier models tested. 20–50% accuracy drop from 10k → 100k+ tokens, even when window isn't full. Models perform better on shuffled haystacks than coherent ones.
- Anthropic, Effective context engineering for AI agents (first-party).
Confidence: high.
Proposal
Two changes:
1. Compressed plan restatement at phase boundaries
At each major boundary (triage → implementation → PR → merge → self-audit), the agent restates in a tight, structured form:
- Which issues are in scope
- Which files will be / were touched
- What invariants must hold
Subsequent phases work from this summary, not the full accumulated transcript. This is consistent with Anthropic's effective-context-engineering guidance.
2. Abort-and-file-gap-issue budget
If the loop hasn't converged after N tool calls or M tokens (numbers to calibrate empirically — start with 500 tool calls / 200k tokens as a placeholder), the agent aborts the current PR, files a gap issue describing what was attempted and why it didn't converge, and exits. The half-life model predicts persistence past a budget is strictly worse than restart with fresh context.
Acceptance criteria
- Phase 2 ends with a "Plan summary" block to be re-read at the start of Phase 3
- Phase 3 ends with an "Implementation summary" block to be re-read at Phase 4
- Phase 8 ends with a "Cycle summary" block to be re-read at Phase 9
- An abort-budget edge case added to Edge cases section, with explicit thresholds
- Aborted cycles produce a gap issue with a specific template
Open question
Whether to use ScheduleWakeup with a fresh-context restart when an abort fires. The harness supports this; the dev-loop skill could be authored to handle it.
Retrofit
Per CLAUDE.md's promotion rule, retrofit PRs needed for all four child skills.
Related
- RESEARCH.md §4
- Top-5 ranking in RESEARCH.md identifies this as the Create a private GitHub repo for each new dev loop skill #4 highest-impact change
- Issue Scope create-dev-loop to also update existing dev loops #16 (update-mode) is adjacent: a working update mode would let us iterate on this without per-skill manual retrofits
drafted by Claude on behalf of Daniel Stephenson
Activity
Add context hygiene at phase boundaries and abort budget (#32)
Add context hygiene at phase boundaries and abort budget (#32)