Skip to content

token budget S3 and S4: one use for the Agent tool, two skills on a diet - #62

Merged
buzzdan merged 4 commits into
mainfrom
claude/funny-faraday-nsb731
Sep 22, 2026
Merged

buzzdan merged 4 commits into
mainfrom
claude/funny-faraday-nsb731

Conversation

@buzzdan

@buzzdan buzzdan commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

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

  • The linter-driven-development skill names the two agents it spawns (the lint-fixer, and the skeptic in PREPARE gate 4) and says the review agents belong to the skills that own them; refactoring is a skill invoked in the main thread, never delegated to a general-purpose or any other subagent, however many escalations there are. The quickfix command repeats it beside the escalation step; the refactoring skill says the same of itself.
  • The lint-fixer has a budget: twelve turns per spawn (about six lint runs and forty edits), one multi-edit turn per file. What its budget did not reach returns as ESCALATED: <linter> → mechanical, budget spent — respawn lint-fixer at <file:line>; leftovers of its two-run no-progress stop return as mechanical, no progress and are never respawned. Callers respawn a fresh lint-fixer at most three times per scope and stop after one reports FIXED: none on the same packages. The parsed report openings are unchanged.

S4 — skill text on a diet

  • pre-commit-review: SKILL.md keeps the protocol and the contract the graders read (spawn-prompt items, one line per anchored finding, cluster entries, the reconciliation header with not reached: and PARTIAL coverage, report as the message), plus the bundle recipe, which every review needs early. A new reference.md holds the hunt-focus table, waiting for agents, hunter output, skeptic and critic verdicts, the merged report and the report example.
  • refactoring: SKILL.md keeps the routing table, the loop, the suppression prohibition with its scan, the compact six-step stopping criteria and the Stop check output contract. reference.md gains 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.
  • Round trips, not text, decide S4's sign (the cost review's finding). Every reference range is printed inside a Bash call the step already makes — the pre-filter, the bundle write, the loop's first lint run, the Gates run of the exit — never as a call of its own; only the report's long form is read on its own, once, before writing. Every pointer carries its sed range; all twelve cited ranges resolve against the rendered reference files; no command wraps across lines.
  • Cross-references updated: code-designing (core and the Go and Python includes), the LDD skill, the quickfix command, the routing-table includes and the Go package-size hook all cite <package_decomposition> in the refactoring skill's reference.md, with the range.
  • Rendered sizes: both skills at about 13k, from 30k and 23k. The 10k target was not reached; the remainder is the routing table, the bundle recipe, the suppression scan, the spawn-prompt items and the two contracts, which are protocol. The docs say so.

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 by lint-core.
  • Passing locally: ldd-gen -check, lint-core, the generator's Go tests, the three gate test matrices, the docs gate, bash -n on the edited hook.

Cases that must not move (Gate 1)

Every refactor case's stop-check grader (six Stop check openings 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's LINT STATUS and 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 general row 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

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
@buzzdan
buzzdan marked this pull request as ready for review September 22, 2026 13:16
@buzzdan
buzzdan requested a balanced review from Copilot September 22, 2026 13:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 Medium severity · 4 Low severity

Open (9)
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.

Comment thread core/commands/{{.CmdPrefix}}-quickfix.md Outdated
Comment thread core/skills/linter-driven-development/SKILL.md
Comment thread core/skills/refactoring/SKILL.md Outdated
Comment thread core/skills/refactoring/SKILL.md Outdated
Comment thread core/skills/refactoring/reference.md
Comment thread docs/token-budget.md Outdated
Comment thread lang/generic/passthrough/CHANGELOG.md Outdated
Comment thread lang/go/passthrough/CHANGELOG.md Outdated
Comment thread lang/python/passthrough/CHANGELOG.md Outdated
…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
@buzzdan
buzzdan merged commit d1e6fcd into main Sep 22, 2026
1 check passed
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.

3 participants