token budget S3 and S4: one use for the Agent tool, two skills on a diet - #62
Merged
Merged
Conversation
S3 — the linter-driven-development skill states that the Agent tool's one use in the workflow is the lint-fixer and that refactoring runs in the main thread, never delegated to a general-purpose or any other subagent; the quickfix command repeats it beside the escalation step, and the refactoring skill says the same of itself. The lint-fixer has a budget of six lint runs and forty edits per spawn; what it did not reach returns as `ESCALATED: … → mechanical, budget spent` lines, and the caller spawns a fresh lint-fixer over those packages. S4 — the pre-commit-review and refactoring skills keep their protocols and the contracts the graders read (spawn-prompt items, report shape, reconciliation header, Stop check block) and move the long form into their reference.md: bundle recipe, agent output shapes, verdict rules, cluster pass and report example; pattern index, file and package routing, preparatory mode, suppression scan, stopping criteria in full, integration and the multi-rule procedures. Each step names the sed range it reads when it needs it. Rendered sizes: review skill 30k to about 12k, refactoring 23k to 11k–13k by binding. <file_and_package_routing> and <package_decomposition> now live in the refactoring skill's reference.md; code-designing, the LDD skill, the quickfix command and the routing-table includes cite it there. Docs, changelogs and the core README residue section updated; all three bindings regenerated; ldd-gen -check, lint-core, generator tests, gate tests and docs gate pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bs5wvpmT7xZst7m1nXXkWB
…d hunt focus Applies the cost-expert and LDD-expert review of PR #62. Round trips, not text, decide S4's sign: every reference range is now printed inside a Bash call the step already makes (the pre-filter, the bundle write, the loop's first lint run, the Gates run), never as a call of its own; only the report's long form is read on its own, once. The bundle recipe and the suppression scan, needed early and unconditionally, are inline again. Every pointer carries its sed range; the two commands that wrapped across lines are on one line; the preparatory range closes on the right heading. The hunt-focus table S4 dropped is back, in the review reference, printed by the pre-filter's command. The LDD skill names the two agents it spawns and the skills that own the review agents instead of a false "one use". The lint-fixer's budget is twelve turns; no-progress leftovers get their own route and are never respawned; callers respawn at most three times and stop after a fresh fixer fixes nothing. The report-contract sentence admits the two non-rule routes. Stale pointers in the Go and Python code-designing includes and the Go package-size hook now name the refactoring reference. Refactoring step 4 carries the critic's paths and ranges itself. Cosmetics: stray period, procedures headings demoted under their section, self-reference removed. Docs and changelogs updated; bindings regenerated; all checks pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bs5wvpmT7xZst7m1nXXkWB
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bs5wvpmT7xZst7m1nXXkWB
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Reference ordering, an invalid doctrine path, incomplete decomposition ranges, and unresolved mechanical-escalation handling can break the documented workflows.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 5
Open (9)
Stop and report unresolved failures after retry cutoff · New Do not route mechanical budget leftovers to refactoring · New Print inspection ranges before applying refactoring · New Fix incorrect relative path to documentation reference · New Include full package decomposition procedure in cited range · New Describe Agent restriction as delegated refactoring only · New Remove bundle recipe from moved-material list · New Remove bundle recipe from moved-material list · New Remove bundle recipe from moved-material list · New
What changed in this PR
Implements token-budget stages S3–S4 by bounding lint-fixer work, keeping refactoring in the main thread, and moving detailed skill guidance into reference files.
Changes:
- Adds lint-fixer retry and budget protocols.
- Extracts review/refactoring guidance into ranged reference sections.
- Regenerates all language bindings and updates documentation.
| File | Description |
|---|---|
core/agents/lint-fixer.md |
Defines the lint-fixer budget and escalation format. |
core/commands/{{.CmdPrefix}}-quickfix.md |
Adds retry and delegation rules. |
core/includes/skills/code-designing/linter-triggers.md |
Updates package-decomposition reference. |
core/includes/skills/refactoring/routing-table.md |
Updates refactoring reference range. |
core/README.md |
Regenerates language-residue counts. |
core/skills/code-designing/SKILL.md |
Updates decomposition guidance. |
core/skills/linter-driven-development/SKILL.md |
Defines agent ownership and retry handling. |
core/skills/pre-commit-review/reference.md |
Adds extracted review guidance. |
core/skills/refactoring/reference.md |
Adds extracted refactoring guidance. |
core/skills/refactoring/SKILL.md |
Compacts the refactoring protocol. |
docs/token-budget.md |
Documents landed S3–S4 behavior. |
go-linter-driven-development/agents/lint-fixer.md |
Renders Go lint-fixer budgeting. |
go-linter-driven-development/CHANGELOG.md |
Records Go binding changes. |
go-linter-driven-development/commands/go-ldd-quickfix.md |
Renders Go retry rules. |
go-linter-driven-development/hooks/check-package-sizes.sh |
Updates decomposition guidance. |
go-linter-driven-development/skills/code-designing/SKILL.md |
Renders Go design references. |
go-linter-driven-development/skills/linter-driven-development/SKILL.md |
Renders Go agent protocol. |
go-linter-driven-development/skills/pre-commit-review/reference.md |
Renders Go review reference. |
go-linter-driven-development/skills/refactoring/reference.md |
Renders Go refactoring reference. |
go-linter-driven-development/skills/refactoring/SKILL.md |
Renders compact Go refactoring skill. |
lang/generic/passthrough/CHANGELOG.md |
Supplies generic changelog text. |
lang/go/passthrough/CHANGELOG.md |
Supplies Go changelog text. |
lang/go/passthrough/hooks/check-package-sizes.sh |
Supplies updated hook message. |
lang/go/skills/code-designing/linter-triggers.md |
Supplies Go design trigger reference. |
lang/go/skills/refactoring/routing-table.md |
Supplies Go routing reference. |
lang/python/passthrough/CHANGELOG.md |
Supplies Python changelog text. |
lang/python/skills/code-designing/linter-triggers.md |
Supplies Python design trigger reference. |
lang/python/skills/refactoring/routing-table.md |
Supplies Python routing reference. |
linter-driven-development/agents/lint-fixer.md |
Renders generic lint-fixer budgeting. |
linter-driven-development/CHANGELOG.md |
Records generic binding changes. |
linter-driven-development/commands/ldd-quickfix.md |
Renders generic retry rules. |
linter-driven-development/skills/code-designing/SKILL.md |
Renders generic design references. |
linter-driven-development/skills/linter-driven-development/SKILL.md |
Renders generic agent protocol. |
linter-driven-development/skills/pre-commit-review/reference.md |
Renders generic review reference. |
linter-driven-development/skills/refactoring/reference.md |
Renders generic refactoring reference. |
linter-driven-development/skills/refactoring/SKILL.md |
Renders compact generic refactoring skill. |
python-linter-driven-development/agents/lint-fixer.md |
Renders Python lint-fixer budgeting. |
python-linter-driven-development/CHANGELOG.md |
Records Python binding changes. |
python-linter-driven-development/commands/py-ldd-quickfix.md |
Renders Python retry rules. |
python-linter-driven-development/skills/code-designing/SKILL.md |
Renders Python design references. |
python-linter-driven-development/skills/linter-driven-development/SKILL.md |
Renders Python agent protocol. |
python-linter-driven-development/skills/pre-commit-review/reference.md |
Renders Python review reference. |
python-linter-driven-development/skills/refactoring/reference.md |
Renders Python refactoring reference. |
python-linter-driven-development/skills/refactoring/SKILL.md |
Renders compact Python refactoring skill. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…anges Mechanical leftovers after the lint-fixer's respawn ceiling, and every no-progress line, are unresolved mechanical lint with no rule route: Phase 3 stops and the ship summary lists each file:line under LINT STATUS: escalations pending, never routed to @Refactoring — in the LDD skill and the quickfix command. The refactoring loop gains an opening lint run (step 2) whose Bash call prints the pattern index and, when applicable, the file-and-package range with its procedure and the preparatory-mode section, before any move. Every <package_decomposition> range now prints the procedure too. The critic's toolbox path in refactoring step 4 is ../documentation/reference.md. The design doc no longer claims a single Agent use; the three changelogs list only the sections that moved. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bs5wvpmT7xZst7m1nXXkWB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Implements stages S3 and S4 of docs/token-budget.md, the second pair after S1 and S2 (#61). No rule text changes; only skills, one agent, one command and their reference files under
core/, with the three renderings regenerated. The second commit applies a two-hat review (AI cost expert, LDD expert) of the first.S3 — budgets and the general-purpose ban
ESCALATED: <linter> → mechanical, budget spent — respawn lint-fixer at <file:line>; leftovers of its two-run no-progress stop return asmechanical, no progressand are never respawned. Callers respawn a fresh lint-fixer at most three times per scope and stop after one reportsFIXED: noneon the same packages. The parsed report openings are unchanged.S4 — skill text on a diet
SKILL.mdkeeps the protocol and the contract the graders read (spawn-prompt items, one line per anchored finding, cluster entries, the reconciliation header withnot reached:andPARTIAL coverage, report as the message), plus the bundle recipe, which every review needs early. A newreference.mdholds the hunt-focus table, waiting for agents, hunter output, skeptic and critic verdicts, the merged report and the report example.SKILL.mdkeeps the routing table, the loop, the suppression prohibition with its scan, the compact six-step stopping criteria and theStop checkoutput contract.reference.mdgains the pattern index,<file_and_package_routing>/<package_decomposition>, preparatory mode in full, the stopping criteria in full and integration, and keeps the multi-rule procedures.sedrange; all twelve cited ranges resolve against the rendered reference files; no command wraps across lines.<package_decomposition>in the refactoring skill'sreference.md, with the range.Also in this PR
docs/token-budget.md: S3 and S4 describe what landed, including the batching rule; S1 to S4 marked landed but unproven. Changelog entries under[Unreleased]in all three bindings. The core README's residue section regenerated bylint-core.ldd-gen -check,lint-core, the generator's Go tests, the three gate test matrices, the docs gate,bash -non the edited hook.Cases that must not move (Gate 1)
Every refactor case's
stop-checkgrader (sixStop checkopenings in order) and art judges; every review case's graders, the whole-repository review's recall count, the clean-tree controls; the red-lint quickfix'sLINT STATUSand escalation routing.Gate 2 to check on the proof run
Refactor tier from 65.9M toward about 45M; the 20M-token class of run gone (no
generalrow in the spend report's per-agent table); lint-fixer read as spawns times median turns, not median turns alone; main-thread calls per run up by no more than about three from the reference reads; mean context on refactor runs down by 3k to 5k.🤖 Generated with Claude Code
https://claude.ai/code/session_01Bs5wvpmT7xZst7m1nXXkWB