Skip to content

Add context hygiene at phase boundaries and abort budget - #32

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/context-hygiene-boundaries
May 25, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/context-hygiene-boundaries

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented May 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Four additions to the generated dev-loop template, grounded in RESEARCH.md §4 (long-horizon decay + context rot):

  1. Phase 2 → 3 "Plan summary" — compressed plan block (issues, branch, expected files, invariants) re-read at the start of Phase 3.
  2. Phase 3 → 4 "Implementation summary" — compressed implementation block (files modified, commit summaries, validation result, open carryovers) re-read at the start of Phase 4.
  3. Phase 8 → 9 "Cycle summary" — compressed cycle block (issues closed, PR merged, surprises, followups) re-read at the start of Phase 9 to seed the self-audit.
  4. Edge case: abort budget — if the cycle exceeds ~500 tool calls or ~200k tokens without converging, abort: mark the PR Draft (or push WIP), file a gap issue with a specific template, exit. The half-life model predicts persistence past budget is worse than restart with fresh context.

Closes #19

Test plan

  • Phase 2 ends with a "Plan summary (re-read at the start of Phase 3)" block (line 167 area)
  • Phase 3 ends with an "Implementation summary (re-read at the start of Phase 4)" block
  • Phase 8 ends with a "Cycle summary (re-read at the start of Phase 9)" block
  • Edge cases section has a new "Cycle exceeds abort budget" entry with explicit thresholds (~500 calls, ~200k tokens) and a 3-step abort procedure
  • The abort-procedure gap-issue template is concrete (title format + 4-bullet body shape)
  • Placeholder count unchanged at 20 (no new {{placeholders}} introduced)
  • Diff size 29 LOC across 2 files — under the 400/10 soft ceiling (PR Add hard PR scope gates: LOC ceiling, do-not-auto-merge paths #30)
  • Localization verified: create-dev-loop.md exists; "Phase 2", "Phase 3 — Implementation", "Phase 8 — Merge", "Edge cases" headings all confirmed present before editing
  • Per the rule shipped in PR Promote 'verify each Closes #N' to template Phase 4 #26, ran gh issue view 19 and confirmed title/body match
  • Per the rule shipped in PR Track implementation outcomes back into RESEARCH.md #27, added an Implementations entry under RESEARCH.md §4
  • Do-not-auto-merge check (PR Add hard PR scope gates: LOC ceiling, do-not-auto-merge paths #30): modified files are create-dev-loop.md and RESEARCH.md; no matches

Open question (#19 noted it)

Whether ScheduleWakeup should be used to fresh-context-restart on abort. Out of scope for this PR — the abort instruction tells the agent to exit, and the user (or harness) initiates the next cycle.


drafted by Claude on behalf of Daniel Stephenson

Closes #19

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@dmccoystephenson dmccoystephenson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review rubric:

  • Scope: PASS — 2 files (create-dev-loop.md, RESEARCH.md); 29 lines total, each tied to a #19 AC item or the CLAUDE.md PR-27 Implementations rule.
  • Tests-new: PASS — boundary-summary instructions are self-exemplifying (re-reading them at the next phase boundary is the test). The abort-budget edge case is exercised by this very cycle staying under it (well under 500 tool calls / 200k tokens for this PR).
  • Tests-fix: N/A — not a bug fix.
  • Sibling structure: PASS — three boundary-summary blocks share an identical shape (**X summary (re-read at the start of Phase Y).** heading + bullet list of structured fields); edge-case entry matches the **Label:** prose + numbered steps pattern of the existing edge cases above it.
  • Sibling renames: N/A — no identifiers renamed.
  • Docs: PASS — Phase 7 sources (create-dev-loop.md, README.md) reviewed; README is high-level and doesn't enumerate inner-phase summary blocks. RESEARCH.md §4 gets an Implementations entry per the CLAUDE.md PR-27 rule.
  • Issue resolution: PASS — all five AC items from #19 met: (1) Phase 2 plan summary; (2) Phase 3 implementation summary; (3) Phase 8 cycle summary; (4) abort-budget edge case with explicit thresholds; (5) gap-issue template is concrete (title format + 4-bullet body shape).
  • Validation: PASS — placeholder count unchanged at 20; no new fenced blocks introduced (the new prose uses inline backticks only); diff under scope ceiling.
  • {{EXTERNAL_SIGNAL_LABEL}}: N/A — no CI; manual validation against the diff is the anchor (which I just did).
  • Placeholder-consistency: N/A — no new placeholders.
  • Escaping: N/A — no new fenced code blocks added.

Adversarial probe — 'Aren't 500 tool calls / 200k tokens just made up numbers?' Yes — RESEARCH.md §4 cites the half-life model but doesn't give a calibrated threshold. The 500/200k figures match #19's own placeholder values from the issue body, which the author marked as 'numbers to calibrate empirically.' Documented limitation; current values are reasonable starting points that future cycles can refine based on observed abort triggers.

@dmccoystephenson
dmccoystephenson merged commit 38e058b into main May 25, 2026
@dmccoystephenson
dmccoystephenson deleted the feature/context-hygiene-boundaries branch May 25, 2026 18:52
dmccoystephenson added a commit that referenced this pull request Aug 3, 2026
Closes #19

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add context-hygiene at phase boundaries: compressed plan restatement and abort budget

1 participant