Skip to content

Comment discipline

Prompt

Before responding to questions or discussion points in this document, explore this repository thoroughly. Read the relevant files and ground your answers in what they actually say. Do not speculate about the repository when you could read it instead. Flag any uncertainty explicitly rather than guessing.

There is no application code here. The artifacts are the audit specifications in docs/audits/, the tooling in scripts/ that measures them, the templates in templates/ that the rest of the fleet copies, and the workflows that run all of it every week against every Shaken Fist repository.

Consult AGENTS.md for the conventions and the invariants that are not visible in the code, and ARCHITECTURE.md for the shape of the system. docs/consistency-audits.md is the reference for what a run does, how to add a criterion, how to bring a repository into scope, and how to test a change before it reaches the fleet -- read it before changing anything under scripts/ or docs/audits/. docs/code-review-tracking.md covers the review tooling, and PUSH-AUDIT.md is the pre-push review runbook that every plan's final phase runs.

Two things make planning here different from planning in a repository that holds a product, and both should shape any plan written from this template:

  • The blast radius is other people's repositories. The weekly workflow files and closes GitHub issues fleet-wide. A change that is merely wrong does not produce a red build; it produces issues in ten repositories, or silently closes ones that should have stayed open. Always pass --dry-run when running audit-manage-issues.py by hand.
  • This repository is in its own audit matrix. A standard we exempt ourselves from is a standard we stop noticing the cost of. A change to a criterion is a change we are measured against on the next run, so a plan should say how many repositories -- including this one -- it newly fails.

Plan file conventions (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-file-conventions.md):

  • All planning documents live in docs/plans/.
  • A phase is planned in detail either in a file of its own or as a prose section of the master plan. Both are allowed, and a repository that prefers sections says so once, in a paragraph above the table in docs/plans/index.md, rather than in every plan. A phase file is named for its master plan, sits in the same directory as it, and appends -phase-NN-descriptive before the .md extension.
  • Either way the master plan tracks every phase, in order, in one table under its Execution section. Merged is last, and the push audit is the last row, for the reasons given in plan-push-audit-phase. The Plan column names the phase file, so it is present with phase files and absent with sections -- there is no file to name:
Phase Plan Status Merged
1. Schema migration PLAN-thing-phase-01-schema.md Not started
2. Public API PLAN-thing-phase-02-api.md Not started
3. Push audit - Not started

Or, where the phases are sections and there is no file to name:

Phase Status Merged
1. Schema migration Not started
2. Public API Not started
3. Push audit Not started

A plan that tracks its phases in prose alone, with no table, records each landing as the Merged: line in that phase's own section, which is the form plan-push-audit-phase describes. Where plan-phase-landing says Merged cell, that line is the cell.

  • One commit per logical change, and at minimum one commit per phase. Unrelated changes are not batched into a single commit. Each commit is self-contained: it builds, passes tests, and has a message explaining what changed and why.

In this repository. Plans here keep their phases as sections inside the master plan rather than as separate phase files, and the Execution table's Plan column is dropped accordingly; docs/plans/index.md says so. The shared convention above is the fleet default, and a plan large enough to want phase files should use them rather than argue with the block.

Situation

A human review pass over shakenfist/actions in December 2026 (its reviews branch, 84c6179, which takes the repository to 190 of 190 in-scope files reviewed) concluded that the comments -- in workflows and helper scripts above all -- are individually reasonable but have grown far longer than they need to be. Measured on actions main at 13be4f7, counting full-line # comments:

Where Comment lines Blocks of 8+ lines Longest block
.github/workflows/*.yml (12 files) 1,469 of 2,839 (52%) 64 63 lines, smoke-cluster.yml:164, explaining one runs-on: line
tools/*.sh, tools/*.py (53 files) 3,014 of 10,640 (28%) 107 112 lines, the header of ci_headroom_collect.sh
*/action.yml (11 files) 167 of 1,551 (11%) 6 24 lines

Reading the two longest blocks shows what the length is made of. Three kinds of text are interleaved:

  1. Constraints the code cannot state, which a reader needs at that line. smoke-cluster.yml explains that its runner labels are prefixed bound- so that no unbound job's labels can be a subset of the runner's. This is what a comment is for.
  2. History. "the s-cloud and s-cluster tokens ... are all gone"; "That produced a Capacity guard census section with nothing to count on every run since the stage-event filter was fixed". This is the commit message, kept twice.
  3. Measurements and design reasoning. "the slim-primary jobs peak at 2678-2714 MB while slim-tier sits at 2618 MB"; "Measured across 204 CI job-runs". True on the day, stale soon after, and the class of material llm-doc-discipline already sends to docs/.

