Skip to content

Plan: a ratchet on source size

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.

Every number in the Situation section below was derived on 2026-10-10 from the default branches of the local clones under ~/src/shakenfist/, and is re-derivable with the commands given beside it. The fleet moves; re-derive before relying on any of them, and say so in the phase if a figure has shifted enough to change a decision.

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

source-file-size has been enforced in every PUSH-AUDIT.md since 2026-09-20 (PLAN-review-unit-size.md, phases 1 and 2). It tells a reviewer that a source file over roughly 800 lines is a candidate to split and one over roughly 1,500 wants a stated reason to stay whole, and it is deliberately advisory: "Neither is a gate, there is no hard cap". Three weeks of evidence say the wording is right and the mechanism does not hold.

The largest files have kept growing since the block landed. Line counts at the last default-branch commit before 2026-09-20 against the default branch today:

File Before the block Today Landings since
shakenfist/mariadb.py 28,755 29,192 9
instar/src/vmm/src/main.rs 20,381 20,971 2
ryll/ryll/src/app.rs 6,131 6,426 6
ryll/ryll/src/bugreport.rs 4,211 4,275 3
development/scripts/tests/test_ci_workflows.py 2,124 2,683 --
development/scripts/tests/test_plans.py 2,791 2,956 --

The last two are this repository, which wrote the block. Derive with git rev-list -1 --first-parent --before=2026-09-20 <branch> and git show <sha>:<path> | wc -l.

The growth is slow, which is why a per-diff review cannot see it. From 2026-06-01 to today, counting first-parent landings on each default branch (git log --first-parent -m --numstat --since=2026-06-01 -- <path>):

File Landings Grew Shrank Median growth Net
shakenfist/mariadb.py 74 73 1 +36 +9,107
ryll/src/app.rs 15 11 4 +4 +795
instar/src/vmm/src/main.rs 19 19 0 +235 +11,316

A push audit is scoped to one branch's diff against the default branch. No branch in the first two rows made its file large; each added a few dozen lines to a file that was already past every threshold, and "this file was already huge" is not a finding against the branch in front of the reviewer. The block is phrased about files and the audit is phrased about diffs, and the gap between them is exactly where slow growth lives. instar's row is the other shape -- fewer, larger landings -- and is a reminder that whatever closes the gap must catch a single 500-line jump as well as fifty 10-line ones.

The fleet distribution. Tracked source (*.py, *.rs, *.ts, *.tsx, *.js, *.go, *.sh, *.c, *.h, *.css) in each primary clone under ~/src/shakenfist/, via git ls-files so that target/, .cargo-cache/ and virtualenvs are never counted, with ryll's vendored sfui/ tree excluded:

Repository Files > 800 > 1,500 > 2,000 Largest
shakenfist 597 75 28 18 shakenfist/mariadb.py (29,192)
instar 340 67 29 18 src/vmm/src/main.rs (20,165 locally)
ryll 149 35 12 7 ryll/src/app.rs (6,426)
development 72 14 8 6 scripts/tests/test_plans.py (2,956)
divergulent 122 12 2 0 divergulent/classify/review.py (1,621)
kerbside 153 6 0 0 kerbside/tests/unit/test_main.py (1,132)
private-ci 21 3 0 0 938
client-python 23 2 1 0 shakenfist_client/apiclient.py (1,653)
actions 64 1 0 0 930
agent-python, client-python-k3s, hunkydory, kerbside-patches, sfui, visual-digest-rust -- 0 0 0 under 800

The counts include files that are not anybody's review unit: shakenfist/protos/database_pb2_grpc.py (10,302 lines) is generated. Any tool here needs an exclusion mechanism from day one, and the NON_SOURCE_DIRS pattern in scripts/audit/text/python_source.py is the precedent -- pruned during the walk, with each entry's reason written beside it.

Function length is the other half, and it is per-language. The file that prompted this plan was ryll's app.rs, whose real defects were a 1,630-line eframe::App::ui and a 610-line process_events; the file's length followed from them. That file no longer exists: shakenfist/ryll's PLAN-app-split.md phases 1 to 4 split it into ryll/src/app/, and as of 2026-11-21 the longest function in the workspace is 649 lines by finding 8's proxy, elsewhere. Phase 3's survey records what that does to this plan; the argument is unaffected, but not because those two functions moved -- they were split, and app.rs is gone. The record is now held by shakenfist-spice-renderer/src/channels/display.rs::handle_message, which was never part of app.rs, so the per-function defect this plan targets has changed address rather than gone away. What each language's linter offers today:

  • Rust (instar, ryll, uncalibrated-sextant, visual-digest-rust): clippy's too_many_lines, in clippy::pedantic, threshold set by too-many-lines-threshold in clippy.toml. All four already run clippy with -D warnings and already carry a clippy.toml for rust-unwrap-lint, which is the precedent for a lint the audit requires in [workspace.lints.clippy].
  • Python: the fleet runs flake8 (via pre-commit, and via tox -e flake8 in kerbside and shakenfist). No repository runs ruff or pylint, so ruff's PLR0915 is not available without changing linter. flake8 itself has no function-length rule; it has max-complexity (mccabe, C901) built in, and length needs a plugin (flake8-functions, CFQ001). See open question 2.
  • TypeScript (hunkydory, sfui): biome. Not investigated in depth for this plan; see open question 3.

How fleet tooling is distributed. A template directory under templates/ holds the files an adopting repository copies verbatim (templates/mermaid-lint/ is the closest precedent: a script for tools/, a workflow, and an optional per-repository exclude file), and a criterion checks the copy is present and current (mermaid-lint-ci in scripts/audit/checks/docs_content.py). Code-level conventions with no template are checked in configuration (rust-unwrap-lint in scripts/audit/checks/packaging.py).

Mission and problem statement

Make it impossible for a file that is already over the size threshold to grow, or for a new file to cross it, without a reviewer seeing a deliberate decision to allow it -- and do the same for functions, where each language's linter can.

This revisits a decision. PLAN-review-unit-size.md made file size "a candidate a reviewer may raise, never a gate", and that was argued rather than assumed. Its reasons, and why a ratchet does not fall foul of them:

  • A hard cap forces splits at line numbers rather than seams. The block's own words: "a file split at a line number rather than at a seam is worse than the long file it replaced". A ratchet forces no split. Every file already over the threshold may stay exactly as large as it is for ever; what it may not do is grow silently. Nobody is pushed into a bad split by a deadline.
  • Raising size is opening a question, not recording a defect. The ratchet keeps that. Growing a baselined file is allowed: the pull request raises the file's entry in the baseline by hand, and that one-line diff is the question asked in a place a reviewer cannot scroll past. The "stated reason" the block already asks for above 1,500 lines gets somewhere to live.
  • Length must not be traded for comments. The real risk of any counter, and the ratchet does not escape it: a contributor near their limit is tempted to delete rationale to make room. The v2 block says so explicitly, the escape hatch above means nobody is ever forced to, and the push audit is told to treat a diff that shrinks a baselined file by deleting comments as a finding.

The same plan's D1 is also the argument for doing this at all: "an advisory block is copied by the repositories that were already going to copy it", and the growth table above is what advisory looks like three weeks in, in the repository that wrote it.

Deliberately out of scope:

  • Splitting any file. That is each repository's own work, under its own plan; ryll's is PLAN-app-split.md in shakenfist/ryll. The ratchet only stops the numbers getting worse.
  • A hard cap of any kind. Not now and not as a later phase.
  • Counting lines differently for comments. A comment-blind count would make deleting code the only way under the line, which is the right incentive, but it needs a lexer per language and the baseline escape hatch already removes the pressure to delete comments. Recorded under Future work.
  • New dependencies in scripts/. The ratchet is stdlib Python.

Open questions

  1. Where does the check run in an adopting repository: as a pre-commit hook, a CI lane, or both? Pre-commit catches it at the author's desk and every repository already runs pre-commit in CI, so a hook alone gates merges too. Default: a local pre-commit hook only, no separate workflow -- unlike mermaid-lint it needs no container and runs in well under a second, so it does not earn its own lane.
  2. Python function length: plugin or complexity? flake8-functions (CFQ001) is a direct length rule but is a third-party plugin in every Python repository's lint environment. mccabe max-complexity is built in but measures branching, not length, and a 600-line function of straight-line code passes it. Moving the fleet to ruff would give PLR0915 and much else, but is a linter migration and a plan of its own. Default: Rust only in this plan; Python and TypeScript become Future work with this analysis attached, so the Python choice is made by someone measuring it rather than by default.
  3. TypeScript. biome's rule set has moved quickly and this plan did not verify which length or complexity rules the fleet's pinned biome version offers. Default: deferred with Python.
  4. Thresholds. 1,500 lines per file matches the block's "wants a stated reason" line, so the baseline is exactly the list of files that owe one. For too-many-lines-threshold, clippy's default of 100 would put a large share of instar and ryll into #[expect] on day one, burying the outliers that matter. Default: choose per repository from the measured distribution during the pilot, recording the figure and its derivation in that repository's clippy.toml comment; the criterion requires the lint to be on, not a particular number. Answered for ryll in phase 3, decision 3: 200, giving 13 #[expect]s across about 4,145 functions. The worry in this question was specific to a pre-split app.rs; measured after the split, clippy's own default of 100 would have cost 40.
  5. Enforcement and the sweep. Bumping source-file-size to v2 and adding a template-adoption criterion makes most of the fleet non-compliant the next morning (see phase 4 for the counts). PLAN-review-unit-size.md D2 chose to let the daily audit drive the fixes rather than sweep the fleet. Default: the same, except ryll, which is the pilot and lands before enforcement.

Execution

Phases are the sections below rather than separate files, following this repository's convention. Phases 1 and 2 shipped together from the branch size-ratchet; from phase 3 on, each phase takes a branch named for it, matching the rest of the fleet (size-ratchet-phase-NN-descriptive). The ryll pilot (phase 3) does its work in shakenfist/ryll and is recorded as ryll <sha> (#pr); the development-side branch for that phase carries the plan, the close-out of phases 1 and 2, and the pilot's report.