The growth has a mechanism, and it is ours. The automated reviewer (review-pr-with-claude in actions) defines its document action as "Documentation should be added or updated"; the respond-to-review skill (in the operator's private llm-setup repository) resolves a document item by addressing it "if it is a comment or a docstring". Every review round therefore adds to a comment and nothing ever takes away, and the comment becomes a changelog of the review rounds that touched its code.

A policy already exists and has not held. comment-proportion v1 (templates/shared-blocks/comment-proportion.md) says a comment earns its length by saying what the code cannot, and flags a block over roughly fifteen lines on a body under ten -- but it is read only by a push audit, it is advisory, and it says nothing about history. The push-audit criterion requires it in every PUSH-AUDIT.md it covers: 14 repositories, 12 of them compliant (docs/audits/compliance.md, push-audit). The source size ratchet's own README describes exactly this failure for file length: "an advisory sentence caught neither". This plan is that ratchet's argument applied to comments.

Two properties of the fleet shape what can be done:

  • Comment edits stale review marks. Marks are keyed to blob SHAs and prune drops any mark whose file changed; there is no carry-forward for comment-only edits (docs/code-review-tracking.md, Staleness), and this plan does not add one, because the comments are exactly what was reviewed. Every file this plan trims must be re-reviewed. The operator has accepted that cost in exchange for a better codebase; the trimmed file is shorter, which makes the re-review cheaper. The pilot is still kept small, but so that the skill is corrected before it runs widely, not to save marks. In other repositories the steady state is trimming during a review session, before stamping.
  • The source size ratchet already has fleet machinery, but the script itself has three adopters. The source-size-ratchet criterion requires a byte-identical copy of tools/source-size-ratchet.py, a pre-commit hook that runs it, and a CI lane that reaches the hook (docs/audits/source-size-ratchet.md). A comment ratchet built into that script reaches every adopter through the existing criterion, hook and lane, with no new criterion for the audit to carry. The distinction that matters for every number in this plan: the criterion applies to 23 repositories (images and private-ci are N/A), while the script is deployed in three -- development, instar and ryll. The other 20 are non-compliant with an open issue each, and that backlog belongs to PLAN-size-ratchet, not here (docs/audits/compliance.md, source-size-ratchet). So the comment ratchet reaches the fleet only as fast as the size ratchet's own rollout does, and shakenfist/actions -- the repository this plan sweeps -- is one of the 20.

Mission and problem statement

Make long comments a decision rather than a drift, the way the size ratchet did for long files, and stop our own review tooling from being the thing that lengthens them. Concretely:

  1. Write the rule down where it is read. comment-proportion v2 adds what v1 lacks: a comment describes the code as it is now; history appears only where it records a previous mistake that must not be made again -- a hard-won lesson the implementation does not make obvious -- and is written as the lesson rather than the story; measurements and design reasoning go to docs/ with a pointer; and touching a comment means rewriting it, not appending to it.
  2. Close the inflow. Change the reviewer's definition of document and respond-to-review's handling of it, so a review round rewrites a comment rather than lengthening it, and have the reviewer notice a comment grown by appended history.
  3. Ratchet it. Extend source-size-ratchet.py to baseline the comment blocks over a threshold in each file, so neither the total nor the longest of a file's long blocks may rise without a baseline edit a reviewer cannot scroll past. The length ratchet's threshold is crossed rarely -- a file reaches 1,500 lines once -- so its hand edits are genuinely occasional. A 16-line comment block in a new file is not rare, so the ongoing friction is an open empirical question rather than an assumption; step 3b measures it from history before the hook is enforced anywhere.
  4. Give the backlog a tool. A trim-comments skill that rewrites a file's comment blocks to the v2 minimum, moving rather than deleting what belongs in docs/, and refuses to touch anything in the trimmed file but its comments. Pilot it on three files in actions.
  5. Let the audit carry it. The ratchet reaches the fleet through the existing source-size-ratchet criterion, at the speed that criterion's own rollout reaches it -- three deployments today, 20 repositories with an open adoption issue -- and the v2 block through the existing shared-block check, which reaches every repository with a PUSH-AUDIT.md immediately.

Out of scope. Trimming the backlog of every other repository is not a phase: the ratchet stops growth there, and the backlog shrinks as files come up for review and the skill is run on them before stamping. actions is the exception -- its review prompted this plan, so it is swept in full once the pilot has corrected the skill. Docstrings and Rust /// / //! doc comments are out of scope (see Open questions, 3). A carry-forward of review marks across comment-only edits is deliberately not built (see Situation). No judgement criterion -- "is this comment pithy?" -- is added; the audits here measure, and docs/consistency-audits.md already records that criteria needing reading get no check. Phase 1's push-audit resyncs other than actions (4b) are background template-resync work driven by the issues the audit files; the plan does not wait on them.

Open questions

  1. Extend source-size-ratchet.py, or a separate template and criterion? Default: extend. One script, one hook, one CI lane and one criterion are already specified for 23 repositories, and deployed in three; a second template would need its own criterion, its own frozen issue title and its own fleet sweep, for a check that is the same shape (a per-file baseline that may shrink and may not grow). Extending is still the right call on the real numbers -- a second criterion would have 23 adoptions of its own to chase rather than inheriting a rollout already in progress -- but the argument is "no second rollout", not "reaches 23 today". The cost is that the script's name undersells it, and the criterion's specification must say it now checks two things.
  2. Threshold and metric. Default: a block is a run of full-line comments not interrupted by a line of code (blank lines inside the run do not end it, so inserting one cannot split a block under the threshold); a block's length is its number of comment lines, so blank lines neither end it nor count towards it, and a file of nothing but comments and blank lines is one block; a block is oversize above 15 lines, the figure v1 already uses, so 16 is the shortest that counts. A file's entry is two numbers, baselined as the size ratchet baselines a file's length: the total length of its oversize blocks, and the length of its longest block. Either rising past its entry fails. Totalling whole blocks rather than their excess over 15 means splitting a 40-line block into two 20-line blocks with a code line between them does not reduce the total. Splitting below the threshold does -- three 13-line blocks leave a total of 0 -- which is the limit of any per-block threshold, accepted: the trim-comments skill (step 4a) forbids splitting to pass, and 3b's numbers say whether a third per-file number, all comment lines, is needed. The converse also holds: deleting or moving the code line between two oversize blocks merges them, so the longest can rise on a commit that adds no comment line, and the comment-pass failure message says so. The longest is there because a total alone lets one block grow by paying for it elsewhere: a file with blocks of 16 and 20 lines (total 36) would pass with the 16 cut to 10 and the 20 grown to 26 (total 26). With both numbers, compensation is accepted only below the file's longest block -- the 16 may grow to 20 while the 20 shrinks -- and so is a new block that fits the file's existing budget: trim the 16 to 15 and add a new 16 elsewhere, and both numbers stand. The guarantee is per file, not per block; growth is capped, placement is not. Blocks themselves are not baselined: they have no identity that survives an edit (lines move, blocks merge and split), and a per-file pair keeps a growth a one-line baseline diff.

The body condition is dropped, deliberately. v1's test is two-part -- "any comment block over roughly fifteen lines attached to a body under ten" -- and the ratchet's is block length alone, because measuring the body means a parser per language. The consequence is that the mechanism is stricter than the policy: a 16-line constraint comment on a 300-line function is fine to the block and oversize to the hook. v2 therefore says both rules (step 1a, addition (vi)), so a reader who hits the hook knows that crossing the threshold asks for a baseline entry with a reason, not for the comment to be wrong. 3. Doc comments. Default: out of scope. Python docstrings need the tokenizer and Rust /// is public API documentation with its own norms; both are Future work. Plain // comments in Rust, Go, TypeScript, JavaScript, C and C++ are in scope, since the Rust repositories are a large part of the fleet. 4. Pilot scope against review marks. Default: three files in actions -- .github/workflows/smoke-cluster.yml, tools/ci_headroom_collect.sh, tools/mermaid-lint.sh, the three largest offenders across the two kinds of file -- once actions' reviews branch has merged, so the marks the pilot stales are recorded first and their loss is visible as an ordinary prune. That has happened (shakenfist/actions#288). The operator has accepted re-reviewing every file trimmed (2026-12-05), so the pilot is followed by a sweep of the rest of actions (step 4d) rather than stopping at three files. 5. Writing-time guidance. The v2 block lives in PUSH-AUDIT.md, which is read at push time, after the comment is written. Default: add one line to the operator's global CLAUDE.md (in llm-setup) under Code preferences, pointing at the block, because that is the only file read in every session at the moment a comment is written. Not AGENTS.md: a fleet-wide line there costs context in every repository's every session for a rule that has one source.

Execution

The phases are tabulated under Phases, after the shared conventions they follow.

Plan status vocabulary (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-status-vocabulary.md):

A status cell -- in the master plan's own Execution phase table, and in the row docs/plans/index.md carries for the plan -- holds exactly one of these terms and nothing else:

  • Proposed -- written down as a concept, not yet scheduled.
  • Not started -- scheduled, but no work has begun.
  • In progress -- work has begun and has not finished.
  • Blocked -- cannot proceed until something outside the plan changes. Say what, in the plan.
  • Complete -- the work is done.
  • Abandoned -- deliberately dropped without being done.
  • Superseded -- replaced by another plan, which the plan names.

The term is the whole cell. No dates, no phase arithmetic, no parenthetical qualifiers, no summary of what happened: a status is read to decide whether a plan still wants attention, and prose in that column has repeatedly grown until it could no longer be read either by a person scanning the table or by tooling. Detail belongs in the plan file, and a one-line summary belongs in the index's own Intent column.

Matching is case-insensitive, so In Progress is accepted, but the spelling above is the one to write.

In this repository. The same term is written twice: once in this plan's own phase table, and once in the row the plan carries in docs/plans/index.md. The index row is the whole-plan status, so it only reaches Complete once every phase has been completed, abandoned or superseded. The plan-index criterion reads that table, and this repository is inside its own audit matrix, so a status that drifts out of the vocabulary fails our own tooling before it fails anybody else's.

Push audit phase (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-push-audit-phase.md):

  • Every master plan ends with a phase that runs the repository's PUSH-AUDIT.md over the whole plan's work. It is the last row of the Execution table and it is not optional. The rule binds every plan that carries the phase, which is decidable from the plan file alone: a plan that is already Complete, Abandoned or Superseded and does not carry the phase is not reopened to acquire one, and a plan that has the phase runs it even if it reaches Complete before the phase does.
  • That phase audits the accumulated diff of every phase in the plan against the default branch, not the diff of the last phase alone. Auditing one phase at a time would miss what the phases did to each other -- the duplicated helper that only exists once phases three and six have both landed, the doc page that phase two made wrong and phase five never revisited.
  • Once the plan's phases have merged, a diff against the default branch is empty and would read as a clean audit. The range is not reliably derivable after the fact either: unrelated work lands on the default branch between phases, so anything anchored on "since the plan file appeared" is far too wide. It has to be recorded. As each phase lands, what put it on the default branch goes into the plan: the merge commit of its pull request, whose diff against its first parent is the whole of what landed, or -- where the phase landed directly -- every commit of the phase, or its first..last range. A single commit is only ever enough when it is a merge commit. first..last is the label, not the range to diff: A..B excludes A, so a direct landing is read as <first>^..<last>. Drop the caret and the first commit of the phase falls out of the diff silently, which is where a version bump or a column addition tends to live.
  • Where the Execution phases are a table, that record is a Merged column, added last so that a row which omits it still reaches Status; where they are prose sections it is a Merged: line in the phase's own section. The Status column keeps its single vocabulary term and nothing else (see plan-status-vocabulary). A phase that landed in another repository records <repo> <sha> (#pr) and is audited against that repository's default branch, as part of the pull request that lands it; the plan's own push-audit phase cites that audit rather than re-running it.
  • Phases that landed before the plan started recording them are reconstructed rather than left blank. Recover what you can from gh pr list --state merged and git rev-list --first-parent, and say in the plan that the range was reconstructed. Do not trust a path-filtered git log on its own: it lists the commits that touched a path without saying which arrived directly and which arrived inside a pull request, and recording a commit that came in under a merge audits one commit of that pull request rather than the pull request. A reconstructed record may be a summary table in the audit phase's own section rather than a column or a line in the Execution table, which keeps retrospective archaeology out of a table that tracks live status. Where a phase accreted over months of unrelated commits and no range is recoverable, say that instead and name the paths the audit read -- an audit that says what it could not scope is a result; one that silently audits nothing is not.
  • Findings land as their own pull request against the default branch, and the plan is not complete until they are resolved or explicitly declined in writing. A finding that is declined says why, in the plan, where the next reader will find it.
  • Where the audit finds nothing, record that in the plan in one sentence. It is a real result, and a run of them is the evidence for making the phase conditional rather than mandatory.
  • A repository with no PUSH-AUDIT.md still carries the phase, and the phase says that the runbook does not exist yet and what was done instead. Silently omitting it is what let the audit go untriggered for as long as it did. What is done instead is at least the checklist below, applied to the recorded ranges: it is a floor, not a substitute for a runbook, and a plan adds the questions its own repository's blast radius raises. Each item gets a verdict, or a sentence saying why it does not apply. Do not borrow another repository's runbook instead: a runbook is written for one repository's blast radius.
  • Every recorded landing takes one of the forms above: a merge commit with two parents, whose diff is read against its first parent; every commit of a direct landing, or its first..last range read as <first>^..<last>; a landing in another repository, whose own audit is cited; or a statement that no range is recoverable, naming the paths the audit read.
  • Anything the diff added that runs unattended -- cron, a timer, a scheduled workflow, a self-update -- reports its own failure somewhere a human sees, or is named as not doing so.
  • No secret or token entered any repository, and no private hostname or IP address entered a repository more public than the one it came from.
  • Anything the diff removed or renamed has no consumer left, checked by grep across every repository that could consume it rather than by assumption, with the greps stated.
  • Where the repository publishes something -- an image, a release, a package -- a broken change fails closed: one that publishes nothing is recoverable, one that publishes something wrong is not.

In this repository. PUSH-AUDIT.md exists at the repository root and is referenced from AGENTS.md, so the final phase runs it rather than explaining its absence. Every diff command in it takes its range from AUDIT_RANGE, written "${AUDIT_RANGE:-origin/main...HEAD}" so that an unset variable diffs origin/main...HEAD rather than the working tree, which on a clean checkout is empty and passes every check over nothing. Work that has already landed sets AUDIT_RANGE explicitly; the runbook says what to set it to for each shape of landing, and requires a git fetch origin first, because origin/main is itself a cached ref.

Phase landing (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-phase-landing.md):

A plan's status and a repository's review state both live in files that every branch would otherwise rewrite. Left alone, that turns each of them into a merge-conflict hot spot, and it spends a pull request and a full CI run on a change that is entirely prose. Three rules keep them out of the way.

  • A phase is closed out in the first commit of the next phase, not in a pull request of its own. By the time the next phase branches, the previous one has merged, so its merge commit is known and its Merged cell can record the thing the push-audit phase actually needs. This is the only ordering that works: a phase cannot record its own merge commit, and a separate close-out pull request buys that record at the price of a round trip. The close-out sets the finished phase's Status and Merged cells and the plan's row in docs/plans/index.md, and it is committed before the next phase's own work, so that the branch never claims the plan is further along than the default branch is.

  • The last phase closes itself out. The push-audit phase is the last row of every plan, so no next phase will carry its close-out. Where the audit raises findings, the plan is not complete until they are resolved or declined. The test for who carries the cell is whether a pull request lands after the audit phase's own: that one is the carrier, and it can record the audit phase's merge commit, which by then is known.

Two orderings leave no carrier, and neither is worth a follow-up pull request opened for the sake of one cell. Where the audit finds nothing, nothing follows the audit phase. Where the audit raised findings but their pull requests landed while the audit phase was still in review, nothing follows it either -- and that is the common ordering rather than the exception, because an audit phase that runs more than one review round is most of them, and a finding is usually fixed as soon as it is found. In both the phase sets its own Status, and the plan's index row, to Complete in its own pull request and records no Merged cell; where the findings landed first it names their pull requests in the row instead, so what the audit produced is still reachable from the table. The push-audit row is the only row permitted to omit the cell. The column exists so that the push-audit phase can reconstruct what to audit; the audit phase is last, so nothing ever reads its own row.

  • REVIEWS.md is not pruned or regenerated in a pull request that changes code or documentation. Editing a reviewed file stales its mark, and adding or removing an in-scope file moves the header count, but neither is the landing pull request's business. prune regenerates the file whether or not it dropped anything, so the prune-reviews workflow heals both on the next push to the default branch. Pruning from a branch is also wrong more often than it is right, though not for the reason it first appears: prune compares each stamp against HEAD, which on a branch is the branch tip, so it drops the marks for the files the pull request itself touched while keeping marks the default branch has already pruned. Committing that state merges a review file computed from a stale tree, and can resurrect marks prune-reviews has already removed. Accumulated staleness is reported by the review-coverage audit, which recomputes coverage against HEAD and raises an issue once the backlog is worth a review session.

A review session is the exception, and it is not optional tidiness: stamp regenerates REVIEWS.md as well as writing the marks, and the rows, the sidecars and the marks are committed together (see docs/code-review-tracking.md). Where a repository requires a pull request to reach its default branch, that is how a review session lands, so "not in a pull request" is about the kind of change, not the mechanism.

These rules assume phases land one after another. Where two phase branches are open at once, each closes out only the phase it directly follows.

In this repository. The plan index is docs/plans/index.md. review-tracking-tests deliberately does not assert the REVIEWS.md header count, so a phase that adds or removes an in-scope file needs no regeneration commit; prune-reviews corrects the count on the next push to main.

Phases

Phases are sections of this plan, as docs/plans/index.md says plans here are written. Phases 2 and 4 land partly outside this repository, in shakenfist/actions and in the operator's private llm-setup repository (GitLab, private/claude), and partly here (steps 2c and the template work); each records its outside landings in its Merged cell as <repo> <sha> (#pr).

Phase Status Merged
1. comment-proportion v2 Not started
2. Close the review inflow Not started
3. The comment ratchet Not started
4. trim-comments and the actions pilot Not started
5. Fleet rollout through the audit Not started
6. Push audit Not started

Ordering: 1 before everything, because 2, 3 and 4 all cite the block. 3 before 4, because the skill uses the ratchet's report mode to find its targets and the pilot tightens both baselines. 4 before 5, because the pilot is the first other repository the new script runs in, and a script a criterion holds 23 repositories to byte for byte should have run somewhere other than its own home first. 2 is independent of 3 and 4 and can run in parallel with them.

Phase 1: comment-proportion v2

Effort: high to plan (it changes what every push audit asks of a comment), medium to execute.

Step Effort Model Isolation Brief for sub-agent
1a high opus none Rewrite templates/shared-blocks/comment-proportion.md as v2 (bump the begin marker to v2). Keep all four of v1's bullets in substance; v1's fourth ("prose that documents user-visible behaviour rather than the implementation usually belongs in docs/, with the comment reduced to a pointer") merges into addition (iii) as one rule covering both classes of material -- do not drop it. Add, in this order: (i) a comment describes the code as it is now; the history of a block -- what it replaced, what was removed, which fix came when -- belongs in the commit message; (ii) the one exception is history recording a previous mistake that must not be made again, a hard-won lesson the implementation does not make obvious, and it is written as the lesson ("do not X: Y happens") rather than as the story of learning it; (iii) measurements, figures, comparisons of alternatives and prose about user-visible behaviour go stale in a comment and belong in docs/, the comment keeping the conclusion and a pointer; (iv) when code a comment describes changes, rewrite the comment to fit, never append a paragraph to it; (v) in configuration (a workflow, an action, an Ansible task) the commented code is often a single line, so the length test is whether each sentence is still a constraint on that line; (vi) the judgment rule is a block over roughly fifteen lines on a body under ten; where a repository runs the source-size-ratchet hook, it separately ratchets block length alone, so a block the judgment rule endorses can still fail the hook -- which asks for a baseline entry with a reason in the pull request, not for the comment to be shortened. Keep it under 40 lines: this block is embedded in 20+ runbooks and is itself subject to the rule. If 40 will not hold the additions, (vi) gives way first: one sentence, with a pointer to templates/source-size-ratchet/README.md for the mechanism. Read templates/shared-blocks/README.md Updating a block first.
1b medium sonnet none Re-embed the v2 block verbatim in this repository's PUSH-AUDIT.md (replace the v1 copy between its markers) and anywhere else here grep -rn 'shared-block: comment-proportion' finds it. Then run grep -rn comment-proportion outside docs/plans/ for the prose references -- at the time of writing templates/shared-blocks/source-file-size.md (and its embedded copy in PUSH-AUDIT.md), docs/audits/test-coverage.md and docs/audits/push-audit.md -- and record a verdict for each in this section. Most will stand; source-file-size is itself a shared block, so changing it is a second version bump and a second fleet sweep, to be decided deliberately rather than discovered. docs/audits/push-audit.md Why comment proportion is a judgment check is left for step 5a, because what it would point at does not exist until phase 3. Run pre-commit run --all-files.
1c medium sonnet none In ~/src/private/llm-setup/dot-claude/CLAUDE.md, under Code preferences, add one bullet: comments state what the code cannot; history only as a lesson not to repeat; rewrite rather than append; the canonical rule is comment-proportion in shakenfist/development. Two lines at most. Separate commit in llm-setup; the operator approved this edit by approving this plan.

Before merging, measure the blast radius with the fleet snapshot recipe from docs/consistency-audits.md, Before and after a change to a check -- audit-check.py audits one checkout at a time (--repo-path/--repo-name), so it is not the tool for a fleet question:

tools/audit-snapshot.sh ~/src/shakenfist /tmp/snap/before
# ... 1a and 1b ...
tools/audit-snapshot.sh ~/src/shakenfist /tmp/snap/after
tools/audit-snapshot.sh --diff /tmp/snap/before /tmp/snap/after

The before snapshot has to be taken before 1a edits the canonical block, so it is the first thing the phase does. Record how many repositories the bump newly fails (expected: 11 -- the 12 compliant in the push-audit table less development, which 1b updates; the two non-compliant ones already have an open issue). That is the design -- Updating a block in the shared-blocks README -- and the template-resync skill is how those issues are worked; the number goes in this section.

Definition of done: v2 merged here; this repository's own copy at v2; the CLAUDE.md line landed in llm-setup; the newly failing count recorded.

Phase 2: close the review inflow

Effort: medium. Three repositories, three landings.

Step Effort Model Isolation Brief for sub-agent
2a medium sonnet none In ~/src/private/llm-setup/dot-claude/skills/respond-to-review/SKILL.md, Triage, replace the document bullet: address it if it is a comment or docstring by rewriting the comment block it concerns to the comment-proportion minimum -- merge the new point into what is there, cut what it supersedes, never append a paragraph, and never record the review round itself in the comment; where the point is design reasoning or a measurement, put it in docs/ and leave a one-line pointer; otherwise let the auto-filed issue carry it. Keep the edit to that bullet plus at most two sentences.
2b medium sonnet worktree In shakenfist/actions, review-pr-with-claude/review-pr-with-claude.sh, prompt heredoc (Action Types, line 543 on actions main as of 2026-12-05): redefine document as "documentation in docs/, or a comment that is missing or wrong -- not a request to lengthen a comment that is already correct". Add one review instruction: a comment block that this PR lengthened by appending history or a narrative of a change, rather than rewriting it, is a consider item in category style. Write both so they stand on their own rather than citing comment-proportion: the reviewer reaches every repository on merge, and 11 of them carry v1 until their resync issues are worked. Update review-schema.json's document description to match. Check tests/test_review_pr_with_claude.py for assertions on prompt text and keep it passing. actions' own docs/actions.md does not describe the action types (checked 2026-12-05) -- check again and leave it alone if that still holds; the page that does describe them is in this repository, and is step 2c. Read actions' AGENTS.md first: a merge to its main deploys to every repository at once, and this file is covered before merge only by that unit test.
2c low sonnet none In this repository, update docs/automated-pr-review.md to the new document definition: the Action Types table row (document | Documentation should be added, around line 90) and the paragraph after the table. The schema block above it lists the action values without describing them, and the values do not change, so it needs no edit. That page is the fleet's written account of the reviewer and is in this repository's review scope, so left alone it contradicts the prompt 2b ships. A landing of its own, since 2a and 2b are each in another repository.

review-pr-with-claude.sh carries a review mark on actions' main, imported when shakenfist/actions#288 merged; 2b stales it, which is expected and goes on the re-review list with the pilot's files.

Definition of done: all three landed; the next automated review on any actions pull request shows the new document wording in its prompt artifact; docs/automated-pr-review.md here says the same thing as that prompt.

Phase 3: the comment ratchet

Effort: high to plan and execute -- this script is the subject of a criterion specified for 23 repositories, compared byte for byte, and deployed in three of them (development, instar, ryll).

Six design decisions are settled here rather than left to a sub-agent, because each of them is a way the step could quietly change what the fleet is held to.

Comment detection is line-based, and its limits are stated rather than engineered away. A line is a comment line when, after leading whitespace, it begins with its file's marker -- #, or // but not /// or //! -- except that a first line beginning #! is a shebang. The file is read in binary in the bounded chunks count_lines() uses, lines split out of each chunk and an over-long line kept only to its first bytes, which are all the marker match needs; the marker is matched as bytes, never decoded. So an undecodable byte cannot raise and a vendored single-line bundle cannot cost memory where count_lines() would not. Nothing else is parsed: no heredoc tracking, no YAML scalar indentation, no string awareness. The README already declined "a lexer per language" for the length ratchet, and a per-family scanner in a byte-identical script is a bug surface every adopter carries. What follows, by construction:

  • Right without effort: a marker anywhere but the start of a line -- in a string literal, a URL, after code -- never makes a comment line, because only full-line comments count; a line with a trailing comment is code and ends a block.
  • Counted though not a comment: a line beginning with the marker inside a heredoc body, a YAML block scalar or a multi-line string. In a workflow's run: | scalar those lines are shell comments and counting them is right; a heredoc that writes a configuration file is the case that is wrong.
  • Not counted though a comment: /* */ blocks, docstrings, doc comments (Open questions 3), and ; comments in .cfg, where only # is recognised.

A false positive is stable rather than a surprise: the baseline is written by the same detector, so the block is already in its entry and surfaces only when someone lengthens it past that. The remedy is a reasoned baseline edit, as for a real comment, or for a file that is mostly generated text an entry in tools/comment-block-exclude. The tests pin this behaviour, false positives included, so changing the detector later is a visible change to what the fleet is held to.

The extension list is separate from SOURCE_EXTENSIONS. The source-size-ratchet criterion reads the tool's own list to decide whether it applies at all: source_extensions() parses SOURCE_EXTENSIONS out of the template with ast and applies() skips "a repository with no tracked source to measure" using it (scripts/audit/checks/source_size.py, and docs/audits/source-size-ratchet.md documents it). Widening SOURCE_EXTENSIONS to reach .yml, .toml and the rest would make images and private-ci -- currently N/A -- applicable and immediately non-compliant, filing consistency issues in two repositories deliberately outside this criterion's reach. The consequence is accepted: images and private-ci, mostly workflows and configuration -- the worst class in Situation -- get no comment ratchet at all (Future work). So the comment pass gets its own module-level marker map (COMMENT_MARKERS), SOURCE_EXTENSIONS is untouched, and applies() does not move. The same short-circuit is why the comment pass gets its own exclude file, tools/comment-block-exclude: measure() tests the extension before applying tools/source-size-exclude, so sharing one file would change which of its patterns count as used and silence existing unused-pattern notes. Everything else in measure()'s walk applies to the comment pass unchanged: BUILTIN_EXCLUDES and the skip of tracked paths that are not regular files. A missing exclude file is an empty one, as now. Note the asymmetry the README already records for review scope: a baseline is machine-written and wants an exclude entry, while an exclude file is hand-written reasoning and wants an include one.

Extensionless files are out of scope. The script decides what is source by extension and nothing else, and both the module docstring and the README record why: "neither is a file with no extension, such as a script known only by its shebang: telling those from data would mean reading every tracked file". Shebang detection would reverse a documented decision for a cost the gain does not justify, so the comment pass has the same blind spot and the README says so. (A shebang line inside an in-scope file is a different thing, and is a detection case the tests must cover: #!/bin/bash must not open a comment block.)

The baseline modes. The script has --update and --init, not --update-baseline, and the two are not interchangeable: --update "never raises an entry or adds a file", so it cannot write a baseline from scratch, and --init writes from scratch, which the README restricts to adoption because "run it later and it silently accepts whatever has grown since, which is the drift the tool exists to stop". Neither mode can do the operation phase 5 needs -- an existing adopter resyncing the new script must initialise the comment baseline while leaving the length baseline alone. So --init gains an optional argument naming which baselines to write: --init (both, for a new adopter, and its explicit spelling --init both), --init comments, --init length, and any other value a usage error (exit 2) that writes nothing. --update tightens whichever baselines are loose, independently, and still never raises an entry in either.

An absent comment baseline means not yet adopted, not empty. The length ratchet treats a missing baseline as an empty one and that stays: few files exceed 1,500 lines, and three repositories already depend on it. For comments almost every repository has oversize blocks, so failing closed would make a resync that copies the script and stops block every commit. So when tools/comment-block-baseline does not exist at all, the comment pass prints a note -- how many oversize blocks there are and that --init comments turns enforcement on -- and exits 0 for that half; once the file exists, even header-only, it is enforced: a file with an oversize block and no entry fails, as for the length baseline, and a file with neither passes. --init comments is therefore the one switch, which is why the resync's follow-on edit runs it (step 5b). Because the hook's note is invisible on a passing commit, the unenforced state is made an audit finding instead (step 5a).

The length ratchet's "do not delete comments" message has to be reconciled. The script prints "Shrinking by deleting comments is not a fix: rationale is worth more than the line count" on every length failure, and the README says the same at more length ("Comments count. A comment-blind count would need a lexer per language, and the baseline already removes the pressure to delete rationale to get under the line"). Without an edit, one tool says both "do not shorten comments to pass me" and "shorten comments to pass me". The distinction to write down, in both places: the length ratchet forbids deleting a reason in order to pass it, while the comment ratchet is passed by rewriting a block to the comment-proportion rule and moving measurements to docs/ with a pointer -- never by deleting rationale to make a number.

Step Effort Model Isolation Brief for sub-agent
3a high opus worktree Extend templates/source-size-ratchet/source-size-ratchet.py (read all of it and its README first) with a comment-block ratchet beside the length ratchet, using the definitions in Open questions 2 and the six decisions above. Detection is the line rule of the first decision and nothing more: no heredoc, scalar or string tracking. Markers in a new COMMENT_MARKERS map keyed by extension, leaving SOURCE_EXTENSIONS exactly as it is: # for .sh .bash .py .yml .yaml .toml .cfg; // for .rs .go .ts .tsx .mts .cts .js .jsx .mjs .cjs .c .h .cc .cpp .cxx .hh .hpp, excluding lines beginning /// or //! -- every SOURCE_EXTENSIONS entry but .css, which has no line comment, so the lookup is defaulted and a file whose extension has no marker is skipped by the comment pass rather than raising. Read in chunks as the first decision says, never a line at a time. Files with no extension are out of scope, Dockerfile included (Future work). A block's length counts comment lines only; oversize is 16 or more. Baseline tools/comment-block-baseline, one <total> <longest> <path> per file sorted by path under a header of its own, written by the existing temporary-file-and-rename writer and is_regular() guard generalised over the destination rather than copied. Exclude tools/comment-block-exclude, the format of tools/source-size-exclude. A missing exclude file is an empty one, a missing length baseline stays an empty one, and a missing comment baseline is the not-adopted state of the decision on an absent comment baseline: a note and exit 0 for that half. In an existing comment baseline, a file with an oversize block and no entry fails, either number above its entry fails, and shrinkage passes and is noted. Mirror the length pass's line-break guard in measure(): a file with an oversize block whose path holds \n or \r is a ToolError naming tools/comment-block-exclude. --init takes an optional comments/length argument, which a store_const member of the mode group cannot: make it nargs='?' with const='both' and choices=('both', 'comments', 'length') -- const must be one of the choices, because argparse checks a bare --init's const against them and with choices=('comments', 'length') rejects it as an invalid choice (checked on Python 3.13) -- on dest='init' with default=None, while --update and --report stay store_const on dest='mode' in the same mutually exclusive group, and the mode is 'init' when args.init is not None, else args.mode or 'check'; argparse's usage error is already exit 2; --update tightens each number of each baseline independently and never raises one. Add a --report mode, needing no baseline, listing every oversize block as path:line length, longest first, for step 3b and the skill in phase 4; it exits 0 whenever it produced a listing, oversize blocks or not, and 2 only on tool failure, since 3b loops it and the skill reads it for discovery -- say so in the module docstring's modes and the argparse epilog; every path through shown(), the invariant the rest of the script keeps for paths that reach a CI log. Describe the comment pass, its detector's limits and the absent-baseline rule in the module docstring. Reword the length-failure message and its README passages per the decision on the length-failure message. The comment-pass failure message names its remedy -- rewrite the block to the comment-proportion rule, measurements to docs/ -- and says that two blocks may have merged because the code between them moved, since that fails a commit adding no comment line. Keep it stdlib-only, single-quoted, wrapped at 120. Tests go in scripts/tests/test_source_size_ratchet.py; measure it on the branch, and if the list below would take it past 1,500, put the comment pass's tests in a new scripts/tests/test_comment_block_ratchet.py instead of adding a baseline entry for the test module. Copy the script to this repository's tools/source-size-ratchet.py in the same commit: test_script_matches_the_template in that file compares the two byte for byte under pre-commit run --all-files, so a template-only commit is red. With no comment baseline yet, the copy's hook passes on the absent-baseline rule, so nothing is enforced before 3b.
3b high opus none Measure before anything enforces or merges, with the 3a script run from its worktree as python3 -I /abs/path/source-size-ratchet.py --report -- -I as the hook runs it, since historical checkouts are the content that flag guards against -- and nothing committed in any repository. (1) Run --report over actions main and record the three areas of Situation's table under the final block definition, beside the table, so the table and the ratchet count the same thing. (2) Friction: for actions, this repository and ryll, take the last 20 merged pull requests and run --report at each one's first parent and merge commit, in a scratch git worktree per commit removed afterwards; count those that would have needed a comment-baseline edit -- a new oversize file, or a file whose total or longest rose. Record the counts here, with the wall-clock time of a full run of the old and new scripts in the largest repository the criterion covers. The threshold of 15 is confirmed or revisited on these numbers. If the friction is high, stop before 3c, with 3a unmerged, and revisit the design rather than the documentation: the grace shape to consider is failing only on growth of a file already in the baseline, and reporting rather than failing a file's first oversize block.
3c medium sonnet none With the copy 3a committed in tools/, generate tools/comment-block-baseline with --init comments, and run pre-commit run --all-files. Add tools/comment-block-baseline to .vscode/review-scope.toml's exclude list, with the same reasoning the tools/source-size-baseline entry carries (the tool rewrites the whole file, a mark on a column of numbers attests to nothing, and because it has no extension no include pattern matches it, so left alone review-scope-completeness reports it as an orphan). Update templates/source-size-ratchet/README.md: files table; a Comment blocks section stating the metric (total and longest), the detector and its stated limits, and the absent-baseline rule, and pointing at comment-proportion as the policy half, as it already does for source-file-size; What it counts, whose Source only bullet must say the comment pass is extension-driven too and names its own marker map; the two passages about deleting comments -- the Lines as wc -l counts them bullet and the last line of Growing a baselined file -- per the decision on the length-failure message above; Repository-local exclusions, for the second exclude file -- a generated tree needs its pattern in both files, and --report is how to find one in the comment pass's wider extensions before --init comments; and Adopting it step 4 (the --init argument) and step 5 (both baselines get a review-scope exclude entry and an exclude file gets an include one, so every later adopter gets it). Rewrite, per v2 rather than by appending, the hook prose that names one baseline and one exclude file as the inputs that change the verdict: the comments in templates/source-size-ratchet/pre-commit-hook.yaml, which every adopter copies, and this repository's copy of that prose above the source-size-ratchet hook in .pre-commit-config.yaml. Add one clause to the root README.md bullet for templates/source-size-ratchet/ naming the comment-block ratchet; one to AGENTS.md's description of the hook -- it now also fails a commit that grows a file's oversize comment blocks past its entry in tools/comment-block-baseline; and one to ARCHITECTURE.md's tools/ bullet naming the second baseline. llm-doc-structure measures AGENTS.md and ARCHITECTURE.md, and readme-discipline the README. Record the generated baseline's entry count in this section.

3a does not merge until 3b's numbers are accepted. Merging the template is what makes every adopter's copy drift, so a design change 3b asks for after that is a second template change and a second drift cycle. 3a stays on its branch while 3b runs against it, 3c is committed on the same branch, and phase 3 lands as one pull request.

Phase 3 is the change that makes every adopter's copy drift from the template, so it carries the blast-radius measurement, with the tools/audit-snapshot.sh before/after/--diff recipe phase 1 uses: before ahead of 3a, after once 3c is done and before the merge. Expected: instar and ryll newly fail on the byte comparison (development is updated in 3a, and the other 20 already have an open source-size-ratchet issue); the length half of the diff should be empty. Record the count here. Those two issues are worked after phase 4, per the ordering above.

Phases 1, 3 and 5 stale review marks here as the pilot does in actions: the shared block and its embedded copies, both copies of the script, the template README and hook prose, .pre-commit-config.yaml, AGENTS.md, ARCHITECTURE.md, README.md, scripts/audit/checks/source_size.py and the docs/audits/ pages. They add to this repository's review-coverage finding (development#449, open at the time of writing) and go on the re-review list phase 4 hands over. The template script comes first on it: instar's, ryll's and actions' marks for their copies are imported from its review here, so until it has one every resync carries an unreviewed copy.

The test list for 3a, in scripts/tests/test_source_size_ratchet.py. The detection cases come first because they are the ones most likely to be wrong, and leaving them to phase 6 would mean the script reaches its adopters -- and through the byte-identical criterion the fleet -- untested. They pin the line rule's behaviour, its known false positives included, so a later change to the detector shows up as a changed test.

  • Detection: a first-line shebang does not open a block, and #! on a later line is a comment; # or // after code, inside a string literal on a code line (Python, Rust, Go, TypeScript) and inside a URL is not a comment line; a line beginning # in a YAML block scalar, a shell heredoc body and a Python triple-quoted string is counted -- the documented false positives; a file holding an undecodable byte is measured, not a failure; /// and //! excluded; blank lines neither splitting a block nor counting towards it; a code line splitting one; a file of only comments and blank lines as one block; CRLF line endings, which read_baseline() already handles explicitly.
  • Threshold: a 15-line block is not oversize and a 16-line block is.
  • Verdicts: pass; the total past its entry; the longest past its entry while the total falls; a new oversize file; shrink noted rather than failed; an absent comment baseline passing with a note that names --init comments; in an existing comment baseline, a file with an oversize block and no entry failing, and one with neither passing.
  • The two baselines are independent in both directions -- initialising or tightening one must not rewrite the other -- and --init comments works on a repository that already has a length baseline; a bare --init writes both and exits 0; --init with any other value exits 2 and writes nothing.
  • Merging and splitting: two oversize blocks with one code line between them, that line deleted and no comment line changed, fail on the longest; a 16-line block split into two 8-line blocks around a code line passes, and --update drops the file's entry.
  • BUILTIN_EXCLUDES and a tracked path that is not a regular file are skipped by the comment pass as by the length pass.
  • A file whose oversize blocks all fall under the threshold leaves the comment baseline on --update, and re-adding a block then fails.
  • A path with a line break and an oversize block is a tool failure naming tools/comment-block-exclude, beside the length pass's test.
  • An unused tools/comment-block-exclude pattern is noted separately from an unused tools/source-size-exclude one.
  • A malformed tools/comment-block-baseline line is a tool failure naming the file, the line number and the expected <total> <longest> <path>, and so is a path listed twice, as for the length baseline; a comment baseline holding only its header is enforced, not treated as absent.
  • --report output format, with nothing oversize, with no comment baseline, and path escaping through shown(); it exits 0 with oversize blocks present.
  • Every SOURCE_EXTENSIONS entry but .css has a COMMENT_MARKERS entry, so widening the length pass cannot leave a language outside the comment pass unnoticed; and a tracked .css file with comment-shaped content is measured by the length pass, skipped by the comment pass, and exits 0.
  • A file of one enormous line in an in-scope extension is measured without being held in memory whole.
  • With no comment baseline, --update and --init length both leave it absent.
  • End to end: the hook in a repository where the comment baseline is absent, which is the state a template resync leaves behind, passes and prints the note.

Definition of done: the template and this repository's copy are byte-identical; tests cover the cases above; 3b's numbers and the newly failing count recorded; this repository passes its own hook with a comment baseline; the template README, the root README.md bullet, both copies of the hook prose, AGENTS.md and ARCHITECTURE.md describe two baselines rather than one.

Phase 4: trim-comments and the actions pilot

Effort: high. The skill's judgement is the part of this plan that can do damage: a block cut from 63 lines to 5 can lose the sentence that stopped someone "fixing" the code under it.

Precondition, now satisfied: actions' reviews branch has merged (shakenfist/actions#288, merge 82fc181, carrying 84c6179), so the marks the pilot stales are recorded and their loss will show up as an ordinary prune.

actions is not a ratchet adopter, so 4b is an adoption. docs/audits/compliance.md records it non-compliant with shakenfist/actions#276 open: no tools/source-size-ratchet.py, and nothing in .pre-commit-config.yaml that invokes it. Copying the script and stopping would land a script no hook and no CI lane runs, so neither ratchet would gate anything in the one repository this plan sweeps -- and 4d's "tighten the baselines" and the skill's ratchet-failure trigger would never fire. 4b therefore runs the whole of Adopting it from templates/source-size-ratchet/README.md, and its pull request closes actions#276. Expect the length baseline to carry entries for whatever actions already has over 1,500 lines; that is a starting point, not an endorsement.

The skill needs a hard stop for byte-identical files. 4a's guards -- the classification rules, the grep for identifiers a test or AGENTS.md depends on, and the hard stop on a non-comment line in the trimmed file's git diff -U0 -- are all about the content of a trim, and none of them stops the skill trimming a file that must stay byte-identical to a template. tools/source-size-ratchet.py itself, tools/ci-prune-reviews.sh, the review-tracking workflow copies and the caller stubs are all in that class (docs/audits/source-size-ratchet.md, docs/audits/review-tracking-templates.md). Trimming one makes its repository non-compliant and files a consistency issue -- the blast radius the preamble names -- and the steady state is running this skill in other people's repositories during a review session, so the stop belongs in the skill rather than in the operator's memory. The skill refuses such a path, reports it rather than skipping it silently, and says that the way to trim one is to edit the template in shakenfist/development and re-sync.

The stop is keyed on the repository, not on the path, and this plan's own pilot shows why. tools/mermaid-lint.sh is a byte-compared wrapper in every adopter (docs/audits/mermaid-lint-ci.md: "the wrapper is held to the template by a byte comparison instead") -- and in actions the same path is the checker itself, "the only copy of it in the fleet", which is the one place it is editable and is a 4b target. A stop that matched the bare name would refuse the only repository where the trim is correct, and a stop that matched nothing would corrupt the other 20. So the skill asks whether this repository's copy is a template copy -- its own notes, the audit spec's adopter list -- and treats a path it cannot classify as a refusal to report rather than a trim to make.

Step Effort Model Isolation Brief for sub-agent
4a high opus none Write ~/src/private/llm-setup/dot-claude/skills/trim-comments/SKILL.md, following the shape of retire-plans and template-resync in that directory. The skill: finds targets with tools/source-size-ratchet.py --report (or takes files as arguments); for each block, classifies every sentence as constraint/trap (keep), lesson-history (keep, rewritten as the lesson), plain history (drop: it is in git log), measurement or design reasoning (move to the docs/ page that owns the topic and leave a pointer, in the same commit), or restatement of code (drop); never splits a block with a code line to get it under the threshold; never removes a sentence that AGENTS.md, a test name or an assertion depends on -- grep for the identifiers the sentence names before cutting it; verifies the trimmed file's diff touches comment lines only (a non-comment line in its git diff -U0 is a hard stop), and that the only other path the commit touches is the docs/ page the moved material landed on, named in the commit message; tightens both baselines with --update; one commit per file; reports which files carried review marks, since each now needs re-review; and refuses a byte-identical template copy per the paragraph above. When the skill is invoked inside a review session, it runs before stamp, so the reviewer stamps the trimmed file. Description must trigger on "trim/prune/shorten comments", "comments are too verbose", and the ratchet failing on comment blocks.
4b high opus worktree In shakenfist/actions, first resync PUSH-AUDIT.md to comment-proportion v2 with template-resync, closing the issue phase 1 filed there, so the trims' justification is in actions' own runbook. Then adopt the ratchet, following Adopting it in templates/source-size-ratchet/README.md: copy the phase 3 script byte for byte and keep it executable, merge the hook stanza into .pre-commit-config.yaml, check how actions CI runs its hooks and add the ci-job.yaml lane if it runs them individually, run --report to find anything generated or vendored, then write tools/comment-block-exclude and tools/source-size-exclude if anything is tracked, run --init to write both baselines, put both baselines in .vscode/review-scope.toml's exclude list and any exclude file written in its include list (review tracking is deployed in actions; that file exists), and say in the pull request that it closes actions#276. The adoption is a pull request of its own, since it changes actions' commit and CI gates. Then, in a second pull request, run trim-comments on .github/workflows/smoke-cluster.yml, tools/ci_headroom_collect.sh and tools/mermaid-lint.sh, one commit each. Re-read the runs-on block before trimming it rather than trusting the list below -- see the note after this table. On actions main today it must keep: that the runner has no swap, so the conductor's swap-based upsize triggers cannot see the need (shakenfist#3696); why the size token is s-cloud/s-cluster rather than s, which is the capacity-claim argument -- a runner is claimed for the per-dimension maximum of every job pending in its (label, size) combination, so a cloud-building job sharing a combination with lint jobs sets every lint runner's claim, and an unknown future topology lands on s-cluster to over-claim rather than refuse; the audit-ok: vm-runner-size marker; and the pointers to docs/consuming.md Runner sizes for jobs that build a cloud and private-ci docs/capacity-claims.md Cloud-building jobs. The megabyte figures (2678-2714, 2618, 2714, 2719) are the measurements, and they move to docs/consuming.md under the heading the comment already points at. Read actions' AGENTS.md first. pre-commit run --all-files and python3 -m unittest discover -s tests -t . must pass. Record before and after line counts per file, and tighten both baselines at the end -- trimming comments shrinks files, so a trimmed file already in tools/source-size-baseline otherwise leaves a loose entry and the hook prints a slack note on every run until --update.
4c medium opus none Revise the skill from what 4b found: every place the management session overrode the skill's classification is a rule the skill lacked. Record the overrides in this section.
4d high opus worktree Sweep the rest of actions with the revised skill: every file --report lists, workflows first, then tools/, then */action.yml. One commit per file, as many pull requests as keep each reviewable (about ten files each), each passing pre-commit run --all-files and the unit suite, each tightening both baselines. The management session reads every diff, not the summary.

smoke-cluster.yml has an open branch over it. actions' bind-smoke-cluster-runners branch rewrites the same runs-on rationale -- it is where the bound- label prefixes and tests/test_smoke_cluster_runner.py come from, and neither is on main -- so the must-keep list above is the file as main has it and will be wrong if that branch lands first. 4b re-reads the block and derives its own list; the list in the brief is there to be checked against, not copied. If the branch is still open when 4b runs, trim smoke-cluster.yml last, or substitute another workflow and say so here: a trim and a rewrite of the same comment block is the one conflict in this plan that no tool resolves.

Definition of done: the skill landed in llm-setup; actions' PUSH-AUDIT.md at v2; the adoption, pilot and sweep pull requests merged in actions and shakenfist/actions#276 closed; actions CI has a lane that reaches the hook; before/after comment counts recorded here (by area, as in Situation); the skill's revisions recorded; --report on actions lists no block the sweep chose to leave without a sentence here saying why; the re-review list (every trimmed file and review-pr-with-claude.sh in actions, and the files phase 3 names here) handed to the operator. A review-coverage issue in actions is an expected output, not a regression: every trim stales a mark, the criterion files once five or more in-scope files need review, and the sweep stales far more. Its file list should match the re-review list.

Phase 5: fleet rollout through the audit

Effort: medium to plan; high where it touches what the source-size-ratchet criterion reports.

Step Effort Model Isolation Brief for sub-agent
5a high opus none Update docs/audits/source-size-ratchet.md (What we check: the script also ratchets comment blocks and carries a second baseline and a second exclude file; the copy is still compared as bytes, so the template change makes every adopter's copy drift; and the comment baseline must exist) and docs/consistency-audits.md if it describes the criterion's scope. Reconcile docs/audits/push-audit.md Why comment proportion is a judgment check, deferred here from 1b: it says "comment volume has no honest mechanical threshold" and that what can be mechanised is "a report-only grep"; keep the judgment framing for proportion, say that where a repository runs the source-size-ratchet hook a block's growth past its per-file baseline is ratcheted mechanically, and replace the report-only-grep sentence with a pointer to --report. The check class gains one finding in run() of scripts/audit/checks/source_size.py, beside its three: where the copy matches the template, a missing tools/comment-block-baseline is non-compliant, with a reason naming --init comments, because the hook passes without one (phase 3's decision on an absent comment baseline) and nothing else would report it. Rewrite the run() docstring's sentence that no baseline is required to exist, keep it true for the length baseline, and add pass and fail cases to scripts/tests/test_source_size_checks.py. The issue title does not change, so the frozen tables do not. applies() should need no change, because phase 3 deliberately leaves SOURCE_EXTENSIONS alone -- verify rather than assume it: read scripts/audit/checks/source_size.py, confirm source_extensions() still parses, confirm applies() returns the same verdict for every repository, and confirm images and private-ci are still N/A. Say so in the pull request. If the extension list did move after all, the two newly applicable repositories are a decision for the operator, not a side effect to absorb.
5b medium sonnet none Measure 5a's new finding alone, with the same snapshot recipe -- phase 3 already recorded the template drift, so this before includes it. Expected: no newly failing repository until instar and ryll are resynced, since the finding applies only where the copy matches the template. Then put the resync obligations in the template README so template-resync picks them up, and work instar and ryll with it: the resync commit runs --report, copies every still-applicable tools/source-size-exclude pattern and any generated tree --report finds into tools/comment-block-exclude, then runs --init comments to write tools/comment-block-baseline (without it the hook passes with a note and the 5a finding reports it); and any later resync whose template change lengthens a comment block -- in the script itself, in another byte-compared file, or in the pre-commit-hook.yaml prose -- raises that file's entry in the same commit, with the reason in the pull request, because --update never raises one.

Definition of done: documentation merged; the comment-baseline finding landed with its tests and applies() verified unchanged; the newly failing count recorded; the first scheduled audit run after merge read, and its filed issues counted against the prediction.

Phase 6: push audit

Run PUSH-AUDIT.md over the union of every phase's recorded landings, here and in actions; the llm-setup landings are audited against the shared block's floor checklist, since that repository has no runbook. Specific questions: did any trimmed comment drop a constraint something still depends on; did any trim touch a file a criterion compares byte for byte; and did this plan's own comments obey v2. Comment detection on YAML block scalars, shebang lines and shell heredocs is not a question for this phase -- phase 3's test list covers it before the script ships, which is where it belongs; this phase checks only that those tests exist and still pass.

Agent guidance

Execution model

Sub-agent execution model (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/subagent-execution-model.md):

All implementation work is done by sub-agents, never in the management session. The management session is reserved for planning, review, and decision-making. This keeps the management context lean and avoids drowning it in implementation diffs.

The workflow is:

  1. Plan at high effort in the management session.
  2. Spawn a sub-agent for each implementation step with the brief from the plan, at the recommended effort level and model.
  3. Review the sub-agent's output in the management session. Check the actual files -- the sub-agent's summary describes what it intended, not necessarily what it did.
  4. Fix or retry if the output is wrong. Diagnose whether the brief was insufficient (improve it) or the model was too light (upgrade it), then re-run.
  5. Commit once the management session is satisfied.

This applies to all steps, including high-effort ones. If a sub-agent cannot succeed even with a detailed brief and the right model, that is a signal the brief needs improving, not that the management session should do the implementation itself.

Use isolation: "worktree" for sub-agents when the change is risky or experimental; the worktree is discarded if the output is unsatisfactory. For safe, well-understood changes, sub-agents can work directly in the main tree.

Planning effort

Planning effort (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-planning-effort.md):

The master plan itself is always created at high effort -- it requires broad codebase understanding, cross-referencing several source files, and judgment calls about scope and sequencing.

Each phase plan states the recommended effort level for planning that phase. Phases that turn on design decisions, cross-component coordination, protocol changes, or subtle correctness questions should be planned at high effort. Phases that are mechanical, or that follow a pattern already established elsewhere in the codebase, can be planned at medium effort.

In this repository. High effort is anything that changes what a criterion means, anything that touches the scheduler in audit-check.py, and anything that reaches audit-manage-issues.py -- those decide what the fleet is held to and what lands in other people's issue trackers. Medium effort covers adding a criterion that follows the shape of an existing one, a documentation sweep, or a template change with a worked example already in the tree.

Step-level guidance

Sub-agent step guidance (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/subagent-step-guidance.md):

Each phase plan includes a table like this:

Step Effort Model Isolation Brief for sub-agent
1a medium sonnet none One-sentence summary of what to do and which files to touch
1b high opus worktree Why this needs high effort: requires understanding X to do Y

Effort levels, from cheapest to most thorough:

  • low -- Purely mechanical changes: rename, reformat, add a log line, regenerate generated code. The brief is a complete instruction.
  • medium -- The plan provides enough context to follow a clear brief. The sub-agent may read a few files, but the approach is already decided.
  • high -- Requires reading several files, making judgment calls, or understanding non-obvious invariants. The sub-agent needs to think about edge cases.
  • xhigh -- The setting for hard coding and agentic steps: long-horizon changes, or steps where the sub-agent must both research and implement.
  • max -- Correctness matters more than cost. Expect diminishing returns and occasional overthinking; reserve it for steps where a wrong answer would be expensive to detect.

Brief for sub-agent: this is the key field. Write it as if briefing a colleague who has never seen the codebase. Include what to change, which files to touch, what patterns to follow, and any non-obvious constraints.

A good brief front-loads the research the planner already did, so the implementing agent does not repeat it. Instead of "add storage functions for the new object", name the functions to add, the file they belong in, the existing equivalent to mirror (with line numbers), and any registration the change also needs.

The better the brief, the lower the effort level needed and the lighter the model that can succeed.

In this repository. A worked brief: instead of "add a check that plans are indexed", write "add a PlanIndex class to scripts/audit/checks/plans.py declaring the id plan-index, its spec and its issue_title as class attributes and implementing run(repo), register the instance in CHECKS in scripts/audit/registry.py beside the other plan checks, write docs/audits/plan-index.md following the structure in docs/audits/README.md and linking to compliance.md#plan-index, add the file to docs/audits/README.md, add its lines to FROZEN_METADATA and FROZEN_ISSUE_TITLES in scripts/tests/test_metadata.py, and add tests to scripts/tests/test_plans.py covering pass, fail and not-applicable." A brief that names five of the criterion's six files is the characteristic defect here, and the frozen tables are the one most often left out.

A check that does not apply reports not_applicable with a reason rather than being omitted, because an omitted check renders as unknown.

Model choice

Sub-agent model roster (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/subagent-model-roster.md):

The planner recommends which model is best suited to each step. This is a judgment call, not a rigid rule -- the right model depends on what the step requires, not on whether it is "planning" or "implementation". The models available to sub-agents are:

  • fable -- The most capable model available, for the hardest reasoning and the longest-horizon work: multi-step changes a single sub-agent must carry end to end, or steps whose correctness depends on holding a whole subsystem in mind at once. It costs materially more than opus, so reserve it for steps that have already defeated opus or are expected to.
  • opus -- The default for steps needing deep reasoning, architectural understanding, subtle correctness judgment (locking, state machines, migrations), or intricate implementation that would be costly to debug if it were wrong.
  • sonnet -- A good default for well-briefed implementation work. Faster and cheaper than opus, and effective when the plan front-loads the research and the brief leaves no broad judgment calls to make.
  • haiku -- Suitable for purely mechanical tasks: search-and-replace, regenerating generated code, adding log lines, running commands. The brief must be a near-complete instruction.

Model choice interacts with effort level and brief quality. A detailed brief compensates for a lighter model -- sonnet at medium effort with a thorough brief often matches opus at medium effort with a vague brief. The planner's job is to write briefs good enough that the recommended model can succeed.

The model also determines the context window: fable, opus and sonnet have 1M tokens, haiku has 200K. A step that must hold many files in context at once may need one of the larger-context models for that reason alone, even when the reasoning itself is straightforward.

When in doubt, skew to the more capable model. Saving money only matters if the outcome is still acceptable. A failed or low-quality implementation wastes more time -- and therefore more money -- than the heavier model would have cost. Recommend a lighter model only when you are confident the brief is detailed enough for it to succeed.

In this repository. The project-specific checks referred to above are:

  • pre-commit run --all-files passes. It runs actionlint, shellcheck, flake8, skillsaw and all five test suites, and ci.yml runs the same command on every pull request.
  • python3 scripts/audit-check.py --repo-path . --repo-name development still reports what it reported before the change, or the plan says why the verdict moved.
  • If the change touches issue filing, it was exercised with --dry-run only.

Management session review checklist

Management session review checklist (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-review-checklist.md):

After a sub-agent completes, the management session verifies:

  • The files that were supposed to change actually changed -- read them, do not trust the summary.
  • No unrelated files were modified.
  • The changes match the intent of the brief: not merely syntactically correct, but semantically right.
  • The project's own pre-merge checks pass, including any generated code that has to be regenerated and committed (see the project-specific checks below).
  • The commit message follows project conventions, including the Co-Authored-By line recording model, context window, and effort level.

Administration and logistics

Success criteria

We will know when this plan has been successfully implemented because the following statements will be true:

  • pre-commit run --all-files passes.
  • scripts/audit-check.py run against this repository reports no new failures, or the plan states which verdicts moved and why.
  • Any new or changed criterion has all six of its files in step, in the order Adding a criterion in docs/consistency-audits.md lists them -- that page is the one list, and this is a restatement of it: the Check subclass in scripts/audit/checks/<family>.py, its registration in CHECKS in scripts/audit/registry.py, its tests in scripts/tests/test_<family>.py, the specification docs/audits/<check-id>.md, its row in docs/audits/README.md, and its frozen lines in FROZEN_METADATA and FROZEN_ISSUE_TITLES in scripts/tests/test_metadata.py -- plus a FROZEN_COLUMN_NAMES line where a spec page carries more than one check. AUDIT_METADATA, ISSUE_TITLES and COLUMN_NAMES are derived from the registry rather than tables anybody edits; the issue title is the fleet-wide idempotency key, so renaming one orphans every open issue for that check across the fleet.
  • No consistency-audit marker block has been added to a criterion specification by hand, and the compliance tables in docs/audits/compliance.md have not been hand-edited.
  • Any entry added to REPO_OVERRIDES carries a stated reason.
  • Anything under templates/ is judged as the code it will become in ten other repositories: placeholders consistent, no reference to paths that only exist here, and the README beside it saying what to substitute.
  • Python is wrapped at 120 characters, single quotes for strings and double quotes for docstrings, and no script has grown a dependency outside the standard library.
  • Documentation in docs/ describes any user-visible change. AGENTS.md changes only if a convention changed; ARCHITECTURE.md only if the shape of the system changed; README.md only if the pitch, the install story or the documentation links changed.
  • comment-proportion v2 is canonical here, and this repository's PUSH-AUDIT.md carries it.
  • The automated reviewer's document action no longer asks for longer comments, and respond-to-review rewrites rather than appends.
  • tools/source-size-ratchet.py here, in actions, and in the template are byte-identical and ratchet comment blocks; both repositories carry tools/comment-block-baseline.
  • actions' comments are swept: shorter, their constraints intact, and the material moved out of them findable in docs/.

Documentation index maintenance

When creating a new master plan from this template, add one row to the table in docs/plans/index.md: the date the plan was written, a link to it, a one-line intent, and its status from the vocabulary above. Rows run oldest first. One row per master plan, never one per phase -- the phases are tracked in the plan's own Execution table, and duplicating them in the index is how the two drift apart.

There is no phase-arithmetic column and no order.yml here; both belong to repositories whose documentation is published through a generated navigation. The plan-index criterion checks the columns this index actually has.

The index row carries the whole-plan status, so it only reaches Complete once every phase has been completed, abandoned or superseded. Update it as the plan progresses, not only at the end.

Once a plan has been finished for 90 days it is retired as docs/plan-retirement.md describes: its reasoning is moved into docs/ and its Future work is filed as issues. Write both so they survive being read by someone who was not here.

Plan close-out sections (shared block; do not edit -- the canonical copy lives in shakenfist/development at templates/shared-blocks/plan-closeout-sections.md):

Future work

We should list obvious extensions, known issues, unrelated bugs we encountered, and anything else we should one day do but have chosen to defer to here, so that we do not forget them.

  • Python docstrings and Rust /// / //! doc comments in the ratchet (Open questions 3).
  • Dockerfile and its variants (Dockerfile.alpine, *.Dockerfile) in the comment pass. The first cut matches by extension alone, as the length pass does, so a name-matched exception waits until it can cover the spellings in use.
  • A fleet-wide trend of total oversize comment lines on the compliance page, so the backlog shrinking is visible without reading 23 baselines.
  • Sweeping another repository the way actions is swept, where its own review finds the same accretion.
  • Whether a repository with tracked workflows but no SOURCE_EXTENSIONS source -- images, private-ci -- should be brought under the comment ratchet by a criterion of its own.

Bugs fixed during this work

This section should list any bugs we encounter during development that we fixed. You should also scan the project's issue tracker, where one exists, for directly related issues that we should either resolve as part of this master plan or at least be aware of while planning it.

None yet.

Back brief

Before executing any step of this plan, please back brief the operator as to your understanding of the plan and how the work you intend to do aligns with that plan.

📝 Report an issue with this page