Phase Status Merged
1. The ratchet template Complete dbcf540 (#405)
2. source-file-size v2 Complete dbcf540 (#405)
3. ryll pilot Complete ryll debf8b1 (#746), 252dd43 (#458)
4. Criteria and enforcement Complete 3743700 (#468)
5. Push audit In progress

Phases 1 and 2 ship as one pull request here, and phase 4 as a second, because the pilot has to land in ryll between them: the criteria should go live only once there is a real adopter to test them against, not just this repository and the fixtures.

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.

1. The ratchet template

A new templates/source-size-ratchet/, following templates/mermaid-lint/'s shape:

File Destination Description
source-size-ratchet.py tools/source-size-ratchet.py The check; stdlib Python 3, copied verbatim
pre-commit-hook.yaml merged into .pre-commit-config.yaml A repo: local hook stanza, pass_filenames: false
-- tools/source-size-baseline Written by the adopting repository on adoption: one <lines> <path> per oversize file, sorted by path
-- tools/source-size-exclude Optional, written by the adopting repository: generated or vendored trees, one glob per line, each with a # comment saying why
README.md -- What it does, how to adopt it, and how to grow a baselined file

Behaviour, all of it decidable from the tree with no git history:

  • Enumerate files with git ls-files, which keeps target/, .cargo-cache/, virtualenvs and anything else untracked out without a list. Count only source extensions (the list in the Situation table, held in one constant). Apply a built-in exclusion list for things that are never a review unit anywhere in the fleet -- *_pb2.py, *_pb2_grpc.py, *.min.js and the like -- each with its reason in a comment, as NON_SOURCE_DIRS does; then the repository's own tools/source-size-exclude. (Lock files need no entry: none has a source extension.)
  • Fail if a file over the threshold (1,500, one constant) is not in the baseline, or is longer than its baseline entry. The failure message names the file, both numbers, and the two honest fixes: shrink it, or raise its entry in the baseline in this pull request and say why in the description.
  • --update rewrites the baseline, but only downwards: it lowers entries that have shrunk and removes files that dropped under the threshold or no longer exist. It never raises an entry or adds a file -- growth is a hand edit by design, because the hand edit is the reviewable decision. A baseline entry that is higher than its file is not a failure (it would make every shrink a two-step dance), but --update tightens it.
  • --init writes the baseline from scratch, for adoption only.

Tests in scripts/tests/test_source_size_ratchet.py, against temporary git repositories built in the test, running the template as a subprocess (it is a script, not a Check, so CheckTestCase does not apply): growth fails, shrink passes, new file over threshold fails, excluded path ignored, untracked file ignored, --update never raises an entry.

This repository adopts it in the same phase: it is in its own audit matrix, and its baseline is the first real one. It holds twelve files, all under scripts/, re-derived on 2026-11-15; the Situation table above counted eight on 2026-10-10, and test_plans.py alone has since grown from 2,956 lines to 4,526.

2. source-file-size v2

Rewrite templates/shared-blocks/source-file-size.md and bump it to v2. Keep everything v1 says that is still true -- re-review cost as the argument, 800 and 1,500, the exemptions, seams not line numbers, never trading comments for length -- and change three things:

  • Replace "Neither is a gate, there is no hard cap" with what is now true: there is still no cap and no file is ever forced to split, but a file over 1,500 lines may not grow, and no file may cross 1,500, without a reviewed edit to the repository's baseline. Point at templates/source-size-ratchet/.
  • Tell the push auditor to read the files the diff touches, not only the diff: a branch that grows a file already over 800 lines is a finding to raise even when the branch's own addition is small, because per-diff review is how slow growth gets past. A raised baseline entry is reviewed as the decision it is, and its reason belongs in the pull request description.
  • Tell the auditor that a diff shrinking a baselined file by deleting rationale comments is a finding, not a win.

Embed v2 in this repository's PUSH-AUDIT.md in the same commit as the bump, so development stays compliant.

What the bump does to the fleet, re-derived on 2026-11-15 by running this branch's scripts/audit-check.py against a fresh clone of each repository's default branch, then scripts/audit-manage-issues.py --dry-run over the results: push-audit applies to 13 repositories, and on main all 13 carry v1 (the first count, from the 2026-11-08 compliance page, had 12 and three already failing; andris has since come into scope and instar, sfui and uncalibrated-sextant have since passed). With v2 this one passes and the other 12 fail with exactly one finding -- source-file-size "v1 embedded, v2 current; copy it verbatim from templates/shared-blocks/source-file-size.md" -- and none has an open push-audit issue, so the next run files 12 new issues: actions, andris, client-python-k3s, divergulent, hunkydory, instar, kerbside, occystrap, ryll, sfui, shakenfist, uncalibrated-sextant. Each is closed by a verbatim copy. ryll's is closed by the pilot.

3. ryll pilot

Planning effort: high. It reaches into another repository's plan to take a phase off it, and it turns on a lint in a build that runs clippy eleven times with different feature sets and -D warnings on each, where #[expect] has a failure mode that #[allow] does not.

One pull request in shakenfist/ryll does the work; the development-side branch size-ratchet-phase-03-ryll-pilot carries this plan, the close-out of phases 1 and 2, and the pilot's report, and is pushed after the ryll pull request merges so that it can carry that report.

In scope. Adopting the ratchet template in ryll (script, hook, exclude file, baseline, review-scope entries); enabling clippy::too_many_lines workspace-wide with a measured threshold and an #[expect] on every remaining offender; the convention and rationale documentation that shakenfist/ryll's PLAN-app-split.md phase 6 asks for; closing out that phase and its phase 4; and reporting back here what phase 4 needs.

Out of scope. Splitting any file or any function. The baseline is a list of files that already owe a reason, not a work queue, and nothing here asks anyone to shorten one. Also out: ryll's PLAN-app-split.md phase 5, which is unplanned and stays that way; the six repositories still holding an open push-audit issue, which the daily audit drives (open question 5); and anything about Python or TypeScript function length (open questions 2 and 3, Future work).

What the survey found

Surveyed 2026-11-21 against shakenfist/ryll origin/develop at f845f45, and shakenfist/development main at 2f0c62e, unless stated. The phase section below was written on 2026-10-10 and re-touched on 2026-11-15, and six of its factual claims have moved. Corrections to the Situation and Mission sections were made at their source in the same commit as this rewrite, so they do not need making again; the dated figures in the Situation table were left alone, as that section's own instructions require, and the shifts are recorded here.

  1. ryll/src/app.rs no longer exists. PLAN-app-split.md phases 1 to 4 split it into ryll/src/app/ and ryll/src/app/ui/, 23 files, none over 1,500 lines. Phase 4 merged as ecf54b5 (#726); its Execution table still reads In progress only because no phase 5 ever branched to close it out. The 1,630-line eframe::App::ui and the 610-line process_events that prompted this plan are both gone: the longest function under app/ is app/mod.rs::new at 246 lines. This is the finding that reopens the sequencing question, and decision 1 settles it.

  2. ryll has 20 source files over 1,500 lines, not twelve. Measured with the template's own SOURCE_EXTENSIONS list and the vendored sfui tree excluded: 221 tracked source files, 52 over 800, 20 over 1,500, largest shakenfist-spice-renderer/src/channels/display.rs at 6,330. At this plan's own 2026-10-10 datum (ryll 16cb826) the same measurement gives 160 files, 39 over 800 and 12 over 1,500 -- so the twelve was right when it was written, and the count has grown by two thirds in six weeks. ryll/src/bugreport.rs went 4,275 to 5,101 and display.rs 5,356 to 6,330 over that window, while app.rs went from 6,308 to nothing. The plan's thesis gained its best evidence while the plan was being written.

  3. ryll already carries source-file-size v2, verbatim. PUSH-AUDIT.md:333, landed by consistency-fixes-2026-11-19 (#740, merge a6028d0); diffed against templates/shared-blocks/source-file-size.md and identical. ryll's push-audit issue #733 is closed. The step that said to re-copy it is already done, by the mechanism phase 2 set up rather than by this phase -- see decision 2.

  4. Phase 2's fleet prediction held exactly. Twelve Consistency: Pre-push audit file issues were filed; six are closed (ryll, shakenfist, hunkydory, instar, sfui, andris) and six remain open (occystrap, client-python-k3s, kerbside, divergulent, actions, uncalibrated-sextant). The audit-driven approach from open question 5 is working and needs no intervention from this phase.

  5. The sfui exclusion is not load-bearing. The largest vendored file is ryll/src/web/assets/sfui/sf.css at 822 lines; nothing under that tree is over 1,500, so the baseline would be correct without an exclude file. Written anyway, for the reason in decision 5.

  6. ryll's clippy configuration is as this plan described it. clippy.toml holds only allow-unwrap-in-tests = true; [workspace.lints.clippy] holds only unwrap_used = "warn". Seven first-party crates carry [lints] workspace = true; shakenfist-spice-protocol/fuzz and tools/gen-swatches-jpeg do not. The second is a second exemption, where phase 4's section anticipates only the fuzz crate -- recorded for phase 4 rather than fixed here.

  7. make lint runs clippy eleven times, each with -D warnings. Makefile:337-340 is one chained sh -c: the workspace with --all-targets and shakenfist-spice-compression/encode,ryll/rdp; -p ryll --features gui,digest-decode; a rustdoc pass, which is not clippy; -p shakenfist-spice-compression --no-default-features --features encode; then tools/check-slim-renderer.sh, which is itself eight more clippy invocations -- the renderer with --no-default-features --all-targets, then once again for each of audio, usbredir, webdav, encoder, h264-decode, mozjpeg and digest-decode. This is the finding that most changes the step plan. #[expect] emits unfulfilled_lint_expectation when its lint does not fire, and -D warnings makes that an error, so a function whose measured length crosses the threshold in one feature configuration and not another cannot carry an #[expect] at all. Headroom above the threshold is a correctness property here, not a matter of taste, and it is the strongest argument for the lower of the two candidate thresholds -- more so than the first count of this finding implied, because shakenfist-spice-renderer, which holds the two longest functions in the workspace, is linted in eight feature configurations rather than one -- nine of the eleven lanes in all, those eight plus the workspace lane.

Step 3b retired the headroom clause as well: the lint counts the body's source span, so every lane that lints a function reports the same length and headroom is not a correctness property. Decision 3 carries the consequence. The rest of this finding stands as the dated record of what was believed before the measurement.

  1. The function-length distribution. A proxy measurement (brace-matching, counting non-blank, non-comment body lines, which is the shape clippy::too_many_lines counts) over the seven lint-inheriting crates: 4,151 functions, of which 44 are over 100 lines, 30 over 120, 22 over 150, 18 over 175, 14 over 200, 11 over 250 and 5 over 300. Exactly one of the 22 is a test. The longest are shakenfist-spice-renderer/src/channels/display.rs::handle_message (649) and ::decode_image_and_emit (529); nothing else exceeds
  2. It is a proxy, so step 3b confirmed it against clippy itself before step 3c annotated anything. Clippy reports 40 over 100, 28 over 120, 21 over 150, 17 over 175 and 13 over 200, and a reconstruction of this proxy lands within one of clippy at every threshold. The residual gap is boundary rounding of a line or two either way, plus one Windows-gated function the proxy counts and no Linux lane can see.

  3. This repository's own ratchet is live and passing. python3 -I tools/source-size-ratchet.py exits 0 on development main, over a baseline of twelve files. Phases 1 and 2 are holding, which is what makes ryll a pilot rather than a first attempt.

  4. Two adoption details the template README covers but the phase section did not. ryll's .pre-commit-config.yaml already has four repo: local entries (lines 2, 32, 129, 142), so the hook stanza merges into one of them rather than adding a fifth. And ryll's .vscode/review-scope.toml include list matches by extension plus a handful of names, none of which matches an extensionless tools/source-size-exclude, so adopting with an exclude file needs an include entry or review-scope-completeness reports it as an orphan.

Decisions

  1. Both halves land in phase 3, in one ryll pull request, and PLAN-app-split.md phase 6 is closed out as Complete pointing here. PLAN-app-split.md phase 6 says to pick the threshold from the distribution after its phase 5, and phase 5 is unplanned. Deferring to it would block this plan's phase 4 on another repository's unplanned refactor and would land rust-function-length-lint with no compliant adopter at all -- the phase 4 section then predicted 3 of 4 Rust repositories failing, which is only true if ryll passes. Phase 4's own survey has since corrected those figures to 6 and 5. Against that, the ordering phase 6 wanted is not load-bearing: #[expect] is precisely the mechanism that makes a stale exemption a build failure, so if phase 5 later shortens app/mod.rs::new or app/connection.rs::reconnect, the annotation fails and is removed rather than quietly surviving. Taking the phase is therefore cheaper than waiting for it, and the two functions phase 5 would touch are the two the mechanism protects. At the threshold step 3b settled on, 200, that last clause is only half true: of the two, just app/mod.rs::new carries an #[expect], while app/connection.rs::reconnect sits below 200 and carries none, so the build-failure guarantee covers one function rather than both. This is the decision a reviewer is most likely to argue with, because it takes a phase off a plan in another repository; the alternative, and its cost, are stated above.

  2. The "re-copy source-file-size v2" step is dropped as already done, not re-performed. Finding 3. Phase 3 verifies the embedded copy is byte-identical to the template and records that it arrived through the daily audit, which is a result worth having: it is the first evidence that open question 5's audit-driven approach closes a v2 bump without a sweep.

  3. too-many-lines-threshold = 200, giving 13 #[expect]s. Planning proposed 150 and 22 annotations, reading finding 8's proxy; Mikal chose 200 once step 3b had measured the real distribution, and the execution notes record the change. The derivation is clippy's own count over all eleven lanes: of about 4,145 functions in the seven lint-inheriting crates, 40 are over 100 lines, 21 over 150 and 13 over 200. The hit counts are clippy's; the denominator is not, and cannot be -- clippy reports only the functions over the threshold, never a total. It comes from a proxy count over the same seven crates, which finding 8 gives as 4,151; the 4,145 written here and in ryll's clippy.toml and docs/development.md is six short of it and the discrepancy was never run down. Nothing rests on the denominator -- the inventory size is what the threshold was chosen on -- but it should not be read as clippy's figure. Thirteen reasons are an inventory a reviewer reads in one sitting; clippy's default of 100 would have cost 40.

The argument that had rejected 200 was finding 7's, that the functions nearest the line -- main.rs::main at 193 and main_channel.rs::run_loop at 192 -- sit in crates built under several feature sets, which is the shape that produces an unfulfilled_lint_expectation in one lane and a too_many_lines in another. Step 3b disproved it: the lint counts the lines of the body's source span, not the code left after cfg stripping, so every function's reported length is identical in every lane that lints it, and a function that is compiled out loses its #[expect] with it. Headroom above the threshold is therefore not the correctness property finding 7 took it for, and the choice between 150 and 200 is a judgement about how long an inventory stays readable. The cost of the wider figure is that main has seven lines of slack: growing it past 200 fails make lint until someone annotates it, which is the same decision-at-the-point-of-growth the baseline asks of a file.

  1. #[expect] throughout, with #[allow] plus a stated reason kept as a documented escape that ryll does not use. The escape was written for a function whose length is feature-sensitive across the threshold, which cannot carry an #[expect] under -D warnings (finding 7). Step 3b looked for one in all eleven lanes and found that none can exist: the lint measures the body's source span, so a feature flag changes only whether a function is linted, never its reported length. ryll therefore carries thirteen #[expect]s and no #[allow], and docs/development.md records the mechanism rather than leaving the next reader to rediscover it.

Phase 4's criterion should still accept an #[allow] that carries a stated reason, even though ryll gives it nothing to accept: the hazard has no instance in a tree clippy measures this way, but a macro-generated or build-script-generated body in another repository may yet need the escape, and a criterion that refuses one outright turns that into an argument about the criterion. Phase 3 records the requirement; phase 4 implements it.

  1. The exclude file is written even though no sfui file is over the threshold. Finding 5. It is correct independently of today's line counts -- the tree is vendored from shakenfist/sfui by that repository's tools/vendor.sh and reviewed there, which .vscode/review-scope.toml:69-74 already says -- and adding it after a vendored file crosses 1,500 would mean editing the baseline to remove an entry, which reads like a concession.

  2. The development-side pull request is pushed after the ryll pull request merges. The pilot's report is phase 3's deliverable and phase 4 reads it, so it belongs in this phase's own pull request rather than in phase 4's close-out commit. The branch therefore holds unpushed commits for as long as the ryll review takes, which is the established pattern here.

Step plan

Step Effort Model Isolation Brief for sub-agent
3a medium sonnet worktree In a shakenfist/ryll worktree off develop, adopt the source-size ratchet, following templates/source-size-ratchet/README.md "Adopting it" in shakenfist/development. Copy templates/source-size-ratchet/source-size-ratchet.py to tools/source-size-ratchet.py byte for byte, keeping the executable bit. Merge the hook from templates/source-size-ratchet/pre-commit-hook.yaml into the hooks: list of an existing repo: local entry in .pre-commit-config.yaml -- there are four, at lines 2 (rust-check), 32 (audit-range-test), 129 (bidi-check) and 142 (docs-line-references); the last is the closest neighbour, a stdlib-Python tree-wide check -- rather than adding a fifth entry, and keep the stanza's comments. Write tools/source-size-exclude with one entry, ryll/src/web/assets/sfui/, and a comment saying the tree is vendored from shakenfist/sfui by that repository's tools/vendor.sh and reviewed there; .vscode/review-scope.toml:69-74 has the wording. Then run python3 -I tools/source-size-ratchet.py --init and --init only once. In .vscode/review-scope.toml, add tools/source-size-baseline to exclude and tools/source-size-exclude to include, each with a comment; shakenfist/development's own .vscode/review-scope.toml:78-111 has both reasons written out, and the include entry is needed because the file has no extension and nothing in ryll's include list would match it. Do not touch REVIEWS.md. Verify: the baseline holds exactly 20 entries, grep -c 'assets/sfui/' tools/source-size-baseline is 0, no *_pb2* or minified file appears in it, python3 -I tools/source-size-ratchet.py exits 0, and pre-commit run --all-files passes. Report the baseline and the hook's wall-clock time (time python3 -I tools/source-size-ratchet.py, best of three). Commit subject: Adopt the source-size ratchet.
3b high opus worktree Same ryll worktree. Measure the real clippy::too_many_lines distribution before anything is annotated. Add too_many_lines = "warn" to [workspace.lints.clippy] in the root Cargo.toml and too-many-lines-threshold = 100 to clippy.toml temporarily, then run each of the eleven clippy invocations in make lint (Makefile:337-340, eight of them inside tools/check-slim-renderer.sh) separately, without -D warnings, capturing every too_many_lines hit with its file, function and reported line count. The build is Dockerised: use the make targets, do not install a toolchain on the host. Produce one table of every function clippy reports over 100, per lane, noting any function that appears in one lane and not another or with a different count -- that set is what decision 4's #[allow] escape exists for, and it is the single most important output of this step. Compare against the proxy measurement in finding 8 (4,151 functions; 44 over 100, 22 over 150, 14 over 200) and say where clippy disagrees with it and why. Then state whether decision 3's threshold of 150 still gives the 22-function inventory it predicts, or what figure does. (The 150 and the 22 are the figures this brief was issued with; at the gate Mikal chose 200, giving 13, and decision 3 is corrected at source.) Revert the temporary clippy.toml value before finishing; leave the Cargo.toml line in place. This step commits nothing: it reports.
3c high opus worktree Same ryll worktree, after the back brief gate on 3b's numbers. Set too-many-lines-threshold in clippy.toml to the confirmed figure, with a comment giving the figure, the date it was measured and the counts it came from (the clippy.toml already carries allow-unwrap-in-tests, so follow its comment style). Put #[expect(clippy::too_many_lines, reason = "...")] on every function 3b reported over that threshold. Each reason says why this function is long and what splitting it would cost -- a dispatch match over a wire protocol whose arms belong together, a decode loop whose state is shared, a main that is sequential setup -- and never restates the lint. For any function 3b flagged as feature-sensitive across the threshold, use #[allow(clippy::too_many_lines)] with an adjacent comment naming the lane that forced it, per decision 4. Then record the convention in AGENTS.md -- #[expect] rather than #[allow], so an exemption that stops being needed fails the build and is removed -- and the rationale in docs/development.md, which is what shakenfist/ryll's PLAN-app-split.md phase 6 asks for. Verify with the full make lint: all eleven clippy lanes must pass with -D warnings and no unfulfilled_lint_expectation. Commit subject: Require a function-length lint.
3d medium sonnet worktree Same ryll worktree. Close out shakenfist/ryll's docs/plans/PLAN-app-split.md: set phase 4's row to Complete with ecf54b5 (#726) in its Merged cell (it merged on 2026-11-14 and no phase 5 branched to close it out, so this pull request is the first to touch the table since), and set phase 6's row to Complete, leaving its Merged cell to be filled with this pull request's own merge commit at close-out. Add two or three sentences to phase 6's section saying the phase was executed as shakenfist/development PLAN-size-ratchet.md phase 3, that the threshold was therefore measured before app-split phase 5 rather than after, and why that is safe (#[expect] turns a stale exemption into a build failure). Update ryll's docs/plans/index.md row for PLAN-app-split.md if its status changes. Do not mark the plan itself Complete: its phases 5 and 7 are outstanding. Commit subject: Close out the function-length lint phase.
3e medium sonnet none In the shakenfist/development worktree development-wt-sr-p3, after the ryll pull request merges. Add a #### Pilot report subsection at the end of this phase 3 section recording, as falsifiable statements: the threshold chosen and its derivation, the number of #[expect]s and the number of #[allow]s with the lane that forced each, the hook's wall-clock time on ryll's tree, the baseline size, and either the template changes the pilot motivates or one sentence saying it motivated none. Where it motivates a template change, make that change in templates/source-size-ratchet/ in the same commit and say whether adopters must re-copy, per this section's original instruction that template changes land here first. Also correct phase 4's section with what the pilot establishes: the tools/gen-swatches-jpeg exemption from finding 6, and decision 4's requirement that the criterion accept an #[allow] carrying a stated reason. The pilot has already motivated two template changes, both recorded in the execution notes: the README's claim that no workflow is needed, and that adopting alongside a function-length lint raises baseline entries. Commit subject: Report the ryll source-size pilot.

Risks and mitigations

  • unfulfilled_lint_expectation in one feature lane. The mechanism is finding 7 and it would show up as a red make lint in a lane nobody was looking at. Step 3b retired it rather than mitigating it: every lane that lints a function reports the same count, so the hazard has no instance. Decision 3's headroom, which this bullet first gave as the mitigation, is not what rules it out -- decision 3 now disclaims headroom as a correctness property. What stands is step 3b measuring every lane separately before anything is annotated, and step 3c's verification being the full make lint rather than one clippy run. The management session reads the lanes' output, not the sub-agent's summary of it.
  • Thirteen reasons written to fill a slot. A reason that restates the lint ("this function is long") is worse than no annotation, because it makes the inventory unreadable while looking complete. Mitigated by the management session reading all thirteen and rejecting any that does not say what splitting would cost; this is the review step most likely to send 3c back.
  • The Docker build is slow and 3b runs clippy eleven times at a low threshold. Mitigated by 3b and 3c sharing one worktree and one image, and by 3b capturing the full hit list once rather than iterating on the threshold.
  • ryll's develop moves while the branch is open. It merged ten commits in the week before this survey. If develop moves under the branch, rebase and re-run --update, never --init: --init silently accepts whatever has grown since, which is the drift the tool exists to stop, and the template README says so.
  • The baseline freezes 20 files, two of which are growing fast. bugreport.rs and display.rs gained 1,800 lines between them in six weeks. The ratchet stops them growing further, which is the point, and no split is asked for; but the pull request description should say that the two are the reason the count moved from twelve to twenty, so the baseline is not read as an endorsement.
  • Taking a phase off another repository's plan. If Mikal prefers PLAN-app-split.md phase 6 to stay open, step 3d's close-out is the only part that changes and decision 1's gate in the back brief is where to say so.

Definition of done

  • python3 -I tools/source-size-ratchet.py exits 0 in ryll, and diff between ryll's tools/source-size-ratchet.py and this repository's templates/source-size-ratchet/source-size-ratchet.py is empty.
  • ryll's tools/source-size-baseline holds exactly the number of entries step 3a reported, grep -c 'assets/sfui/' on it is 0, and no entry matches *_pb2*, *.min.js or *.min.css.
  • pre-commit run --all-files passes in ryll, and make lint passes with all eleven clippy invocations run and no unfulfilled_lint_expectation in any of them.
  • ryll's clippy.toml holds a too-many-lines-threshold whose adjacent comment states the figure, the date it was measured and the counts it came from.
  • ryll carries exactly thirteen #[expect(clippy::too_many_lines, reason = "...")] annotations and no #[allow(clippy::too_many_lines)] at all, which step 3b's measurement established it does not need. Should a later tree need one, it carries an adjacent comment naming the lane that forced it; there are no bare ones.
  • ryll's .vscode/review-scope.toml lists tools/source-size-baseline under exclude and tools/source-size-exclude under include, each with a reason, and python3 scripts/audit-check.py against ryll reports no new review-scope-completeness failure.
  • ryll's PLAN-app-split.md phase 4 row reads Complete with ecf54b5 (#726), and its phase 6 row reads Complete.
  • ryll's AGENTS.md states the #[expect]-not-#[allow] convention and docs/development.md carries the rationale.
  • This section carries a Pilot report subsection, and the threshold figure appears identically in it, in ryll's clippy.toml comment and in ryll's docs/development.md -- no fact about the threshold is stated differently in two places.
  • pre-commit run --all-files passes in shakenfist/development, and python3 scripts/audit-check.py --repo-path . --repo-name development reports what it reported before this phase.

Back brief

Two gates, both because the work after them is cheap to propose and expensive to redo:

  • After step 3b, before 3c annotates anything. Report clippy's own hit list, the set of feature-sensitive functions, and whether decision 3's threshold of 150 survives contact with it. Twenty-two hand-written reasons against the wrong number is the expensive mistake available here. (It did not survive: the gate chose 200 and thirteen reasons. The figures here are what the gate was asked, not what it answered.)
  • Before step 3d closes out PLAN-app-split.md phase 6. Confirm Complete pointing here, rather than Superseded or leaving it open.

Execution notes

2026-11-21 (AEDT). The back brief confirmed decision 1 -- shakenfist/ryll's PLAN-app-split.md phase 6 is closed out Complete pointing here, rather than Superseded or left open -- and gave this session permission to push the ryll branch and open its pull request once the definition of done passes.

ryll's develop had moved from the surveyed f845f45 to 10dfdc1 by the time execution started, so the branch size-ratchet-pilot (worktree ryll-wt-size-ratchet) was cut from that. The baseline is 20 entries on either base, so finding 2's count is unaffected.

Commit Step
ryll 965a14f 3a: the script, the hook, a CI job, the exclude file, the baseline and the review-scope entries
ryll a1cfada 3c: the threshold, thirteen #[expect]s, AGENTS.md, docs/development.md, six raised baseline entries
ryll c70d276 3d: PLAN-app-split.md phases 4 and 6 closed out
  • make lint runs clippy eleven times, not four. Finding 7 counted the commands chained in the lint target and did not look inside tools/check-slim-renderer.sh, which is eight clippy invocations of its own. Corrected at source in finding 7, in this phase's preamble, in 3b's and 3c's briefs, in the risks and in the definition of done. It strengthens rather than weakens decision 3: shakenfist-spice-renderer holds the two longest functions in the workspace and is linted under eight feature configurations -- nine lanes counting the workspace lane -- which is the exact shape that makes an #[expect] fire in one lane and fail as unfulfilled_lint_expectation in another.
  • ryll's CI does not run pre-commit run --all-files, so the template's step 2 is wrong about this repository. The template README says there is no workflow to add, because the fleet's CI runs every hook through pre-commit. ryll runs one hook that way (skillsaw, for reasons its job comment gives) and gives every other hook a CI job of its own, deliberately, so that a failure is reported under one name and holds one runner. Adopting by the README alone would therefore have gated commits by anyone with hooks installed and nothing else -- not merges, and not a branch pushed with --no-verify. Step 3a's commit adds a source-size-ratchet job mirroring the bidi scan, with the same runner size and the same fork guard, since it too runs a script from the checkout that a fork can edit, and adds it to the Can enqueue and Automated reviewer gates. This is the first template change the pilot motivates and step 3e lands it: the README cannot assert pre-commit run --all-files fleet-wide, and must tell an adopter to check how its CI runs hooks and add a job where they are run individually. The source-size-ratchet criterion in phase 4 reads .pre-commit-config.yaml and would not notice the difference, which is worth deciding there rather than here.
  • The sub-agent's hook comment asserted the CI run the template promises. It was corrected before the commit rather than after, which is the reason to read a brief's factual premises before sending it and the diff before committing it.
  • audit-check.py against the branch moves one verdict against the local clone, push-audit from fail to pass, because that clone predates ryll's adoption of source-file-size v2. That is finding 3 confirmed from the other direction rather than an effect of this work; review-scope-completeness and review-scope-ci both pass.
  • The threshold is 200, not the 150 decision 3 proposed. At the first back-brief gate Mikal took the wider figure, so ryll carries thirteen #[expect]s rather than twenty-one. Decision 3 is corrected at source, along with open question 4's answer and the risk that counted the reasons. The planning argument for 150 rested on headroom being a correctness property; step 3b removed that basis, which left inventory size as the whole question and 200 a defensible answer to it.
  • The feature-sensitive set is empty, and cannot be otherwise. Step 3b ran all eleven lanes at a threshold of 100 and found 40 functions over it, with every function's count identical in every lane that lints it. clippy::too_many_lines measures the lines of the body's source span, not the code left after cfg stripping: shakenfist-spice-renderer/src/session.rs::run_connection holds four #[cfg(feature = ...)] statements inside its body and reports 268 lines in all nine lanes that lint it -- the workspace lane plus the eight in tools/check-slim-renderer.sh, since the other two clippy invocations select ryll and shakenfist-spice-compression and lint neither the renderer nor it -- including the lane with no features and the two that turn those features on. A feature flag changes only whether a function is linted, and a function compiled out loses its #[expect] with it. Decision 4's escape therefore has no instance here; it stays documented, and phase 4's criterion stays permissive, per the gate's second answer.
  • The management session re-parsed the raw per-lane JSON rather than taking the counts on report, and reproduced all of them: 40 over 100, 28 over 120, 21 over 150, 17 over 175, 13 over 200, and no function with a differing count. One lane, -p shakenfist-spice-compression --no-default-features --features encode, reports nothing at all, because that crate gates every long module behind features the lane does not enable.
  • The ratchet's first catch was the pull request that installed it. The thirteen exemptions add 70 lines of prose to six files that are already in the baseline, so step 3c's first pre-commit run --all-files failed on the source-size-ratchet hook adopted two commits earlier: bugreport.rs 5,101 to 5,110, display.rs 6,330 to 6,347, inputs.rs 3,201 to 3,210, main_channel.rs 3,921 to 3,929, playback.rs 2,331 to 2,340 and session.rs 1,663 to 1,681. The six entries were raised by hand, which is the flow the baseline's own header prescribes and the only one available, since --update never raises an entry. Two things worth carrying forward: the reason for the growth has to be in the pull request description, which is where the baseline design puts the judgement, and the two halves of this plan interact in a way neither phase predicted -- a function-length lint makes files longer, because the exemptions live next to the functions they excuse. An adopter taking both halves in one pull request should expect to raise entries in it, and the template should say so. Every raised entry equals its file's current length exactly, which the management session checked rather than assumed.
  • 3a's commit hash in this table was corrected after an amend: 15e5538 became 965a14f, and nothing outside this table had cited it.
  • Step 3d found that PLAN-app-split.md phase 6's Plan cell named a phase plan file that was never written and now never will be, so it names shakenfist/development's PLAN-size-ratchet.md phase 3 instead. Nothing reads that column: this repository's plan criteria take a phase's label from the first cell and its state from the Status column, and ryll has no test that reads it. The phase 6 section also instructed a reader to measure after app-split phase 5, which is no longer what happened, so that instruction was corrected rather than left to contradict the record.

Pilot report

Phase 4 reads this subsection. Each statement is checkable.

  • Landing. shakenfist/ryll pull request #746, "Adopt the source-size ratchet and require a function-length lint", merged 2026-11-22 as debf8b1 onto develop. Commits 965a14f (3a), a1cfada (3c) and c70d276 (3d); step 3b committed nothing, by design.
  • Threshold: 200, derived from clippy's own per-lane counts, not the proxy. Of about 4,145 functions in the seven crates that inherit the workspace lints, 40 are over 100 lines, 28 over 120, 21 over 150, 17 over 175 and 13 over 200. The management session re-parsed the raw per-lane JSON and reproduced every count. Planning proposed 150; Mikal took 200 at the first back-brief gate once 3b had measured. Clippy's default of 100 would have cost 40 exemptions.
  • Exemptions: 13 #[expect(clippy::too_many_lines, reason = "...")], and zero #[allow]. As the pilot landed them, at debf8b1, by file and function: app/mod.rs::new, bugreport.rs::test_display_snapshot_serialises, main.rs::run_web, rdp.rs::run_rdp, glz.rs::decompress_glz, channels/display.rs::handle_message and ::decode_image_and_emit, channels/inputs.rs::handle_input_event, channels/main_channel.rs::handle_message, channels/playback.rs::process_messages, channels/usbredir.rs::handle_usbredir_message, session.rs::run_connection and ::run_headless. Exactly one is a test.

The functions matter, not just the files: main.rs is annotated on run_web and main_channel.rs on handle_message, so decision 3's observation that main (193) and run_loop (192) sit below the threshold carrying no annotation is consistent with this list rather than contradicted by it.

The annotations are multi-line, so a single-line grep for expect(clippy::too_many_lines finds none and under-reports to zero. What does reproduce the count is an occurrence count of the lint's name, one per annotation: grep -rn 'clippy::too_many_lines' --include='*.rs' . | wc -l prints 13.

ryll has moved since. The bugreport.rs annotation sat on test_display_snapshot_serialises, and ryll #823 (213f53c, merged 2026-11-27) moved the renderer's snapshot tests out of that file, so on origin/develop the same thirteen read shakenfist-spice-renderer/tests/snapshots.rs in place of ryll/src/bugreport.rs. The count is thirteen on both trees and exactly one is still a test. An earlier draft of this report listed the origin/develop set while attributing it to the pilot, which made bugreport.rs appear to have been raised in the baseline without carrying an exemption; it carried one. * The #[allow] count is zero, and mechanically so. clippy::too_many_lines measures the lines of the function body's source span, not the code left after cfg stripping, so a feature flag changes only whether a function is linted, never its reported length. Every lane that lints a function reports the same count, and a function compiled out loses its #[expect] with it. 3b ran all eleven lanes at a threshold of 100 and found no function with a differing count. shakenfist-spice-renderer/src/session.rs::run_connection holds four #[cfg(feature = ...)] statements inside its body and reports 268 lines in all nine lanes that lint the renderer: the workspace lane plus the eight in tools/check-slim-renderer.sh. Nine, not the ten the first draft of this report and the execution notes both said -- cargo clippy -p <pkg> lints only the selected package, so the ryll and shakenfist-spice-compression lanes do not see the renderer at all. The property the conclusion rests on is unaffected: the count is identical in every lane that lints it. Decision 4's escape therefore has no instance here; it stays documented and phase 4's criterion stays permissive.

This is how clippy counts today, not a documented guarantee, and ryll pins no toolchain -- .devcontainer/Dockerfile installs rustup stable, and Cargo.toml's rust-version = "1.89" is only the MSRV -- so the measurement is against whatever stable was on 2026-11-21 and the next bump can move it. A toolchain that counted post-expansion lines would reintroduce exactly the hazard finding 7 described, which is the standing reason decision 4 keeps the escape documented for a tree that has no use for it. Worth re-checking on a toolchain bump; phase 4 should not write a criterion that assumes the set stays empty. * The Windows-gated gap in finding 8 is not a hole. Finding 8 noted one Windows-gated function the proxy counts and no Linux lane can see. It is in the only file carrying Windows cfgs in the lint-inheriting crates, shakenfist-spice-compression/src/jpeg.rs: the longest such function is decode at jpeg.rs:715, 209 lines of span and 120 counted body lines. That is over the threshold of 100 step 3b measured at, which is why the proxy saw it and Linux clippy did not, and well under the 200 finally chosen -- so no Windows-only exemption is missing, and "exactly thirteen" is not a Linux-only claim. Checked at debf8b1. * Hook cost: 0.169s, best of five runs (range 0.169-0.181s), for python3 -I tools/source-size-ratchet.py at debf8b1, exit 0, over 230 tracked files carrying one of the tool's source extensions. Measured by the management session on the kasm host, so it is an order-of-magnitude figure for a developer machine rather than a CI guarantee. * Baseline: 20 entries; grep -c 'assets/sfui/' on it is 0; and ryll's tools/source-size-ratchet.py is byte-identical to templates/source-size-ratchet/source-size-ratchet.py. * source-file-size v2 arrived through the daily audit, not this phase. ryll's PUSH-AUDIT.md:333 is identical to templates/shared-blocks/source-file-size.md, landed by #740 (merge a6028d0), and ryll's push-audit issue #733 is closed. That is the first evidence that open question 5's audit-driven approach closes a shared-block version bump without a sweep. * Two template changes were motivated and landed with this report, both in templates/source-size-ratchet/README.md: step 2 of "Adopting it" claimed the fleet's CI runs pre-commit run --all-files, which is false for ryll (it runs skillsaw through pre-commit and gives every other hook a job of its own), and "Growing a baselined file" now says an adopter taking a function-length lint should expect to raise entries. source-size-ratchet.py itself is unchanged, so no adopter, ryll included, needs to re-copy it; only the README's adoption guidance changed. Step 3e's brief anticipated a re-copy, and there is none to do.

The same finding leaves phase 4 a decision, recorded in its own section: a source-size-ratchet criterion that checks only for the hook in .pre-commit-config.yaml passes a repository whose hooks never run in CI, which is the state ryll was in before this pilot. * The interaction neither phase predicted. A function-length lint makes files longer, because the exemption reasons live next to the functions they excuse. The thirteen reasons added 70 lines of prose to six files already in the baseline, so step 3c's first pre-commit run --all-files failed on the hook adopted two commits earlier: bugreport.rs 5,101 to 5,110, display.rs 6,330 to 6,347, inputs.rs 3,201 to 3,210, main_channel.rs 3,921 to 3,929, playback.rs 2,331 to 2,340 and session.rs 1,663 to 1,681. The entries were raised by hand, since --update never raises one, and every raised entry equals its file's current length exactly. Phase 4 and every future adopter inherit this.

4. Criteria and enforcement

Two new criteria, each with all five of its files in step (see Success criteria), both in one new family module, scripts/audit/checks/source_size.py, for the reason decision 1 below gives.

  • source-size-ratchet (docs/audits/source-size-ratchet.md): applicable to every in-scope repository with tracked source. Requires tools/source-size-ratchet.py to be byte-identical to the template, the hook to be invoked from .pre-commit-config.yaml, and CI to reach that hook. Does not re-run the ratchet: whether the baseline is honoured is the hook's job on every pull request, and an audit that re-judged it would only disagree with CI. It does not require tools/source-size-baseline or tools/source-size-exclude to exist, for the reason the survey gives.

The pilot found the hole in that sketch, and this phase settles it: the hook being in .pre-commit-config.yaml does not mean it gates anything. ryll runs each hook as its own CI job rather than pre-commit run --all-files, so until phase 3's pilot added a source-size-ratchet job the hook gated only commits by people with hooks installed -- not merges, and not a branch pushed with --no-verify. A criterion that reads only the pre-commit config passes such a repository. Decision 2 requires a CI invocation, and the survey found the precedent for reading one. * rust-function-length-lint (docs/audits/rust-function-length-lint.md): modelled on rust-unwrap-lint, which lives in scripts/audit/checks/packaging.py, but not beside it, for the reason decision 1 below gives. Requires too_many_lines at warn or deny in the root Cargo.toml, inherited by every first-party crate that the root workspace covers, and a too-many-lines-threshold in clippy.toml. It does not judge the number (open question 4). Per phase 3's decision 4 it accepts an #[allow(clippy::too_many_lines)] that carries a stated reason and flags only a bare one: ryll needs no #[allow] and the hazard has no instance in a tree clippy measures this way, but a macro- or build-script-generated body elsewhere may need the escape, and a criterion that refuses one outright turns that into an argument about the criterion.

What switching them on does, measured by step 4d rather than predicted: rust-function-length-lint applies to 6 repositories and fails 5 (andris, instar, teneral, uncalibrated-sextant, visual-digest-rust), with ryll passing. source-size-ratchet applies to all 23 in-scope repositories -- every one has tracked source -- and fails 20, because three pass: development, ryll and instar. As in PLAN-review-unit-size.md D2, the daily audit drives the fixes; this plan opens no pull requests in those repositories, and docs/audits/compliance.md showing both criteria mostly red for a while is the intended state of a newly enforced rule.

Verify with audit-check.py against local clones of ryll, instar and kerbside and audit-manage-issues.py --dry-run, per the procedure in PLAN-review-unit-size.md phase 2. Never regenerate docs/audits/compliance.md in place.

What the survey found

Surveyed on 2026-11-28, against main at c605ae1 and ryll at origin/develop. Seven of this section's factual claims were checked and five had gone stale; the two that held are named at the end, because a survey that reports only what it broke reads as if nothing was verified.

  1. packaging.py cannot take the criterion, and its tests cannot take the tests. Every entry in tools/source-size-baseline is currently equal to its file's length -- that is what --update leaves behind -- so scripts/audit/checks/packaging.py (2,391) and scripts/tests/test_packaging.py (2,922) are both at their baselines, as are ci_workflows.py (2,605) and its suite (3,793). Adding a criterion to either family means raising an entry by hand, which is exactly the question this plan built the ratchet to ask. PLAN-workflow-ref-trust.md phase 4 hit the same wall on 2026-11-22 and answered it with a new action_pinning family module; decision 1 follows it.
  2. "Applies to 4 repositories" is now 6. andris joined the audit matrix on 2026-10-08 (066d639) and teneral on 2026-11-28 (60db82b), and both are Rust. None of the five non-ryll Rust repositories sets too_many_lines anywhere in its root manifest, so the criterion fails all five on the day it lands, not three.
  3. "22 in-scope repositories" is now 23. The in-scope list in docs/audits/README.md holds 23 names; client-python-ova (2026-10-15) and teneral joined after this section was written. How many of the 23 have tracked source is still the dry run's to report.
  4. The two non-inheriting crates are not two exemptions. This section said the criterion "must allow for more than one exemption or it fails ryll". Measured against rust-unwrap-lint's own rules, neither crate needs a new exemption mechanism. shakenfist-spice-protocol/fuzz is already skipped, by the 'fuzz' in manifest.split('/') test at scripts/audit/checks/packaging.py:2323. And tools/gen-swatches-jpeg/Cargo.toml is not a workspace member that fails to inherit: it declares its own [workspace], so cargo excludes it from the root workspace entirely, and it defines [lints.clippy] unwrap_used = "warn" for itself. It passes rust-unwrap-lint today through the "defines it itself" branch, not through an exemption. Decision 5 settles what the new criterion does with it.
  5. The baseline file is not evidence of adoption. This section said the criterion requires tools/source-size-baseline to exist. The tool's own docstring says "a missing baseline is an empty one", so a repository with nothing over 1,500 lines is compliant without the file, and this repository carries no tools/source-size-exclude at all. Requiring either would fail a correctly adopted repository for the absence of a file it does not need. Decision 3.
  6. The claim phase 3 retired from the README survives in the stanza adopters paste. Step 3e replaced the README's assertion that "the fleet's CI already runs pre-commit run --all-files, so the hook gates merges too". The same claim is still in templates/source-size-ratchet/pre-commit-hook.yaml, in the comment above - repo: local: "every repository in the fleet already runs pre-commit run --all-files in CI, so this one hook gates merges as well as commits". That is the text an adopter copies into its own .pre-commit-config.yaml, so the false claim propagates into each adopter's tree rather than staying in a README nobody re-reads. Step 4a fixes it.
  7. The CI-reach question already has a worked answer in the tree. llm-context-lint-ci (scripts/audit/checks/llm_docs.py:496) requires skillsaw in .pre-commit-config.yaml and in CI, and accepts three routes: a workflow that names the tool, a workflow that runs pre-commit (PRE_COMMIT_RUN_RE, line 151), or a workflow that invokes the command directly. The regex is pre[-_]commit['"]?\s+run\b, whose optional closing quote is what makes it match this repository's own invocation, "${RUNNER_TEMP}/venv-lint/bin/pre-commit" run --all-files at .github/workflows/ci.yml:151. Decision 2 reuses that shape rather than inventing one.

What held: the rust-unwrap-lint model is the right one, and its manifest-walking code is reusable as written; the ReviewTrackingTemplates byte-comparison (scripts/audit/checks/review.py:360) is the right mechanism for the template-identity half, including its read_within of this repository's own checkout and its repo.read_blob of the adopter's; the reasoning for not re-running the ratchet stands; and both repositories this phase must not break do pass today -- this repository's tools/source-size-ratchet.py is byte-identical to the template it ships, and ryll's is too.

The false claims in this section's own text, and the figures in the docs/plans/index.md row, were corrected in the commit that registered this phase, so a later step does not need to redo them.

Decisions

  1. Both criteria go in one new family module, scripts/audit/checks/source_size.py, with their tests in scripts/tests/test_source_size_checks.py. Finding 1: the homes this section named -- packaging.py for the Rust lint, and ci_workflows.py where the pre-commit criteria live -- are both exactly at their tools/source-size-baseline entries, as are both suites. Landing a criterion there means raising an entry by hand, and a plan whose whole subject is that raising an entry should be a question asked in review cannot answer it with "to land the criterion". The new suite is named test_source_size_checks.py rather than mirroring the module as test_source_size.py, because scripts/tests/test_source_size_ratchet.py already exists and tests the shipped tool; two suites a letter apart, one testing the tool and one the criteria, is a trap for the next reader. unittest discover picks the new file up with no hook change (.pre-commit-config.yaml, audit-package-tests).

The counter-argument is real: rust-function-length-lint is a Rust manifest criterion and belongs with rust-unwrap-lint, and splitting them makes the home of the next Rust criterion ambiguous. Against it: the family this module names is source size, which both criteria measure -- one per file, one per function -- and PLAN-workflow-ref-trust.md phase 4 made the same call for the same reason five days earlier, so a reader who finds one finds the pattern. The module docstring says what the family covers and why it is not in packaging.py.

  1. source-size-ratchet requires CI to reach the hook, read the way llm-context-lint-ci reads the same question (finding 7). The hook must be invoked from .pre-commit-config.yaml, and at least one workflow must either run pre-commit (PRE_COMMIT_RUN_RE) or invoke tools/source-size-ratchet.py directly. That accepts both shapes in the fleet today: this repository's single pre-commit run --all-files lane, and ryll's job per hook.

The alternative this section offered -- hook presence is enough, if something else establishes that hooks run in CI -- has nothing to rest on. The criterion that would have to establish it, pre-commit-config, checks only that .pre-commit-config.yaml exists.

  1. Neither tools/source-size-baseline nor tools/source-size-exclude is required to exist. Finding 5. A repository with nothing over 1,500 lines is compliant with no baseline -- the tool reads a missing one as empty -- and this repository carries no exclude file at all. The criterion therefore measures adoption (the script, the hook, the CI reach) and leaves the contents to the hook.

  2. The fuzz crate needs no exemption, and a crate declaring its own [workspace] is skipped. Finding 4. The first is already true of rust-unwrap-lint's manifest walk, which the new criterion reuses. The second is the decision: cargo excludes a nested workspace root from the parent workspace, so [workspace.lints] cannot reach it and "inherit the workspace lints" is not a thing it can do. Requiring it to define the lint itself would fail ryll on the day the criterion lands -- tools/gen-swatches-jpeg defines unwrap_used and not too_many_lines -- and ryll is the adopter whose passing is what makes the criterion credible. The honest cost is recorded in the spec's residual and in Future work: a nested workspace is unmeasured, and ryll has one.

  3. The template gains a CI job snippet, and #460 is closed by this phase. Decision 2 makes the job the criterion's requirement, so the template cannot keep asking an adopter to write one from a prose description: the fork guard is the part most likely to be dropped, and dropping it on this fleet's self-hosted runners is arbitrary code execution on our own infrastructure. #460 was declined in phase 3 as template surface a pilot report should not carry, and named this phase as where it belongs if the criterion required the job. It does.

  4. templates/source-size-ratchet/source-size-ratchet.py is not touched in this phase. The criterion compares the adopter's copy to the template byte for byte, so any edit to the script makes every adopter non-compliant until it re-copies. #436 (a file vanishing between lstat and open exits 2) is a real one-line fix and is deliberately left for a change that also re-syncs ryll, through the template-resync skill, rather than landing here and failing the criterion's own pilot repository. The comment fix in step 4a is not a counter-example: it is in pre-commit-hook.yaml, which nothing compares byte for byte.

  5. audit-manage-issues.py runs --dry-run only. Turning two criteria on fails most of the fleet at once, and the daily audit is what files the issues, on its own schedule, the morning after this merges. PLAN-review-unit-size.md D2 is the precedent.

Step plan

Step Effort Model Isolation Brief for sub-agent
4a medium sonnet worktree Ship the CI job snippet the criterion will require, and retire the last copy of the claim phase 3 corrected. Add templates/source-size-ratchet/ci-job.yaml: a single job stanza indented to paste into an adopter's jobs: map, shaped like the sibling pre-commit-hook.yaml (a comment per setting, no {{PLACEHOLDER}}), modelled on the job phase 3 added to ryll, which is source-size-ratchet: in ryll's .github/workflows/ci.yml at origin/develop lines 521-542: name, a runs-on the adopter edits, timeout-minutes: 15, the fork guard (github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) with the comment saying what it is for, a concurrency group, actions/checkout, and python3 -I tools/source-size-ratchet.py with the comment on -I that the hook stanza already carries. Pin actions/checkout to the sha this repository's own .github/workflows/ci.yml uses, with the # v7 comment, and say in a comment that this file is not a workflow so neither Renovate's workflow manager nor third-party-action-pinning reaches it, and the adopter should re-pin to whatever its repository pins. State in a comment that the guard means a fork pull request reports no verdict, and that this is deliberate. Add it to the README's Files table marked optional, for repositories whose CI runs hooks individually, and rewrite step 2 of "Adopting it" to point at the snippet instead of describing ryll's job in prose, keeping the fork-guard consequence and the self-hosted-runner reason that step 3e wrote. Then fix the comment above - repo: local in pre-commit-hook.yaml, which still says every repository in the fleet runs pre-commit run --all-files in CI so the hook gates merges: that is the claim step 3e retired from the README, and this is the copy an adopter pastes into its own config. Finally extend the files: negative lookahead on the actionlint-templates hook in .pre-commit-config.yaml to exclude ci-job.yaml as well, since actionlint can only reject a bare job stanza, and keep the explanatory comment above it accurate for two files. Do not add it to that hook's exclude: list: ConvergedTemplatesTest.test_only_excluded_templates_carry_placeholders in scripts/tests/test_registry.py holds that list to exactly the templates carrying placeholders, and this file carries none -- #460 predicted an exclude-list change, and it is the lookahead that needs one. No test pins the lookahead's text (scripts/tests/test_hooks.py builds its own config), so the only check is that pre-commit run --all-files still passes. Commit subject: Ship the ratchet's CI job as a snippet.
4b high opus worktree Add the source-size-ratchet criterion in a new family module, scripts/audit/checks/source_size.py, whose docstring says the family is source size -- a file-level ratchet and a function-level lint -- and why it is not in packaging.py or ci_workflows.py (decision 1: both are at their tools/source-size-baseline entries). Class SourceSizeRatchet, id = 'source-size-ratchet', spec = 'docs/audits/source-size-ratchet.md', template = 'templates/source-size-ratchet/', issue_title = 'Source size ratchet'. applies() returns a reason unless the repository has tracked source the tool would measure: read SOURCE_EXTENSIONS from the template rather than restating the list, or state in a comment why a copy was unavoidable. run() checks three things. One, tools/source-size-ratchet.py is byte-identical to templates/source-size-ratchet/source-size-ratchet.py, using the mechanism ReviewTrackingTemplates uses (scripts/audit/checks/review.py:360): read_within(DEVELOPMENT_ROOT, ..., binary=True) for this repository's template, raising ToolFailure if the audit cannot read its own checkout, and repo.read_blob() for the adopter's copy, with the same distinction between missing and "not a regular file the audit will read" that check draws, and the same os.path.lexists test behind it. Two, .pre-commit-config.yaml invokes the hook -- match the entry (tools/source-size-ratchet.py) rather than the hook id, so a renamed id still counts and a comment mentioning the tool does not; file_mentions is in scripts/audit/files.py and file_matches and PRE_COMMIT_RUN_RE are in scripts/audit/checks/llm_docs.py; move the latter two into audit.files beside the former and have llm_docs.py import them from there, rather than importing across two criteria's modules. Nothing else in scripts/ references either name and files.py is not baselined, so the move costs one file and no test changes. Three, CI reaches it (decision 2): at least one workflow matches PRE_COMMIT_RUN_RE (llm_docs.py:151) or invokes the script directly; import both rather than re-spelling them. Report each failure separately, in the terms the compliance page needs, and name the fix. Do not run the ratchet, and do not require tools/source-size-baseline or tools/source-size-exclude (decision 3). Write docs/audits/source-size-ratchet.md following docs/audits/README.md's shape, with a ## Projects section linking compliance.md#source-size-ratchet, a Why that states the 1,500-line threshold and that the baseline is the list of files owing a stated reason, and a residual section recording that a fork-guarded job satisfies the CI-reach test while reporting no verdict on a fork pull request, which is the trade ryll's job makes deliberately. The spec cites no plan phase, step or decision number -- plan-phase-references greps docs/ for phase <n> and skips only plans/ -- and links this plan for the history instead. Register it: add source_size to the from audit.checks import (...) list in scripts/audit/registry.py and append the instance at the end of CHECKS (the docstring says families are appended, because the results JSON's order is part of its bytes), add the row to docs/audits/README.md, and add its lines to FROZEN_METADATA and FROZEN_ISSUE_TITLES in scripts/tests/test_metadata.py. It reaches no network, so NETWORK_CHECKS in scripts/audit_snapshot.py is not edited. Add SourceSizeRatchetTest(CheckTestCase) in a new scripts/tests/test_source_size_checks.py covering: no tracked source (not_applicable); the copy missing; the copy differing by one byte; the copy present as a dangling symlink; the hook absent from the config; the hook named only in a comment; the hook present with no workflow at all; present with a workflow running pre-commit run --all-files through a quoted venv path (pass, the shape this repository uses); present with a workflow invoking python3 -I tools/source-size-ratchet.py directly (pass, the shape ryll uses); present with a workflow that merely installs pre-commit (fail); and a fully compliant repository (pass). Commit subject: Add the source-size-ratchet criterion.
4c medium sonnet worktree Add the rust-function-length-lint criterion to the module 4b created. Class RustFunctionLengthLint, id = 'rust-function-length-lint', spec = 'docs/audits/rust-function-length-lint.md', template = None, issue_title = 'Rust function length lint'. Model it on RustUnwrapLint (scripts/audit/checks/packaging.py:2255), reusing its structure rather than paraphrasing it: skip unless repo.props['has_cargo_toml']; root manifest Cargo.toml or src/Cargo.toml; require too_many_lines at warn or deny under [workspace.lints.clippy] or [lints.clippy] with the same level-matching pattern (which exists so that too_many_lines = "allow" # was "deny" is not read as enabled); require a too-many-lines-threshold in the clippy.toml beside the root manifest, without judging the number (open question 4); and walk every other tracked *Cargo.toml requiring it to inherit or define the lint. Keep RustUnwrapLint's 'fuzz' in manifest.split('/') skip, and add the decision 4 skip: a manifest declaring its own [workspace] is a nested workspace root, which cargo excludes from the parent, so the parent's [workspace.lints] cannot reach it. Import the shared helpers (toml_section_has_key, check_file_contains, require_tracked_paths) from audit.checks.packaging rather than copying them, and say in a comment why the class is not there. Per phase 3's decision 4, an #[allow(clippy::too_many_lines)] carrying a stated reason is accepted and only a bare one is flagged; scan tracked *.rs for allow(clippy::too_many_lines and require a reason = in the same attribute or a comment on the line above, remembering that these annotations span lines -- the pilot report records that git grep -c 'expect(clippy::too_many_lines' finds none for exactly this reason. Write docs/audits/rust-function-length-lint.md with a ## Projects section linking compliance.md#rust-function-length-lint, a Why citing the measured ryll distribution (about 4,145 functions, 40 over 100 lines, 21 over 150, 13 over 200, threshold 200) as the worked example of choosing a number, the #[expect]-not-#[allow] reasoning, and a residual recording that a nested workspace is unmeasured and ryll has one. No plan phase, step or decision numbers in the spec. Register it in registry.py, docs/audits/README.md, FROZEN_METADATA and FROZEN_ISSUE_TITLES, after the source-size-ratchet entry. Add RustFunctionLengthLintTest(CheckTestCase) to scripts/tests/test_source_size_checks.py covering: no Cargo.toml (not_applicable); the lint missing; too_many_lines = "allow" with a trailing comment naming deny; the table form { level = "warn", priority = -1 }; a missing clippy.toml; a clippy.toml without the threshold; a member crate that neither inherits nor defines; a fuzz crate that does neither (pass); a nested-workspace crate that does neither (pass, decision 4); a bare #[allow(clippy::too_many_lines)] (fail); one with reason = "..." (pass); one with a comment above it (pass); and ryll's own shape (pass). Commit subject: Add the rust-function-length-lint criterion.
4d medium sonnet none Measure what the two criteria do to the fleet, and record it. Follow the before-and-after procedure in docs/consistency-audits.md: tools/audit-snapshot.sh before the change and --diff after, against fresh clones of the matrix in .github/workflows/consistency-audit.yml, with audit-manage-issues.py --dry-run only (decision 7). Report, as a table in this section's Execution notes: how many of the 23 in-scope repositories each criterion applies to, how many newly fail, and the names, including this repository, which must pass both. Check the two predictions this section makes -- 6 applicable and 5 failing for rust-function-length-lint, and every repository with tracked source except development and ryll failing source-size-ratchet -- and correct the section where the measurement disagrees rather than leaving the prediction standing. Confirm no baseline entry moved: python3 -I tools/source-size-ratchet.py exits 0 and git diff --quiet tools/source-size-baseline. Do not regenerate docs/audits/compliance.md in place; the daily audit owns it. Commit subject: Record what the new criteria fail.

Risks and mitigations

  • The byte-identity clause turns any template edit into a fleet sweep. Decision 6 keeps the script untouched here, which leaves #436 open. Mitigation: #436's fix and a template-resync run land together, and the spec says plainly that the tool's copies are compared as bytes, so the next reader does not edit the template expecting the criterion to tolerate it. Checked by whoever takes #436, not by this phase.
  • A fork-guarded job satisfies the CI-reach test while reporting no verdict. This is ryll's deliberate trade, and the criterion cannot see a guard without parsing conditions it has no business parsing. Mitigation: recorded in the spec's residual and in the template's step 2, where an adopter reads it. Not mitigated in code.
  • Two criteria turning red across 21-odd repositories at once reads as a broken audit. Mitigation: decision 7 and the D2 precedent -- the daily audit files the issues and docs/audits/compliance.md is left to it -- plus step 4d recording the expected count in the plan, so the morning after is predicted rather than discovered.
  • The new family module is the second this month. A reader looking for a Rust criterion will look in packaging.py and not find this one. Mitigation: both module docstrings say where the other is and why, and the registry keeps the append-only order the results JSON depends on. Checked in the management review of 4b.

Definition of done

  • python3 scripts/audit-check.py --repo-path . --repo-name development reports pass for both source-size-ratchet and rust-function-length-lint, and reports for every other criterion what it reported before this phase.
  • python3 -I tools/source-size-ratchet.py exits 0 and git diff --quiet tools/source-size-baseline -- no entry was raised to make room for this phase's own code.
  • docs/audits/source-size-ratchet.md and docs/audits/rust-function-length-lint.md exist, each is linked from the table in docs/audits/README.md, each carries a ## Projects section linking its compliance.md anchor, and grep -niE 'phase [0-9]' docs/audits/source-size-ratchet.md docs/audits/rust-function-length-lint.md prints nothing.
  • Both ids appear in FROZEN_METADATA and FROZEN_ISSUE_TITLES in scripts/tests/test_metadata.py, and python3 -m unittest discover -s scripts/tests -t scripts passes.
  • Run against a clone of ryll at debf8b1 or later, both criteria report pass; run against a clone of instar, rust-function-length-lint reports fail.
  • templates/source-size-ratchet/ci-job.yaml exists, carries no {{PLACEHOLDER}}, is named in the README's Files table, and pre-commit run --all-files passes with it in the tree.
  • No copy of the claim that the fleet's CI runs pre-commit run --all-files survives in templates/source-size-ratchet/: grep -rn 'pre-commit run --all-files' templates/source-size-ratchet/ prints only lines that say which repositories do and which do not.
  • This section's Execution notes carry step 4d's measured table, and any prediction the measurement contradicted has been corrected in place rather than annotated.
  • 460 is closed by the pull request that lands this phase.

Execution notes

2026-11-28 (AEDT). Both back brief gates were answered before any step ran, and both confirmed the plan as written: decision 2's CI-reach rule, and decision 4's skip for a crate declaring its own [workspace]. This session was also given permission to push the branch and open the pull request, which phase 3's did not have.

Two departures from the step table, both found by checking the briefs' own premises before sending them.

The 4b row said file_matches and file_mentions were both in scripts/audit/checks/llm_docs.py and importable. file_mentions is in scripts/audit/files.py; the other two names the row needed, file_matches and PRE_COMMIT_RUN_RE, are in the check module, so importing them would have pointed a new family module's dependency into another criterion's module. They were moved to audit.files instead, which is the seam that module's docstring exists to describe, and the row above is corrected.

The 4b row also said to read SOURCE_EXTENSIONS from the template rather than restating it, which is right but not possible the obvious way: the template's filename is hyphenated, so it cannot be imported. It is read out of the file's text with ast, without executing it.

Step 4a's review changed two claims the step asserted rather than verified. Its snippet justified a merge_group exclusion as skipping a queue run "where the pull request has already been checked", which is neither ryll's reason -- ryll sorts jobs into a pull request tier and a smaller merge tier, in its docs/ci.md -- nor true in general, since a queue run exists to test the merged result. The exclusion was dropped, so the snippet measures the tree about to land. Its pinning comment also cited the third-party-action-pinning criterion, which does not exist yet.

Step 4d measured what the two criteria do to the fleet, from two hermetic git archive copies of main and of this branch, against 25 fresh --filter=blob:none clones of the audit matrix. The matrix holds 25 names and the in-scope list 23: images and private-ci are scoped to a named subset of criteria, so both new criteria are not applicable to them. Every one of the 23 has tracked source, so the ratchet applies to all of them.

Criterion Applies Pass Fail
source-size-ratchet 23 3 20
rust-function-length-lint 6 1 5

Every ratchet failure reads the same way -- the script is missing and the hook is not in .pre-commit-config.yaml -- so the fix is adoption rather than repair. audit-manage-issues.py --dry-run would file 20 Consistency: Source size ratchet issues and 5 Consistency: Rust function length lint issues, and the snapshot diff moved nothing else: all 50 differences are these two criteria appearing across the 25 repositories, and no network check differed.

One prediction did not survive the measurement. The section said the ratchet would fail every in-scope repository except development and ryll, which is 21. It fails 20, because instar passes: it adopted the template on 2026-11-25 in its own fba04bc, three days before this phase and with no criterion asking it to, and it is wired the way ryll is -- byte-identical script, hook in the pre-commit config, and a CI job of its own whose comment records that pre-commit run --all-files is not how that repository runs hooks.

That is worth more than the arithmetic. It is a repository adopting the template from its README alone, which is the case the template exists for, and a second independent confirmation that decision 2's lane test is drawn in the right place: instar also runs pre-commit run skillsaw --all-files, so the loose reading would have passed it on that job, and the narrow one passes it on the ratchet job it actually has. instar now passes one new criterion and fails the other.

Review round 1 on #468: 3 fix, 1 document, 7 consider, 2 none; the three fixes and six of the considers taken. The fix that mattered was in the criterion's output rather than its logic. The lane test was gated on the hook being declared, so a repository with no hook was also told "no workflow runs every pre-commit hook", which is false for any repository that does run one -- shakenfist runs pre-commit run --all-files in two workflows and was told otherwise. The two halves are judged independently now, and the table above was written from a step report that had truncated that third clause away. Also taken: both halves required a mention of the script rather than an invocation of it, so an on.paths filter naming the script counted as CI running it; the nested-workspace skip fired on any [workspace.*] header, which made the exemption self-service; and a cfg_attr carrying both an expect for length and an allow of something else was flagged as a bare allow.

One of them was a repeat of a known defect rather than a new one. The new suite's unittest.main() sat between its two test classes, so running the file directly reported 17 tests and silently skipped 31 -- which is #413, still open against test_ci_workflows.py. Both files are fixed and a test now asserts that no suite defines a class after its main block, so the third instance fails at the hook instead of being found by a reviewer.

Review round 2: 2 fix, 6 consider, 3 none; both fixes and four of the considers taken. Both fixes were about code round 1 added, which is the convergence signal worth watching, and both were wrong verdicts rather than wrong prose, so both were worth taking.

Round 1's narrowing of the lane test closed a false pass and opened a false fail: pre-commit run source-size-ratchet --all-files, which is the natural way to run this one hook as its own job, matched neither accepted shape. The lane now also accepts a run of the hook by the id the config gives it, read from the config rather than fixed, so a repository that renamed the hook is measured on its own name.

The entry: scanner round 1 hand-rolled captured the indent before the - of a list item, so for a hook whose first key was entry: every sibling key read as a continuation of the value -- a files: pattern naming the script counted as invoking it, which is a false pass. The scanner is deleted rather than repaired: audit/text/pre_commit.py already parses a config into hooks and their keys, two other check modules use it, and the same parse is what supplies the hook id above.

Also taken: an unterminated #[ masked to end of file, so a later genuine bare allow was reported at the wrong line; and the reason = search ran over the whole attribute while round 1 had scoped the lint name to its own allow(...) group, so a reason explaining a sibling expect excused the allow -- the other half of round 1's fix.

Declined: the dotted TOML spellings of the lint, because no Rust repository in the fleet uses them, the spec states the forms that count, and rust-unwrap-lint has the same limit, so fixing one criterion alone would leave the two disagreeing about what TOML means. Also declined: the memory cost of reading every tracked .rs into the read cache.

The spec gained the twenty counted extensions as prose in this round and lost them again in review. The criterion reads that list out of the template with ast precisely so it cannot disagree with the tool, and a copy in prose is the thing that drifts: the note about which criteria reach the network fell two checks behind that way, which is why docs/consistency-audits.md says to read such a list at its source. The spec now points at the template instead.

Review round 3 ended the loop: 1 fix, 1 document, 6 consider, 2 none. The fix was prose wrap -- three lines the earlier rounds' mid-sentence inserts left past the column the surrounding text uses, in docs/audits/rust-function-length-lint.md. It is not a false verdict, which is the test the previous round set for carrying on, so this round took it, took the document item (the spec's summary table listed two of the three accepted lane shapes), and stopped.

Three substantive items were filed rather than taken, each verified latent before deferring it. #470: too_many_lines is in clippy's pedantic group and a level set in source beats the one [lints] passes, so #![allow(clippy::pedantic)] would switch the lint off while every check the criterion makes still passes -- no in-scope Rust repository allows that group or warnings, checked across all six. #471: the lane regex rejects spellings that do run the script, such as a quoted path or a second interpreter flag -- both repositories with a direct lane use the template's own spelling.

472: an unreadable Cargo.toml is reported as "not a Rust

project", which states the opposite of what is true and closes any open issue, where the policy for a tool that did not answer is error; the wording is inherited from rust-unwrap-lint, so a fix covers both and must contend with packaging.py being at its baseline.

Trajectory across the three rounds: 3 fix, then 2, then 1, with the considers 7, 6, 6. The two middle fixes were about code round 1 added, which was the signal to watch, and both were wrong verdicts; by round 3 nothing left was, so the exit rule was met rather than the reviewer running out of things to say.

Back brief

Two gates, both because the work after them is cheap to propose and expensive to redo:

  • Before 4b writes the criterion. Confirm the CI-reach rule of decision 2 -- hook in the config, plus pre-commit run or a direct invocation in a workflow -- and that it passes this repository through PRE_COMMIT_RUN_RE's optional closing quote rather than by accident. A criterion that fails the repository that owns the audit is the expensive mistake available here.
  • Before 4c decides what to do with a nested workspace. Confirm decision 4's skip rather than requiring tools/gen-swatches-jpeg to define the lint itself. The alternative needs a pull request in ryll, which this phase does not open.

5. Push audit

Planning effort: medium, as the master plan's own guidance sets it for a phase that follows an established pattern. The phase runs a runbook that already exists over ranges that are already recorded, and changes no code. The judgement went into the survey below.

Review effort: high, rather than the medium the precedent used. Three things raise it. The range is three merge commits rather than one, so the silent failure PUSH-AUDIT.md:50-64 warns about has three chances to happen and a reader that drops one range still reports a clean result over the other two. One phase landed in a second repository whose audit this section expected to cite and which does not exist. And the extra wave runs the tool this plan shipped, in twenty-three repositories, in a mode the plan's own Future work records as able to erase a failure in one command.

Planned on 2026-11-29 (AEDT) against 5fd3d69, on the branch size-ratchet-phase-05-push-audit. This section replaces the sketch the master plan carried. Of its three instructions, one holds, one names an audit that does not exist, and one is not executable as written.

Scope

In: running PUSH-AUDIT.md's wave 1 and wave 2 over the three merges that landed this plan's development-side work; running ryll's own PUSH-AUDIT.md over the merge that landed the pilot there, because the audit this section meant to cite has not been run; the extra exclusion-list wave the sketch asks for, in the one form in which it is executable; the record of all of that; and this phase's own close-out.

Out: fixing anything the audit finds, which lands as its own pull request afterwards, per plan-push-audit-phase. The twenty repositories the new source-size-ratchet criterion fails and the five that fail rust-function-length-lint, which are consistency-fix's work from the issues the weekly run files, not findings about this plan. #436, #470, #471 and #472, which are filed deferrals recorded in the phase 4 execution notes rather than findings. The six other plan files in this repository carrying a stale copy of plan-push-audit-phase, and the absence of a criterion that would have caught them: survey item 6 files that rather than fixing it here. Editing anything in shakenfist/ryll, including ryll's own plan: this phase reads that repository and writes only here.

What the survey found

Read on 2026-11-29 AEDT against 5fd3d69, against shakenfist/ryll at origin/develop, and against the consistency audit run over this repository's own working tree. The sketch made three instructions' worth of claims. One holds in full, one rests on an audit that does not exist, and one cannot be executed as written. Each false claim is corrected at its source in the planning commit rather than only here.

  1. The ryll pilot's own push audit does not exist, is not started, and is gated behind an unrelated phase. The sketch says to "cite the ryll pilot's own push audit for the ryll commits of phase 3 rather than re-running those". There is nothing to cite. The pilot landed in ryll as debf8b1 (#746) and took over phase 6 of shakenfist/ryll's docs/plans/PLAN-app-split.md; that plan's push audit is its phase 7, which reads Not started (PLAN-app-split.md:223), covers phases 1 to 6 together, and cannot run until that plan's phase 5 finishes -- phase 5 reads In progress (:221). So the citation the sketch plans is a citation of a phase of another plan in another repository, blocked on work that has nothing to do with this plan.

The instruction was not unreasonable when written. plan-push-audit-phase says a phase that landed in another repository "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". That presumes the audit happened at landing time. ryll #746 did not run one, so the form the block describes was never produced. Decision 1 answers what to do instead.

  1. --init cannot write "into a scratch directory", and in a working clone it would rewrite that clone's baseline upwards. The sketch's extra wave says to "run the ratchet against every local clone with --init into a scratch directory". The tool has no output path: BASELINE is the literal os.path.join('tools', 'source-size-baseline') (templates/source-size-ratchet/source-size-ratchet.py:116), and main() resolves git rev-parse --show-toplevel and os.chdir(top) before running anything (:476-477), so the baseline is always written inside the repository under measurement. There is no flag that redirects it and --init and --update are the only modes (:465-472).

Two further constraints make the obvious workarounds wrong as well. The plan's own Future work records that --init over an existing baseline "rewrites the baseline upwards and exits 0, so it can erase a failure in one command" -- so running it in a working clone does not merely dirty that clone, it destroys the evidence. And a git archive export is not a git repository, so git rev-parse fails and the tool exits 2: phase 4 measured exactly this, and its execution notes record that scratch copies "failed first because they lacked repo-root files and were not git repositories (3 errors, not failures)". Decision 3 restates the wave in the one form that works.

The local clones would be the wrong input even if the tool could write elsewhere. Phase 4 found them sitting on other sessions' branches, which is why it measured the fleet from twenty-five fresh --filter=blob:none clones instead.

  1. The range is three merge commits, and every one of them is clean. The sketch speaks of "the accumulated diff", which PUSH-AUDIT.md:33-39 turns into a concrete rule: "a plan whose phases landed as several merges runs every command once per merge", each as <sha>^1..<sha>. All three landings are merge commits with two parents, so the second-parent history is the whole of each phase and nothing landed outside them:
Range Phases Parents Branch commits Diff
dbcf540^1..dbcf540 1 and 2 (#405) d17d887, 756c82e 7 16 files, +3028 -34
252dd43^1..252dd43 3, development side (#458) a08ed67, 953154d 8 3 files, +744 -45
3743700^1..3743700 4 (#468) d302dd7, bbb8601 9 17 files, +2827 -141

Six thousand five hundred and ninety-nine insertions across thirty distinct paths, which is about four times the single-merge range the most recent push-audit phase in this repository read. Decision 2 is what keeps a reader from quietly covering one range and reporting on three, and decision 4 is what the volume does to the model roster.

  1. The sketch's one wholly correct claim: the development-side half of phase 3 did ship adoption guidance the ryll audit could not cover. 252dd43 changed templates/source-size-ratchet/README.md by 42 lines, and that file is not in ryll. Worth adding, because it strengthens the point rather than weakening it: 3743700 changed the same file again, by 57 lines, so the adoption guidance the fleet copies was rewritten in two of the three ranges and the documentation reader should read it whole rather than as two sets of hunks.

  2. This plan's own copy of plan-push-audit-phase is stale, and it is the block this phase executes. The plan embeds v3 (PLAN-size-ratchet.md:352); the canonical copy is v4 (templates/shared-blocks/plan-push-audit-phase.md:1). The difference is a twenty-six-line addition: a five-item floor for a repository that has no PUSH-AUDIT.md, and the instruction not to borrow another repository's runbook instead. Re-synced in the planning commit, because a phase reading a stale copy of its own instructions is the kind of defect this plan exists to prevent.

It changes nothing this phase does -- the addition applies only where there is no runbook, and this repository has one -- and decision 5 says so explicitly rather than leaving a reader to wonder whether the re-sync widened the phase.

  1. Nothing in the audit reads shared blocks inside a plan file, and seven of this repository's thirteen copies of this one are stale. validate_shared_blocks (scripts/audit/text/shared_blocks.py:123) reports a version mismatch as "shared block ... is stale", and three criteria call it: plan-index for docs/plans/index.md, plan-template for PLAN-TEMPLATE.md, and push-audit for PUSH-AUDIT.md. None reads docs/plans/PLAN-*.md. The consequence, measured by grepping every copy in the tree: PLAN-TEMPLATE.md and five plan files carry v4, while PLAN-bot-bypass-identity.md, PLAN-plan-references-in-code.md, PLAN-renovate-cadence.md, PLAN-review-import.md, PLAN-review-unit-size.md, PLAN-workflow-ref-trust.md and this plan carry v3.

This phase re-syncs its own copy; the rest is #477, filed while planning. Fixing six other plans' blocks is a sweep, and a criterion that reads plan files is a criterion -- both are a pull request of their own, not a push audit's work.

The issue has to say more than "add a criterion", because a naive one would fail on every plan in the repository. Running validate_shared_blocks over this plan file reports a second problem: plan-closeout-sections has "drifted from the canonical wording". It has not. That block ships ... placeholders under Future work and Bugs fixed during this work which every plan is meant to replace with its own content (templates/shared-blocks/plan-closeout-sections.md), so a plan that has filled them in necessarily differs from the canonical text, and PLAN-TEMPLATE.md passes plan-template only because it is the one file that still carries the placeholders. A criterion for plan files therefore has to compare version markers rather than wording, or hold that block to its markers and not its body.

Comparing version markers is not sufficient either, because extraction is fence-blind: SHARED_BLOCK_MARKER_RE.finditer runs over raw content with no fence handling (scripts/audit/text/shared_blocks.py:76), so a marker quoted inside a fenced code block is read as an embedded copy. This repository has exactly one such case and the audit's own record walked into it -- PLAN-review-unit-size.md:644, a deliberately fenced v1 draft that finding 1 first mistook for live drift. So the criterion needs a rule for quoted and drafted copies too: skip fenced blocks, or require a marker-adjacent note.

A second stale class turned up in the same sweep and belongs in the same issue: plan-file-conventions is v2 canonically and three plans carry v1 -- PLAN-review-import.md:43, PLAN-review-unit-size.md:58 and PLAN-workflow-ref-trust.md:43 -- all embedded, so the sweep is larger than the six plan-push-audit-phase copies alone. That is the design question and the scope, and it is why the gap is filed rather than closed here.

  1. PUSH-AUDIT.md is as the phase assumes, including the multi-merge rule. Wave 1 is pre-commit run --all-files plus grep-level checks that report rather than block (:65-199); wave 2 is four independent readers, 2a code quality, 2b test review and 2c documentation review at sonnet and medium effort, 2d security review at opus and high (:204-209, :405-410, :472-477, :609-614). The runbook carries the empty-diff warning decision 2 is built on (:50-64), the explicit multi-merge rule (:33-39), the first..last caret rule that does not arise here because all three landings are merges, and a ten-item management checklist (:695-715). It is referenced from AGENTS.md:93, and the push-audit criterion passes on this repository.

  2. ryll has its own runbook, and its range includes a workflow and a runbook change. PUSH-AUDIT.md exists in ryll with the same two-wave shape and its own section numbering (:173 wave 1, :281 2a, :430 2b, :486 2c, :641 2d, :708 the checklist), so decision 1 has a runbook written for ryll's blast radius and need not borrow this one -- which v4 of the shared block explicitly forbids. ryll's default branch is develop, not main. The range debf8b1^1..debf8b1 is 26 files, +881 -29, over 5 branch commits, and it includes .github/workflows/ci.yml, ryll's own PUSH-AUDIT.md, AGENTS.md, clippy.toml, the root Cargo.toml, and the three tools/ files. It adds no tests: no #[test], #[cfg(test)] or mod tests line appears in the diff, which is why decision 1 records ryll's test-review section as void rather than running it.

  3. This repository fails review-coverage on main, and it is not a finding of this plan. The full audit over the working tree reports 236 of 258 in-scope files reviewed, 22 needing review against a threshold of 5, and that is the only failing criterion of the 72 (41 pass, 30 not applicable, 0 error). source-size-ratchet passes here, and rust-function-length-lint is correctly not applicable. The coverage number moves whenever a pull request adds or edits an in-scope file, and this plan added several; prune-reviews heals the marks on each push to main, and the runbook's own rule (:710) is that stale marks are named in the pull request body rather than pruned from a branch. Step 5a names them; nothing in this phase prunes or regenerates REVIEWS.md.

  4. "No Merged cell for this phase" is conditional, not flat. plan-phase-landing permits the omission only where the audit finds nothing; where it finds something, the findings pull request is the carrier, records this phase's merge commit, and the plan is not complete until the findings are resolved or declined in writing. Step 5h follows whichever case the audit produces, and decision 7 states both branches so that neither is decided by whoever happens to be holding the keyboard.

Decisions

  1. Audit the ryll commits here, with ryll's own runbook, rather than citing an audit that does not exist. A citation to a Not started phase of another plan, blocked on that plan's phase 5, is a promise rather than a record -- and silent omission is the failure mode the push-audit phase exists to prevent. So step 5f runs ryll's PUSH-AUDIT.md over debf8b1^1..debf8b1 in a read-only ryll worktree on develop: wave 1, then code quality, documentation review and security review. Test review is recorded as void with the reason, because survey item 8 establishes the range adds no tests.

This is a deliberate departure from plan-push-audit-phase, and it is the decision most open to argument. The block says to cite rather than re-run, and ryll's phase 7 will read these commits again inside its phases 1 to 6, so the work is duplicated. The alternative spends nothing now and leaves this plan's completeness hanging on an unrelated ryll phase, with no carrier left if this audit finds nothing -- which is exactly how the note the most recent push-audit phase in this repository was planned from "came to sit unexecuted for a month". Duplicated reading is the cheaper mistake. This phase does not edit ryll or its plan: what it produces is a record here.

  1. Every wave 2 brief carries all three literal ranges, and every report states three sets of totals. PUSH-AUDIT.md:50-64 is explicit that a brief handed over with ${AUDIT_RANGE:-origin/main...HEAD} still in it expands, in the agent's own shell, to a diff against origin/main -- empty for landed work, and an empty diff reads as a clean review. With three ranges the hazard is worse than the runbook contemplates: a reader can cover two and report on three, and the report looks identical. So each brief substitutes dbcf540^1..dbcf540, 252dd43^1..252dd43 and 3743700^1..3743700 in full, names each in prose, and must state 16 files, +3028 -34, 3 files, +744 -45 and 17 files, +2827 -141 separately. A report missing any one of the three is re-run rather than triaged. It is the only check here that does not depend on the agent noticing its own mistake.

  2. The exclusion wave runs in fresh clones, never a working clone and never an export. Survey item 2 rules out the sketch's wording. Step 5g clones each in-scope repository with gh repo clone shakenfist/<repo> <scratch>/<repo> -- --filter=blob:none, as the scheduled audit does (.github/workflows/consistency-audit.yml:138), runs python3 -I tools/source-size-ratchet.py --init inside the clone, reads the baseline it produced, and discards the clone. The repository list comes from matrix_repos() in scripts/audit/scope.py, which raises rather than returning a partial list; of its 25 entries, images and private-ci are scoped down by only_checks in REPO_OVERRIDES (scripts/audit/repo.py:49, the two entries at :127 and :143) and are recorded as scoped out rather than as swept, leaving the 23 the criterion applies to.

What the wave is looking for is a generated file that reached a baseline, which means BUILTIN_EXCLUDES (*_pb2.py, *_pb2_grpc.py, *.pb.go, *.min.js, *.min.css) plus that repository's own tools/source-size-exclude missed it. A repository that carries an adopted baseline already is measured the same way and its generated clone baseline compared with the committed one, because --init ignores what is there.

  1. Code quality and test review run at opus, not the sonnet the runbook sets; documentation review and security review keep the runbook's models. The runbook's table is written for a single branch's diff. This range is three merges and 6,599 insertions, including a 675-line new module and a 1,072-line new test file, and the two readers whose work scales with insertion count are the two being raised. Documentation review reads a fixed set of pages and security review is already opus at high effort. Recorded as a decision because a departure from the runbook's own settings should be visible, not buried in a step brief.

  2. The stale shared block is re-synced in the planning commit, and changes nothing this phase does. Survey item 5. The v4 addition applies only to a repository with no PUSH-AUDIT.md; this one has one, and under decision 1 the out-of-repository landing is audited with ryll's runbook rather than against the floor. So the five-item floor is not run, and that is said here because a phase that silently skips a checklist and one that correctly does not need it look identical afterwards.

  3. Every step is read-only outside this worktree, and this phase dispatches nothing. No step files, closes, comments on or edits an issue; none runs workflow_dispatch on the consistency audit, which would file and close issues across twenty-five repositories; none pushes to ryll or edits a ryll file; none prunes or regenerates REVIEWS.md or docs/audits/compliance.md. The issue survey item 6 calls for is filed by the management session after Mikal approves it at the back brief, not by a step.

  4. The close-out is conditional and both branches are written down. Where the audit finds nothing: step 5h sets this phase's Status and the plan's docs/plans/index.md row to Complete and records no Merged cell, which plan-phase-landing permits for this row alone. Where it finds something: both stay In progress, the record says the findings pull request is the carrier for both rows and for this phase's merge commit, and the plan is not complete until the findings are resolved or declined in writing.

Step plan

Steps 5b to 5g are read-only readers and run in parallel, after 5a passes: the runbook's own rule is that wave 2 is only worth spending on if wave 1 passes. None of 5a to 5g commits anything, and none of them writes outside this worktree -- 5f and 5g read other repositories through git -C and through throwaway clones respectively. The management session writes the record, and that record is the commit, as step 5h.

Step Effort Model Isolation Brief for sub-agent
5a (wave 1) medium opus none Management session, inline: wave 1 of PUSH-AUDIT.md, three times. git fetch origin first, then for each of AUDIT_RANGE=dbcf540^1..dbcf540, AUDIT_RANGE=252dd43^1..252dd43 and AUDIT_RANGE=3743700^1..3743700 run pre-commit run --all-files once on this branch and every grep-level check once per range. Record every result per range, including the empty ones, because an empty grep is a result and a skipped grep is not. Confirm each range before trusting it, by all three of the figures survey item 3 records: git diff --shortstat must read 16 files changed, 3028 insertions(+), 34 deletions(-), 3 files changed, 744 insertions(+), 45 deletions(-) and 17 files changed, 2827 insertions(+), 141 deletions(-); git rev-list --parents -n1 <sha> must give the recorded parent pairs (d17d887/756c82e, a08ed67/953154d, d302dd7/bbb8601); and git rev-list --count <sha>^1..<sha>^2 must give 7, 8 and 9. Measure the branch commits as ^1..^2 and not as <sha>^2..<sha>, which also collects the first parent's commits since the merge base and so fails this gate on a correct range. Where the parents and the commit count both hold and only a diffstat differs, the recorded figure is wrong rather than the range: correct it in this plan and carry the corrected total into every wave 2 brief, because halting here reads as a range error and would stop a phase whose range is in fact right. Where either of the other two disagrees for a range, that range is wrong and nothing below is worth running for it. The ranges touch no templates/shared-blocks/ file, so the shared-block version-bump question does not arise for the audited work -- say so rather than omitting it, and note separately that this phase's own planning commit does re-sync one such block in this plan file, which is survey item 5 rather than a finding. Name the review marks the ranges staled rather than pruning or regenerating REVIEWS.md (PUSH-AUDIT.md:710): for a merged range that is naming history, since prune-reviews healed them on each push to main, so it is a line of the record rather than work to do. Keep the grep output verbatim per range: step 5b's runbook section opens by taking it as input (PUSH-AUDIT.md:213-217), and a sub-agent inherits nothing, so what is not pasted into that brief does not reach it.
5b (runbook 2a, code quality) medium opus none Section 2a of PUSH-AUDIT.md, code quality, read-only, at opus rather than the sonnet the table sets, per decision 4. Substitute all three literal ranges into every command; do not leave ${AUDIT_RANGE:-origin/main...HEAD} anywhere, and state the insertion and deletion totals measured for each of the three separately -- a report that does not state all three is re-run rather than triaged (decision 2). Paste step 5a's wave 1 results into the brief inline, per range: the TODO/FIXME hits, the new suppressions, the new third-party import lines, and the wc -l list of touched files over 800 lines, because the section opens by taking that report as input and triaging each item, and an agent handed no report will either re-derive the greps or skip the triage the section is built around. Read the new module whole rather than as hunks: scripts/audit/checks/source_size.py is 675 lines and arrived in one range, and scripts/audit/files.py gained helpers moved out of llm_docs.py in the same range, so the question of whether the move left a caller behind is a cross-range question that a per-hunk read cannot answer. The two criteria were deliberately put in a new family module rather than in packaging.py or ci_workflows.py, both of which sit at their own baseline entries; judge whether the module's docstring still states a true reason now that the module is 675 lines. #436, #470, #471 and #472 are filed deferrals recorded in the phase 4 execution notes, not findings.
5c (runbook 2b, test review) medium opus none Section 2b of PUSH-AUDIT.md, test review, read-only, at opus rather than sonnet per decision 4, same substitution of all three ranges and the same three-totals requirement. The tests in range are scripts/tests/test_source_size_checks.py (new, 1,072 lines, 81 cases across SourceSizeRatchetTest and RustFunctionLengthLintTest), SuiteLocationTest.test_no_suite_defines_a_class_after_its_main_block in scripts/tests/test_hooks.py, the unittest.main() move in scripts/tests/test_ci_workflows.py, and the frozen-metadata additions in scripts/tests/test_metadata.py. Worth testing against the claims rather than the counts: phase 4 asserts that the criteria's verdicts were confirmed by mutation -- copy the file aside, mutate in place, run, restore, confirm byte-exact -- so say which of the 81 cases would survive deleting each of the three problem branches in SourceSizeRatchet.run (the byte-identity check, the pre-commit invocation check, the CI-reach check), and whether anything pins the narrow PRE_COMMIT_RUN_ALL_RE against the loose PRE_COMMIT_RUN_RE such that reverting to the loose one fails a test. That distinction is the one a review round found and the test suite is supposed to hold. Run each mutant under timeout and count a timeout as killed; restore from a copy, never with git checkout <dir>.
5d (runbook 2c, documentation review) medium sonnet none Section 2c of PUSH-AUDIT.md, documentation review, read-only, at the runbook's own model and effort, same substitution of all three ranges and the same three-totals requirement. In scope: docs/audits/source-size-ratchet.md, docs/audits/rust-function-length-lint.md, the row each added to docs/audits/README.md, templates/source-size-ratchet/README.md, templates/source-size-ratchet/pre-commit-hook.yaml, templates/source-size-ratchet/ci-job.yaml, templates/shared-blocks/source-file-size.md, this repository's PUSH-AUDIT.md where phase 2 embedded v2, and this plan file. Read templates/source-size-ratchet/README.md whole rather than as hunks: survey item 4 records that it was rewritten in two of the three ranges, 42 lines in one and 57 in another, so the hunks of either range read as consistent while the page as a whole may not. The specific question is whether each specification and the code say the same thing, compared line by line rather than taken as updated: docs/audits/source-size-ratchet.md's three-row "What we check" table against SourceSizeRatchet.run, and its extension paragraph, which deliberately points at the template rather than listing the extensions, against source_extensions(). Phase 4's review rounds corrected a truncated error message quoted into this plan and three over-long lines in the Rust spec, so a claim about what an error message contains is the failure mode to look for rather than a settled one. Check also that neither spec cites a plan phase, step or decision number: plan-phase-references greps docs/ for phase <n> and skips only plans/.
5e (runbook 2d, security review) high opus none Section 2d of PUSH-AUDIT.md, security review, read-only, at the runbook's own model and effort, same substitution of all three ranges and the same three-totals requirement. The blast radius is twofold and both halves are in range. First, other people's issue trackers: a criterion that reports wrongly files an issue in up to twenty-five repositories, and a criterion's message is quoted into those issues verbatim, so judge whether any finding text added here can carry content from a repository under audit into an issue body unescaped, and whether it contains anything that acts as a bot trigger when quoted into a GitHub issue, as the ci-review-automation finding text does. Second, and particular to this plan: the range ships executable code the fleet copies and runs in CI. templates/source-size-ratchet/source-size-ratchet.py runs in every adopter's pre-commit and CI, and templates/source-size-ratchet/ci-job.yaml is a job stanza adopters paste into a workflow. Judge the -I isolation claim (that tools/ stays off sys.path, so a pull request planting tools/fnmatch.py cannot shadow the standard library inside the check), the fork guard and its stated consequence that a fork pull request reports no verdict, the actions/checkout pin and persist-credentials: false, and the job-level permissions: contents: read. Also judge source_extensions(), which parses the template with ast.parse and literal_eval specifically so that the audit never executes the script it is comparing -- confirm there is no path by which it does. Nothing in range touches a token or a secret; confirm that rather than assuming it.
5f (ryll pilot audit) high opus none Audit the pilot's ryll landing with ryll's own runbook, per decision 1, entirely read-only against the operator's existing ryll clone (<ryll clone>) through git -C. Do not create a branch, worktree or checkout there, do not fetch, do not edit any file in it, and do not run git checkout, git switch or anything else that writes: the clone is shared with other sessions, and this step reads history that is already present. Read ryll's PUSH-AUDIT.md with git -C <ryll clone> show origin/develop:PUSH-AUDIT.md, and every audited file with git -C <ryll> show debf8b1:<path>. ryll's default branch is develop, not main. The range is debf8b1^1..debf8b1: 26 files, +881 -29, over 5 branch commits, parents afc204e and 76b7171 -- state those totals in the report. Run ryll's wave 1 grep-level checks over that range and its wave 2 sections 2a (code quality, :281), 2c (documentation review, :486) and 2d (security review, :641). Record ryll's 2b (test review, :430) as void, with the reason: survey item 8 establishes the range adds no tests, with no #[test], #[cfg(test)] or mod tests line in the diff. Record the suite-running portion of ryll's wave 1 as void too, with its reason: the range is landed and was gated by ryll's own CI, and re-running a Rust toolchain in Docker over a merged commit answers nothing the merge did not. Say which checklist items that leaves void, rather than omitting them. Three specifics beyond the runbook. The thirteen #[expect(clippy::too_many_lines, reason = "...")] attributes: judge whether each reason is a real reason rather than a restatement of the lint, and whether #[expect] rather than #[allow] is used throughout, since an #[expect] that stops being needed fails the build and that is the whole design. tools/source-size-ratchet.py in ryll, which should be byte-identical to this repository's template: confirm with git -C <ryll> show debf8b1:tools/source-size-ratchet.py | git hash-object --stdin against git hash-object templates/source-size-ratchet/source-size-ratchet.py here, and report the two hashes. And .github/workflows/ci.yml, whose added source-size-ratchet job is the shape the template's snippet was modelled on: judge the fork guard, the pin and the permissions as 5e judges the template's. Also note that this range changed ryll's own PUSH-AUDIT.md and AGENTS.md, which is in scope for documentation review. Write nothing to ryll and nothing to this worktree: report to the management session.
5g (exclusion wave) medium sonnet none The extra wave the master plan asks for, in the form decision 3 establishes, because --init has no output path and always writes inside the repository it measures. Work only in <scratch>/ratchet-init/, which must be empty when you start, and keep every script you write in <scratch>/scripts/ instead -- never in the directory holding a clone. For each in-scope repository: gh repo clone shakenfist/<repo> <scratch>/ratchet-init/<repo> -- --filter=blob:none, as the scheduled audit does (.github/workflows/consistency-audit.yml:138), then cd into that clone and run python3 -I <this worktree>/templates/source-size-ratchet/source-size-ratchet.py --init, then read the tools/source-size-baseline it wrote. Never run --init in any working checkout under the operator's source tree: the plan's own Future work records that --init over an existing baseline rewrites it upwards and exits 0, so it would destroy a real baseline and any failure it was recording. Report, per repository, the absolute path of the clone you used, so that the record shows none was a working checkout. Derive the repository list from matrix_repos() in scripts/audit/scope.py:210 rather than by hand, since it raises rather than returning a partial list; of its 25 entries, record images and private-ci as scoped out by only_checks in REPO_OVERRIDES (scripts/audit/repo.py:49, entries at :127 and :143) rather than as swept, leaving 23. The question the wave answers: did any generated file reach a baseline, meaning BUILTIN_EXCLUDES (*_pb2.py, *_pb2_grpc.py, *.pb.go, *.min.js, *.min.css) plus that repository's own tools/source-size-exclude missed it. Judge each baseline entry by what the file is, not by its name alone: read enough of any entry that looks machine-written -- long single lines, a generated-by header, a vendored path, a bindings or schema directory -- to say which. For a repository that already carries a committed baseline, diff the generated one against it and report the difference, since --init ignores what is there; a committed baseline missing an entry the generated one has is either growth since adoption or an exclusion, and saying which is the point. Report the 23 by name with a verdict each, the generated paths found with the repository and the exclusion that should have caught each, and none where that is the answer -- it is a result. Clone nothing outside shakenfist/, file nothing, and push nothing.
5h (record and close-out) medium opus none Management session, inline: the record and the close-out. One commit, subject Record the size ratchet push audit. Write what each wave found into the Record section below, including "nothing", which plan-push-audit-phase says is worth a sentence of its own. Head each wave 2 verdict with the runbook's own section name -- code quality, test review, documentation review, security review -- rather than a step letter, because this plan's step letters and the runbook's section letters are offset by one and the record outlives the mapping. Record wave 1 per range, the ryll audit separately with its own four verdicts and its two void sections, and the exclusion wave's 23 verdicts. Record which of the runbook's ten management-session checklist items (PUSH-AUDIT.md:695-715) the audit answered and which are void because the work is already pushed: generated files, criterion specs, shared-block bumps and review marks still apply to a landed range, while "fixed and re-verified before push", "branch up to date" and "ready to push" cannot, and saying so is the same standard decision 5 sets for the five-item floor. Fill Bugs fixed during this work, which is still the template's ..., from what this plan's landings actually fixed -- at least #413's second misplaced unittest.main(), found and swept as a class in phase 4, and the loose CI-lane pattern that would have passed a repository whose ratchet job had been deleted -- or say that none were recorded. Set phase 4's Status to Complete with 3743700 (#468) in its Merged cell if the close-out commit has not already done so. Then follow decision 7: where the audit found nothing, set this phase's Status and the plan's docs/plans/index.md row to Complete and leave this row's Merged cell empty, which plan-phase-landing permits for this row alone; where it found something, leave both In progress and say in the record that the findings pull request is the carrier for both rows and for this phase's merge commit. Run pre-commit run --all-files before proposing the commit.

Record

Run on 2026-11-29 (AEDT) from the branch size-ratchet-phase-05-push-audit at 9900343, over the three merges that landed this plan's development-side work and, separately, over the merge that landed the pilot in shakenfist/ryll. Wave 1 ran inline; the four wave 2 readers, the ryll audit and the exclusion wave ran in parallel as read-only readers once wave 1 passed.

The audit found things, so this phase does not close the plan. Eight findings against the plan's own work, none critical or high and none material -- the one first recorded as material was re-read in review and is neither. Seven of the eight need an action; finding 1 needs none, being already correct in the tree and covered by #477. Per plan-push-audit-phase they land as their own pull request after this phase merges, and that pull request is the carrier for this phase's Merged cell, for this phase's Status and for the plan's row in docs/plans/index.md -- all three of which stay In progress here. The plan is not complete until the findings are resolved or declined in writing.

Every reader measured all three ranges and stated all three totals, so no report had to be re-run. Each range was confirmed on its diffstat, its parent pair and its branch-commit count before any grep was trusted.

Findings

Against this plan's own work. Each names the range that introduced it.

  1. An unannotated v1 draft of source-file-size, quoted in a complete plan. docs/plans/PLAN-review-unit-size.md:644 carries a v1 copy whose text reads "Both are advisory. Neither is a gate, there is no hard cap" -- the sentence v2 replaced and the ratchet contradicts. Range 1 bumped the canonical copy and PUSH-AUDIT.md's and did not touch this one.

Nothing for the findings pull request to do, on the third reading. The fix this item first prescribed was to annotate the fence rather than bump the draft -- and the fence is already annotated, two lines above the marker: "Copy this out to the canonical file; it carries its own markers, which is why it is fenced here rather than embedded" (PLAN-review-unit-size.md:639). A human reader is already told exactly what that copy is. What is missing is something a criterion could key on, which is #477's work and is recorded there, so this item is correct-in-the-tree and wholly covered by #477. The findings pull request should not open a Complete plan to add a note it already carries.

This item was first recorded as a live embedded copy left materially stale, which it is not, and the correction is worth keeping visible because of how the first reading went wrong. The copy sits inside a ``markdown fence whose own preamble at:639says "Copy this out to the canonical file; it carries its own markers, which is why it is fenced here rather than embedded". It is that plan's phase 1 deliverable -- the record of the block as drafted and shipped -- in a plan whose status isComplete`. Re-syncing it to v2 would rewrite the record of what that phase delivered, which is the opposite of the fix. The first reading verified the version marker and the contradicted sentence and never read the three lines above them.

Measured rather than assumed, because the first reading's error was exactly an unmeasured frame: of the 141 shared-block markers in this repository's plans, PLAN-TEMPLATE.md and PUSH-AUDIT.md, this is the only fenced one. Every other marker is a live embedded copy, so #477's premise is unaffected and the six stale plan-push-audit-phase copies it names are all genuinely embedded. 2. The CI job snippet is tested by nothing. Three readers reached this independently. templates/source-size-ratchet/ci-job.yaml is excluded from the template linter by the files: lookahead -- deliberately, because actionlint cannot parse a bare job stanza -- so nothing checks that it parses as YAML, and nothing checks that its python3 -I tools/source-size-ratchet.py step still matches RATCHET_INVOCATION_RE. The lane this repository tells the fleet to paste is unchecked against the criterion that judges lanes, while the sibling pre-commit-hook.yaml is pinned by a test. Range 3.

One test closes it, and the assertion it can make is narrower than "it parses as YAML", which this record said first and no test here can do: AGENTS.md:163 holds the audit scripts to the standard library plus the git and gh CLIs, and nothing under scripts/ imports a YAML parser. What a test can assert is that the stanza's run: line still matches RATCHET_INVOCATION_RE, read with the repository's own scanners in scripts/audit/text/ -- workflows.py and pre_commit.py -- which is what pins the sibling stanza. Named here so whoever writes it does not begin by looking for PyYAML. 3. The specification does not record the isolation residual. RATCHET_INVOCATION_RE accepts a lane without -I, so an adopter can pass while running the script with tools/ first on the import path -- the condition adoption step 1 of the template README exists to prevent. The lane shapes section does disclose that -I is optional, so this is not hidden behaviour; what is missing is the consequence, stated where the exactly analogous fork-guard residual already is. Range 3.

Tightening the pattern to demand -I would be the wrong fix and the findings pull request should not do it: one accepted lane is pre-commit run <hook id>, where -I lives in the hook's entry: and never appears in the workflow line at all, so the stricter pattern would fail a repository whose lane is correct. 4. A sentence one phase made incomplete and a later phase never revisited. docs/audits/push-audit.md:122 says "adopting the ratchet is not something this audit checks". That is still true of the push-audit criterion, whose page it is, and was unambiguous when range 1 wrote it; since range 3 there is a source-size-ratchet criterion that does check adoption, so a reader who finds both pages has to work out which audit is meant. Ranges 1 and 3 together, which is the defect shape this phase exists to catch. 5. chmod by name rather than by descriptor. The baseline is written through mkstemp and then chmod'd by path, so a concurrent writer in tools/ could have an arbitrary file made 0644. os.fchmod(fd, ...) is the correct spelling. Needs a local foothold on the runner. Range 1, and distinct from #436, whose scope was read and confirmed to be the measure()/count_lines() path on a source file. 6. An is_regular()-then-open() window on the baseline and exclude files, which a concurrent writer in tools/ can redirect between the check and the read, with a malformed line then quoted into the log. Same foothold requirement, also range 1, also outside #436. 7. The template README understates the failure message. Its description lists the two fixes the message offers but not the third line report_growth prints when the baseline is absent. An omission rather than a false claim -- and a near relative of the truncation a phase 4 review round caught in this plan itself. Range 3, which is the range that last rewrote that section of the README; range 1 created the file and range 2 rewrote it too, so the range is named here rather than left to a reader to infer from a file touched in both. 8. Two test nits. findings() in scripts/tests/test_source_size_checks.py splits a rendered details string on the prose '. Adopt the ratchet', so a reworded fix sentence would stop every count assertion measuring; the split would fail loudly rather than pass silently, so this is hardening rather than a bug. And of the four shapes the specification names for the unreadable-copy branch, only the dangling link has a case. Range 3.

Not findings against this plan, recorded so they are not lost:

  • shakenfist/ryll's adopted CI job is missing two hardenings the template now ships -- persist-credentials: false and a job-level permissions:, so it inherits pull-requests: write and issues: write and keeps a token in the checkout's git config while running the script from that checkout. Found independently by the security and ryll readers. Range 3 hardened the template and ryll was never re-synced; because the criterion compares only the script, which is byte-identical, no audit run will ever report it. This is template-resync's work in ryll, not a change here.
  • ryll's job excludes merge_group and a skipped job counts as success in its enqueue gate, so the ratchet runs in neither the merge tier nor a fork pull request. The shipped template carries no such exclusion, with a comment recording that the omission is deliberate -- which is the correction a phase 4 review made on finding the clause's stated rationale was invented.
  • PUSH-AUDIT.md:154 is miswritten, in this repository, and was found by running it. It reads git diff "$RANGE" -- 'templates/shared-blocks/*.md' --name-only; everything after -- is a pathspec, so --name-only is parsed as a path and the check prints a full diff instead of a list of names. The same runbook has the correct order at :174. The shape arrived in e2585e3 and 4873e95 only replaced the literal range with the variable, and both are ancestors of all three ranges, so it predates this plan and is not fixed here. It is also how this audit nearly recorded "no shared block touched" for the range that bumped one. The findings pull request carries the fix; no issue is needed. Settled in review round 3 rather than left awaiting an answer. The deferral was first reasoned from the push-audit rule that a problem predating the plan is an issue rather than a finding, but that rule is about not growing an audit into unrelated repair work, and this is a two-argument reorder in the runbook this very phase executed -- not an outward action, and nothing decision 6 forbids. So it rides in the findings pull request with the rest, and the question put to Mikal in the round 1 report is withdrawn: it needed a carrier, not a decision.
Wave 1

Run on 2026-11-29 (AEDT) against 9900343, the branch tip when the audit ran, once per range. pre-commit run --all-files is clean on the branch: actionlint over the workflows and the shipped templates, shellcheck, flake8, skillsaw, both Renovate validators, the audit suites, the ratchet itself and the review tracking suite.

Each range was confirmed on all three of the figures the step plan records before any grep was trusted, and all three agreed for all three ranges:

Range Diffstat Parents Branch commits
dbcf540^1..dbcf540 16 files, +3028 -34 d17d887, 756c82e 7
252dd43^1..252dd43 3 files, +744 -45 a08ed67, 953154d 8
3743700^1..3743700 17 files, +2827 -141 d302dd7, bbb8601 9

The grep-level checks, including the empty ones:

Check dbcf540 252dd43 3743700
Python lines over 120 chars none none none
Touched source over 800 lines none none test_ci_workflows.py 3793, test_source_size_checks.py 1072
New third-party imports none; all stdlib or first-party none none; all stdlib or first-party
Hand-edited compliance.md none none none
Generated block in a criterion spec none none none
FROZEN_ISSUE_TITLES renamed or removed none none none
issue_title declarations changed none none two added
RETIRED_ISSUE_TITLES changed none none none
Shared blocks touched two none none
TODO/FIXME/HACK/XXX none none none
New suppressions one # noqa: E402 none three # noqa: E402
Plan references in code none none none
Documentation touched 8 files 3 files 6 files

Three of those need a management verdict rather than a count.

The two issue_title additions are correct and the frozen list is consistent with them. 3743700 adds 'Source size ratchet' and 'Rust function length lint', one per new criterion. The FROZEN_ISSUE_TITLES grep reports nothing because it is written to catch a rename or a removal -- the two spellings that orphan or wrongly close issues fleet-wide -- and an addition is neither. The two greps together are what cover the interface: the frozen one catches a destructive edit, issue_title catches a new one. Both read as expected here.

The # noqa: E402 suppressions are the repository's established test-module pattern, not new licence. Each sits on a first-party import that follows a sys.path insertion, which is what E402 exists to flag and what every suite under scripts/tests/ already does. No suppression was added to non-test code.

source-file-size was bumped v1 to v2 in dbcf540, and that is the one shared-block change in the plan. The step plan's brief for this step said the ranges touch no templates/shared-blocks/ file. That was wrong, and it was wrong about the most consequential thing in wave 1: dbcf540 changed both templates/shared-blocks/source-file-size.md, bumping its marker from v1 to v2, and templates/shared-blocks/README.md. Bumping a block marks every repository carrying the old version non-compliant on the next scheduled run and files issues automatically, which the runbook says should be a decision rather than a side effect.

It was a decision, and this is the audit's best evidence that the mechanism works end to end. Phase 2 exists to make that bump; its section re-derived the consequence on 2026-11-15 and predicted that push-audit applies to 13 repositories, that this one would pass and the other 12 would fail with exactly one finding, and that since none held an open push-audit issue the next run would file 12 new ones, naming all twelve. What happened:

  • dbcf540 merged 2026-11-15T06:52Z.
  • The scheduled run that evening filed a Consistency: Pre-push audit file issue in all twelve, at 2026-11-15T22:29Z -- the predicted set exactly, with no thirteenth and none missing.
  • The bodies carry the predicted finding: client-python-k3s #175 names source-file-size and the v1-embedded-v2-current wording.
  • No thirteenth repository was filed against. The other twelve matrix repositories were swept and hold no such issue at all; development's own open #232 is a hand-written issue from 2026-10-08 about three producer repositories having no runbook, carries no consistency label, and is not audit-filed.
  • Ten have since been closed by adopters copying v2 verbatim. Two remain open: client-python-k3s #175 and divergulent #157.

So the version-bump checklist item is answered: the bump was deliberate, the fleet consequence was predicted precisely before it happened, and it played out as predicted. The two open issues are the fleet's own work through consistency-fix, not findings of this plan.

Review marks. The ranges stale the marks on every file they edited, and prune-reviews healed them on each push to main, so for a landed range this is naming history rather than work to do. review-coverage passes at the branch tip: 255 of 258 in-scope files reviewed, 3 needing review against a threshold of 5. An earlier reading during this phase recorded 236 of 258 and called it the only failing criterion; both halves have since moved, because prune-reviews and a mark import landed on main while the audit was running. Nothing here prunes, regenerates or re-stamps REVIEWS.md.

The one criterion failing at the branch tip is plan-phase-references, on docs/audits/bypass-actor-identity.md and docs/audits/moving-ref-source-protection.md. Neither page is in any of the three ranges, and the citations arrived on main earlier the same day in unrelated work, so this is not a finding of this plan -- but the documentation reader's verdict that the criterion "passes on this repository" was true when it read and is no longer, which is worth correcting rather than leaving. This repository is in its own audit matrix, so the weekly run files the finding against it like any other, and clearing it is consistency-fix's work -- the same disposition the record gives the twenty repositories that fail source-size-ratchet.

One pre-existing defect in the runbook, found by running it. PUSH-AUDIT.md:154 is written git diff "$RANGE" -- 'templates/shared-blocks/*.md' --name-only. Everything after -- is a pathspec, so --name-only is parsed as a path rather than an option and the command prints a full diff instead of a list of names. The same runbook has the correct order at :174, --name-only -- 'docs/*' '*.md'. The effect is mild -- the check still shows that a shared block changed, just verbosely -- but it is how this audit nearly recorded "no shared block touched" for a range that bumped one. The shape predates this plan: it arrived in e2585e3 and 4873e95 only replaced the literal range with the variable, and both are ancestors of all three ranges. So it is filed rather than fixed here.

Code quality

No blocking finding. scripts/audit/checks/source_size.py was read whole rather than as hunks: every verdict goes through self.ok(), self.fail() or self.skip() with no hand-built result, both applies() return reasons, and every read of a repository under audit goes through repo.read, read_blob or read_within with the os.path.lexists distinction between "missing" and "not a regular file the audit will read". The helper move left no caller behind: file_matches and PRE_COMMIT_RUN_RE are referenced only from audit/files.py, from llm_docs.py, which imports both from their new home, and from source_size.py, and the pattern is byte-identical across the move, so llm-context-lint-ci has no blast radius. The six files a new criterion has to touch are all present for both criteria, and neither declares a column or reaches the network, so FROZEN_COLUMN_NAMES and NETWORK_CHECKS are correctly untouched.

The module docstring's reason for existing is still true, which matters because it is the justification for a new family module rather than a new class in an old one. All four of ci_workflows.py, packaging.py, test_ci_workflows.py and test_packaging.py still sit exactly at their baseline entries, so adding to either family would still have required a hand-raised baseline.

One finding, and it is one this plan made: dbcf540 bumped source-file-size to v2 and updated this repository's PUSH-AUDIT.md copy, and did not touch the v1 copy in docs/plans/PLAN-review-unit-size.md:644. Finding 1 carries the verdict, and it is not the one this section first recorded: the copy is a fenced draft in a complete plan, not live drift, and the fix is to annotate the fence rather than bump the draft. The reason nothing noticed is #477's gap, that no criterion reads shared blocks inside plan files.

The verdict is stated once, in the findings list, and cited here rather than restated. That is a change this round made for a reason: when finding 1's reading was corrected, this paragraph kept the retracted conclusion -- "the drift is material", with the re-sync it implies -- and a reader reaching the wave verdicts without the findings list got the wrong answer and the one action finding 1 says would destroy the record of what that phase delivered. Each wave section is meant to read standalone, which is why the judgement was duplicated in the first place; the lesson is that a verdict can be duplicated or it can be corrected once, not both.

One reported finding did not reproduce and is recorded as checked rather than quietly dropped. The claim was that a hook declaring entry: but no id: would make ratchet_hook_ids() return [None], so the "does not invoke" branch would be skipped and runs_hook_re(None) would reach re.escape(None) and raise. Tested against the real scanner, scan_pre_commit_yaml(...).hooks() yields no hook at all for such an item, so the list is empty, the "does not invoke" finding fires as it should, and runs_hook_re is never called. The reasoning had stopped at item_value without asking whether hooks() would yield the hook.

Two observations recorded rather than acted on. scripts/tests/test_source_size_checks.py is 1,072 lines, over the 800 at which the shared block says to ask the question and under the 1,500 at which a file may not grow without a reviewed baseline edit: the answer is to leave it whole, because its only seam is per-criterion and docs/consistency-audits.md requires one test module per family. And templates/source-size-ratchet/ci-job.yaml is a workflow fragment shipped to the fleet that no linter now sees, which is deliberate -- actionlint cannot parse a bare job stanza, which is why the hook's files: lookahead excludes it -- and is worth stating because the exclusion is invisible from the template itself.

Test review

Nothing survived mutation. Ten distinct mutants, each run under timeout against the whole suite, and every one killed. Listed one per line so the total checks itself, since an earlier reading of this record said eleven against a list of eight:

  1. the byte-identity differs from branch deleted -- killed by 1
  2. its is missing branch deleted -- killed by 1
  3. its irregular-file branch deleted -- killed by 1
  4. the whole byte-identity check neutered -- killed by 3
  5. the pre-commit invocation branch deleted -- killed by 9
  6. the CI-reach branch deleted -- killed by 11
  7. the narrow lane pattern reverted to the loose one -- killed by 6
  8. applies() made never to skip -- killed by 2
  9. applies() moved outside registry.run_check's guard -- killed by 1, a test that predates all three ranges
  10. test_ci_workflows.py's unittest.main() block moved back above its last three classes -- killed by 1

The management session then re-ran mutant 7 independently, which is an eleventh run of the ten, not an eleventh mutation. The scripts are under the step's scratch directory and the tree was restored from copies and confirmed byte-exact.

The claim that most needed pinning is pinned, and the management session reproduced it rather than taking the report for it. Reverting PRE_COMMIT_RUN_ALL_RE to the loose PRE_COMMIT_RUN_RE fails six cases, headed by test_ryll_shaped_ci_without_its_ratchet_job_fails, whose fixture is ryll's pre-commit run skillsaw --all-files with the ratchet job deleted. The failure reads 'pass' != 'fail' against the details ...and is reached by CI: under the loose pattern a repository whose ratchet job had been deleted is reported as reached by CI on the strength of a job that lints something else. That is the defect a phase 4 review round found, and it is held by a named regression test rather than by prose.

How much of the suite pins each half is low by design rather than thin. Deleting the byte-identity check fails 3 of the 81 cases, the hook-invocation check 9, and the CI-reach check 11, because the suite is built as one case per shape plus assertNotIn on the other two halves' sentences -- so each half is pinned by the cases that are about it and deliberately not by the rest.

The suite runs 2,929 tests from the repository root and is clean. Run from scripts/ the same 2,929 run and exactly four fail, all cwd-dependent unmeasured_specs() cases in test_audit_update_docs that resolve docs/audits/ against the working directory; none touches either new criterion. That is the same trap phase 4 recorded, and the figure in this phase's own brief was stale: 2,929 rather than the 2,864 the brief carried, because the branch's planning commit added cases.

Finding 2 carries the verdict: ci-job.yaml is tested by nothing, and it is the audit's most corroborated finding -- the code quality, security and test readers each reached it independently. It is excluded from the template linter by the files: lookahead, deliberately, because actionlint cannot parse a bare job stanza; the consequence is that nothing checks that it parses as YAML at all, and nothing checks that its python3 -I tools/source-size-ratchet.py step still matches RATCHET_INVOCATION_RE. So the lane this repository tells adopters to paste is not checked against the criterion that judges lanes, and the sibling pre-commit-hook.yaml is pinned by a test while this one is not. One test closes it.

One gap in the ToolFailure boundary is worth recording because these are the first criteria that can reach it from applies(). run_check's guard over applies() is held by RunCheckBoundaryTest in scripts/tests/test_registry.py, which predates all three ranges and which the mutation confirms is live -- but no case asserts a ToolFailure raised from this criterion's applies(), and nothing pins ContractTest.results()'s hand-copied guard against run_check's own. Low risk given the generic coverage, and recorded rather than acted on.

Two nits in the new suite. findings() splits a rendered details string on the prose '. Adopt the ratchet', so a reworded fix sentence would make every len(self.findings(...)) assertion stop measuring -- self-protecting, since the split would fail loudly, but cheap to harden. And three of the four shapes the specification names for the unreadable-copy branch -- a link out of the checkout, a directory, a file over the read cap -- have no case, only the dangling link does; the branch itself is killed, so this is coverage of the specification rather than a survivor.

Documentation review

No defect in the documentation these ranges added. Every claim the two new specifications make was compared line by line against the code rather than taken as updated, including the three-row "What we check" table against SourceSizeRatchet.run, the extension paragraph that deliberately points at the template against source_extensions(), the #[allow] reason forms against length_allow_groups, and the attribute scanner's bracket matching. All agreed. The --init correction an earlier review round made to "How to fix it" has held: --update on a missing baseline reads an empty mapping and writes nothing, and the script's own no-baseline message names --init.

The error-message hunt that phase 4's rounds motivated found nothing false. Neither specification quotes an audit message, and the one gap is an omission rather than a wrong claim -- finding 7 carries the verdict.

No specification this plan added cites a phase, step or decision number, which is what plan-phase-references asks of them. The reader's further verdict that the criterion "passes on this repository" was true when it read and is not now; wave 1 above carries the current state and the reason, which is two unrelated specification pages rather than anything in these ranges. A reading of a moving tree belongs with its date, and this is the section that proves it: the sentence it replaced was accurate for about four hours.

One cross-range observation, which is the kind this phase exists to find, and finding 4 carries the verdict. docs/audits/push-audit.md:122 says "adopting the ratchet is not something this audit checks". That is still true of the push-audit criterion, whose page it is, and was unambiguous when dbcf540 wrote it. Since 3743700 there is a source-size-ratchet criterion that does check adoption, so the sentence is now incomplete rather than false: a reader who finds both pages has to work out which audit is meant. Recorded as a finding against this plan rather than a pre-existing one, because this plan wrote the sentence and this plan changed the world it describes.

A premise in this phase's own brief for the documentation reader was wrong and the reader was right to push back. The brief asserted that prose in docs/ wraps at 70 columns. No such rule is written down, and the fleet does not follow one: measured across the specification pages, bypass-actor-identity.md has 37 lines over 70 and secret-handling.md 22, and the two pages this plan added sit at 9 and 7 with a maximum of 72, mid-pack among their siblings. The twenty-one lines at 71 and 72 columns are therefore not a finding, and the three genuinely long lines phase 4's round 3 fixed were a different thing. Corrected here rather than left to imply a defect.

Security review

No critical or high finding. The claims the template rests on were tested rather than read.

The -I isolation claim holds, and holds on every path that reaches the script: the shebang, the hook's entry:, and the CI job's run:. Verified empirically rather than by inspection -- with -I, a planted tools/fnmatch.py is not imported; without it, it is, and shadows the standard library. Every import in the script is stdlib at module top, there is no dynamic import and no exec, and pass_filenames: false means nothing attacker-named reaches argv.

The fork guard folds to one well-formed expression and fails closed, and the job carries the actions/checkout pin this repository uses in all seven of its own workflows, persist-credentials: false, and a job-level permissions: contents: read -- which is the only permissions: line any of the three ranges adds.

source_extensions() never executes the template it parses: it is read_within plus ast.parse plus ast.literal_eval over top-level assignments, the module shells out nowhere, and the only eval in it is ast.literal_eval. read_within cannot read outside the repository under audit -- it requires both isfile and a realpath containment test, caps the read at 2 MiB counted from the read rather than from a stat, and scripts/audit/repo.py is untouched by all three ranges.

Finding text cannot carry audited content into an issue body unescaped. RustFunctionLengthLint does interpolate paths taken from git ls-files, but every criterion's details is whitespace-collapsed and wrapped in a backtick-widened code span before it reaches an issue body, and issue titles are static constants so title-keyed closing is unaffected. A search of the new module, both specifications, the template script, both YAML stanzas and the template README for the fleet's known bot-trigger shapes found none.

Finding 3 carries the verdict: the criterion accepts a CI lane that discards the isolation the template argues for. RATCHET_INVOCATION_RE makes -I optional -- confirmed by matching all four spellings, including bare python3 tools/source-size-ratchet.py -- so an adopter whose lane drops it passes this criterion while running the script with tools/ first on the import path, which is the condition adoption step 1 exists to prevent. The specification does disclose that -I is optional where it lists the lane shapes, so this is not an undocumented behaviour; what it does not do is name the consequence in "What this does not check", where the exactly analogous fork-guard residual is named.

Tightening the pattern to require -I would be the wrong fix, and that is worth recording with the finding. One accepted lane is pre-commit run <hook id>, where the -I lives in the hook's entry: in the configuration and never appears in the workflow line at all, so a pattern demanding -I in the workflow would fail a repository whose lane is correct. The fix is the residual paragraph, not the regex.

Two low findings in the template script -- findings 5 and 6 carry the verdicts -- both needing a local foothold on the runner and both distinct from #436, whose scope was read and confirmed to be the measure()/count_lines() path on a source file. The baseline is written through mkstemp and then chmod'd by name rather than by file descriptor, so a concurrent writer in tools/ could have an arbitrary file made 0644; os.fchmod(fd, ...) is the correct spelling. And the is_regular()-then-open() sequence on the baseline and exclude files can be redirected between the check and the read, with a malformed line then quoted into the log. Both arrived in dbcf540.

ryll's adopted job is missing two hardenings the template now ships, which the ryll audit found independently: no persist-credentials: false and no job-level permissions:, so it inherits the workflow's pull-requests: write and issues: write and keeps a token in the checkout's git config while running the script from that checkout. Range 3 hardened the template and ryll was never re-synced. The criterion compares only the script, which is byte-identical, so no audit will ever report this -- it is template-resync's work rather than something the fleet check will surface.

One consequence of the actionlint exclusion, recorded because it is invisible from the file itself: ci-job.yaml is seen by no linter here, is not a workflow so neither Renovate's workflow manager nor third-party-action-pinning reaches it, and no test ties its pin to this repository's own. Its if: expression and its pin can therefore age silently. The file's own comment says so.

Nothing in any range touches a token, a secret or a workflow permission beyond the narrowing above, established per range by git diff --name-only showing no .github/** or tools/*.sh file in scope and by searching the added lines for credential and token shapes. The one apparent hit is a test fixture asserting that the tool does not print a value it is given.

Not checked: actionlint is not installed on this host, so ci-job.yaml was validated by YAML parse and expression inspection rather than by the linter. The pre-commit hook that lints the templates excludes this file by design.

The ryll pilot's landing

Audited with ryll's own PUSH-AUDIT.md read from origin/develop, over debf8b1^1..debf8b1: 26 files, +881 -29, 5 branch commits, parents afc204e and 76b7171. Code quality, documentation review and security review all pass. Nothing was written to the ryll clone: its HEAD read cc7c7f6 before and after, and git status --short was empty both times.

Two sections are void with their reasons rather than omitted. Test review, because the range adds no test: no #[test], #[cfg(test)] or mod tests line appears in the diff, and the eleven Rust files it touches gain attributes only. And wave 1's suite portion, because the range is landed and was gated by ryll's own CI, so re-running a Rust toolchain in Docker over a merged commit answers nothing the merge did not. Three checklist items are inapplicable for the same reason any audit of landed work cannot answer them: findings fixed and re-verified before push, branch up to date, ready to push.

The byte-identity requirement the new criterion enforces holds for the pilot: ryll's tools/source-size-ratchet.py at debf8b1 and this repository's template both hash to f07378a356f391be5a6c6d8d949bc1607786c618.

All thirteen exemptions are #[expect] and none is #[allow], which is the design rather than a detail, because an #[expect] that stops being needed fails the build while an #[allow] rots silently -- git grep 'allow(.*too_many_lines' at debf8b1 finds nothing repository-wide. All thirteen reasons name the specific structure and what splitting it would cost rather than restating the lint.

Two findings about ryll's CI job, and the notable thing about both is that the template this plan shipped is already stricter than the pilot it was modelled on. ryll's job declares no job-level permissions:, so it inherits the workflow default including pull-requests: write and issues: write while needing only contents: read; the template carries permissions: contents: read. And ryll's job excludes merge_group, so with a skipped job counted as success the ratchet runs in neither the merge tier nor a fork pull request; the template carries no merge_group exclusion and a comment saying the omission is deliberate, which is the correction phase 4's review made when it found the clause's stated rationale was invented. Both are findings against ryll rather than against this plan, and ryll's own push-audit phase covers its CI.

One reported finding was correct at the commit it was read at and is already resolved, which is the phase-landing convention working rather than a gap. At debf8b1, phase 6's Merged cell in ryll's PLAN-app-split.md read (#746) with no commit; at origin/develop it reads debf8b1 (#746). A phase cannot record its own merge commit, so a later commit fills the cell in -- which is exactly why this plan's phase 4 close-out was the first commit of phase 5.

One informational result worth keeping, because it is a property of adoption rather than of ryll. The pilot wrote its baseline with --init at the head of the adopting branch, so the six oversize files that branch itself grew were absorbed into the baseline rather than ratcheted against it: display.rs was baselined at 6,347 having been 6,330 at the range's first parent. That is unavoidable when adopting -- the baseline has to describe the tree as it is -- but it means an adopting pull request measures nothing about its own growth, and an adopter who wants that measured baselines before making changes rather than after.

Exclusion wave

No baseline committed anywhere in the fleet contains a generated file. Each of the twenty-three was cloned with gh repo clone shakenfist/<repo> <scratch>/ratchet-init/<repo> -- --filter=blob:none and measured by running --init inside that throwaway clone, never in a working checkout. That is the clone path for all 23: the prefix is this session's scratch directory plus ratchet-init/, and each repository's path is that prefix plus its name, which is what definition of done item 5 asks for in place of twenty-three literal paths naming an operator's home directory.

Every run exited 0 -- no exit 1, which would be a growth finding, and no exit 2, which would be the tool itself failing. images and private-ci are recorded as scoped out by only_checks rather than as swept.

Definition of done item 5 asks for the names and a verdict each rather than a summary, because a repository the sweep missed is otherwise invisible inside a negative result:

Repository Baseline entries Verdict
actions 1 clean
agent-python 0 clean
andris 1 clean
client-python 4 clean
client-python-k3s 5 clean
client-python-ova 0 clean
clingwrap 0 clean
cloudgood 1 a generated file would enter the baseline
development 12 clean
divergulent 2 clean
hunkydory 0 clean
instar 40 clean; carries its own exclude file
kerbside 3 clean
kerbside-client 0 clean
kerbside-patches 0 clean
library-utilities 0 clean
occystrap 1 clean
ryll 20 clean; carries its own exclude file
sfui 0 clean
shakenfist 39 clean
teneral 4 clean
uncalibrated-sextant 0 clean
visual-digest-rust 0 clean

The table has 23 rows, which is the 25 of the matrix less the two scoped out, and ten of them are zeros. Those zeros are real: no file in any of those ten is over the threshold, which is not the same as the sweep skipping them. The two counts are stated together so they check each other -- an earlier reading of this record said eleven zeros against a table of ten, which is exactly the discrepancy definition of done item 5 asks for the names in order to surface.

Item 6 asks for evidence rather than an assertion that no working checkout was touched, since --init over an existing baseline rewrites it upwards and exits 0, so damage would be silent. Every clone used was under <scratch>/ratchet-init/, and afterwards every checkout under the operator's source tree that carries a tools/source-size-baseline -- ten of them, including this worktree, the primary clone, ryll and the instar and ryll phase worktrees -- reported nothing from git status --short for that path. None was mutated.

Exactly three repositories have adopted, which a sweep of the clones for the three files confirms rather than assumes: development carries the script and a baseline, instar and ryll carry the script, a baseline and an exclude file. No repository carries a baseline without the script.

One prospective case, and it is the one step 3 of the adoption guidance exists to catch. cloudgood tracks examples/video/mode13h/vga_image.h, 4,019 lines of machine-written C whose header reads "Auto-generated VGA Mode 13h image data" and which convert_image.py in the same directory produces from a PNG. Nothing in BUILTIN_EXCLUDES matches it, and correctly so: a per-repository generated artefact belongs in that repository's tools/source-size-exclude, and widening the built-in list to *.h would exclude hand-written headers fleet-wide. cloudgood has adopted nothing, so no committed baseline holds the entry today -- the file the sweep found sits only in the throwaway clone, written by the sweep's own --init. The guidance already orders this correctly: step 3 says to write the exclude file first, before step 4 runs --init, "so those files never enter the baseline". So this is not a defect in what the plan shipped. It is recorded because whoever adopts cloudgood needs to know, and because a future --init that skipped step 3 would bake a 4,019-line generated file into a baseline silently.

Two committed baselines are looser than their trees: this repository's entry for scripts/tests/test_registry.py reads 1,581 against 1,569 on disk, and ryll's for shakenfist-spice-protocol/src/client.rs reads 1,962 against 1,961. Neither is a failure and both are the design working: the ratchet fails only on growth, and running it here prints note: 1 baseline entry is looser than the tree (not a failure) and exits 0. Tightening with --update is optional and deliberately not automatic. In all three adopters the generated baseline holds no entry the committed one lacks, so there is no growth and no hidden exclusion anywhere.

The runbook's management checklist

All ten items, with the ones that cannot apply to landed work said rather than omitted -- the same standard decision 5 sets for the five-item floor.

Item Verdict
Wave 1 passed Yes: pre-commit clean, every grep reviewed per range
Wave 2 findings reviewed Yes, and each verified against the tree by the management session
Blocking findings fixed and re-verified before push Void: the work is landed, and no finding is blocking. Findings land as their own pull request
Security findings assessed; critical and high fixed before push Answered: none critical or high. Two low, both needing a local foothold on the runner
Shared-block bump deliberate, fleet consequence understood Answered at length: source-file-size v1 to v2, predicted before it happened and confirmed afterwards
Generated files generated, not hand-edited Yes: compliance.md untouched in all three ranges, no criterion spec grew a generated block, REVIEWS.md not regenerated here
Stale review marks named, not pruned Yes: named in wave 1 above and in the pull request body; nothing pruned or re-stamped
Commit history clean Yes: two commits, no fixups, no WIP subjects, no accidental files
Branch up to date with main Void for the audited ranges, which are fixed merge commits. Checked for this phase's own branch before the push
Ready to push Void for the audited ranges. Applies to this phase's own branch, which carries only this record

Risks and mitigations

  • A wave 2 reader covers one or two of the three ranges and reports on three. The failure is silent, it looks exactly like success, and three ranges give it three chances where the runbook's warning contemplates one. Decision 2 is the mitigation and the management session enforces it: a report that does not state all three of 16 files, +3028 -34, 3 files, +744 -45 and 17 files, +2827 -141 is re-run, not triaged.
  • Step 5g runs --init in a working clone and destroys a baseline. This is the one step in the phase that can damage something, and the damage is invisible: --init rewrites a baseline upwards and exits 0, so a real failure disappears without an error. Three mitigations rather than one, because the brief alone is not enough: the brief forbids any path under the operator's source tree, it requires the report to state the absolute clone path used for each repository, and the definition of done checks git status --short in every clone under that tree before the phase is called done.
  • The ryll audit borrows this repository's runbook. v4 of plan-push-audit-phase forbids it in as many words -- a runbook is written for one repository's blast radius -- and ryll's is a Rust workspace audited in Docker where this is Python automation. The brief names ryll's own file and its section line numbers, and the report must cite them.
  • Step 5f writes to the shared ryll clone. Another session may be working in it. The brief restricts the step to git -C with show, diff, log and rev-list, forbids a branch, worktree, checkout or fetch, and the definition of done confirms ryll's HEAD and git status --short are unchanged.
  • The audit finds something and the close-out guesses. Both branches are written down in decision 7 and in step 5h's brief, so the choice is a reading of what the record says rather than a judgement made at commit time.
  • main moves under the phase. Several merges landed while this was being planned. The three ranges are fixed merge commits and are immune, which is the point of recording them; what is not immune is pre-commit run --all-files and the branch's mergeability, so the branch is rebased before the push if main has moved, and 5a's pre-commit run is repeated after any rebase.

Definition of done

  1. The Record section states, for each of the three ranges, the diffstat, the parent pair and the branch-commit count, and each matches what git diff --shortstat, git rev-list --parents -n1 and git rev-list --count <sha>^1..<sha>^2 print today.
  2. Every wave 2 report quoted or summarised in the record stated all three ranges' totals. Where one did not, the record says it was re-run rather than triaged.
  3. Wave 1's results appear per range, with the empty greps present rather than omitted.
  4. The ryll landing has four recorded verdicts -- code quality, documentation review, security review, and test review as void with its reason -- citing ryll's own PUSH-AUDIT.md sections, and the two git hash-object values -- for ryll's copy of the ratchet script and for this repository's template -- are recorded and equal.
  5. The exclusion wave records 23 repositories by name with a verdict each, records images and private-ci as scoped out rather than swept, states the scratch clone prefix and the rule by which each repository's path derives from it, and names every generated path that reached a baseline or says none did.

Amended during review round 2, and the amendment is the point of the item rather than a relaxation of it. As written this asked for "the absolute clone path used for each repository"; round 1 replaced the operator's absolute paths throughout this phase with placeholders, because a published plan should not name one account's workstation layout and a brief that does is not re-executable. Twenty-three literal paths would have put four of them back. What the item exists to prove is that no working checkout was used, and the prefix plus the derivation proves it for all 23 at once; item 6 is the independent evidence. 6. No working checkout was mutated by the exclusion wave: for every checkout under the operator's source tree, git -C <clone> status --short prints nothing that the phase put there, and no tools/source-size-baseline under that tree differs from its committed content. 7. The shared ryll clone is untouched: git -C <ryll> status --short is empty and its HEAD is the same commit it was before step 5f. 8. This plan's copy of plan-push-audit-phase is current and matches the canonical wording. Runnable, and narrowed to that one block for the reason survey item 6 gives -- a whole-file check reports plan-closeout-sections on every plan that has filled in its placeholders:

python3 -I -c "
import sys; sys.path.insert(0, 'scripts')
from audit.text.shared_blocks import (
    extract_shared_blocks, load_canonical_block, normalize_block)
name = 'plan-push-audit-phase'
d = 'templates/shared-blocks'
t = open('docs/plans/PLAN-size-ratchet.md', encoding='utf-8').read()
e = [b for b in extract_shared_blocks(t) if b[0] == name]
v, c = load_canonical_block(name, blocks_dir=d)
assert len(e) == 1, e
assert e[0][1] == v, (e[0][1], v)
assert normalize_block(e[0][2]) == normalize_block(c)
print(f'{name} is current at v{v}')
"

must print plan-push-audit-phase is current at v4. Run it from the repository root. The one sys.path insertion is deliberate and narrow -- the audit package has to be importable -- which is not what -I is there to prevent: -I keeps the implicit entries out, so a module beside the script or in the working directory cannot shadow the standard library. 9. #477 carries the six other plan files with a stale copy and the design question a criterion for plan files has to answer. It was filed on 2026-11-29 while planning, so this item is already met; no step closes it, and the record says so rather than implying the audit fixed it. 10. Phase 4's Execution row reads Complete with 3743700 (#468). 11. This phase's row and the plan's docs/plans/index.md row follow decision 7, and this row carries no Merged cell unless the audit found something. 12. Bugs fixed during this work is filled from this plan's landings or states that none were recorded. It no longer reads .... 13. Each of the runbook's ten management-session checklist items has either a verdict or a stated reason for being void. 14. pre-commit run --all-files passes on the branch. 15. No issue was filed, closed, commented on or edited by a step, the consistency audit was not dispatched, docs/audits/compliance.md and REVIEWS.md were not regenerated, and nothing was pushed to shakenfist/ryll.

Execution notes

Executed on 2026-11-29 (AEDT) from 9900343. Steps ran as the step plan set them: wave 1 inline first, then 5b to 5g in parallel as read-only readers, then this record. No step wrote outside this worktree, none filed, closed or commented on an issue, none dispatched the consistency audit, and nothing was pushed to shakenfist/ryll -- its clone's HEAD read cc7c7f6 before and after and its working tree stayed clean, which the ryll reader recorded at both ends.

Three gates were answered rather than assumed. Decision 1 (audit the ryll commits here rather than cite an audit that does not exist) and the filing of #477 were put to Mikal at planning time on 2026-11-29 and both confirmed; he also declined a pull request to ryll saying the range was already audited, so ryll's phase 7 will read these commits again. At execution he confirmed decision 4, raising code quality and test review to opus, and the full 23-repository exclusion sweep, and authorised the push and the pull request.

Three factual premises in this phase's own briefs were wrong, and each is corrected at its source above rather than left standing. Recorded together because the pattern matters more than any one of them: all three were claims the planning session asserted without measuring, and each was caught by running the thing rather than reading it.

  • The brief for wave 1 said the ranges touch no templates/shared-blocks/ file, so the version-bump question did not arise. dbcf540 changed two of them and bumped source-file-size to v2, which is phase 2's entire purpose and the most consequential single change in the plan. Had the brief been followed as written, the audit would have recorded "no shared block touched" for the range that bumped one -- and the miswritten runbook command at PUSH-AUDIT.md:154 would have made that easy to believe.
  • The brief for documentation review said prose in docs/ wraps at 70 columns. No such rule is written down and the fleet does not follow one: bypass-actor-identity.md has 37 lines over 70 and secret-handling.md 22, against 9 and 7 for the two pages this plan added. The reader was right to push back instead of filing twenty-one findings.
  • The brief for test review said the branch runs about 2,864 tests. It runs 2,929 from the repository root, the branch's own planning commit having added cases. The four spurious failures when the suite is run from scripts/ are as phase 4 recorded them.

One departure from the step plan's letter: step 5f was briefed to read the shared ryll clone through git -C rather than to take a worktree of it, which is what "read-only" in that row required in practice, since a worktree write to a clone another session is using is exactly the risk the row was guarding against.

Review round 1, 2026-11-29: one fix, five document and four consider, and every item was taken. That is unusual for a round and it is the right reading here, because the deliverable of this phase is a record: an item saying the record is inaccurate is a defect in the deliverable rather than an optional improvement.

Two of them changed what the record says rather than how it says it. The fix was that wave 1 named 5fd3d69 as its base while the whole-tree checks demonstrably ran later, at 9900343 -- the test count proves it, since the branch's own planning commit added the cases that take the suite to 2,929. And a consider established that finding 1's target is a fenced draft rather than a live embedded copy, which retired the record's only "material" finding and sent the audit back to measure what it had asserted: 141 markers in the tree, exactly one of them fenced, which is the one the first reading tripped over. The same round found that the exclusion wave's record did not meet the phase's own definition of done -- it summarised where items 5 and 6 ask for names, clone paths and evidence -- so the 23 repositories are now listed individually.

Two figures in the record went stale while the audit ran, both corrected: review-coverage now passes at 255 of 258 rather than failing at 236, because prune-reviews and a mark import landed on main mid-audit, and plan-phase-references now fails on two specification pages that unrelated work added citations to earlier the same day. Neither page is in any audited range. A record of a moving tree has to say when it was read, which is the same lesson the fix taught.

Review round 2, 2026-11-29: three fix, one document, five consider and two none; all nine actionable items taken. The fix count rose from one, and the reason it rose is worth naming, because it is not the plan's work going backwards. All three were in text round 1 wrote or failed to update, and two were arithmetic this record had propagated rather than checked: eleven zeros against a table of ten, and eleven mutants against a list of eight. Both are now stated beside the count that checks them, and the mutants are enumerated one per line -- ten distinct mutations, with the management session's own re-run of the lane mutant being an eleventh run rather than an eleventh mutation.

The third was round 1's own correction left half-applied, which is the failure mode the review skill calls incomplete generalisation. Finding 1's reading was corrected in the findings list and the Code quality section kept the retracted conclusion verbatim -- "the drift is material" -- so a reader arriving at the wave verdicts first got the wrong answer, and the action it implies is the one finding 1 says would destroy the record of what that phase delivered. Fixed, and then fixed structurally: the numbered findings list is now the single source of truth for a verdict and the wave sections cite it. A verdict can be duplicated across four sections or it can be corrected once; it cannot be both, and this record tried.

One item resolved a tension round 1 created. Definition of done item 5 asked for twenty-three absolute clone paths, and round 1 removed the operator's absolute paths from this phase on the grounds that a published brief should not name one account's layout. Item 5 is amended to ask for the prefix and the derivation, which proves the same thing -- that no working checkout was used -- for all 23 at once, with item 6 as the independent evidence.

Review round 3, 2026-11-29: no fix, three document, five consider and one none. The loop is closed on the exit rule -- fix went one, three, none -- and the record lands here. All three document items were taken, because in a phase whose deliverable is a record an inaccurate record is a defect in the deliverable, and two of the five considers with them.

The round's best item is the one that says round 2's own fix was applied to one place out of four. Round 2 claimed "the numbered findings list is now the single source of truth for a verdict and the wave sections cite it"; that was true of the code quality section, which is the one where the half-applied correction had bitten, and three other wave sections went on restating verdicts with no finding number. The same shape, one round later, in the fix for that shape. All four now cite their findings, and sweeping for the class rather than the reported instances turned up a fifth the review had not named: the documentation review still carried the plan-phase-references verdict that wave 1 had already corrected.

Two items improved a finding's prescribed fix rather than its verdict, which is a distinction worth recording because the verdicts survived all three rounds unchanged. Finding 1 asked for the fence to be annotated and the fence is already annotated for a human reader, two lines above the marker, so the item is correct-in-the-tree and wholly #477's work -- the findings pull request should not open a Complete plan to add a note it already carries. And finding 2's "nothing checks that it parses as YAML" named an assertion no test here can make: AGENTS.md:163 holds these scripts to the standard library plus git and gh, and nothing under scripts/ imports a YAML parser, so what a test can pin is the run: line against RATCHET_INVOCATION_RE, read with the scanners in scripts/audit/text/.

The last two closed the deferrals' limbo. The PUSH-AUDIT.md:154 pathspec bug is now carried by the findings pull request rather than awaiting an answer: the push-audit rule that a pre-existing problem is an issue rather than a finding is about not growing an audit into unrelated repair work, and a two-argument reorder in the runbook this phase executed is not that. It needed a carrier, not a decision, so the question put in the round 1 report is withdrawn. The ryll re-sync still needs Mikal's yes, because filing into another repository is genuinely his -- but it now names template-resync as its owner, since that is the only mechanism that will ever raise it and it is the audit's one concrete token-exposure finding.

Back brief

Two of the three gates below were put to Mikal at planning time, on 2026-11-29, and answered; they are kept because the reasoning is the record of why the phase is shaped this way, and an implementing session should not re-ask them. Before executing, back brief him on the understanding above and on gate 3, which is still open:

  1. Decision 1, the ryll commits. The section says to cite the pilot's own push audit; there is none, and the one that will cover those commits is phase 7 of another plan in another repository, Not started and blocked on that plan's phase 5. The plan's answer is to audit them here with ryll's own runbook, read-only. The alternative is to cite the forthcoming audit and accept that this plan's completeness waits on unrelated ryll work. This is the decision most open to argument and it should be his. Answered 2026-11-29: audit them here. He also declined the third option, a pull request to ryll saying the range is already audited, so ryll's phase 7 will read these commits again and nothing in this plan tells it not to.
  2. Filing the shared-block issue. Survey item 6 found seven of this repository's thirteen copies of plan-push-audit-phase stale and no criterion that would notice. Filing an issue is an outward action on the tracker, so it waits for his yes; the re-sync of this plan's own copy is in the planning commit either way. Answered 2026-11-29: file it. Filed as #477, which also carries the design question a criterion has to answer first.
  3. Decision 4, raising two readers to opus. The runbook sets sonnet for code quality and test review. This range is three merges and 6,599 insertions, so the plan raises both, which costs more than the runbook's settings would. Say so plainly rather than spending it quietly.

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 four of the criterion's five 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 five of its files in step: the Check subclass in scripts/audit/checks/<family>.py, its registration in CHECKS in scripts/audit/registry.py, the specification under docs/audits/, 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.

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.

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.

  • A comment-blind line count. Counting only code would make deleting code the only way under the line, but needs a lexer per language; the baseline escape hatch removes the pressure to delete comments meanwhile. Out of scope above.
  • Watch where the ratchet pushes code, not only comments. On its first commit it moved a test out of its natural home: SourceSizeRatchetDeploymentTest lives in scripts/tests/test_source_size_ratchet.py rather than beside MermaidLintDeploymentTest, because test_docs_content.py is baselined. The plan predicted pressure on rationale comments, not on placement. Look for both during the ryll pilot.
  • --init over an existing baseline. It rewrites the baseline upwards and exits 0, so it can erase a failure in one command. The defence is that the baseline diff is reviewed; refusing to raise an entry without --force would make it checked rather than stated. Deferred as a behaviour change of its own.
  • Teach plan-push-audit-phase what to do when the cited audit does not exist. The block says a phase landing in another repository is audited as part of the pull request that lands it and that the plan then cites that audit. Phase 5 found that presumption false for the ryll pilot and departed from the block, with Mikal's agreement, by auditing the range itself with ryll's own runbook. That is the reusable answer and it is currently written down only here, so the next plan with a cross-repository phase re-derives it. Propose a v5 clause saying so. Bumping the block marks every repository carrying v4 non-compliant on the next scheduled run, so it is a decision rather than a side effect -- and seven of this repository's own copies are still at v3, which #477 covers.
  • Fix the PUSH-AUDIT.md:154 pathspec bug in the findings pull request. --name-only sits after --, so git reads it as a path and the shared-block check prints a full diff instead of a list of names; :174 has the correct order. It predates this plan, which is why it is not a finding against it, but it is a two-argument reorder in the runbook this phase executed and it is how the phase 5 audit nearly recorded "no shared block touched" for the one range that bumped a block. Carried by the findings pull request rather than filed as an issue: it needed a carrier, not a decision.
  • Re-sync ryll's ratchet CI job. ryll's job predates the hardening phase 4 put in the shipped template: it has no persist-credentials: false and no job-level permissions:, so it inherits pull-requests: write and issues: write and keeps a token in the checkout's git config while running the script from that checkout. No audit run will ever report it, because the criterion compares only the script and ryll's is byte-identical, so nothing surfaces this except a deliberate template-resync. The same pass should decide ryll's merge_group exclusion, which with a skipped job counted as success leaves the ratchet running in neither the merge tier nor a fork pull request; the shipped template carries no such exclusion.

Status: not filed in ryll, and awaiting approval to be. Owner: template-resync. Filing into another repository is an outward action, decision 6 keeps every step of this phase from taking one, and the management session put it to Mikal in the round 1 report. This is the one item where waiting on an answer is right rather than a limbo, because the action itself needs his approval -- but the owner is named either way, so it is a commitment rather than a note. template-resync is the mechanism that re-syncs a drifted adopter, and it is the only thing that will ever raise this: the criterion compares the script alone, and ryll's is byte-identical, so no scheduled run can surface it. It is also the audit's one concrete token-exposure finding, which is why it is not left to be noticed.

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.

  • A CI-lane test that would have passed a repository with its ratchet job deleted. The first version of source-size-ratchet answered "does CI reach the ratchet" with the loose PRE_COMMIT_RUN_RE, which matches pre-commit run <any hook>. ryll runs pre-commit run skillsaw --all-files, so ryll would have passed on the strength of a job that lints something else. Found in the first review round of #468 and fixed with the narrow PRE_COMMIT_RUN_ALL_RE, pinned by test_ryll_shaped_ci_without_its_ratchet_job_fails; the push audit reproduced the mutation and the revert fails six cases.
  • A misplaced unittest.main() block, swept as a class rather than as an instance. scripts/tests/test_ci_workflows.py defined three classes after its if __name__ == '__main__' block, so they never ran under direct invocation. This was the second occurrence of #413, so both files were fixed and SuiteLocationTest.test_no_suite_defines_a_class_after_its_main_block added to stop a third.
  • A specification that named the wrong flag for adoption. The source-size-ratchet page told an adopter to write the baseline with --update, which from a missing baseline reads an empty mapping and writes nothing. Corrected to --init in review, and re-confirmed by the push audit against the script's own no-baseline message.
  • An invented rationale in the CI job template. The first draft of ci-job.yaml justified a merge_group exclusion as the tier "where the pull request has already been checked", which is not ryll's reason and is false in general. The clause and its rationale were dropped, which is why the shipped template is stricter than the pilot job it was modelled on.
  • A truncated error message quoted into this plan. Phase 4's measured report described every ratchet failure as reading two clauses; the real message has three, and the third was false for this repository. Corrected in review round 1.
  • 460, the prediction that the actionlint exclusion would need an

    exclude: entry, was closed by #468 -- the lookahead needed the change, not the exclude list.

Known and deliberately not fixed: #436, an lstat/open race in the template script. Because the criterion now compares the script byte for byte, a fix has to re-sync three adopters in the same change. The push audit found two further races of the same class in the same script, outside #436's scope, which the findings pull request carries -- and they inherit the same constraint, which is worth stating where they are handed over rather than only here. Findings 5 and 6 are both in templates/source-size-ratchet/source-size-ratchet.py, and source-size-ratchet fails an adopter whose copy differs by a byte, so the findings pull request cannot touch the template without re-syncing this repository's own tools/ copy, instar and ryll in the same change. Otherwise the next scheduled run files an issue against three adopters for drift the fix itself introduced. Either bundle the three copies or fold the two races into #436's change, and decide which rather than discovering it on the next run.

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.

Plan-specific close-out notes:

  • Future work. Python function length (open question 2): choose between flake8-functions and a move to ruff, measured against shakenfist's and divergulent's distributions. TypeScript the same for biome (open question 3). A comment-blind line count, if the ratchet turns out to put pressure on rationale comments in practice. Reporting baseline totals per repository over time on the compliance page, so shrinkage is visible as well as growth.
  • Related. shakenfist/ryll docs/plans/PLAN-app-split.md (the split that prompted this, and whose phase 6 is the clippy half of the pilot). PLAN-review-unit-size.md, whose advisory decision this plan revisits.

📝 Report an issue with this page