diff --git a/.agents/skills/agent-conduct/SKILL.md b/.agents/skills/agent-conduct/SKILL.md index e5dd6065e..64e4e1d92 100644 --- a/.agents/skills/agent-conduct/SKILL.md +++ b/.agents/skills/agent-conduct/SKILL.md @@ -25,7 +25,7 @@ The checks that separate work actually done from work that merely reports succes - **Config with a uniqueness rule is validated on read, and its consumers assert what it promised.** A repeated key in a lookup table is not a precedence question to settle quietly, it is two answers to one question, and keeping whichever came last picks one of them where the reader sees no choice being made. Fail on the duplicate at the point the config is read, so the code downstream can rely on the invariant instead of re-deriving it. - **Validate and read on the same normalized key.** A guard that compares stripped names while the join looks up the raw one passes a padded key and then matches nothing, so the exact fault the guard exists to stop is sitting inside the guard. Normalize once at the boundary and use that one value for both the check and the lookup. - **Every push toward a pull request is preceded by a local adversarial review of the branch's whole diff, and the pass is recorded.** The rule binds every push rather than the first one, so a fix push answering a reviewer's finding owes a pass exactly as the branch's first push did, and that is the round it is actually skipped on: the fix looks small, the branch was reviewed once already, and what goes up is content no review has read. Skipping it does not save the round, it moves it, into the fix-commit and review-comment cycle that spends wall-clock, Actions runtime, and agent tokens finding what a local pass would have. The pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, and `scripts/local_review.py` records it keyed on the content the reviewer actually saw, so a capture point can ask whether a receipt still covers what is about to be pushed rather than trusting the rule to have been remembered. The pass is mandatory and its findings are advisory, which are opposite claims worth keeping apart: a pass is recorded whether it raised ten findings or none, and disposing of each one is judgment, per `GOVERNANCE.md` "PR Review Etiquette". -- **Canonical content one repo authors and others carry is reviewed the way a carrier reads it, whole, in the repo that can fix it.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and answers whether one still covers each unit a change moved or newly carried, so a capture point can refuse exactly those rather than trusting the rule to have been remembered. A unit edited today is therefore read today, while a unit nothing has read here yet is left to the burn-down that engine's `report` renders and is never a block on unrelated work. Recording a pass writes one tracked file, the engine's ledger, so where it lands relative to the commit is a real ordering rather than a preference. It is committed before the push, since a capture point that gates a push refuses tracked content differing from HEAD before it runs either gate, while the diff receipt above is not tracked and is recorded after the last commit instead. So the ledger goes in ahead of the commit that carries it and the receipt is written after that commit, which is why the two records sit on opposite sides of it. Which repos hold such a capture point at all is a separate question, and the rule binds whether or not one is installed. Like the pass above, this one is mandatory and its findings are advisory. +- **Canonical content one repo authors and others carry is read the way a carrier reads it, whole, in the repo that can fix it, and that read is swept periodically rather than owed by a push.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. **The read is swept because owing it at every push cost too much to keep owing it there.** Measured across this fleet's review rounds, the passes a push owed were a large share of what a pull request spent, and what they returned was never measured against that, so the read moves to a schedule on the cost alone rather than being owed by whichever change happens to touch a unit. A change that moves a unit is no longer refused over one, and no capture point asks a change for a pass of this kind, the diff pass the bullet above requires being owed by every push exactly as before. What replaces it is a schedule in the authoring repo, which gathers the work into one piece and files it where an agent session can run the passes and fix what they find. That work is every unit whose text has moved past the pass that read it, plus a bounded slice of the units nothing has read there at all, taken newest-committed first. The slice is what keeps a newly authored unit from waiting on a volunteer, since such a unit has no earlier pass to move past and would otherwise reach a carrier with nothing having asked to read it, which is the case this whole rule is about. A unit newly carried by widening the manifest alone is not reached that way, the order reading the unit's own file rather than the manifest, so it joins the backlog at that file's age, where a section written and declared in one commit leads like any other newly authored one. Bounding it is what keeps a long backlog from arriving as one week's work. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and names both sets, so the sweep's list is read off that record rather than remembered, and its ledger is tracked content the change carrying it commits like any other. Like the pass above, a pass the sweep asks for is mandatory and its findings are advisory. - **Another round of edits after either pass is owed only while a defect this change introduced is open, never by a finding count.** Which findings count as introduced, what each class owes, and how many rounds a push may spend are the `local-strict-review` Skill's. - **Run the repo's whole lint gate before every push, not the parts that look relevant.** CI runs all of them, so a partial local run only defers the failure, and the tool most likely to catch a given change is often the one it seems least about (an edit that manipulates line endings is exactly when `editorconfig-checker` matters). The repo documents each linter's known-working invocation, and this rule is that **all** of them run. - **Editing CRLF files programmatically: `.` matches `\r` in a regex**, so a captured line keeps its carriage return and rejoining with `\r\n` yields `CRCRLF`. Prefer literal replacement over regex reassembly. In Python the *default* path is a text-mode rewrite, which has the mirror failure: `Path.read_text()` decodes through universal newlines and `write_text()` translates each `\n` back to `os.linesep`, so a read-edit-write round trip rewrites every line ending in the file to the host's own while the edit itself looks correct. Work in bytes, or open the file explicitly with `newline=''` on both the read and the write, since a read that preserves the endings still hands them to a write that translates them. Use `open()` rather than `Path.read_text()`, which accepts that argument only on Python 3.13 and newer and raises `TypeError` below it. The corruption is worth naming because it is invisible in a rendered diff. @@ -46,7 +46,7 @@ The checks that separate work actually done from work that merely reports succes -Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a change moved, their delegation shape, and how each is recorded are the `local-strict-review` skill's. +Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a sweep names, their delegation shape, and how each is recorded are the `local-strict-review` skill's. ## Before Assuming diff --git a/.agents/skills/drive-pr/SKILL.md b/.agents/skills/drive-pr/SKILL.md index 9ea24f53f..95db1abe0 100644 --- a/.agents/skills/drive-pr/SKILL.md +++ b/.agents/skills/drive-pr/SKILL.md @@ -78,10 +78,9 @@ promotion PR once the fix lands, is the early exit this skill exists to prevent. 1. Isolate into a worktree per repo-worktree, based on the branch that skill's base rule names, develop unless the task is explicitly about main-only content, before the first edit. 2. Commit the work, then run `local-strict-review` and record its pass in the order that skill - gives, its diff receipt following the commit, and its carried-content record instead preceding - the commit where the change moves a carried canonical unit in the repository that authors one, - because that ledger is tracked. Then push the branch and open the feature -> develop PR if it - does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a + gives, its diff receipt following the commit. Where the change also carries the canonical ledger, + that skill's carried-content records instead precede the commit, because that ledger is tracked. + Then push the branch and open the feature -> develop PR if it does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a repository has only if it adds one, is that gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. @@ -141,9 +140,13 @@ maintainer when". -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -154,8 +157,12 @@ maintainer when". impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -164,11 +171,16 @@ maintainer when". attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.agents/skills/local-strict-review/SKILL.md b/.agents/skills/local-strict-review/SKILL.md index fa1c1a86b..d5d25c0f1 100644 --- a/.agents/skills/local-strict-review/SKILL.md +++ b/.agents/skills/local-strict-review/SKILL.md @@ -11,11 +11,12 @@ description: >- the exact gap this skill exists to close before a PR-hosted reviewer closes it instead. Reuses `code-review`'s "Review the Change" criteria rather than restating them, and owns only this local, pre-PR moment. Once a pull request exists, `pr-review-conduct` and `drive-pr` own - triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever a change - edits rule text, a Skill, or any other canonical content this repository authors and other - repositories carry, because that content reaches a reviewer whole only when a repository - carries it for the first time, and a second pass reading each changed unit's whole text is - what moves that read into the repository that can act on what it finds. + triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever the periodic + canonical sweep is worked, which names the carried units whose text has moved past the pass + that read them together with a bounded slice of those nothing has read at all, because that + content reaches a reviewer whole only when a repository carries it for the first time, and a pass reading each named unit's whole text is what moves that read + into the repository that can act on what it finds. Editing such content owes no pass of its + own, so a change that moves a unit pushes and merges like any other. --- # Local Strict Review @@ -26,7 +27,7 @@ A coding agent that finishes a unit of work, judges it ready, and opens the pull ## What It Does -Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the carried-content pass below running against uncommitted content instead, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. +Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the sweep's own passes below running against uncommitted content instead on the change that carries their ledger, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. `git diff` never reports a path `git add` has not touched, so a newly created file sitting untracked would otherwise go unread. List it explicitly, `git ls-files --others --exclude-standard`, and read each result in full alongside the diff, the same as any other file the diff touches. @@ -69,9 +70,9 @@ Commit first, then read the digest, then dispatch the subagent, then hand that s ```sh engine="/scripts/local_review.py" # in the hub itself, scripts/local_review.py -python3 "$engine" status --target # JSON, take contentDigest +python3 "$engine" status --target '' # JSON, take contentDigest # run the pass above, then: -python3 "$engine" record --reviewer agent-skill --target --expect-digest [--findings N] +python3 "$engine" record --reviewer agent-skill --target '' --expect-digest '' [--findings N] ``` Every subcommand here, `run --backend ` included, runs with the repository under review as the working directory, whichever repository that is. The engine takes no `--repo` and reads whichever repository it is run in, so the path names where the script lives and the working directory names what it measures. @@ -80,19 +81,21 @@ Every subcommand here, `run --backend ` included, runs with the repository `--expect-digest` is required rather than optional, and binding it to the earlier read is the whole point. A format-on-save or a hook autofix between the review and the record would otherwise be stamped as reviewed by a pass that never saw it. A refusal there is the content having moved, so the answer is another pass over the current content rather than another read of the digest. -Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so an interactive rebase that leaves the tree alone keeps the receipt valid, and changing one byte invalidates it. +Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so a rebase that leaves the tree alone keeps the receipt valid while the fork point holds, and changing one byte invalidates it. The key holds that fork point too, so rebasing onto a target that has moved retires the receipt although no file changed. **Why the commit comes first**, rather than being an ordering that could equally run the other way. A push delivers the commit, and the hook's tree check refuses a push whose tracked content differs from HEAD, so the record has to describe what HEAD holds. A commit that leaves the tree alone usually does not move the receipt's key, so diligence done before it still describes the same content, and a commit putting a path back to its base state drops it from the change set and does move it. Two reasons make the order matter anyway: staging a modified tracked file moves the key even though its content did not change, and a commit made after the record can carry content the pass never read. Reviewing earlier than this is still worth doing as ordinary diligence, and it does not substitute for the recorded pass: the digest read and the record bracket a window in which the tree holds still, and a commit inside that window ends it. The engine is hub-hosted per `GOVERNANCE.md` "Hub-Hosted Tooling", so a downstream repository reaches a hub checkout's copy rather than carrying one, which is what the path above is for. -## The Carried-Content Pass +## The Carried-Content Sweep A second pass under the same rule, run in the repository that authors canonical content other repositories carry, which in this fleet is the hub. `GOVERNANCE.md` "Verification Discipline" states the rule and why the ordering it corrects is a defect, and is not restated here. What it requires of a run is below. -**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `check` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. +**No change owes this pass.** Editing a carried unit refuses no push and fails no pull request. The passes are worked instead from the sweep's own issue, which a scheduled workflow in the authoring repository files with the units it asks for this round, and working that issue is the moment this section is for. What it produces is an ordinary pull request, carrying the ledger and whatever the passes had you fix, driven the ordinary way. -Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, its flags, and the point in the sequence where the record is written each differ, and all four are below. +**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `sweep` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. + +Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, and its flags each differ, and all three are below. ```text Task: adversarial review of one canonical unit, read as a repository carrying it for the first @@ -109,21 +112,19 @@ Bounds: read-only. Report a rule that looks incomplete rather than guessing at w ``` ```sh -git fetch origin # stop and report a failed fetch rather than measuring past it -python3 scripts/canonical_review.py check --target # each uncovered unit, with its digest +python3 scripts/canonical_review.py sweep # the units it asks for this round, with their digests +# exit 1 where it named any, which is the sweep working rather than the command failing # run the pass above over each unit it named, then, per unit: -python3 scripts/canonical_review.py record --reviewer agent-skill --target --unit '=' [--findings N] +python3 scripts/canonical_review.py record --reviewer agent-skill --target develop --findings '' --unit '=' ``` -These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Point an engine in one checkout at another checkout's tree and the two mix, the engine's own section rules over the other tree's manifest and files. - -`` is the branch this work targets, resolved once as the pass above resolves it and passed to both commands explicitly. Left off it defaults to `develop`, so a branch based on `main` is measured from a fork point nobody read, and `record` stamps each pass with a merge-base against a branch the work never targeted. The fetch matters for the same reason it does above: the engine resolves `origin/` if it already exists and never fetches it, so a stale remote-tracking ref moves the fork point without saying so. Lagging, which is the ordinary way to be stale, moves it back and gates units this change never touched, and the reverse case, where the branch restores text the target has since changed, drops one it did move. Neither is announced, so the fetch is what keeps the fork point meaning what the reviewer read against. `check` names each uncovered unit with the digest to hand back, so nothing has to be looked up separately, and `list` is there for reading the whole set rather than for this loop. +These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Both resolve the repository from the working directory rather than from where the script sits, so the directory a command runs in is what decides which tree it measures, while the unit model and the manifest reader come from the checkout the script itself lives in. Running one checkout's copy against another's tree therefore measures the second tree by the first's rules, so run them in the tree being measured. `record` additionally stamps each pass with the merge-base against `--target`, which is provenance rather than coverage. The line above names it rather than leaning on the default, since a sweep's own branch is based on `develop`, and a `main`-based branch passes `--target main` instead. The digest is bound to the read for the same reason `--expect-digest` is above: recording a unit by name alone would stamp whatever the file holds at record time, so an edit between the review and the record would be attested to by a reviewer who never saw it. Record each unit whatever the pass found, including nothing. Fixing a finding is itself such an edit, so `record` then refuses the digest you were holding: that refusal is the content having moved rather than a fault in the record, and the answer is a read of the unit's new text, which is what a carrier will actually receive, recorded at its new digest. -**This pass records before the commit, where the pass above records after it**, and the two orders are opposite because the two records live in different places. A receipt sits in the worktree's git directory and can never be committed, so it is written once the commit has fixed what a push will deliver. This ledger, `reports/canonical-review.json`, is a tracked file the commit has to carry, so writing it after that commit leaves the tree differing from HEAD, which is a state the pre-push hook refuses before either gate runs. The shortest order meeting both, and the one the refusal table below assumes, is: run this pass and record each unit, commit that together with the change, then read the digest, run the diff pass, record its receipt, and push. Committing the change first and the ledger in a second commit satisfies the same constraint and costs a commit. +**The ledger this writes is tracked content, so the commit has to carry it**, where the receipt the pass above writes never can be. Record each unit, commit the ledger together with whatever the passes had you fix, then read the digest, run the diff pass over that commit, record its receipt, and push. That is why the two records sit on opposite sides of the one commit. -**A unit nothing has read here yet is not this branch's debt.** `check` refuses the units this change moved, meaning the ones whose text it edited and the ones it newly carried, since widening the manifest hands a carrier content for the first time exactly as writing it would. Everything else is a burn-down entry `canonical_review.py report` renders rather than a block on unrelated work. Working one of those off is worthwhile, and it is its own change rather than a tax on an unrelated one. +**A unit nothing has read here yet reaches the list a slice at a time.** `sweep` names every unit whose text has moved past a pass, and beside them a bounded number of the never-read ones, ordered by how recently the file each sits in was last committed, so recently authored content comes ahead of text that has sat unread for months rather than waiting behind the whole backlog. The key is the file rather than the unit, so committing to a file lifts every unread unit in it, and a unit becomes carried without being lifted wherever the manifest is widened on its own, the manifest being a file of its own. Declaring a section in the same commit that writes it lifts it like any other. `canonical_review.py report` renders that backlog in full, and working more of it off than the sweep asked for is worthwhile and is its own change. ## Disposing of Findings @@ -135,7 +136,7 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - `Why:` the reviewer is asked to omit preferences and returns some anyway, and `style` is classed first so that a preference on text this change wrote is not owed a fix. - **Another round is owed only while an `introduced` finding is open.** Unless evidence disproves it, an `introduced` finding is fixed within the budget below, or escalated where `pr-review-conduct` "Escalate to the maintainer when" says so, a `pre-existing` one is filed once and blocks nothing, and a `style` one is declined with evidence, per `pr-review-conduct` "Every finding ends in one of five outcomes", the evidence being `code-review` "Review the Change"'s own rule to omit preferences. - `Why:` a finding count over prose never reaches zero, so a loop closing on "did it find anything" does not close, where one closing on the false claim, the unfollowable instruction, or the wrong behavior this change put there does. -- **A push allows two rounds of edits in answer to the passes it owes, one budget across both.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". +- **Two rounds of edits answer a pass, one budget per push and one per sweep issue.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". - `Why:` past the second round nearly every finding is against text the previous round's fix wrote, so the rounds are producing the defects they find rather than removing them. - **The pass is mandatory, and the count it records gates nothing.** A pass is recorded whatever it raised, so the record attests that a review ran rather than that the content is clean. - `Why:` a gate reading the count would make a pass raising nothing the cheapest way through it, the opposite of what recording one is for. @@ -145,20 +146,18 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - Before the first push toward a pull request, the push that opens it in `drive-pr` "The Drive Loop" and in `pr-review-conduct` "Expected review loop". - Before pushing a fix for a reviewer finding, the same self-review blind spot applies to a fix as to the original diff (the fix outcome of `pr-review-conduct` "Every finding ends in one of five outcomes", which `drive-pr` "Disposing of Every Finding" carries). - Whenever `agent-conduct`'s "about to claim work is done, verified, green, or fixed" trigger fires for work that will become, or already is, a pull request. -- Before pushing a change that edits canonical content other repositories carry, or that newly carries some by widening the manifest, over each unit `check` names, per "The Carried-Content Pass" above. +- When the canonical sweep's issue is worked, over each unit it names, per "The Carried-Content Sweep" above. Editing such content is not itself one of these moments, and nothing refuses a push over it. -In the hub, `.husky/pre-push` checks the receipt, and the canonical-unit coverage beside it, at the push itself, so the moments above are where each pass is run rather than the only places it is noticed. A blocked push usually means one of those passes was skipped. Both capture points, that hook and the pull request one named below, are the hub's own, and a repository carrying this Skill has neither until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. The hub's own `.github/actions/validate` composite action runs the canonical-unit half again as a step on every pull request into `main` or `develop`, which is what its workflow triggers on. That one needs no hooks path, runs whether or not any clone enabled one, and `--no-verify` does not reach it, which is what makes it the capture point a push cannot bypass where it applies. +In the hub, `.husky/pre-push` checks the receipt at the push itself, so the moments above are where the pass is run rather than the only place it is noticed. A blocked push usually means it was skipped. That hook is the hub's own, and a repository carrying this Skill has none until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. No capture point anywhere gates the carried-content sweep: the hub's `.github/actions/validate` composite action renders the coverage burn-down into every run's job summary and fails no pull request over what that rendering shows, which is the sweep being periodic rather than enforced at a push. That step does still fail where the engine could not read what it needs at all, which is a boundary rather than a verdict about coverage. -**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before either engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. +**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before the engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. | The refusal says | What it means | What clears it | | --- | --- | --- | | No local review covers this branch's current content | The ordinary missing pass: no recorded receipt covers what this push delivers, either because none was recorded or because the content moved after one was | One pass over the branch's whole diff, recorded per "Recording the Pass" above | -| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also moved a canonical unit, follow "The Carried-Content Pass" order instead, since committing first strands that ledger after the commit and each fix then lands on another row. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | +| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also carries the canonical ledger, record those passes before that commit, per "The Carried-Content Sweep" above, since a ledger written after it leaves the tree differing from HEAD again. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | | The commit is not this worktree's HEAD | Any pushed branch ref carrying an object id that is neither this worktree's HEAD nor the all-zero id of a delete, which a push from a checkout sitting elsewhere reaches and so does a multi-ref push such as `git push --all` | Push one branch, the one this worktree holds. Where another branch is the one wanted, check it out in its own worktree first, per `repo-worktree` | -| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, a manifest or ledger the engine could not read, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | -| This branch changes N carried canonical unit(s) that no recorded pass covers | The carried-content pass was skipped for a unit this change moved or newly carried, and the refusal names each one with the digest to hand back | One carried-content pass per named unit, then `canonical_review.py record` for each, in the order "The Carried-Content Pass" above gives. The ledger that writes is tracked content, so the commit has to carry it and the diff pass comes after | -| A canonical refusal naming units this branch never touched | The fork point is not where the reader thinks it is. Either `origin/` does not hold the commit this branch forked from, since neither engine ever fetches it, or the branch is based on something other than `develop` and the hook, which passes no `--target`, measured it against `develop` regardless. Unlike the row below it still prints a record command, and taking that one records passes over units nobody read | `git fetch origin `, then `canonical_review.py check --target ` by hand for the real set, then pass and record what that names and commit the ledger with the change, per the carried-unit row above. Where the branch targets something the hook does not measure, no pass clears it, so the gate cannot judge that branch at all and the bypass is its answer, as in the row below | +| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | | The recorded pass was run against X and this check measured Y, printed under the missing-pass headline | The hook reads `develop` and nothing else, so a branch based elsewhere is measured against `develop` whatever the pass targeted, and the engine deliberately prints no record command, since the one it would print records a pass over a diff nobody read | One more pass against the branch this work actually targets, where it does target the measured one. Where it does not, the gate cannot judge the branch at all and the bypass is its answer | This table is the fleet's one enumeration of these, and every other surface states the principle and routes here rather than listing the shapes. That is deliberate: every review round that added a shape also left a restatement of it somewhere else, and keeping one table is what stops the next round doing the same. diff --git a/.agents/skills/pr-review-conduct/SKILL.md b/.agents/skills/pr-review-conduct/SKILL.md index 5fc7c137c..7f33e4021 100644 --- a/.agents/skills/pr-review-conduct/SKILL.md +++ b/.agents/skills/pr-review-conduct/SKILL.md @@ -50,6 +50,19 @@ visible comments, routinely still carries a finding nobody has answered. Treatin specifically, not "no review of any kind covers this head": an advisory reviewer carrying the exact head under `other_reviewed`, with an empty review body and no new threads, is its own ordinary "reviewed, nothing to flag" shape, not a missing review (#1066). + A refusal is not that coverage, so this item stays unsatisfied under one, and the loop clears + it where it can. A file-count refusal is cleared by splitting the pull request, which is the + only cause on record that the loop can clear. `pr_review.py wait` exit `46` is the one nothing + the loop does clears, an account-quota refusal carrying the current head, which is the case + "Which Reviewers a Repository Actually Has" below states. Exit `47` is that same account state + read from the reviewer's activity elsewhere when this head carries none of its own, and exit + `41` holding across several heads with no cause its body names reaches it the slower way. + Those three are `wait`'s alone: `status` exits 0 over a refusal, carrying it as `refusal=` in + the digest line instead, so reading that exit code as the absence of one would falsely satisfy + this item on the exact state it exists to catch. That is where the + unsatisfied item goes to the maintainer, with the coverage the other reviewers gave that head + read rather than counted and named to them, and their permission under item 5 is what allows + the merge. Item 2 is never waived, and a merge over an unsatisfied one is theirs to authorize. 3. **Every** finding on that head SHA is closed: threads resolved, issue-level comments (which have no resolve action) triaged and replied to, **and** the low-confidence findings collapsed in the review body investigated and answered. Those appear in no thread, so polling threads @@ -131,7 +144,7 @@ that says only "open a PR" is not such an instruction. Run every `scripts/pr_review.py` command below from a hub checkout. The script is hosted there and is never carried into a downstream repository. -Run `local-strict-review` against the branch's current diff before step 1's push, and again before any fix push under outcome 1 below. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. +Run `local-strict-review` against the branch's current diff before every push this loop makes, the one that opens the pull request in step 1 and each one after it, whatever finding it answers and whether or not the branch was reviewed once already. A push that delivers content no pass has read is the case the rule is about, so a re-push of a tree a recorded pass already covers needs no second pass, the receipt being keyed on the branch's net content rather than on its commit series. A rebase that leaves the tree alone keeps it only while the merge base holds: rebasing onto a target that has moved retires the receipt although no file changed, and that push owes a pass like any other. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. 1. Push changes to the PR branch and open the pull request when it does not exist. 2. Run `scripts/pr_review.py status --repo /` once in the foreground and read its output. @@ -147,7 +160,8 @@ Run `local-strict-review` against the branch's current diff before step 1's push head only repeats the decline. 5. Triage findings (see below). 6. Apply fixes or write a rationale for declines. -7. Reply to each thread and resolve what was addressed. +7. Reply to each thread, and resolve what was addressed and what was declined on evidence the + reviewer could check for itself, per outcome 2 below. 8. Re-run the loop after every fix push until the checks are green and no finding remains open. The review effort setting is user-controlled. The workflow never selects or changes it. `status` reports `effort=lite`, `effort=balanced`, or `effort=max` when the completed review exposes that metadata, lowercased, and names an inherited setting apart from a chosen one in a separate `effort_source=default|explicit` field, both reading `unknown` when no effort line parses. Missing effort metadata reports `unknown` and does not change coverage or completion. A pending effort-labeled request can complete without a `copilot_work_started` timeline event, so absence of that event never proves the request is abandoned. The bounded timeout reports `PENDING` when no review or terminal answer arrives. After a timeout with `requested=yes`, rerun `wait` for another bounded interval by default because the request may still be active. If the maintainer directs a retry, remove Copilot in the pull request UI, add it again, and rerun `wait`. This recovery replaces only the review request and never changes the effort setting. @@ -163,9 +177,13 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure ## Every finding ends in one of five outcomes -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -176,8 +194,12 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -186,11 +208,16 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.agents/skills/skill-lifecycle/SKILL.md b/.agents/skills/skill-lifecycle/SKILL.md index d829c7fc2..6badfcf3b 100644 --- a/.agents/skills/skill-lifecycle/SKILL.md +++ b/.agents/skills/skill-lifecycle/SKILL.md @@ -15,7 +15,7 @@ The agent most likely to get a skill wrong is the one editing a skill, and befor - **`.agents/skills//SKILL.md` is the only tree a skill is authored in**, with optional `references/` and `scripts/` directories beside it, and the one part of it not written by hand is the text inside an include region, described below. Codex and opencode read this tree directly, project-local, and also read the global `~/.agents/skills/` copy the installer materializes. - **Generated distributions serve GitHub Copilot and Claude Code.** `scripts/build_dist.py` generates `.github/skills/` for GitHub Copilot and a Claude-plugin-compatible copy at `.claude-plugin/fleet-skills/`, published through `.claude-plugin/marketplace.json`. Neither generated tree is hand-edited, and `build_dist.py --check` exits non-zero when either tree differs from `.agents/skills/`. - **The skill set is implicit.** Every `.agents/skills//` directory carrying a `SKILL.md` is a skill, and the generated `plugin.json` derives its list from those directories, so adding or retiring a skill edits no manifest by hand. `marketplace.json` names the plugin, not the skills, and is untouched by ordinary lifecycle work. -- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs, so the whole-unit review pass `scripts/canonical_review.py` records for each of those units is owed again, which is the cost of a carrier reading generated text in the skill's own context. +- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs. Those units then read as moved past the pass that covered them, which is the periodic sweep's work rather than this change's, per `GOVERNANCE.md` "Verification Discipline". - **`--check` holds every region to its source.** It fails when a region differs from what its source renders now, so a hand edit inside one and a source edit nobody regenerated for both fail the pull request the same way a stale mirror does. `python3 scripts/build_dist.py`, with no flag, is what clears either. A failure regenerating cannot repair is exit 2 rather than 1, whether or not a region is what it is about: a key with no ` > ` or an empty heading, a path naming no file, a heading that no longer resolves or that recurs in its source, a body with nothing in it or leaving a code fence open, a region in a file the generator does not walk, reached through a key, a declared destination refused by the same path rules a source is held to, or carried by the manifest, a `spec/files.json` that cannot be read or parsed while a destination is declared, since a check that cannot run must not wave one through, a symlink at or under a skill's own directory, a region that opens inside another or never closes, a close marker with no region open, a cycle, a path that is empty, absolute, carries a `..` component, or is spelled otherwise than the tree spells it, one outside the root, through a symlink, or under a generated tree, a file that is not UTF-8 wherever the run decodes one, a file holding a region while mixing line endings, and a line outside a code block that begins like a marker and matches neither form, which read as content would leave a region unfilled. An unreadable file is exit 2 as well, and it is the one cause that is not a refusal: `--check` catches the operating system's own error beside the refusals, so a permissions failure or a file removed mid-run is reported rather than read as a stale result. Every code here is `--check`'s. The no-flag run reports a refusal as exit 1. - **`scripts/skills_install.py`, run from a hub checkout, installs both forms per machine**: an overlay copy into `~/.agents/skills/` for Codex and opencode, marked per skill so a retired skill is removed on the next run and a foreign skill is never touched, and a user-scope plugin install for Claude Code via the `claude` CLI. Each run stamps the hub commit into `~/.agents/skills-install-stamp.json`, and `--report` reads that stamp against the checkout and exits non-zero when the machine is behind. The install is global per user, and per-repo pinning is a settled non-goal (`docs/fleet-map.md` "Skills Install Model"). diff --git a/.claude-plugin/fleet-skills/.source-digests/agent-conduct b/.claude-plugin/fleet-skills/.source-digests/agent-conduct index 94690ba9e..5f9653ba4 100644 --- a/.claude-plugin/fleet-skills/.source-digests/agent-conduct +++ b/.claude-plugin/fleet-skills/.source-digests/agent-conduct @@ -1 +1 @@ -004d1370299af4bb +8ab4e0d1eeac34e7 diff --git a/.claude-plugin/fleet-skills/.source-digests/drive-pr b/.claude-plugin/fleet-skills/.source-digests/drive-pr index e2fd732fe..b412223cd 100644 --- a/.claude-plugin/fleet-skills/.source-digests/drive-pr +++ b/.claude-plugin/fleet-skills/.source-digests/drive-pr @@ -1 +1 @@ -cdb7964c85903121 +760b9ce61d5be294 diff --git a/.claude-plugin/fleet-skills/.source-digests/local-strict-review b/.claude-plugin/fleet-skills/.source-digests/local-strict-review index aef8c7b70..58a966c6f 100644 --- a/.claude-plugin/fleet-skills/.source-digests/local-strict-review +++ b/.claude-plugin/fleet-skills/.source-digests/local-strict-review @@ -1 +1 @@ -d8a070025e2cff17 +207a60ead2fe2151 diff --git a/.claude-plugin/fleet-skills/.source-digests/pr-review-conduct b/.claude-plugin/fleet-skills/.source-digests/pr-review-conduct index 03748af75..7e3aff0bf 100644 --- a/.claude-plugin/fleet-skills/.source-digests/pr-review-conduct +++ b/.claude-plugin/fleet-skills/.source-digests/pr-review-conduct @@ -1 +1 @@ -3cd082bcd411066f +891873f7dcc0c8c6 diff --git a/.claude-plugin/fleet-skills/.source-digests/skill-lifecycle b/.claude-plugin/fleet-skills/.source-digests/skill-lifecycle index 3a051ea6a..98aae03f6 100644 --- a/.claude-plugin/fleet-skills/.source-digests/skill-lifecycle +++ b/.claude-plugin/fleet-skills/.source-digests/skill-lifecycle @@ -1 +1 @@ -88690599c29f089f +9882dd4fd36208d5 diff --git a/.claude-plugin/fleet-skills/skills/agent-conduct/SKILL.md b/.claude-plugin/fleet-skills/skills/agent-conduct/SKILL.md index e5dd6065e..64e4e1d92 100644 --- a/.claude-plugin/fleet-skills/skills/agent-conduct/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/agent-conduct/SKILL.md @@ -25,7 +25,7 @@ The checks that separate work actually done from work that merely reports succes - **Config with a uniqueness rule is validated on read, and its consumers assert what it promised.** A repeated key in a lookup table is not a precedence question to settle quietly, it is two answers to one question, and keeping whichever came last picks one of them where the reader sees no choice being made. Fail on the duplicate at the point the config is read, so the code downstream can rely on the invariant instead of re-deriving it. - **Validate and read on the same normalized key.** A guard that compares stripped names while the join looks up the raw one passes a padded key and then matches nothing, so the exact fault the guard exists to stop is sitting inside the guard. Normalize once at the boundary and use that one value for both the check and the lookup. - **Every push toward a pull request is preceded by a local adversarial review of the branch's whole diff, and the pass is recorded.** The rule binds every push rather than the first one, so a fix push answering a reviewer's finding owes a pass exactly as the branch's first push did, and that is the round it is actually skipped on: the fix looks small, the branch was reviewed once already, and what goes up is content no review has read. Skipping it does not save the round, it moves it, into the fix-commit and review-comment cycle that spends wall-clock, Actions runtime, and agent tokens finding what a local pass would have. The pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, and `scripts/local_review.py` records it keyed on the content the reviewer actually saw, so a capture point can ask whether a receipt still covers what is about to be pushed rather than trusting the rule to have been remembered. The pass is mandatory and its findings are advisory, which are opposite claims worth keeping apart: a pass is recorded whether it raised ten findings or none, and disposing of each one is judgment, per `GOVERNANCE.md` "PR Review Etiquette". -- **Canonical content one repo authors and others carry is reviewed the way a carrier reads it, whole, in the repo that can fix it.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and answers whether one still covers each unit a change moved or newly carried, so a capture point can refuse exactly those rather than trusting the rule to have been remembered. A unit edited today is therefore read today, while a unit nothing has read here yet is left to the burn-down that engine's `report` renders and is never a block on unrelated work. Recording a pass writes one tracked file, the engine's ledger, so where it lands relative to the commit is a real ordering rather than a preference. It is committed before the push, since a capture point that gates a push refuses tracked content differing from HEAD before it runs either gate, while the diff receipt above is not tracked and is recorded after the last commit instead. So the ledger goes in ahead of the commit that carries it and the receipt is written after that commit, which is why the two records sit on opposite sides of it. Which repos hold such a capture point at all is a separate question, and the rule binds whether or not one is installed. Like the pass above, this one is mandatory and its findings are advisory. +- **Canonical content one repo authors and others carry is read the way a carrier reads it, whole, in the repo that can fix it, and that read is swept periodically rather than owed by a push.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. **The read is swept because owing it at every push cost too much to keep owing it there.** Measured across this fleet's review rounds, the passes a push owed were a large share of what a pull request spent, and what they returned was never measured against that, so the read moves to a schedule on the cost alone rather than being owed by whichever change happens to touch a unit. A change that moves a unit is no longer refused over one, and no capture point asks a change for a pass of this kind, the diff pass the bullet above requires being owed by every push exactly as before. What replaces it is a schedule in the authoring repo, which gathers the work into one piece and files it where an agent session can run the passes and fix what they find. That work is every unit whose text has moved past the pass that read it, plus a bounded slice of the units nothing has read there at all, taken newest-committed first. The slice is what keeps a newly authored unit from waiting on a volunteer, since such a unit has no earlier pass to move past and would otherwise reach a carrier with nothing having asked to read it, which is the case this whole rule is about. A unit newly carried by widening the manifest alone is not reached that way, the order reading the unit's own file rather than the manifest, so it joins the backlog at that file's age, where a section written and declared in one commit leads like any other newly authored one. Bounding it is what keeps a long backlog from arriving as one week's work. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and names both sets, so the sweep's list is read off that record rather than remembered, and its ledger is tracked content the change carrying it commits like any other. Like the pass above, a pass the sweep asks for is mandatory and its findings are advisory. - **Another round of edits after either pass is owed only while a defect this change introduced is open, never by a finding count.** Which findings count as introduced, what each class owes, and how many rounds a push may spend are the `local-strict-review` Skill's. - **Run the repo's whole lint gate before every push, not the parts that look relevant.** CI runs all of them, so a partial local run only defers the failure, and the tool most likely to catch a given change is often the one it seems least about (an edit that manipulates line endings is exactly when `editorconfig-checker` matters). The repo documents each linter's known-working invocation, and this rule is that **all** of them run. - **Editing CRLF files programmatically: `.` matches `\r` in a regex**, so a captured line keeps its carriage return and rejoining with `\r\n` yields `CRCRLF`. Prefer literal replacement over regex reassembly. In Python the *default* path is a text-mode rewrite, which has the mirror failure: `Path.read_text()` decodes through universal newlines and `write_text()` translates each `\n` back to `os.linesep`, so a read-edit-write round trip rewrites every line ending in the file to the host's own while the edit itself looks correct. Work in bytes, or open the file explicitly with `newline=''` on both the read and the write, since a read that preserves the endings still hands them to a write that translates them. Use `open()` rather than `Path.read_text()`, which accepts that argument only on Python 3.13 and newer and raises `TypeError` below it. The corruption is worth naming because it is invisible in a rendered diff. @@ -46,7 +46,7 @@ The checks that separate work actually done from work that merely reports succes -Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a change moved, their delegation shape, and how each is recorded are the `local-strict-review` skill's. +Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a sweep names, their delegation shape, and how each is recorded are the `local-strict-review` skill's. ## Before Assuming diff --git a/.claude-plugin/fleet-skills/skills/drive-pr/SKILL.md b/.claude-plugin/fleet-skills/skills/drive-pr/SKILL.md index 9ea24f53f..95db1abe0 100644 --- a/.claude-plugin/fleet-skills/skills/drive-pr/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/drive-pr/SKILL.md @@ -78,10 +78,9 @@ promotion PR once the fix lands, is the early exit this skill exists to prevent. 1. Isolate into a worktree per repo-worktree, based on the branch that skill's base rule names, develop unless the task is explicitly about main-only content, before the first edit. 2. Commit the work, then run `local-strict-review` and record its pass in the order that skill - gives, its diff receipt following the commit, and its carried-content record instead preceding - the commit where the change moves a carried canonical unit in the repository that authors one, - because that ledger is tracked. Then push the branch and open the feature -> develop PR if it - does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a + gives, its diff receipt following the commit. Where the change also carries the canonical ledger, + that skill's carried-content records instead precede the commit, because that ledger is tracked. + Then push the branch and open the feature -> develop PR if it does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a repository has only if it adds one, is that gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. @@ -141,9 +140,13 @@ maintainer when". -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -154,8 +157,12 @@ maintainer when". impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -164,11 +171,16 @@ maintainer when". attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.claude-plugin/fleet-skills/skills/local-strict-review/SKILL.md b/.claude-plugin/fleet-skills/skills/local-strict-review/SKILL.md index fa1c1a86b..d5d25c0f1 100644 --- a/.claude-plugin/fleet-skills/skills/local-strict-review/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/local-strict-review/SKILL.md @@ -11,11 +11,12 @@ description: >- the exact gap this skill exists to close before a PR-hosted reviewer closes it instead. Reuses `code-review`'s "Review the Change" criteria rather than restating them, and owns only this local, pre-PR moment. Once a pull request exists, `pr-review-conduct` and `drive-pr` own - triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever a change - edits rule text, a Skill, or any other canonical content this repository authors and other - repositories carry, because that content reaches a reviewer whole only when a repository - carries it for the first time, and a second pass reading each changed unit's whole text is - what moves that read into the repository that can act on what it finds. + triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever the periodic + canonical sweep is worked, which names the carried units whose text has moved past the pass + that read them together with a bounded slice of those nothing has read at all, because that + content reaches a reviewer whole only when a repository carries it for the first time, and a pass reading each named unit's whole text is what moves that read + into the repository that can act on what it finds. Editing such content owes no pass of its + own, so a change that moves a unit pushes and merges like any other. --- # Local Strict Review @@ -26,7 +27,7 @@ A coding agent that finishes a unit of work, judges it ready, and opens the pull ## What It Does -Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the carried-content pass below running against uncommitted content instead, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. +Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the sweep's own passes below running against uncommitted content instead on the change that carries their ledger, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. `git diff` never reports a path `git add` has not touched, so a newly created file sitting untracked would otherwise go unread. List it explicitly, `git ls-files --others --exclude-standard`, and read each result in full alongside the diff, the same as any other file the diff touches. @@ -69,9 +70,9 @@ Commit first, then read the digest, then dispatch the subagent, then hand that s ```sh engine="/scripts/local_review.py" # in the hub itself, scripts/local_review.py -python3 "$engine" status --target # JSON, take contentDigest +python3 "$engine" status --target '' # JSON, take contentDigest # run the pass above, then: -python3 "$engine" record --reviewer agent-skill --target --expect-digest [--findings N] +python3 "$engine" record --reviewer agent-skill --target '' --expect-digest '' [--findings N] ``` Every subcommand here, `run --backend ` included, runs with the repository under review as the working directory, whichever repository that is. The engine takes no `--repo` and reads whichever repository it is run in, so the path names where the script lives and the working directory names what it measures. @@ -80,19 +81,21 @@ Every subcommand here, `run --backend ` included, runs with the repository `--expect-digest` is required rather than optional, and binding it to the earlier read is the whole point. A format-on-save or a hook autofix between the review and the record would otherwise be stamped as reviewed by a pass that never saw it. A refusal there is the content having moved, so the answer is another pass over the current content rather than another read of the digest. -Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so an interactive rebase that leaves the tree alone keeps the receipt valid, and changing one byte invalidates it. +Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so a rebase that leaves the tree alone keeps the receipt valid while the fork point holds, and changing one byte invalidates it. The key holds that fork point too, so rebasing onto a target that has moved retires the receipt although no file changed. **Why the commit comes first**, rather than being an ordering that could equally run the other way. A push delivers the commit, and the hook's tree check refuses a push whose tracked content differs from HEAD, so the record has to describe what HEAD holds. A commit that leaves the tree alone usually does not move the receipt's key, so diligence done before it still describes the same content, and a commit putting a path back to its base state drops it from the change set and does move it. Two reasons make the order matter anyway: staging a modified tracked file moves the key even though its content did not change, and a commit made after the record can carry content the pass never read. Reviewing earlier than this is still worth doing as ordinary diligence, and it does not substitute for the recorded pass: the digest read and the record bracket a window in which the tree holds still, and a commit inside that window ends it. The engine is hub-hosted per `GOVERNANCE.md` "Hub-Hosted Tooling", so a downstream repository reaches a hub checkout's copy rather than carrying one, which is what the path above is for. -## The Carried-Content Pass +## The Carried-Content Sweep A second pass under the same rule, run in the repository that authors canonical content other repositories carry, which in this fleet is the hub. `GOVERNANCE.md` "Verification Discipline" states the rule and why the ordering it corrects is a defect, and is not restated here. What it requires of a run is below. -**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `check` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. +**No change owes this pass.** Editing a carried unit refuses no push and fails no pull request. The passes are worked instead from the sweep's own issue, which a scheduled workflow in the authoring repository files with the units it asks for this round, and working that issue is the moment this section is for. What it produces is an ordinary pull request, carrying the ledger and whatever the passes had you fix, driven the ordinary way. -Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, its flags, and the point in the sequence where the record is written each differ, and all four are below. +**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `sweep` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. + +Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, and its flags each differ, and all three are below. ```text Task: adversarial review of one canonical unit, read as a repository carrying it for the first @@ -109,21 +112,19 @@ Bounds: read-only. Report a rule that looks incomplete rather than guessing at w ``` ```sh -git fetch origin # stop and report a failed fetch rather than measuring past it -python3 scripts/canonical_review.py check --target # each uncovered unit, with its digest +python3 scripts/canonical_review.py sweep # the units it asks for this round, with their digests +# exit 1 where it named any, which is the sweep working rather than the command failing # run the pass above over each unit it named, then, per unit: -python3 scripts/canonical_review.py record --reviewer agent-skill --target --unit '=' [--findings N] +python3 scripts/canonical_review.py record --reviewer agent-skill --target develop --findings '' --unit '=' ``` -These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Point an engine in one checkout at another checkout's tree and the two mix, the engine's own section rules over the other tree's manifest and files. - -`` is the branch this work targets, resolved once as the pass above resolves it and passed to both commands explicitly. Left off it defaults to `develop`, so a branch based on `main` is measured from a fork point nobody read, and `record` stamps each pass with a merge-base against a branch the work never targeted. The fetch matters for the same reason it does above: the engine resolves `origin/` if it already exists and never fetches it, so a stale remote-tracking ref moves the fork point without saying so. Lagging, which is the ordinary way to be stale, moves it back and gates units this change never touched, and the reverse case, where the branch restores text the target has since changed, drops one it did move. Neither is announced, so the fetch is what keeps the fork point meaning what the reviewer read against. `check` names each uncovered unit with the digest to hand back, so nothing has to be looked up separately, and `list` is there for reading the whole set rather than for this loop. +These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Both resolve the repository from the working directory rather than from where the script sits, so the directory a command runs in is what decides which tree it measures, while the unit model and the manifest reader come from the checkout the script itself lives in. Running one checkout's copy against another's tree therefore measures the second tree by the first's rules, so run them in the tree being measured. `record` additionally stamps each pass with the merge-base against `--target`, which is provenance rather than coverage. The line above names it rather than leaning on the default, since a sweep's own branch is based on `develop`, and a `main`-based branch passes `--target main` instead. The digest is bound to the read for the same reason `--expect-digest` is above: recording a unit by name alone would stamp whatever the file holds at record time, so an edit between the review and the record would be attested to by a reviewer who never saw it. Record each unit whatever the pass found, including nothing. Fixing a finding is itself such an edit, so `record` then refuses the digest you were holding: that refusal is the content having moved rather than a fault in the record, and the answer is a read of the unit's new text, which is what a carrier will actually receive, recorded at its new digest. -**This pass records before the commit, where the pass above records after it**, and the two orders are opposite because the two records live in different places. A receipt sits in the worktree's git directory and can never be committed, so it is written once the commit has fixed what a push will deliver. This ledger, `reports/canonical-review.json`, is a tracked file the commit has to carry, so writing it after that commit leaves the tree differing from HEAD, which is a state the pre-push hook refuses before either gate runs. The shortest order meeting both, and the one the refusal table below assumes, is: run this pass and record each unit, commit that together with the change, then read the digest, run the diff pass, record its receipt, and push. Committing the change first and the ledger in a second commit satisfies the same constraint and costs a commit. +**The ledger this writes is tracked content, so the commit has to carry it**, where the receipt the pass above writes never can be. Record each unit, commit the ledger together with whatever the passes had you fix, then read the digest, run the diff pass over that commit, record its receipt, and push. That is why the two records sit on opposite sides of the one commit. -**A unit nothing has read here yet is not this branch's debt.** `check` refuses the units this change moved, meaning the ones whose text it edited and the ones it newly carried, since widening the manifest hands a carrier content for the first time exactly as writing it would. Everything else is a burn-down entry `canonical_review.py report` renders rather than a block on unrelated work. Working one of those off is worthwhile, and it is its own change rather than a tax on an unrelated one. +**A unit nothing has read here yet reaches the list a slice at a time.** `sweep` names every unit whose text has moved past a pass, and beside them a bounded number of the never-read ones, ordered by how recently the file each sits in was last committed, so recently authored content comes ahead of text that has sat unread for months rather than waiting behind the whole backlog. The key is the file rather than the unit, so committing to a file lifts every unread unit in it, and a unit becomes carried without being lifted wherever the manifest is widened on its own, the manifest being a file of its own. Declaring a section in the same commit that writes it lifts it like any other. `canonical_review.py report` renders that backlog in full, and working more of it off than the sweep asked for is worthwhile and is its own change. ## Disposing of Findings @@ -135,7 +136,7 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - `Why:` the reviewer is asked to omit preferences and returns some anyway, and `style` is classed first so that a preference on text this change wrote is not owed a fix. - **Another round is owed only while an `introduced` finding is open.** Unless evidence disproves it, an `introduced` finding is fixed within the budget below, or escalated where `pr-review-conduct` "Escalate to the maintainer when" says so, a `pre-existing` one is filed once and blocks nothing, and a `style` one is declined with evidence, per `pr-review-conduct` "Every finding ends in one of five outcomes", the evidence being `code-review` "Review the Change"'s own rule to omit preferences. - `Why:` a finding count over prose never reaches zero, so a loop closing on "did it find anything" does not close, where one closing on the false claim, the unfollowable instruction, or the wrong behavior this change put there does. -- **A push allows two rounds of edits in answer to the passes it owes, one budget across both.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". +- **Two rounds of edits answer a pass, one budget per push and one per sweep issue.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". - `Why:` past the second round nearly every finding is against text the previous round's fix wrote, so the rounds are producing the defects they find rather than removing them. - **The pass is mandatory, and the count it records gates nothing.** A pass is recorded whatever it raised, so the record attests that a review ran rather than that the content is clean. - `Why:` a gate reading the count would make a pass raising nothing the cheapest way through it, the opposite of what recording one is for. @@ -145,20 +146,18 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - Before the first push toward a pull request, the push that opens it in `drive-pr` "The Drive Loop" and in `pr-review-conduct` "Expected review loop". - Before pushing a fix for a reviewer finding, the same self-review blind spot applies to a fix as to the original diff (the fix outcome of `pr-review-conduct` "Every finding ends in one of five outcomes", which `drive-pr` "Disposing of Every Finding" carries). - Whenever `agent-conduct`'s "about to claim work is done, verified, green, or fixed" trigger fires for work that will become, or already is, a pull request. -- Before pushing a change that edits canonical content other repositories carry, or that newly carries some by widening the manifest, over each unit `check` names, per "The Carried-Content Pass" above. +- When the canonical sweep's issue is worked, over each unit it names, per "The Carried-Content Sweep" above. Editing such content is not itself one of these moments, and nothing refuses a push over it. -In the hub, `.husky/pre-push` checks the receipt, and the canonical-unit coverage beside it, at the push itself, so the moments above are where each pass is run rather than the only places it is noticed. A blocked push usually means one of those passes was skipped. Both capture points, that hook and the pull request one named below, are the hub's own, and a repository carrying this Skill has neither until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. The hub's own `.github/actions/validate` composite action runs the canonical-unit half again as a step on every pull request into `main` or `develop`, which is what its workflow triggers on. That one needs no hooks path, runs whether or not any clone enabled one, and `--no-verify` does not reach it, which is what makes it the capture point a push cannot bypass where it applies. +In the hub, `.husky/pre-push` checks the receipt at the push itself, so the moments above are where the pass is run rather than the only place it is noticed. A blocked push usually means it was skipped. That hook is the hub's own, and a repository carrying this Skill has none until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. No capture point anywhere gates the carried-content sweep: the hub's `.github/actions/validate` composite action renders the coverage burn-down into every run's job summary and fails no pull request over what that rendering shows, which is the sweep being periodic rather than enforced at a push. That step does still fail where the engine could not read what it needs at all, which is a boundary rather than a verdict about coverage. -**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before either engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. +**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before the engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. | The refusal says | What it means | What clears it | | --- | --- | --- | | No local review covers this branch's current content | The ordinary missing pass: no recorded receipt covers what this push delivers, either because none was recorded or because the content moved after one was | One pass over the branch's whole diff, recorded per "Recording the Pass" above | -| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also moved a canonical unit, follow "The Carried-Content Pass" order instead, since committing first strands that ledger after the commit and each fix then lands on another row. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | +| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also carries the canonical ledger, record those passes before that commit, per "The Carried-Content Sweep" above, since a ledger written after it leaves the tree differing from HEAD again. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | | The commit is not this worktree's HEAD | Any pushed branch ref carrying an object id that is neither this worktree's HEAD nor the all-zero id of a delete, which a push from a checkout sitting elsewhere reaches and so does a multi-ref push such as `git push --all` | Push one branch, the one this worktree holds. Where another branch is the one wanted, check it out in its own worktree first, per `repo-worktree` | -| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, a manifest or ledger the engine could not read, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | -| This branch changes N carried canonical unit(s) that no recorded pass covers | The carried-content pass was skipped for a unit this change moved or newly carried, and the refusal names each one with the digest to hand back | One carried-content pass per named unit, then `canonical_review.py record` for each, in the order "The Carried-Content Pass" above gives. The ledger that writes is tracked content, so the commit has to carry it and the diff pass comes after | -| A canonical refusal naming units this branch never touched | The fork point is not where the reader thinks it is. Either `origin/` does not hold the commit this branch forked from, since neither engine ever fetches it, or the branch is based on something other than `develop` and the hook, which passes no `--target`, measured it against `develop` regardless. Unlike the row below it still prints a record command, and taking that one records passes over units nobody read | `git fetch origin `, then `canonical_review.py check --target ` by hand for the real set, then pass and record what that names and commit the ledger with the change, per the carried-unit row above. Where the branch targets something the hook does not measure, no pass clears it, so the gate cannot judge that branch at all and the bypass is its answer, as in the row below | +| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | | The recorded pass was run against X and this check measured Y, printed under the missing-pass headline | The hook reads `develop` and nothing else, so a branch based elsewhere is measured against `develop` whatever the pass targeted, and the engine deliberately prints no record command, since the one it would print records a pass over a diff nobody read | One more pass against the branch this work actually targets, where it does target the measured one. Where it does not, the gate cannot judge the branch at all and the bypass is its answer | This table is the fleet's one enumeration of these, and every other surface states the principle and routes here rather than listing the shapes. That is deliberate: every review round that added a shape also left a restatement of it somewhere else, and keeping one table is what stops the next round doing the same. diff --git a/.claude-plugin/fleet-skills/skills/pr-review-conduct/SKILL.md b/.claude-plugin/fleet-skills/skills/pr-review-conduct/SKILL.md index 5fc7c137c..7f33e4021 100644 --- a/.claude-plugin/fleet-skills/skills/pr-review-conduct/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/pr-review-conduct/SKILL.md @@ -50,6 +50,19 @@ visible comments, routinely still carries a finding nobody has answered. Treatin specifically, not "no review of any kind covers this head": an advisory reviewer carrying the exact head under `other_reviewed`, with an empty review body and no new threads, is its own ordinary "reviewed, nothing to flag" shape, not a missing review (#1066). + A refusal is not that coverage, so this item stays unsatisfied under one, and the loop clears + it where it can. A file-count refusal is cleared by splitting the pull request, which is the + only cause on record that the loop can clear. `pr_review.py wait` exit `46` is the one nothing + the loop does clears, an account-quota refusal carrying the current head, which is the case + "Which Reviewers a Repository Actually Has" below states. Exit `47` is that same account state + read from the reviewer's activity elsewhere when this head carries none of its own, and exit + `41` holding across several heads with no cause its body names reaches it the slower way. + Those three are `wait`'s alone: `status` exits 0 over a refusal, carrying it as `refusal=` in + the digest line instead, so reading that exit code as the absence of one would falsely satisfy + this item on the exact state it exists to catch. That is where the + unsatisfied item goes to the maintainer, with the coverage the other reviewers gave that head + read rather than counted and named to them, and their permission under item 5 is what allows + the merge. Item 2 is never waived, and a merge over an unsatisfied one is theirs to authorize. 3. **Every** finding on that head SHA is closed: threads resolved, issue-level comments (which have no resolve action) triaged and replied to, **and** the low-confidence findings collapsed in the review body investigated and answered. Those appear in no thread, so polling threads @@ -131,7 +144,7 @@ that says only "open a PR" is not such an instruction. Run every `scripts/pr_review.py` command below from a hub checkout. The script is hosted there and is never carried into a downstream repository. -Run `local-strict-review` against the branch's current diff before step 1's push, and again before any fix push under outcome 1 below. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. +Run `local-strict-review` against the branch's current diff before every push this loop makes, the one that opens the pull request in step 1 and each one after it, whatever finding it answers and whether or not the branch was reviewed once already. A push that delivers content no pass has read is the case the rule is about, so a re-push of a tree a recorded pass already covers needs no second pass, the receipt being keyed on the branch's net content rather than on its commit series. A rebase that leaves the tree alone keeps it only while the merge base holds: rebasing onto a target that has moved retires the receipt although no file changed, and that push owes a pass like any other. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. 1. Push changes to the PR branch and open the pull request when it does not exist. 2. Run `scripts/pr_review.py status --repo /` once in the foreground and read its output. @@ -147,7 +160,8 @@ Run `local-strict-review` against the branch's current diff before step 1's push head only repeats the decline. 5. Triage findings (see below). 6. Apply fixes or write a rationale for declines. -7. Reply to each thread and resolve what was addressed. +7. Reply to each thread, and resolve what was addressed and what was declined on evidence the + reviewer could check for itself, per outcome 2 below. 8. Re-run the loop after every fix push until the checks are green and no finding remains open. The review effort setting is user-controlled. The workflow never selects or changes it. `status` reports `effort=lite`, `effort=balanced`, or `effort=max` when the completed review exposes that metadata, lowercased, and names an inherited setting apart from a chosen one in a separate `effort_source=default|explicit` field, both reading `unknown` when no effort line parses. Missing effort metadata reports `unknown` and does not change coverage or completion. A pending effort-labeled request can complete without a `copilot_work_started` timeline event, so absence of that event never proves the request is abandoned. The bounded timeout reports `PENDING` when no review or terminal answer arrives. After a timeout with `requested=yes`, rerun `wait` for another bounded interval by default because the request may still be active. If the maintainer directs a retry, remove Copilot in the pull request UI, add it again, and rerun `wait`. This recovery replaces only the review request and never changes the effort setting. @@ -163,9 +177,13 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure ## Every finding ends in one of five outcomes -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -176,8 +194,12 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -186,11 +208,16 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.claude-plugin/fleet-skills/skills/skill-lifecycle/SKILL.md b/.claude-plugin/fleet-skills/skills/skill-lifecycle/SKILL.md index d829c7fc2..6badfcf3b 100644 --- a/.claude-plugin/fleet-skills/skills/skill-lifecycle/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/skill-lifecycle/SKILL.md @@ -15,7 +15,7 @@ The agent most likely to get a skill wrong is the one editing a skill, and befor - **`.agents/skills//SKILL.md` is the only tree a skill is authored in**, with optional `references/` and `scripts/` directories beside it, and the one part of it not written by hand is the text inside an include region, described below. Codex and opencode read this tree directly, project-local, and also read the global `~/.agents/skills/` copy the installer materializes. - **Generated distributions serve GitHub Copilot and Claude Code.** `scripts/build_dist.py` generates `.github/skills/` for GitHub Copilot and a Claude-plugin-compatible copy at `.claude-plugin/fleet-skills/`, published through `.claude-plugin/marketplace.json`. Neither generated tree is hand-edited, and `build_dist.py --check` exits non-zero when either tree differs from `.agents/skills/`. - **The skill set is implicit.** Every `.agents/skills//` directory carrying a `SKILL.md` is a skill, and the generated `plugin.json` derives its list from those directories, so adding or retiring a skill edits no manifest by hand. `marketplace.json` names the plugin, not the skills, and is untouched by ordinary lifecycle work. -- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs, so the whole-unit review pass `scripts/canonical_review.py` records for each of those units is owed again, which is the cost of a carrier reading generated text in the skill's own context. +- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs. Those units then read as moved past the pass that covered them, which is the periodic sweep's work rather than this change's, per `GOVERNANCE.md` "Verification Discipline". - **`--check` holds every region to its source.** It fails when a region differs from what its source renders now, so a hand edit inside one and a source edit nobody regenerated for both fail the pull request the same way a stale mirror does. `python3 scripts/build_dist.py`, with no flag, is what clears either. A failure regenerating cannot repair is exit 2 rather than 1, whether or not a region is what it is about: a key with no ` > ` or an empty heading, a path naming no file, a heading that no longer resolves or that recurs in its source, a body with nothing in it or leaving a code fence open, a region in a file the generator does not walk, reached through a key, a declared destination refused by the same path rules a source is held to, or carried by the manifest, a `spec/files.json` that cannot be read or parsed while a destination is declared, since a check that cannot run must not wave one through, a symlink at or under a skill's own directory, a region that opens inside another or never closes, a close marker with no region open, a cycle, a path that is empty, absolute, carries a `..` component, or is spelled otherwise than the tree spells it, one outside the root, through a symlink, or under a generated tree, a file that is not UTF-8 wherever the run decodes one, a file holding a region while mixing line endings, and a line outside a code block that begins like a marker and matches neither form, which read as content would leave a region unfilled. An unreadable file is exit 2 as well, and it is the one cause that is not a refusal: `--check` catches the operating system's own error beside the refusals, so a permissions failure or a file removed mid-run is reported rather than read as a stale result. Every code here is `--check`'s. The no-flag run reports a refusal as exit 1. - **`scripts/skills_install.py`, run from a hub checkout, installs both forms per machine**: an overlay copy into `~/.agents/skills/` for Codex and opencode, marked per skill so a retired skill is removed on the next run and a foreign skill is never touched, and a user-scope plugin install for Claude Code via the `claude` CLI. Each run stamps the hub commit into `~/.agents/skills-install-stamp.json`, and `--report` reads that stamp against the checkout and exits non-zero when the machine is behind. The install is global per user, and per-repo pinning is a settled non-goal (`docs/fleet-map.md` "Skills Install Model"). diff --git a/.github/actions/validate/action.yml b/.github/actions/validate/action.yml index d9ef7ccf3..deae114d2 100644 --- a/.github/actions/validate/action.yml +++ b/.github/actions/validate/action.yml @@ -42,31 +42,10 @@ runs: shell: bash run: python3 scripts/build_dist.py --check - # The carried-content half of the local-review rule, per GOVERNANCE.md "Verification Discipline". - # The .husky/pre-push hook runs the same check and is bypassable by construction, so this is where it actually binds. - # Pull requests only, since a canonical unit's change is measured against the branch it is proposed into and a push carrying no pull request has none. - # The base commit reaches the script through the environment rather than through an expression inside it, so a ref value can never be read as shell. - - name: Check carried canonical content review coverage step - if: github.event.pull_request != null - shell: bash - env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} - run: | - set -Eeuo pipefail - # This job checks out at the default depth, and the check measures each unit from the merge-base with the pull request's base, which a depth-1 clone holds neither side of. - # Deepening here rather than raising the job's own fetch-depth keeps the cost with the hub, whose hook this is, rather than on every repository that reuses this workflow. - # The engine reports an unresolvable base as a boundary rather than as a verdict, so without this the step fails loudly instead of passing blind, which is how the gap was found. - if [ "$(git rev-parse --is-shallow-repository)" = true ]; then - git fetch --no-tags --prune --unshallow origin - fi - # The base is an ancestor of the ref this event checks out, so unshallowing normally supplies it, and it is fetched by name where it does not. - if ! git rev-parse --verify --quiet "$BASE_SHA^{commit}"; then - git fetch --no-tags origin "$BASE_SHA" - fi - python3 scripts/canonical_review.py check --target "$BASE_SHA" - # The burn-down goes to the run's job summary rather than into the tree, per scripts/README.md, on every event since it describes the commit rather than a comparison against a base. - # Read-only and informational, so `!cancelled()` renders it after an earlier step failed. + # No pull request is refused over a canonical unit's coverage, which the weekly canonical-review-sweep.yml files as its own work instead, per GOVERNANCE.md "Verification Discipline". + # The step still fails on the engine's boundary exit, meaning it could not read what it needs rather than having read it and found a unit uncovered, since a boundary is not a verdict about coverage. + # Read-only, and `!cancelled()` so it renders after an earlier step failed. - name: Render the canonical review burn-down step if: ${{ !cancelled() }} shell: bash diff --git a/.github/skills/agent-conduct/SKILL.md b/.github/skills/agent-conduct/SKILL.md index e5dd6065e..64e4e1d92 100644 --- a/.github/skills/agent-conduct/SKILL.md +++ b/.github/skills/agent-conduct/SKILL.md @@ -25,7 +25,7 @@ The checks that separate work actually done from work that merely reports succes - **Config with a uniqueness rule is validated on read, and its consumers assert what it promised.** A repeated key in a lookup table is not a precedence question to settle quietly, it is two answers to one question, and keeping whichever came last picks one of them where the reader sees no choice being made. Fail on the duplicate at the point the config is read, so the code downstream can rely on the invariant instead of re-deriving it. - **Validate and read on the same normalized key.** A guard that compares stripped names while the join looks up the raw one passes a padded key and then matches nothing, so the exact fault the guard exists to stop is sitting inside the guard. Normalize once at the boundary and use that one value for both the check and the lookup. - **Every push toward a pull request is preceded by a local adversarial review of the branch's whole diff, and the pass is recorded.** The rule binds every push rather than the first one, so a fix push answering a reviewer's finding owes a pass exactly as the branch's first push did, and that is the round it is actually skipped on: the fix looks small, the branch was reviewed once already, and what goes up is content no review has read. Skipping it does not save the round, it moves it, into the fix-commit and review-comment cycle that spends wall-clock, Actions runtime, and agent tokens finding what a local pass would have. The pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, and `scripts/local_review.py` records it keyed on the content the reviewer actually saw, so a capture point can ask whether a receipt still covers what is about to be pushed rather than trusting the rule to have been remembered. The pass is mandatory and its findings are advisory, which are opposite claims worth keeping apart: a pass is recorded whether it raised ten findings or none, and disposing of each one is judgment, per `GOVERNANCE.md` "PR Review Etiquette". -- **Canonical content one repo authors and others carry is reviewed the way a carrier reads it, whole, in the repo that can fix it.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and answers whether one still covers each unit a change moved or newly carried, so a capture point can refuse exactly those rather than trusting the rule to have been remembered. A unit edited today is therefore read today, while a unit nothing has read here yet is left to the burn-down that engine's `report` renders and is never a block on unrelated work. Recording a pass writes one tracked file, the engine's ledger, so where it lands relative to the commit is a real ordering rather than a preference. It is committed before the push, since a capture point that gates a push refuses tracked content differing from HEAD before it runs either gate, while the diff receipt above is not tracked and is recorded after the last commit instead. So the ledger goes in ahead of the commit that carries it and the receipt is written after that commit, which is why the two records sit on opposite sides of it. Which repos hold such a capture point at all is a separate question, and the rule binds whether or not one is installed. Like the pass above, this one is mandatory and its findings are advisory. +- **Canonical content one repo authors and others carry is read the way a carrier reads it, whole, in the repo that can fix it, and that read is swept periodically rather than owed by a push.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. **The read is swept because owing it at every push cost too much to keep owing it there.** Measured across this fleet's review rounds, the passes a push owed were a large share of what a pull request spent, and what they returned was never measured against that, so the read moves to a schedule on the cost alone rather than being owed by whichever change happens to touch a unit. A change that moves a unit is no longer refused over one, and no capture point asks a change for a pass of this kind, the diff pass the bullet above requires being owed by every push exactly as before. What replaces it is a schedule in the authoring repo, which gathers the work into one piece and files it where an agent session can run the passes and fix what they find. That work is every unit whose text has moved past the pass that read it, plus a bounded slice of the units nothing has read there at all, taken newest-committed first. The slice is what keeps a newly authored unit from waiting on a volunteer, since such a unit has no earlier pass to move past and would otherwise reach a carrier with nothing having asked to read it, which is the case this whole rule is about. A unit newly carried by widening the manifest alone is not reached that way, the order reading the unit's own file rather than the manifest, so it joins the backlog at that file's age, where a section written and declared in one commit leads like any other newly authored one. Bounding it is what keeps a long backlog from arriving as one week's work. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and names both sets, so the sweep's list is read off that record rather than remembered, and its ledger is tracked content the change carrying it commits like any other. Like the pass above, a pass the sweep asks for is mandatory and its findings are advisory. - **Another round of edits after either pass is owed only while a defect this change introduced is open, never by a finding count.** Which findings count as introduced, what each class owes, and how many rounds a push may spend are the `local-strict-review` Skill's. - **Run the repo's whole lint gate before every push, not the parts that look relevant.** CI runs all of them, so a partial local run only defers the failure, and the tool most likely to catch a given change is often the one it seems least about (an edit that manipulates line endings is exactly when `editorconfig-checker` matters). The repo documents each linter's known-working invocation, and this rule is that **all** of them run. - **Editing CRLF files programmatically: `.` matches `\r` in a regex**, so a captured line keeps its carriage return and rejoining with `\r\n` yields `CRCRLF`. Prefer literal replacement over regex reassembly. In Python the *default* path is a text-mode rewrite, which has the mirror failure: `Path.read_text()` decodes through universal newlines and `write_text()` translates each `\n` back to `os.linesep`, so a read-edit-write round trip rewrites every line ending in the file to the host's own while the edit itself looks correct. Work in bytes, or open the file explicitly with `newline=''` on both the read and the write, since a read that preserves the endings still hands them to a write that translates them. Use `open()` rather than `Path.read_text()`, which accepts that argument only on Python 3.13 and newer and raises `TypeError` below it. The corruption is worth naming because it is invisible in a rendered diff. @@ -46,7 +46,7 @@ The checks that separate work actually done from work that merely reports succes -Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a change moved, their delegation shape, and how each is recorded are the `local-strict-review` skill's. +Claims about a pull request being reviewed, clean, or mergeable are owned by the `pr-review-conduct` skill, and claims that a commit landed by `git-commit-conventions`. The two review passes the section above requires, one over a push's diff and one over each canonical unit a sweep names, their delegation shape, and how each is recorded are the `local-strict-review` skill's. ## Before Assuming diff --git a/.github/skills/drive-pr/SKILL.md b/.github/skills/drive-pr/SKILL.md index 9ea24f53f..95db1abe0 100644 --- a/.github/skills/drive-pr/SKILL.md +++ b/.github/skills/drive-pr/SKILL.md @@ -78,10 +78,9 @@ promotion PR once the fix lands, is the early exit this skill exists to prevent. 1. Isolate into a worktree per repo-worktree, based on the branch that skill's base rule names, develop unless the task is explicitly about main-only content, before the first edit. 2. Commit the work, then run `local-strict-review` and record its pass in the order that skill - gives, its diff receipt following the commit, and its carried-content record instead preceding - the commit where the change moves a carried canonical unit in the repository that authors one, - because that ledger is tracked. Then push the branch and open the feature -> develop PR if it - does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a + gives, its diff receipt following the commit. Where the change also carries the canonical ledger, + that skill's carried-content records instead precede the commit, because that ledger is tracked. + Then push the branch and open the feature -> develop PR if it does not exist yet. A push refused by a `.husky/pre-push` hook, which the hub carries and a repository has only if it adds one, is that gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. @@ -141,9 +140,13 @@ maintainer when". -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -154,8 +157,12 @@ maintainer when". impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -164,11 +171,16 @@ maintainer when". attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.github/skills/local-strict-review/SKILL.md b/.github/skills/local-strict-review/SKILL.md index fa1c1a86b..d5d25c0f1 100644 --- a/.github/skills/local-strict-review/SKILL.md +++ b/.github/skills/local-strict-review/SKILL.md @@ -11,11 +11,12 @@ description: >- the exact gap this skill exists to close before a PR-hosted reviewer closes it instead. Reuses `code-review`'s "Review the Change" criteria rather than restating them, and owns only this local, pre-PR moment. Once a pull request exists, `pr-review-conduct` and `drive-pr` own - triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever a change - edits rule text, a Skill, or any other canonical content this repository authors and other - repositories carry, because that content reaches a reviewer whole only when a repository - carries it for the first time, and a second pass reading each changed unit's whole text is - what moves that read into the repository that can act on what it finds. + triaging and disposing of what a PR-hosted reviewer finds. Also triggers whenever the periodic + canonical sweep is worked, which names the carried units whose text has moved past the pass + that read them together with a bounded slice of those nothing has read at all, because that + content reaches a reviewer whole only when a repository carries it for the first time, and a pass reading each named unit's whole text is what moves that read + into the repository that can act on what it finds. Editing such content owes no pass of its + own, so a change that moves a unit pushes and merges like any other. --- # Local Strict Review @@ -26,7 +27,7 @@ A coding agent that finishes a unit of work, judges it ready, and opens the pull ## What It Does -Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the carried-content pass below running against uncommitted content instead, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. +Dispatches one read-only subagent against this branch's full diff since it forked from its target branch. Resolve `` once, `develop` unless `repo-worktree`'s base-branch rule put this branch on `main` instead, then fetch it, `git fetch origin `, and diff against the merge-base, `git diff "$(git merge-base origin/ HEAD)"`. Stop and report a failed fetch rather than running the merge-base or diff commands anyway: an existing local `origin/` ref can still resolve after a failed fetch, and reviewing against it silently trades the current target for a stale one. Use the same resolved `` in every command below, never a literal `develop` alongside it. Naming the target branch explicitly matters: the branch's own `@{u}` tracking ref points at the branch's own remote once it has been pushed, not at the branch it targets, so anchoring there silently narrows a later run to only the diff since the last push instead of the full accumulated diff. That merge-base diff covers every commit already on the branch plus whatever is currently staged or unstaged, so it never reviews only the latest increment, at any of the moments this skill is invoked from. An empty diff is not the same as nothing to review, and it is never the signal to stop: it reports no untracked file at all, and it reports nothing for content a commit carries that the working tree has since put back. The untracked-file list below covers the first of those. The second is why the diff pass commits before reviewing, the sweep's own passes below running against uncommitted content instead on the change that carries their ledger, since a removal or a restore that is committed leaves no net content to miss, and why the engine reads HEAD rather than this diff, its change set coming from the merge base against HEAD, the index and the working tree, so the two answer different questions. A fresh review of the full accumulated diff is what catches what per-push review misses, the exact evidence this skill exists to act on. `git diff` never reports a path `git add` has not touched, so a newly created file sitting untracked would otherwise go unread. List it explicitly, `git ls-files --others --exclude-standard`, and read each result in full alongside the diff, the same as any other file the diff touches. @@ -69,9 +70,9 @@ Commit first, then read the digest, then dispatch the subagent, then hand that s ```sh engine="/scripts/local_review.py" # in the hub itself, scripts/local_review.py -python3 "$engine" status --target # JSON, take contentDigest +python3 "$engine" status --target '' # JSON, take contentDigest # run the pass above, then: -python3 "$engine" record --reviewer agent-skill --target --expect-digest [--findings N] +python3 "$engine" record --reviewer agent-skill --target '' --expect-digest '' [--findings N] ``` Every subcommand here, `run --backend ` included, runs with the repository under review as the working directory, whichever repository that is. The engine takes no `--repo` and reads whichever repository it is run in, so the path names where the script lives and the working directory names what it measures. @@ -80,19 +81,21 @@ Every subcommand here, `run --backend ` included, runs with the repository `--expect-digest` is required rather than optional, and binding it to the earlier read is the whole point. A format-on-save or a hook autofix between the review and the record would otherwise be stamped as reviewed by a pass that never saw it. A refusal there is the content having moved, so the answer is another pass over the current content rather than another read of the digest. -Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so an interactive rebase that leaves the tree alone keeps the receipt valid, and changing one byte invalidates it. +Record the pass whatever it found, including nothing. The key covers the net content the branch introduces against its target rather than the commit series, so a rebase that leaves the tree alone keeps the receipt valid while the fork point holds, and changing one byte invalidates it. The key holds that fork point too, so rebasing onto a target that has moved retires the receipt although no file changed. **Why the commit comes first**, rather than being an ordering that could equally run the other way. A push delivers the commit, and the hook's tree check refuses a push whose tracked content differs from HEAD, so the record has to describe what HEAD holds. A commit that leaves the tree alone usually does not move the receipt's key, so diligence done before it still describes the same content, and a commit putting a path back to its base state drops it from the change set and does move it. Two reasons make the order matter anyway: staging a modified tracked file moves the key even though its content did not change, and a commit made after the record can carry content the pass never read. Reviewing earlier than this is still worth doing as ordinary diligence, and it does not substitute for the recorded pass: the digest read and the record bracket a window in which the tree holds still, and a commit inside that window ends it. The engine is hub-hosted per `GOVERNANCE.md` "Hub-Hosted Tooling", so a downstream repository reaches a hub checkout's copy rather than carrying one, which is what the path above is for. -## The Carried-Content Pass +## The Carried-Content Sweep A second pass under the same rule, run in the repository that authors canonical content other repositories carry, which in this fleet is the hub. `GOVERNANCE.md` "Verification Discipline" states the rule and why the ordering it corrects is a defect, and is not restated here. What it requires of a run is below. -**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `check` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. +**No change owes this pass.** Editing a carried unit refuses no push and fails no pull request. The passes are worked instead from the sweep's own issue, which a scheduled workflow in the authoring repository files with the units it asks for this round, and working that issue is the moment this section is for. What it produces is an ordinary pull request, carrying the ledger and whatever the passes had you fix, driven the ordinary way. -Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, its flags, and the point in the sequence where the record is written each differ, and all four are below. +**The unit is what a reviewer reads whole**, and `spec/files.json` rather than the document decides which, down to which files carry units at all. `canonical_review.py list` names the whole set and is the authority on it, so the rules are not paraphrased here, where a paraphrase can only drift from them. In the ordinary case a unit is one level-two section of a carried Markdown canonical, and `sweep` names each one it wants exactly as `record` takes it. The pass reads that unit's whole current text rather than the diff that moved it, because reproducing the carrier's read is the entire point, and a diff with surrounding context is a different read the pass above has already done. + +Run it at the same model tier and in the same delegation shape as the pass above. The brief, the engine, and its flags each differ, and all three are below. ```text Task: adversarial review of one canonical unit, read as a repository carrying it for the first @@ -109,21 +112,19 @@ Bounds: read-only. Report a rule that looks incomplete rather than guessing at w ``` ```sh -git fetch origin # stop and report a failed fetch rather than measuring past it -python3 scripts/canonical_review.py check --target # each uncovered unit, with its digest +python3 scripts/canonical_review.py sweep # the units it asks for this round, with their digests +# exit 1 where it named any, which is the sweep working rather than the command failing # run the pass above over each unit it named, then, per unit: -python3 scripts/canonical_review.py record --reviewer agent-skill --target --unit '=' [--findings N] +python3 scripts/canonical_review.py record --reviewer agent-skill --target develop --findings '' --unit '=' ``` -These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Point an engine in one checkout at another checkout's tree and the two mix, the engine's own section rules over the other tree's manifest and files. - -`` is the branch this work targets, resolved once as the pass above resolves it and passed to both commands explicitly. Left off it defaults to `develop`, so a branch based on `main` is measured from a fork point nobody read, and `record` stamps each pass with a merge-base against a branch the work never targeted. The fetch matters for the same reason it does above: the engine resolves `origin/` if it already exists and never fetches it, so a stale remote-tracking ref moves the fork point without saying so. Lagging, which is the ordinary way to be stale, moves it back and gates units this change never touched, and the reverse case, where the branch restores text the target has since changed, drops one it did move. Neither is announced, so the fetch is what keeps the fork point meaning what the reviewer read against. `check` names each uncovered unit with the digest to hand back, so nothing has to be looked up separately, and `list` is there for reading the whole set rather than for this loop. +These run in the authoring repository itself, which is the only repository this pass ever runs in, so the engine path is the plain one and there is no downstream side needing the `/` form the pass above shows for its own reach. Both resolve the repository from the working directory rather than from where the script sits, so the directory a command runs in is what decides which tree it measures, while the unit model and the manifest reader come from the checkout the script itself lives in. Running one checkout's copy against another's tree therefore measures the second tree by the first's rules, so run them in the tree being measured. `record` additionally stamps each pass with the merge-base against `--target`, which is provenance rather than coverage. The line above names it rather than leaning on the default, since a sweep's own branch is based on `develop`, and a `main`-based branch passes `--target main` instead. The digest is bound to the read for the same reason `--expect-digest` is above: recording a unit by name alone would stamp whatever the file holds at record time, so an edit between the review and the record would be attested to by a reviewer who never saw it. Record each unit whatever the pass found, including nothing. Fixing a finding is itself such an edit, so `record` then refuses the digest you were holding: that refusal is the content having moved rather than a fault in the record, and the answer is a read of the unit's new text, which is what a carrier will actually receive, recorded at its new digest. -**This pass records before the commit, where the pass above records after it**, and the two orders are opposite because the two records live in different places. A receipt sits in the worktree's git directory and can never be committed, so it is written once the commit has fixed what a push will deliver. This ledger, `reports/canonical-review.json`, is a tracked file the commit has to carry, so writing it after that commit leaves the tree differing from HEAD, which is a state the pre-push hook refuses before either gate runs. The shortest order meeting both, and the one the refusal table below assumes, is: run this pass and record each unit, commit that together with the change, then read the digest, run the diff pass, record its receipt, and push. Committing the change first and the ledger in a second commit satisfies the same constraint and costs a commit. +**The ledger this writes is tracked content, so the commit has to carry it**, where the receipt the pass above writes never can be. Record each unit, commit the ledger together with whatever the passes had you fix, then read the digest, run the diff pass over that commit, record its receipt, and push. That is why the two records sit on opposite sides of the one commit. -**A unit nothing has read here yet is not this branch's debt.** `check` refuses the units this change moved, meaning the ones whose text it edited and the ones it newly carried, since widening the manifest hands a carrier content for the first time exactly as writing it would. Everything else is a burn-down entry `canonical_review.py report` renders rather than a block on unrelated work. Working one of those off is worthwhile, and it is its own change rather than a tax on an unrelated one. +**A unit nothing has read here yet reaches the list a slice at a time.** `sweep` names every unit whose text has moved past a pass, and beside them a bounded number of the never-read ones, ordered by how recently the file each sits in was last committed, so recently authored content comes ahead of text that has sat unread for months rather than waiting behind the whole backlog. The key is the file rather than the unit, so committing to a file lifts every unread unit in it, and a unit becomes carried without being lifted wherever the manifest is widened on its own, the manifest being a file of its own. Declaring a section in the same commit that writes it lifts it like any other. `canonical_review.py report` renders that backlog in full, and working more of it off than the sweep asked for is worthwhile and is its own change. ## Disposing of Findings @@ -135,7 +136,7 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - `Why:` the reviewer is asked to omit preferences and returns some anyway, and `style` is classed first so that a preference on text this change wrote is not owed a fix. - **Another round is owed only while an `introduced` finding is open.** Unless evidence disproves it, an `introduced` finding is fixed within the budget below, or escalated where `pr-review-conduct` "Escalate to the maintainer when" says so, a `pre-existing` one is filed once and blocks nothing, and a `style` one is declined with evidence, per `pr-review-conduct` "Every finding ends in one of five outcomes", the evidence being `code-review` "Review the Change"'s own rule to omit preferences. - `Why:` a finding count over prose never reaches zero, so a loop closing on "did it find anything" does not close, where one closing on the false claim, the unfollowable instruction, or the wrong behavior this change put there does. -- **A push allows two rounds of edits in answer to the passes it owes, one budget across both.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". +- **Two rounds of edits answer a pass, one budget per push and one per sweep issue.** Where an `introduced` finding is still open after the second round, editing stops and what remains goes to the maintainer with its counts per class, per `pr-review-conduct` "Escalate to the maintainer when". - `Why:` past the second round nearly every finding is against text the previous round's fix wrote, so the rounds are producing the defects they find rather than removing them. - **The pass is mandatory, and the count it records gates nothing.** A pass is recorded whatever it raised, so the record attests that a review ran rather than that the content is clean. - `Why:` a gate reading the count would make a pass raising nothing the cheapest way through it, the opposite of what recording one is for. @@ -145,20 +146,18 @@ Each bullet is a rule down to its `Why:` line, which is rationale rather than ru - Before the first push toward a pull request, the push that opens it in `drive-pr` "The Drive Loop" and in `pr-review-conduct` "Expected review loop". - Before pushing a fix for a reviewer finding, the same self-review blind spot applies to a fix as to the original diff (the fix outcome of `pr-review-conduct` "Every finding ends in one of five outcomes", which `drive-pr` "Disposing of Every Finding" carries). - Whenever `agent-conduct`'s "about to claim work is done, verified, green, or fixed" trigger fires for work that will become, or already is, a pull request. -- Before pushing a change that edits canonical content other repositories carry, or that newly carries some by widening the manifest, over each unit `check` names, per "The Carried-Content Pass" above. +- When the canonical sweep's issue is worked, over each unit it names, per "The Carried-Content Sweep" above. Editing such content is not itself one of these moments, and nothing refuses a push over it. -In the hub, `.husky/pre-push` checks the receipt, and the canonical-unit coverage beside it, at the push itself, so the moments above are where each pass is run rather than the only places it is noticed. A blocked push usually means one of those passes was skipped. Both capture points, that hook and the pull request one named below, are the hub's own, and a repository carrying this Skill has neither until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. The hub's own `.github/actions/validate` composite action runs the canonical-unit half again as a step on every pull request into `main` or `develop`, which is what its workflow triggers on. That one needs no hooks path, runs whether or not any clone enabled one, and `--no-verify` does not reach it, which is what makes it the capture point a push cannot bypass where it applies. +In the hub, `.husky/pre-push` checks the receipt at the push itself, so the moments above are where the pass is run rather than the only place it is noticed. A blocked push usually means it was skipped. That hook is the hub's own, and a repository carrying this Skill has none until one is carried to it, which is what makes the moments above the layer that actually binds everywhere. The hook is a backstop under this skill and not a replacement for it: it fires only in a clone that enabled `core.hooksPath`, it says nothing about a repository that carries no such hook, and it is bypassable by design, `--no-verify` being the documented route for a genuine pickle rather than for a diff nobody read. That route is not open in every seat. A Claude Code session running the fleet's agent-safety hook has the flag denied unconditionally, so where the rows below say a bypass is the answer, the answer in that seat is to report the state and hand the push to the maintainer rather than to force it. No capture point anywhere gates the carried-content sweep: the hub's `.github/actions/validate` composite action renders the coverage burn-down into every run's job summary and fails no pull request over what that rendering shows, which is the sweep being periodic rather than enforced at a push. That step does still fail where the engine could not read what it needs at all, which is a boundary rather than a verdict about coverage. -**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before either engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. +**Read the refusal itself, which names its own case.** Some of the rows below are cleared by running a pass and some are cleared by nothing of the kind, and each row says which, so no count of either is kept here to go stale against the table. Some the hook decides before the engine runs, so there is no engine message under them, and the rows say where each one's detail comes from. | The refusal says | What it means | What clears it | | --- | --- | --- | | No local review covers this branch's current content | The ordinary missing pass: no recorded receipt covers what this push delivers, either because none was recorded or because the content moved after one was | One pass over the branch's whole diff, recorded per "Recording the Pass" above | -| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also moved a canonical unit, follow "The Carried-Content Pass" order instead, since committing first strands that ledger after the commit and each fix then lands on another row. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | +| Tracked content differs from HEAD | A push delivers HEAD while a receipt covers the index and working tree, so the receipt does not describe this push. The hook prints the same headline for an unresolved merge and for a `git update-index --refresh` that exited above 1, naming each on its own line | Commit what is being pushed, then the pass, then the record. Where the change also carries the canonical ledger, record those passes before that commit, per "The Carried-Content Sweep" above, since a ledger written after it leaves the tree differing from HEAD again. Resolve the merge first where the hook names one, and run `git status` first where it names the refresh, since the content may not differ at all | | The commit is not this worktree's HEAD | Any pushed branch ref carrying an object id that is neither this worktree's HEAD nor the all-zero id of a delete, which a push from a checkout sitting elsewhere reaches and so does a multi-ref push such as `git push --all` | Push one branch, the one this worktree holds. Where another branch is the one wanted, check it out in its own worktree first, per `repo-worktree` | -| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, a manifest or ledger the engine could not read, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | -| This branch changes N carried canonical unit(s) that no recorded pass covers | The carried-content pass was skipped for a unit this change moved or newly carried, and the refusal names each one with the digest to hand back | One carried-content pass per named unit, then `canonical_review.py record` for each, in the order "The Carried-Content Pass" above gives. The ledger that writes is tracked content, so the commit has to carry it and the diff pass comes after | -| A canonical refusal naming units this branch never touched | The fork point is not where the reader thinks it is. Either `origin/` does not hold the commit this branch forked from, since neither engine ever fetches it, or the branch is based on something other than `develop` and the hook, which passes no `--target`, measured it against `develop` regardless. Unlike the row below it still prints a record command, and taking that one records passes over units nobody read | `git fetch origin `, then `canonical_review.py check --target ` by hand for the real set, then pass and record what that names and commit the ledger with the change, per the carried-unit row above. Where the branch targets something the hook does not measure, no pass clears it, so the gate cannot judge that branch at all and the bypass is its answer, as in the row below | +| Any wording saying the gate did not or could not run | An execution boundary rather than a verdict, which blocks because a gate that waves a push through when it could not run has stopped gating. The cause is named in that same message or in the engine error printed above it, and it is a missing Python interpreter, an unresolvable target, an unreadable receipt, a git command that failed, or any unexpected failure | Whatever the message names, most often installing an interpreter per `docs/host-setup.md` or fetching the target branch. Never another pass | | The recorded pass was run against X and this check measured Y, printed under the missing-pass headline | The hook reads `develop` and nothing else, so a branch based elsewhere is measured against `develop` whatever the pass targeted, and the engine deliberately prints no record command, since the one it would print records a pass over a diff nobody read | One more pass against the branch this work actually targets, where it does target the measured one. Where it does not, the gate cannot judge the branch at all and the bypass is its answer | This table is the fleet's one enumeration of these, and every other surface states the principle and routes here rather than listing the shapes. That is deliberate: every review round that added a shape also left a restatement of it somewhere else, and keeping one table is what stops the next round doing the same. diff --git a/.github/skills/pr-review-conduct/SKILL.md b/.github/skills/pr-review-conduct/SKILL.md index 5fc7c137c..7f33e4021 100644 --- a/.github/skills/pr-review-conduct/SKILL.md +++ b/.github/skills/pr-review-conduct/SKILL.md @@ -50,6 +50,19 @@ visible comments, routinely still carries a finding nobody has answered. Treatin specifically, not "no review of any kind covers this head": an advisory reviewer carrying the exact head under `other_reviewed`, with an empty review body and no new threads, is its own ordinary "reviewed, nothing to flag" shape, not a missing review (#1066). + A refusal is not that coverage, so this item stays unsatisfied under one, and the loop clears + it where it can. A file-count refusal is cleared by splitting the pull request, which is the + only cause on record that the loop can clear. `pr_review.py wait` exit `46` is the one nothing + the loop does clears, an account-quota refusal carrying the current head, which is the case + "Which Reviewers a Repository Actually Has" below states. Exit `47` is that same account state + read from the reviewer's activity elsewhere when this head carries none of its own, and exit + `41` holding across several heads with no cause its body names reaches it the slower way. + Those three are `wait`'s alone: `status` exits 0 over a refusal, carrying it as `refusal=` in + the digest line instead, so reading that exit code as the absence of one would falsely satisfy + this item on the exact state it exists to catch. That is where the + unsatisfied item goes to the maintainer, with the coverage the other reviewers gave that head + read rather than counted and named to them, and their permission under item 5 is what allows + the merge. Item 2 is never waived, and a merge over an unsatisfied one is theirs to authorize. 3. **Every** finding on that head SHA is closed: threads resolved, issue-level comments (which have no resolve action) triaged and replied to, **and** the low-confidence findings collapsed in the review body investigated and answered. Those appear in no thread, so polling threads @@ -131,7 +144,7 @@ that says only "open a PR" is not such an instruction. Run every `scripts/pr_review.py` command below from a hub checkout. The script is hosted there and is never carried into a downstream repository. -Run `local-strict-review` against the branch's current diff before step 1's push, and again before any fix push under outcome 1 below. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. +Run `local-strict-review` against the branch's current diff before every push this loop makes, the one that opens the pull request in step 1 and each one after it, whatever finding it answers and whether or not the branch was reviewed once already. A push that delivers content no pass has read is the case the rule is about, so a re-push of a tree a recorded pass already covers needs no second pass, the receipt being keyed on the branch's net content rather than on its commit series. A rebase that leaves the tree alone keeps it only while the merge base holds: rebasing onto a target that has moved retires the receipt although no file changed, and that push owes a pass like any other. Follow that skill's own ordering and record each pass, which is what a capture point reads, the hub's own `pre-push` hook being one and a repository having none until such a hook is carried to it. A push that hook refuses, where one is present, is the gate working rather than an obstacle to route around, and that skill's refusal table says what each refusal means and what clears it. 1. Push changes to the PR branch and open the pull request when it does not exist. 2. Run `scripts/pr_review.py status --repo /` once in the foreground and read its output. @@ -147,7 +160,8 @@ Run `local-strict-review` against the branch's current diff before step 1's push head only repeats the decline. 5. Triage findings (see below). 6. Apply fixes or write a rationale for declines. -7. Reply to each thread and resolve what was addressed. +7. Reply to each thread, and resolve what was addressed and what was declined on evidence the + reviewer could check for itself, per outcome 2 below. 8. Re-run the loop after every fix push until the checks are green and no finding remains open. The review effort setting is user-controlled. The workflow never selects or changes it. `status` reports `effort=lite`, `effort=balanced`, or `effort=max` when the completed review exposes that metadata, lowercased, and names an inherited setting apart from a chosen one in a separate `effort_source=default|explicit` field, both reading `unknown` when no effort line parses. Missing effort metadata reports `unknown` and does not change coverage or completion. A pending effort-labeled request can complete without a `copilot_work_started` timeline event, so absence of that event never proves the request is abandoned. The bounded timeout reports `PENDING` when no review or terminal answer arrives. After a timeout with `requested=yes`, rerun `wait` for another bounded interval by default because the request may still be active. If the maintainer directs a retry, remove Copilot in the pull request UI, add it again, and rerun `wait`. This recovery replaces only the review request and never changes the effort setting. @@ -163,9 +177,13 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure ## Every finding ends in one of five outcomes -1. **Real, so fix it.** Take the fix through `local-strict-review` the same way the push that - opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply with - the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which +1. **Real, so fix it, and fix the class rather than the instance.** A reviewer samples rather + than enumerates, so sweep for the finding's siblings before replying and fix each one sitting + in a file the diff already touches or that this change itself made wrong, filing the rest, per + `GOVERNANCE.md` "Verification Discipline". That sweep is owed the first time the finding is + raised, not once it recurs. Take the fix through `local-strict-review` the same way the push + that opened the pull request went, per `pr-review-conduct` "Expected review loop", then reply + with the fixing commit SHA. A branch already reviewed once has not been reviewed for the fix, which is the round the `local-strict-review` pass gets dropped on and the churn `local-strict-review` exists to stop. For a finding on platform-specific code (PowerShell, a macOS- or WSL-only path), "fixed" means executed on that platform, per @@ -176,8 +194,12 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure impossible, or the rule that governs it. A finding that is factually correct but not this repo's to fix (a verbatim-fidelity manifest entry byte-locking the section, ownership that sits elsewhere) declines the same way: name the boundary and cite what proves it. Either shape - closes the thread on its own evidence. An assertion ("this is fine") does not close a finding, - a decline needs evidence the reviewer itself could check. + closes the thread on its own evidence, and the agent resolves such a thread itself rather than + leaving it for the maintainer. What makes that safe is the evidence being checkable by anyone, + a command and its output, the code path, the quoted rule, a byte-identical diff, so a decline + resting on anything weaker is not one of these. An assertion ("this is fine") does not close a + finding, and outcome 3's value call is the maintainer's, so that thread stays open until they + answer it. 3. **Real, fixable here, but deliberately left as is, a value call rather than a scope boundary, so it is the maintainer's, not the agent's.** Reach for this only once outcome 2 is ruled out, since a scope boundary declines on its own evidence and never needs this outcome at @@ -186,11 +208,16 @@ After an authorized merge, run the `repo-worktree` post-merge cleanup procedure attention moves elsewhere. If the maintainer is not reachable right now, leave the thread open and say so, rather than treating the intention to ask as the asking. 4. **Real and worth doing later, so file the issue first, then reply with its link.** A deferral - noted only in a thread is lost the moment the PR merges. -5. **Keeps recurring, so fix the class, not the instance.** A finding raised repeatedly against - correct code means the code is not communicating something: add the comment, sharpen the name, - narrow the interface, or fix the rule if the rule is wrong. Bouncing the same point across - rounds is the signal to escalate the rule itself, not to keep re-arguing it. + noted only in a thread is lost the moment the PR merges. File it in the repository where the + fix has to land, which for a finding against carried content is the repository that authors + that content rather than the one carrying it, since an issue filed where nobody may make the + fix is a deferral nobody can close. +5. **Keeps recurring although the class was swept, so the rule is what needs fixing.** A finding + raised repeatedly against correct code means the code is not communicating something: add the + comment, sharpen the name, narrow the interface, or fix the rule if the rule is wrong. + Bouncing the same point across rounds is the signal to escalate the rule itself, not to keep + re-arguing it. This is not where the class sweep lives, outcome 1 already owing that on the + first instance, and reaching here means the sweep ran and the finding came back anyway. **A disposition decided on one PR does not carry to the next.** The same finding shape recurring on a sibling repo or PR, even within one batch or one session, gets its own outcome: its own diff --git a/.github/skills/skill-lifecycle/SKILL.md b/.github/skills/skill-lifecycle/SKILL.md index d829c7fc2..6badfcf3b 100644 --- a/.github/skills/skill-lifecycle/SKILL.md +++ b/.github/skills/skill-lifecycle/SKILL.md @@ -15,7 +15,7 @@ The agent most likely to get a skill wrong is the one editing a skill, and befor - **`.agents/skills//SKILL.md` is the only tree a skill is authored in**, with optional `references/` and `scripts/` directories beside it, and the one part of it not written by hand is the text inside an include region, described below. Codex and opencode read this tree directly, project-local, and also read the global `~/.agents/skills/` copy the installer materializes. - **Generated distributions serve GitHub Copilot and Claude Code.** `scripts/build_dist.py` generates `.github/skills/` for GitHub Copilot and a Claude-plugin-compatible copy at `.claude-plugin/fleet-skills/`, published through `.claude-plugin/marketplace.json`. Neither generated tree is hand-edited, and `build_dist.py --check` exits non-zero when either tree differs from `.agents/skills/`. - **The skill set is implicit.** Every `.agents/skills//` directory carrying a `SKILL.md` is a skill, and the generated `plugin.json` derives its list from those directories, so adding or retiring a skill edits no manifest by hand. `marketplace.json` names the plugin, not the skills, and is untouched by ordinary lifecycle work. -- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs, so the whole-unit review pass `scripts/canonical_review.py` records for each of those units is owed again, which is the cost of a carrier reading generated text in the skill's own context. +- **A rule's text reaches a skill as a generated include, never as a copy.** A region opened by a line holding only `` and closed by a line holding only ``, each indented at most three spaces, is filled by `build_dist.py` with the body under that heading. The key is the root-relative path, spelled as the tree spells it, then ` > `, then the heading text at any level from two, matched case-insensitively. The body runs to the next heading at that level or above, level one included, so a key naming a level-two heading carries every subsection under it. The fill lands in `.agents/skills/` itself, since Codex and opencode read that tree directly and a region left empty there is a skill with a hole in it, and the generated trees mirror the filled source. A region is filled only in a file the generator walks, which is the `*.md` files under each `.agents/skills//` directory carrying a `SKILL.md`, plus the files `build_dist.py`'s `INCLUDE_DESTINATIONS` tuple declares: a Markdown file sitting in `.agents/skills/` but not under such a directory, `.agents/skills/README.md` among them, is walked no more than a file elsewhere is. That tuple is how a hub surface that is not a skill carries a rule's text rather than restating it, each entry declared by hand and held to the same path rules a source is held to, and a file `spec/files.json` carries content from is refused. It is empty today, because the surfaces that would qualify restate a rule in their own words rather than copying it and a pointer is what each of those needs, so `scripts/tests/test_build_dist.py` rather than any shipped declaration is where the shape of one is exercised. A source is any regular file under the repository root outside the two generated trees and reached through no symlink, so a key may name a `GOVERNANCE.md` section, an `AGENTS.md` subsection, or a section of a sibling skill, and a region filled from a file carrying regions of its own reads that file's filled text. Regenerating after a source edit changes the bytes of every skill unit including it, and `--check` fails the pull request until that regenerate runs. Those units then read as moved past the pass that covered them, which is the periodic sweep's work rather than this change's, per `GOVERNANCE.md` "Verification Discipline". - **`--check` holds every region to its source.** It fails when a region differs from what its source renders now, so a hand edit inside one and a source edit nobody regenerated for both fail the pull request the same way a stale mirror does. `python3 scripts/build_dist.py`, with no flag, is what clears either. A failure regenerating cannot repair is exit 2 rather than 1, whether or not a region is what it is about: a key with no ` > ` or an empty heading, a path naming no file, a heading that no longer resolves or that recurs in its source, a body with nothing in it or leaving a code fence open, a region in a file the generator does not walk, reached through a key, a declared destination refused by the same path rules a source is held to, or carried by the manifest, a `spec/files.json` that cannot be read or parsed while a destination is declared, since a check that cannot run must not wave one through, a symlink at or under a skill's own directory, a region that opens inside another or never closes, a close marker with no region open, a cycle, a path that is empty, absolute, carries a `..` component, or is spelled otherwise than the tree spells it, one outside the root, through a symlink, or under a generated tree, a file that is not UTF-8 wherever the run decodes one, a file holding a region while mixing line endings, and a line outside a code block that begins like a marker and matches neither form, which read as content would leave a region unfilled. An unreadable file is exit 2 as well, and it is the one cause that is not a refusal: `--check` catches the operating system's own error beside the refusals, so a permissions failure or a file removed mid-run is reported rather than read as a stale result. Every code here is `--check`'s. The no-flag run reports a refusal as exit 1. - **`scripts/skills_install.py`, run from a hub checkout, installs both forms per machine**: an overlay copy into `~/.agents/skills/` for Codex and opencode, marked per skill so a retired skill is removed on the next run and a foreign skill is never touched, and a user-scope plugin install for Claude Code via the `claude` CLI. Each run stamps the hub commit into `~/.agents/skills-install-stamp.json`, and `--report` reads that stamp against the checkout and exits non-zero when the machine is behind. The install is global per user, and per-repo pinning is a settled non-goal (`docs/fleet-map.md` "Skills Install Model"). diff --git a/.github/workflows/canonical-review-sweep.yml b/.github/workflows/canonical-review-sweep.yml new file mode 100644 index 000000000..124bc2138 --- /dev/null +++ b/.github/workflows/canonical-review-sweep.yml @@ -0,0 +1,112 @@ +name: Sweep canonical review coverage action + +# The periodic half of GOVERNANCE.md "Verification Discipline"'s carried-content rule, which no push and no pull request is gated on any more. +# This files the work rather than doing it: the read is an adversarial pass by an agent, so a workflow can only name the units it asks for and hand them to a session that can run it. +# Hub-only, since the canonical content is authored here and a carrier has nothing of its own to sweep. +# A schedule fires from this file as the default branch holds it, and a dispatch is offered only once it is there, so the first run comes at the promotion that carries this file to main rather than at the merge into develop that removes the gate it replaces. +# The issue's label comes from the fleet label set in repo-config/labels.json, so on a repository where repo-config/configure.sh has not applied that set the first run that finds work fails at gh issue create rather than filing an unlabeled issue no later run would find. +# A run that finds no work says nothing about the label either way, since the listing below returns an empty set for a label that does not exist. + +on: + schedule: + - cron: '23 5 * * 1' + workflow_dispatch: + +# Workflow-only group, with no -${{ github.ref }} and cancel-in-progress false, per GOVERNANCE.md "Workflow YAML Conventions". +# The one thing a run writes is a single repository-scoped issue, so a ref-scoped group would separate a dispatch made from any branch other than the default from the weekly schedule, which always runs on the default, and let each read no open issue and file one. +# Cancelling is worse than queueing here for the same reason: the closing path comments and then closes, and a cancel between the two leaves the comment posted on an issue that stays open. +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +permissions: {} + +jobs: + + sweep: + name: Sweep canonical review coverage job + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + + # The ref is named rather than left to the default a scheduled run checks out, which is the default branch. + # The passes this issue asks for are worked on a develop-based branch, per the repo-worktree base rule, so measuring main would name units against text that branch does not hold, refuse each record on a digest the tree has moved past, and re-file the same list every week until a promotion carried the fix. + - name: Checkout repository step + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: develop + # Full history, because the backlog slice orders never-read units by their file's last commit and a shallow clone dates every path to the tip commit, which would collapse that order to the unit key and file the alphabet's first units every week. + fetch-depth: 0 + # The job holds issues: write, and checkout persists that token in .git/config by default, where nothing here needs git authentication: every git call here reads local state, in the step below and inside the engines alike, and every gh call takes GH_TOKEN. + persist-credentials: false + + # The engine imports datetime.UTC at module level, so the interpreter is pinned to the floor spec/host-tools.json declares rather than left as whatever the runner image ships. + - name: Setup python step + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: '3.13' + + - name: Render the sweep work list step + id: sweep + shell: bash + run: | + set -Eeuo pipefail + # The engine's three-valued exit is read rather than folded: 0 is no unit owing a read, 1 is work to file, and 2 is the sweep never having run, which is not a verdict either way. + status=0 + python3 scripts/canonical_review.py sweep > "$RUNNER_TEMP/sweep.md" || status=$? + if [ "$status" -gt 1 ]; then + echo "::error::canonical_review.py sweep could not run, so this run says nothing about coverage" + exit 1 + fi + echo "owed=$status" >> "$GITHUB_OUTPUT" + cat "$RUNNER_TEMP/sweep.md" >> "$GITHUB_STEP_SUMMARY" + + - name: File or close the sweep issue step + shell: bash + env: + GH_TOKEN: ${{ github.token }} + OWED: ${{ steps.sweep.outputs.owed }} + LABEL: canonical-sweep + TITLE: Canonical content review sweep + run: | + set -Eeuo pipefail + # The commit this run measured, read from the checkout rather than from GITHUB_SHA, which on a scheduled event names the default branch's head and not the develop tip checked out above. + head_sha="$(git rev-parse HEAD)" + # A renamed or removed section leaves its pass naming a unit the tree no longer holds. + # The renamed text is read again under its new key, which the work list reaches, where the stranded pass is not. + # Warned rather than filed, since no pass closes an orphan and an issue that cannot be closed is worse than a warning nobody has to act on. + # `.orphanedPasses | length` answers 0 for an absent key rather than failing, so the field is asserted: a renamed one has to stop the step rather than stop the warning. + orphans="$(python3 scripts/canonical_review.py status | jq 'if has("orphanedPasses") then (.orphanedPasses | length) else error("canonical_review.py status carries no orphanedPasses field") end')" + if [ "$orphans" -gt 0 ]; then + echo "::warning::$orphans recorded pass(es) name a unit this tree no longer holds, so a section was renamed or removed, and a renamed one is read again under its new key in the never-read backlog" + fi + # Every number a write below targets is read here, in this run, rather than constructed. + # Each producer writes to a file rather than into a process substitution, since mapfile reports success whatever the producer did, so a failed listing or filter would read as no open issue and file a second one beside the first. + gh issue list --repo "$GITHUB_REPOSITORY" --state open --label "$LABEL" --json number,title > "$RUNNER_TEMP/issues.json" + jq -r '.[].number' "$RUNNER_TEMP/issues.json" > "$RUNNER_TEMP/labeled.txt" + jq -r --arg t "$TITLE" '.[] | select(.title == $t) | .number' "$RUNNER_TEMP/issues.json" > "$RUNNER_TEMP/titled.txt" + mapfile -t labeled < "$RUNNER_TEMP/labeled.txt" + mapfile -t titled < "$RUNNER_TEMP/titled.txt" + # The label carries one open issue per repository, so a second one, or a single one carrying a title this workflow never files under, is a state to report rather than one to pick from. + # Refusing on the second shape is what keeps an issue a human labeled from having its body replaced with the work list. + if [ "${#labeled[@]}" -gt 1 ] || [ "${#labeled[@]}" -ne "${#titled[@]}" ]; then + echo "::error::open $LABEL issue(s) ${labeled[*]} are not the single issue titled '$TITLE' that this workflow files, so which one it owns is undecided and a hand edit is what settles it" + exit 1 + fi + number="${titled[0]-}" + if [ "$OWED" = 1 ]; then + if [ -n "$number" ]; then + gh issue edit "$number" --repo "$GITHUB_REPOSITORY" --body-file "$RUNNER_TEMP/sweep.md" + else + gh issue create --repo "$GITHUB_REPOSITORY" --label "$LABEL" --title "$TITLE" --body-file "$RUNNER_TEMP/sweep.md" + fi + elif [ -n "$number" ]; then + # Closed rather than left open, so the issue's own state answers whether any unit is owed a read. + # A unit that owes a read again is filed as a new issue rather than reopening this one, since the listing above reads open issues only. + gh issue comment "$number" --repo "$GITHUB_REPOSITORY" --body "Every carried canonical unit has been read at its current text, measured on develop at $head_sha. A unit that moves past its pass, and one newly authored or newly carried, is filed as a new sweep issue." + gh issue close "$number" --repo "$GITHUB_REPOSITORY" + else + echo "No carried canonical unit owes a read, and no open $LABEL issue to close." + fi diff --git a/.husky/pre-push b/.husky/pre-push index b2a77a8c3..1ad388c98 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Refuses a branch push whose diff no recorded local review pass covers, and one carrying a canonical unit no full-content pass covers, per GOVERNANCE.md "Verification Discipline". +# Refuses a branch push whose diff no recorded local review pass covers, per GOVERNANCE.md "Verification Discipline". # Enable it per clone with `git config core.hooksPath .husky`, and see the pre-commit hook for why `_/husky.sh` is not sourced. set -Eeuo pipefail @@ -77,7 +77,7 @@ else exit 1 fi -# The engines import datetime.UTC at module level, so an interpreter below the floor fails at import and exits 1, which reads as a refusal rather than as the gate never running. +# The engine imports datetime.UTC at module level, so an interpreter below the floor fails at import and exits 1, which reads as a refusal rather than as the gate never running. # The interpreter answers about its own version, which needs no text comparison and so no sort -V, a GNU spelling this repository uses only in Linux-only scripts. # The floor is read out of the spec rather than repeated here, since a copy drifts the way the probe order above already did. py_floor=$(run_py -c "import json; print(next(t['minimum'] for t in json.load(open('spec/host-tools.json'))['tools'] if t['name'] == 'python3'))" 2>/dev/null) || py_floor="" @@ -92,29 +92,24 @@ if ! run_py -c "import sys; raise SystemExit(0 if sys.version_info >= tuple(int( exit 1 fi -# Two gates under one rule. -# The first asks whether a recorded pass covers this branch's diff, and the second whether one covers each canonical unit the branch moved, which a repository carrying that content reads whole rather than as a diff. -# Both run before either verdict is read, so one blocked push names every reason it was refused rather than only the first, which would otherwise cost a second push to discover the next. +# One gate, over whether a recorded pass covers this branch's diff. +# The canonical-unit half is swept weekly by .github/workflows/canonical-review-sweep.yml instead of gated here, per GOVERNANCE.md "Verification Discipline". # No --target: a target read from the environment is set inline on the very command being gated. diff_status=0 run_py scripts/local_review.py check || diff_status=$? -unit_status=0 -run_py scripts/canonical_review.py check || unit_status=$? -if [ "$diff_status" -eq 0 ] && [ "$unit_status" -eq 0 ]; then +if [ "$diff_status" -eq 0 ]; then exit 0 fi echo "" >&2 -# The engines name their own cases, and only some of them are a missing pass. +# The engine names its own cases, and only some of them are a missing pass. if [ "$py_name" != python3 ]; then - echo "pre-push: this host runs the engines as '$py_name', so read any 'python3' above as '$py_name'." >&2 + echo "pre-push: this host runs the engine as '$py_name', so read any 'python3' above as '$py_name'." >&2 fi -if [ "$diff_status" -eq 1 ] || [ "$unit_status" -eq 1 ]; then +if [ "$diff_status" -eq 1 ]; then echo "pre-push: this push is blocked, which is the gate working. Read the engine message above for the case." >&2 - echo "pre-push: the local-strict-review skill's refusal table says what each refusal means and what clears it," >&2 - echo "pre-push: for both gates, and its carried-content section says how the canonical pass itself is run." >&2 -fi -if [ "$diff_status" -gt 1 ] || [ "$unit_status" -gt 1 ]; then - echo "pre-push: a review gate could not run, which is not a verdict either way." >&2 + echo "pre-push: the local-strict-review skill's refusal table says what each refusal means and what clears it." >&2 +else + echo "pre-push: the review gate could not run, which is not a verdict either way." >&2 echo "pre-push: fix what it reported above, most often by fetching the target branch." >&2 fi exit 1 diff --git a/AGENTS.md b/AGENTS.md index 0c410033a..61bed5533 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,7 +94,7 @@ Every rule below is a level-two section of [`GOVERNANCE.md`](./GOVERNANCE.md) un | Writing a commit message or pull request title | `Pull Request Title and Commit Message Conventions`, packaged as the `comment-and-doc-style` Skill | | Any prose, comment, doc, or line-ending change | `Documentation Style Conventions`, packaged as the `comment-and-doc-style` Skill | | Proving work actually happened | `Verification Discipline`, surfaced at its decision moment by the `agent-conduct` Skill, and the section keeps the full rules | -| Editing rule text, a Skill, or any other content other repos carry | `Verification Discipline`'s carried-content rule, whose pass the `local-strict-review` Skill runs and whose record the hub-hosted `scripts/canonical_review.py` keeps | +| Editing rule text, a Skill, or any other content other repos carry | `Verification Discipline`'s carried-content rule, which asks nothing of the change itself, its passes being run by the `local-strict-review` Skill against the units a periodic sweep names and recorded by the hub-hosted `scripts/canonical_review.py` | | Opening a pull request, or requesting, monitoring, answering, or closing a review | `PR Review Etiquette`, packaged as the `pr-review-conduct` Skill | | Reviewing a pull request, patch, or change set | No section of its own: the `code-review` Skill, which routes to the applicable general, language, documentation, and workflow skills | | Reporting progress or asking the user something | `Communicating with the User`, surfaced at its decision moments by the `agent-conduct` and `session-handoff` Skills, and the section keeps the full rules | @@ -113,4 +113,4 @@ Adding or changing a managed host tool is packaged as `add-host-tool`. It keeps Driving a pull request through its review loop, from a feature branch into `develop` and, when asked, on to a mergeable `develop -> main` promotion PR, disposing of every reviewer finding along the way per `pr-review-conduct`, is packaged as `drive-pr`, new content rather than a rule extracted from a section. Merging a ready promotion PR and dispatching the release it unblocks, refreshing this machine's installed Skills first when the repo is this hub, is `merge-and-release`, its own new-content package, invoked separately from `drive-pr` so the promotion merge and the release dispatch each keep their own explicit go-ahead. Working a whole open-issue backlog down by rounds, ranking the issues, grouping them so no two groups touch the same file, dispatching one subagent per group to drive its own pull request into `develop`, opening at most one `develop -> main` promotion pull request per round, and re-ranking from scratch afterwards because each round's reviews file new issues, is `backlog-burndown`, also new content rather than a rule extracted from a section. It orchestrates `drive-pr` rather than replacing it, and it scopes to the repository the session is in, and a fleet-wide issue sweep is a different request. -Running one read-only, adversarial review pass against a branch's current diff against its target branch, full file context included, on the strongest model tier the session can reach, before a unit of PR-bound work is pushed toward a pull request or claimed done, is packaged as `local-strict-review`, new content rather than a rule extracted from a section. `drive-pr`, `pr-review-conduct`, and `agent-conduct` each reference it at the moment they already govern, rather than restating what it does. The rule itself lives in [`GOVERNANCE.md`](./GOVERNANCE.md) "Verification Discipline", the hub-hosted `scripts/local_review.py` is the engine that records a pass so a capture point can check one, and a repository carrying a `.husky/pre-push` hook enforces it at the push itself, the skill staying the primary and agent-agnostic layer with the hook a bypassable backstop under it. That skill carries a second pass under the same rule, over canonical content this repository authors and others carry, read one whole unit at a time rather than as a diff, because a diff-scoped read leaves the first real review of a rule to whichever repository carries it next, which is the one repository that cannot act on what it finds. `scripts/canonical_review.py` is that pass's engine, and the units the pass has yet to reach are listed in the burn-down that engine's `report` renders from the hub's `reports/canonical-review.json`, not a repo-relative link here since that path is hub-local like the Skills tree above. +Running one read-only, adversarial review pass against a branch's current diff against its target branch, full file context included, on the strongest model tier the session can reach, before a unit of PR-bound work is pushed toward a pull request or claimed done, is packaged as `local-strict-review`, new content rather than a rule extracted from a section. `drive-pr`, `pr-review-conduct`, and `agent-conduct` each reference it at the moment they already govern, rather than restating what it does. The rule itself lives in [`GOVERNANCE.md`](./GOVERNANCE.md) "Verification Discipline", the hub-hosted `scripts/local_review.py` is the engine that records a pass so a capture point can check one, and a repository carrying a `.husky/pre-push` hook enforces it at the push itself, the skill staying the primary and agent-agnostic layer with the hook a bypassable backstop under it. That skill carries a second pass under the same rule, over canonical content this repository authors and others carry, read one whole unit at a time rather than as a diff, because a diff-scoped read leaves the first real review of a rule to whichever repository carries it next, which is the one repository that cannot act on what it finds. That one is swept on a schedule rather than owed by a push, since owing it at every change cost more than the fleet chose to keep spending there, so a change that edits such content pushes and merges like any other. `scripts/canonical_review.py` is that pass's engine, and the units the pass has yet to reach are listed in the burn-down that engine's `report` renders from the hub's `reports/canonical-review.json`, not a repo-relative link here since that path is hub-local like the Skills tree above. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index bdab7d26c..6674e77f3 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -185,7 +185,7 @@ The checks that separate work actually done from work that merely reports succes - **Config with a uniqueness rule is validated on read, and its consumers assert what it promised.** A repeated key in a lookup table is not a precedence question to settle quietly, it is two answers to one question, and keeping whichever came last picks one of them where the reader sees no choice being made. Fail on the duplicate at the point the config is read, so the code downstream can rely on the invariant instead of re-deriving it. - **Validate and read on the same normalized key.** A guard that compares stripped names while the join looks up the raw one passes a padded key and then matches nothing, so the exact fault the guard exists to stop is sitting inside the guard. Normalize once at the boundary and use that one value for both the check and the lookup. - **Every push toward a pull request is preceded by a local adversarial review of the branch's whole diff, and the pass is recorded.** The rule binds every push rather than the first one, so a fix push answering a reviewer's finding owes a pass exactly as the branch's first push did, and that is the round it is actually skipped on: the fix looks small, the branch was reviewed once already, and what goes up is content no review has read. Skipping it does not save the round, it moves it, into the fix-commit and review-comment cycle that spends wall-clock, Actions runtime, and agent tokens finding what a local pass would have. The pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, and `scripts/local_review.py` records it keyed on the content the reviewer actually saw, so a capture point can ask whether a receipt still covers what is about to be pushed rather than trusting the rule to have been remembered. The pass is mandatory and its findings are advisory, which are opposite claims worth keeping apart: a pass is recorded whether it raised ten findings or none, and disposing of each one is judgment, per `GOVERNANCE.md` "PR Review Etiquette". -- **Canonical content one repo authors and others carry is reviewed the way a carrier reads it, whole, in the repo that can fix it.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and answers whether one still covers each unit a change moved or newly carried, so a capture point can refuse exactly those rather than trusting the rule to have been remembered. A unit edited today is therefore read today, while a unit nothing has read here yet is left to the burn-down that engine's `report` renders and is never a block on unrelated work. Recording a pass writes one tracked file, the engine's ledger, so where it lands relative to the commit is a real ordering rather than a preference. It is committed before the push, since a capture point that gates a push refuses tracked content differing from HEAD before it runs either gate, while the diff receipt above is not tracked and is recorded after the last commit instead. So the ledger goes in ahead of the commit that carries it and the receipt is written after that commit, which is why the two records sit on opposite sides of it. Which repos hold such a capture point at all is a separate question, and the rule binds whether or not one is installed. Like the pass above, this one is mandatory and its findings are advisory. +- **Canonical content one repo authors and others carry is read the way a carrier reads it, whole, in the repo that can fix it, and that read is swept periodically rather than owed by a push.** Such content is written and merged against a diff of a few lines, and reaches a reviewer as a new file, in full, only when a repo carries it for the first time, so the first real read of a rule happens where nothing can be done about the result: the tree is manifest-owned, the copy is compared against the authoring repo's, byte for byte wherever the declared fidelity is verbatim, and a local edit there is drift on the next fidelity check. Where the fidelity is intent the carrier may adapt its own copy, and the defect still has to be fixed at the source, since every other carrier holds it too. Every carrier after that re-discovers the same defect, and the finding arrives in a session holding no checkout of the authoring repo and no standing to test the claim. The unit is what a reviewer reads whole, and the carry manifest, `spec/files.json` in the hub, rather than the document decides which, down to which files carry units at all, so the engine that reads that manifest is the authority on the set rather than any restatement of its rules. In the ordinary case a unit is one level-two section of a carried Markdown canonical, which is the fidelity unit `spec/section-model.md` declares. The read is of the unit's whole current text rather than of the diff that moved it, and the pass itself, its delegation shape, and its model tier are the `local-strict-review` Skill's, exactly as they are for the pass above. **The read is swept because owing it at every push cost too much to keep owing it there.** Measured across this fleet's review rounds, the passes a push owed were a large share of what a pull request spent, and what they returned was never measured against that, so the read moves to a schedule on the cost alone rather than being owed by whichever change happens to touch a unit. A change that moves a unit is no longer refused over one, and no capture point asks a change for a pass of this kind, the diff pass the bullet above requires being owed by every push exactly as before. What replaces it is a schedule in the authoring repo, which gathers the work into one piece and files it where an agent session can run the passes and fix what they find. That work is every unit whose text has moved past the pass that read it, plus a bounded slice of the units nothing has read there at all, taken newest-committed first. The slice is what keeps a newly authored unit from waiting on a volunteer, since such a unit has no earlier pass to move past and would otherwise reach a carrier with nothing having asked to read it, which is the case this whole rule is about. A unit newly carried by widening the manifest alone is not reached that way, the order reading the unit's own file rather than the manifest, so it joins the backlog at that file's age, where a section written and declared in one commit leads like any other newly authored one. Bounding it is what keeps a long backlog from arriving as one week's work. `scripts/canonical_review.py` records each pass keyed on the content the reviewer saw and names both sets, so the sweep's list is read off that record rather than remembered, and its ledger is tracked content the change carrying it commits like any other. Like the pass above, a pass the sweep asks for is mandatory and its findings are advisory. - **Another round of edits after either pass is owed only while a defect this change introduced is open, never by a finding count.** Which findings count as introduced, what each class owes, and how many rounds a push may spend are the `local-strict-review` Skill's. - **Run the repo's whole lint gate before every push, not the parts that look relevant.** CI runs all of them, so a partial local run only defers the failure, and the tool most likely to catch a given change is often the one it seems least about (an edit that manipulates line endings is exactly when `editorconfig-checker` matters). The repo documents each linter's known-working invocation, and this rule is that **all** of them run. - **Editing CRLF files programmatically: `.` matches `\r` in a regex**, so a captured line keeps its carriage return and rejoining with `\r\n` yields `CRCRLF`. Prefer literal replacement over regex reassembly. In Python the *default* path is a text-mode rewrite, which has the mirror failure: `Path.read_text()` decodes through universal newlines and `write_text()` translates each `\n` back to `os.linesep`, so a read-edit-write round trip rewrites every line ending in the file to the host's own while the edit itself looks correct. Work in bytes, or open the file explicitly with `newline=''` on both the read and the write, since a read that preserves the endings still hands them to a write that translates them. Use `open()` rather than `Path.read_text()`, which accepts that argument only on Python 3.13 and newer and raises `TypeError` below it. The corruption is worth naming because it is invisible in a rendered diff. @@ -232,7 +232,7 @@ An overlap with `WORKFLOW.md` resolves **by subject**, never by blanket preceden - **Filename**: a workflow declaring `on: workflow_call` ends in `-task.yml`, **whatever else it is also triggered by**, since that is the half the suffix is about. A workflow without `workflow_call` is an entry point (`push`, `pull_request`, `pull_request_target`, `schedule`, `workflow_dispatch`) and takes no `-task` suffix, ending instead with what it does: `-pull-request.yml`, `-release.yml`. The suffix says the file is meant to be `uses:`-d, which stays true of a file that is also dispatchable. Composite actions are named by their path (`.github/actions//action.yml`), so these suffix rules do not reach them. - **Workflow `name:`** (the top-level `name:` field): a workflow declaring `workflow_call` takes a name ending in **"task"** (e.g. `Build project release task`), matching the filename rule above and covering a file that is also dispatchable, and every other workflow takes one ending in **"action"** (e.g. `Publish project release action`, `Test pull request action`). The suffix tells an orchestrator from a callee while reading the source tree, and on the runs list for an entry point. It does not do that in the Actions UI for a callee: a called reusable workflow's jobs appear nested inside the caller's run as ` / `, and the runs list shows the caller's workflow name rather than the callee's own. - **Job and step `name:` suffixes**: every job's `name:` ends in **"job"** and every step's `name:` ends in **"step"**, including the PR-gate aggregator, whose `name:` is a required-status-check `context:` in a branch ruleset (`Check pull request workflow status job` in `test-pull-request.yml`). A trailing parenthetical qualifier after the suffix is allowed and is the only exception (`Upload coverage to Codecov step (Python)`), and nothing enforces the rule mechanically. A ruleset-bound job's `name:` and its ruleset `context:` are the **same string**: rename them **together**, or required-status-check enforcement silently breaks. Every surface whose staleness breaks that enforcement moves in the same change, never one without the others. In a repository the surfaces are the live ruleset and its own workflow. A rename of the fleet-wide string additionally moves the hub's `repo-config/` payloads, its `spec/files.json` `requiredCheckName`, and each adopter-facing stub in its `catalog/` and `docs/reusable-workflows.md`, which exist only in the hub. Prose naming the old string goes stale rather than breaking, and follows behind. -- **Concurrency**: top-level workflows declare `concurrency: { group: '${{ github.workflow }}-${{ github.ref }}', cancel-in-progress: true }` so a fresh push supersedes an in-flight run on the same ref. `cancel-in-progress: false` queues instead of cancelling, and queuing is not ordering: GitHub holds at most one pending run per group and cancels the previously pending one when a newer run queues, so the guarantee it buys is that a **running** job finishes rather than that every event runs in arrival order. **Documented exceptions**, each recording its rationale inline in its own header comment: (1) a merge-bot workflow keys the group on the **PR number** (`-${{ github.event.pull_request.number }}` rather than `-${{ github.ref }}`, which under `pull_request_target` is the base branch and would serialize every bot PR against it) and takes `cancel-in-progress: false`, because cancelling mid-flight would leave auto-merge enabled or disabled inconsistently (`.github/workflows/merge-bot-pull-request.yml`). (2) A publisher uses a **global, ref-independent group** (`group: ${{ github.workflow }}`, dropping the usual `-${{ github.ref }}`) with `cancel-in-progress: false`, because it publishes shared ref-independent outputs (both branches' Docker tags and caches, and GitHub releases) and its triggers need not agree on a ref, so a ref-scoped group would let two runs double-push, and cancelling one can leave a partially pushed tag set or a half-created release (`.github/workflows/publish-release.yml`). (3) A deploy workflow keys the group on the **environment** it deploys with `cancel-in-progress: false`, because a cancelled deploy leaves a release uploaded and the pointer unflipped. No workflow in this repository implements it, the deploy task being reusable rather than top-level, so the rationale lives here rather than in a header comment. +- **Concurrency**: top-level workflows declare `concurrency: { group: '${{ github.workflow }}-${{ github.ref }}', cancel-in-progress: true }` so a fresh push supersedes an in-flight run on the same ref. `cancel-in-progress: false` queues instead of cancelling, and queuing is not ordering: GitHub holds at most one pending run per group and cancels the previously pending one when a newer run queues, so the guarantee it buys is that a **running** job finishes rather than that every event runs in arrival order. **Documented exceptions**, each recording its rationale inline in its own header comment: (1) a merge-bot workflow keys the group on the **PR number** (`-${{ github.event.pull_request.number }}` rather than `-${{ github.ref }}`, which under `pull_request_target` is the base branch and would serialize every bot PR against it) and takes `cancel-in-progress: false`, because cancelling mid-flight would leave auto-merge enabled or disabled inconsistently (`.github/workflows/merge-bot-pull-request.yml`). (2) A publisher uses a **global, ref-independent group** (`group: ${{ github.workflow }}`, dropping the usual `-${{ github.ref }}`) with `cancel-in-progress: false`, because it publishes shared ref-independent outputs (both branches' Docker tags and caches, and GitHub releases) and its triggers need not agree on a ref, so a ref-scoped group would let two runs double-push, and cancelling one can leave a partially pushed tag set or a half-created release (`.github/workflows/publish-release.yml`). (3) A deploy workflow keys the group on the **environment** it deploys with `cancel-in-progress: false`, because a cancelled deploy leaves a release uploaded and the pointer unflipped. No workflow in this repository implements it, the deploy task being reusable rather than top-level, so the rationale lives here rather than in a header comment. (4) A workflow whose only write is one repository-scoped issue keys on the **workflow alone** with `cancel-in-progress: false`, because nothing it writes varies by ref, so a ref-scoped group would separate a scheduled run, which always runs on the default branch, from a dispatch made anywhere else, and let each read no open issue and each file one, and a cancel between two writes can leave the first landed and the second unmade. The one workflow implementing it is hub-only, so a repository carrying this section holds no such file and finds the rationale here rather than in a header comment. - **Shells**: every bash surface, a multi-line `run:` block and every committed `.sh` script alike, starts with `set -Eeuo pipefail`: fail fast, fail on undefined vars, fail on a failed pipe segment, and let an `ERR` trap inherit into functions, subshells, and command substitutions (`-E`). The `-E` is defense in depth: the fleet ships no `ERR` trap today, so a script that later adds one inherits the behavior instead of silently losing it. A deliberately POSIX `#!/bin/sh` surface, a git hook that must run before any toolchain exists being the case in practice, is not a bash surface: it takes `set -eu`, dropping `-E` and `pipefail`, which `sh` does not carry. - **Conditionals**: multi-line `if:` uses the folded scalar `if: >-`, which joins the wrapped source lines back into one line. `WORKFLOW.md` D9.3 requires it. A literal block (`if: |`) evaluates the same, the expression lexer skipping newlines along with other whitespace, so this is a legibility rule rather than a correctness one, and it binds as a guarantee regardless. - **Boolean inputs**: a workflow triggered both via `workflow_call` and `workflow_dispatch` declares each boolean input in *both* trigger blocks, since one declaration does not propagate to the other. Which context reads it then decides the comparison, and the two are not the same. The `inputs` context **preserves the declared boolean** on both paths, so `if: ${{ inputs.foo }}` is read directly. The `github.event.inputs` context delivers **every** input as a string whatever its declared type, so a read through it is compared against `'true'`. Comparing a `github.event.inputs` read against the boolean `true` as well is dead rather than defensive: an operand-type mismatch casts each side to a number, a non-numeric string casts to `NaN`, and `NaN` compares equal to nothing, so `github.event.inputs.foo == true` is false even on the run where the input arrived as `true`. A both-forms comparison on an `inputs` read is merely redundant. `WORKFLOW.md` D7.3 is the contract this bullet's rationale serves, and wins on any disagreement. @@ -253,7 +253,7 @@ CI runs the full lint set, but run the linters locally before pushing to catch i - **A working local hook is strongly suggested fleet-wide, and its absence is a measured audit finding, not an invisible gap.** `spec/project-types.json`'s `parity.hooks` check reads this section for its rationale, judged by hand during an `AUDIT.md` run like every sibling check in its dimension, never mechanized by `spec/audit.py`: a repo with no local hook mechanism wired at all is a `linter-parity` defect, the same severity a missing markdownlint config already gets, while a repo mid-convergence (below) stays operational. CI remains the authoritative run regardless. Two catalog snippets carry the canonical shape, each with a copy of `catalog/snippets/hub-fetch-run.py` alongside it. `catalog/snippets/husky/` is Husky.Net, for a repo that already keeps a .NET tool manifest declaring it, since `dotnet tool restore` then `dotnet husky install` is what generates the `.husky/_/husky.sh` its hook sources, and the snippet ships no manifest of its own. `catalog/snippets/pre-commit/` is the `pre-commit` framework, for a repo without one and for any repo that prefers it. Neither snippet is scoped to a language by what it runs. Each carries the repo's own language checks plus the two shared doc gates. A repo drops the block for a language it does not have. A Docker, config, or docs repo therefore wires the doc gates alone, which is a mechanism rather than the absence of one. Which snippet a repo starts from is bounded by the toolchain it already keeps, never by which languages its checks cover. A snippet is a starting point rather than the only shape: a repo may wire an equivalent hook of its own at `.husky/pre-commit`, enabled with `core.hooksPath` and sourcing nothing, which is what this repository does. That path matters, since `parity.hooks` reads the tracked file at `.husky/pre-commit` or `.pre-commit-config.yaml` rather than a per-clone hooks path it cannot observe. - **The hook** runs **language formatting** and the **diff-scoped doc gates**, never Docker, so it stays fast. The formatting half is whatever the repo's own language needs, CSharpier and `dotnet format` for .NET or ruff and the repo's type checker for Python, via native tooling. A repo adds each half once its tree passes that half, since a gate that fails on the corpus it guards blocks every commit from the moment it lands, so a hook running one half is a repo mid-convergence rather than a repo out of conformance. The doc half runs each gate at the scope that fits it. The prose gate is scoped to the working tree diff against `HEAD` rather than swept over the tree, which is the difference between about 2.2 seconds and about 0.13 and is what makes it affordable in a hook at all. That scope is the working tree rather than the staged index under a plain git hook, so a partially staged file is judged on all of its edits. Under the `pre-commit` framework it is the staged state instead, since that runner stashes unstaged changes before running a hook, which is measured rather than assumed. CI re-checks the whole tree regardless, which is what makes the scope affordable in a hook either way. A whole-repo check belongs there too when it is already fast and takes no file list, which the line-ending consistency check is, so scope is a property of the gate rather than a rule the hook applies to all of them. `repo_gate.py --check sha-pin` stays out of the hook regardless, since it resolves a same-owner pin against the GitHub API. - **The doc gates reach a downstream repo by fetching `.github/actions/prose-gate/prose_lint.py` and `.github/actions/repo-gate/repo_gate.py` fresh from `ptr727/ProjectTemplate`'s `main` branch, via `hub-fetch-run.py`, never vendored and never pinned.** Pinning anything Dependabot does not maintain goes stale by construction, and CI (this repo's own, and the hub's) is the backstop that catches a change landing broken on `main` before a locally fetched copy does real damage. These are the only network calls the doc gates make, one per fetched script. A Python repo's `uvx`-run ruff and type checker can also reach the network, to resolve `@latest` on a cache miss or refresh, the same category of dependency as the Docker pulls the VS Code Lint tasks already do routinely, not a new one. A fetch failure fails the commit, and it never silently skips the gate. The **hub's own** `.husky/pre-commit` is the one exception, staying local and offline, since it already carries `scripts/prose_lint.py` and `scripts/repo_gate.py` directly and has no hub to reach. A repo enables its hook per clone with `git config core.hooksPath .husky` or (`uv tool install pre-commit` once, then) `pre-commit install`. The Husky.Net snippet needs one more step per clone, `dotnet tool restore` then `dotnet husky install`, which generates `.husky/_/husky.sh`, the file the hook sources. CI remains the authoritative run either way. -- **The hub carries a second hook, `.husky/pre-push`, gating the local-review rule rather than lint.** It runs `scripts/local_review.py check` and `scripts/canonical_review.py check`, refusing a branch push whose diff no recorded review pass covers and one whose changed canonical units none covers, per "Verification Discipline" above. Both run before either verdict is read, so a blocked push names every reason it was refused rather than only the first, which would otherwise cost a second push to discover the next. It fires only for a branch update, so a tag push and a branch delete pass through, and a branch holding no net content against its target has nothing for a review to cover. It refuses rather than guesses in every state it cannot speak for, since the engine reads the checkout it runs in while a push delivers a commit, and those describe the same content only sometimes. The order that keeps them describing the same content is to run the carried-content pass and record it, commit that together with the change, then review the diff, record its receipt, and push. What the two gates actually require is narrower than that sequence, since the canonical ledger is tracked and need only be committed before the push, while the diff receipt is not tracked and must be recorded after the last commit. The sequence above is the shortest one meeting both, which is why every capture point's wording assumes it. It reads `develop` and accepts no override from the environment, since an environment variable is set inline on the very command being gated, by whoever is being gated, which is the same reason an authorization is never read from a channel the agent itself can set. The cost is that it measures a branch based on anything but `develop` against `develop` anyway, so its refusal there is not a verdict about that branch. Each refusal names its own case, and the `local-strict-review` Skill carries the fleet's one enumeration of them with what clears each, deliberately in one place rather than restated here. It folds the engine's three-valued exit honestly: a check that could not run blocks too, and says so in different words than a check that ran and found no pass, because a gate that waves a push through when it could not run is a gate that stopped gating. It is a backstop rather than a seal, and it is bypassable by construction: `--no-verify` is the documented route out of a pickle and is not the only one, since a git hook cannot police its own invocation. A Claude Code session meets a narrower surface, that flag being denied unconditionally by the agent-safety hook's explicit-bypass rule, and that denial is Claude Code's alone, since Codex and opencode carry no such hook yet. So the committed hook raises the cost of skipping the rule for one agent and lowers it for none, and the prose layer above stays the agent-agnostic one that actually binds. It is hub-only for now. `local_review.py` is hub-hosted per "Hub-Hosted Tooling", and a downstream repo reaches it as a hub checkout's copy run with its own worktree as the working directory, so a catalog snippet carrying this hook fleet-wide is a later step rather than part of this one. `canonical_review.py` is hub-hosted too and is not reached that way at all: it reads `spec/files.json` to learn what is carried, `spec/` is hub-hosted rather than carried, and run against a downstream worktree it exits 2 saying that tree describes no carried set. It runs in the repository that authors the content, which is this one. The canonical-unit half is also run by the hub's own `.github/actions/validate` composite action, as a step on every pull request, which is where it actually binds, since a hook a push can bypass raises the cost of skipping the rule without ever settling it. That step is scoped to a pull request because a unit's change is measured against the branch it is proposed into, and a push carrying no pull request names none. +- **The hub carries a second hook, `.husky/pre-push`, gating the local-review rule rather than lint.** It runs `scripts/local_review.py check`, refusing a branch push whose diff no recorded review pass covers, per "Verification Discipline" above. It fires only for a branch update, so a tag push and a branch delete pass through, and a branch holding no net content against its target has nothing for a review to cover. It refuses rather than guesses in every state it cannot speak for, since the engine reads the checkout it runs in while a push delivers a commit, and those describe the same content only sometimes. The order that keeps them describing the same content is to commit the change, then review the diff, record its receipt, and push, the receipt being untracked and so recorded after the last commit. A change that also carries the canonical ledger records those passes ahead of that commit instead, the ledger being tracked content the commit has to hold. It reads `develop` and accepts no override from the environment, since an environment variable is set inline on the very command being gated, by whoever is being gated, which is the same reason an authorization is never read from a channel the agent itself can set. The cost is that it measures a branch based on anything but `develop` against `develop` anyway, so its refusal there is not a verdict about that branch. Each refusal names its own case, and the `local-strict-review` Skill carries the fleet's one enumeration of them with what clears each, deliberately in one place rather than restated here. It folds the engine's three-valued exit honestly: a check that could not run blocks too, and says so in different words than a check that ran and found no pass, because a gate that waves a push through when it could not run is a gate that stopped gating. It is a backstop rather than a seal, and it is bypassable by construction: `--no-verify` is the documented route out of a pickle and is not the only one, since a git hook cannot police its own invocation. A Claude Code session meets a narrower surface, that flag being denied unconditionally by the agent-safety hook's explicit-bypass rule, and that denial is Claude Code's alone, since Codex and opencode carry no such hook yet. So the committed hook raises the cost of skipping the rule for one agent and lowers it for none, and the prose layer above stays the agent-agnostic one that actually binds. It is hub-only for now. `local_review.py` is hub-hosted per "Hub-Hosted Tooling", and a downstream repo reaches it as a hub checkout's copy run with its own worktree as the working directory, so a catalog snippet carrying this hook fleet-wide is a later step rather than part of this one. `canonical_review.py` is not run here at all, and nothing else gates a push or a pull request over a canonical unit either, that read being swept on a schedule instead, per "Verification Discipline" above. The hub's own `.github/actions/validate` composite action renders its coverage burn-down into every run's job summary and fails no pull request over what that shows, while still failing where the engine could not read the manifest or the ledger at all, that being a boundary rather than a verdict. - **The VS Code Lint tasks** run the full doc-lint set via Docker `:latest` on demand, the local surface for Markdown, spelling, workflow, and EditorConfig checks, plus `Lint: Prose` and `Lint: EOL`, the same two hook gates in whole-repo mode rather than diff-scoped, for on-demand full-tree validation. The Docker invocations below run the same tools and configs as the VS Code tasks. Their headless form separates the image pull and minimizes repository exposure for an agent executor. diff --git a/OPERATIONS.md b/OPERATIONS.md index 57b226cc7..b2eaee1b9 100644 --- a/OPERATIONS.md +++ b/OPERATIONS.md @@ -23,11 +23,12 @@ uvx ruff@latest format --check . uvx mypy@latest uvx coverage@latest run --source=scripts,spec,host-setup -m unittest discover -s scripts/tests uvx coverage@latest run --source=scripts,spec,host-setup --append spec/audit.py --selftest +uvx coverage@latest run --source=scripts,spec,host-setup --append spec/workflow_reuse.py --selftest uvx coverage@latest run --source=scripts,spec,host-setup --append host-setup/agent-safety/claude/gh-write-guard.py --selftest uvx coverage@latest run --source=scripts,spec,host-setup --append host-setup/agent-safety/claude/test_install.py uvx coverage@latest report python3 scripts/build_dist.py --check -python3 scripts/canonical_review.py check +python3 scripts/canonical_review.py status > /dev/null python3 scripts/repo_gate.py python3 scripts/prose_lint.py . --check charset --check semicolon --check dash --check dupword --check spelling --check comment-wrap --check comment-case --check home-path --check dead-path python3 scripts/prose_lint.py . --check charset-unknown --summary @@ -36,9 +37,7 @@ python3 spec/validate.py python3 scripts/docker_lint.py ``` -`python3 scripts/canonical_review.py report` renders the burn-down from the ledger to standard output, and CI writes the same rendering to the run's job summary. The local block above runs under `set -Eeuo pipefail`, so a failing gate stops it there and the gates below never run, and reaching a second verdict means fixing the first or running the later command on its own. - -The canonical-review check sits in CI's own list only for a pull request, since a canonical unit's change is measured against the branch it is proposed into and a push carrying no pull request names none. The local run above takes the default target, `develop`, which is the same measurement for an ordinary feature branch and the wrong one for a branch based on `main`, where it needs `--target main` to mean anything. +`python3 scripts/canonical_review.py report` renders the coverage burn-down from the ledger to standard output, and CI writes the same rendering to the run's job summary. Neither refuses anything over what it shows, and no command above turns a unit's coverage into a verdict, since that read is swept on a schedule rather than owed by a change, per [`GOVERNANCE.md`](./GOVERNANCE.md) "Verification Discipline". The CI step does still fail where the engine could not read what it needs at all, that being a boundary rather than a verdict, and `status` is in the block above for that exit code rather than for its output, which is why the output goes nowhere. The local block above runs under `set -Eeuo pipefail`, so a failing gate stops it there and the gates below never run, and reaching a second verdict means fixing the first or running the later command on its own. The cache directory is unique to this verification run and remains outside the checkout. The operating system can reap it with other temporary data. A restricted executor may deny the first `uvx` network request, Docker socket access, or third-party image access to the repository. Record that denial as an execution boundary, then rerun the required command with scoped approval. Persist repository-exposure approval only when the executor constrains the read-only mount, disabled networking, and digest together. Only the rerun's tool output is a lint or test verdict. Provider-specific host configuration lives in [`docs/host-setup.md`](./docs/host-setup.md) "Agent Worktree Access". diff --git a/repo-config/README.md b/repo-config/README.md index 07ea0e129..2db2c46d7 100644 --- a/repo-config/README.md +++ b/repo-config/README.md @@ -43,6 +43,10 @@ The triage labels classify an issue by the kind of work it needs, so a backlog s - **`handoff`**: a link in the session handoff chain, one open issue per track. +`canonical-sweep` is a surface marker too, carried by the one open issue the periodic canonical content review sweep files while any carried unit owes a read, per [GOVERNANCE.md "Verification Discipline"][governance-verification-discipline]. That is every unit whose text has moved past its pass, and a bounded slice of those nothing has read at all, so the issue stands until the backlog is worked off rather than only between one edit and its pass. Only the repository that authors carried content files one, so in this fleet that is the hub alone, and the label is declared here rather than there because one payload reaching every repository is what keeps the set auditable. A sweep issue carries no triage label either, for a reason of its own rather than the handoff's: it does record work, and the workflow files it, rewrites its body each week, and closes it, so ranking or counting it as backlog counts work no pull request closes and no round can retire. + +- **`canonical-sweep`**: the periodic canonical content review sweep, one open issue while any carried unit owes a read. + The class labels `introduced` and `pre-existing` record which class, per the `local-strict-review` Skill's "Disposing of Findings", a filed review finding carried. A `style` finding is declined rather than filed, so it has no label. `agents`, `skills`, and `codegen` mark the surface, and the rest are GitHub's own defaults and the Dependabot pair, declared so every fleet repo carries at least this set. ## Repo Settings @@ -73,6 +77,7 @@ A repository linked to a project of its own is left alone, like a label the payl [governance-communicating-with-the-user]: ../GOVERNANCE.md#communicating-with-the-user [governance-durable-knowledge]: ../GOVERNANCE.md#durable-knowledge-and-self-improvement [governance-hub-hosted-tooling]: ../GOVERNANCE.md#hub-hosted-tooling +[governance-verification-discipline]: ../GOVERNANCE.md#verification-discipline [project-json]: ./project.json [repo-config-doc]: ../docs/repo-config.md [settings-json]: ./settings.json diff --git a/repo-config/labels.json b/repo-config/labels.json index f444bd4b9..3ef87adab 100644 --- a/repo-config/labels.json +++ b/repo-config/labels.json @@ -2,6 +2,7 @@ { "name": "agents", "color": "f86915", "description": "Agents instructions" }, { "name": "blocked", "color": "d93f0b", "description": "Blocked on an issue in another repository, named in the body" }, { "name": "bug", "color": "d73a4a", "description": "Something isn't working" }, + { "name": "canonical-sweep", "color": "0e8a16", "description": "The periodic canonical content review sweep, one open issue while any carried unit owes a read" }, { "name": "chore", "color": "c2e0c6", "description": "Registry, labels, rollout, and other fleet housekeeping" }, { "name": "codegen", "color": "3526d4", "description": "Codegen bot" }, { "name": "decision", "color": "b60205", "description": "A question waiting on the maintainer, alone or beside whatever else the issue carries" }, diff --git a/scripts/README.md b/scripts/README.md index 7e21a7de9..7ec79f448 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,7 +4,7 @@ The fleet's checks and review tooling, run by hand, with the deterministic ones **Hosted here and reached, never carried.** These are not declared in [`spec/files.json`][files], so the audit does not expect a downstream repo to ship them, the same footing as `spec/audit.py`. That is the fleet model rather than an omission: a gate holding no per-repo content has one canonical implementation for the fleet. The prose and repository gate implementations live beside their composite actions under `.github/actions/`, which lets reusable workflows reach the implementation at their pinned hub commit through `$/.github/actions/` without checking out the hub. The same-named files in `scripts/` are thin local entry points that call those action-owned implementations, so maintainers and hooks retain the established commands from a hub checkout without creating a second copy of either gate. A repository that cannot reach the hub reports a local check as not run rather than reconstructing it, since a rebuilt gate encodes its author's reading of the rule and agrees with no other repository. -Python only, standard library only, no third-party packages. Every check script is read-only and exits non-zero on a finding. `build_dist.py`, `local_review.py`, `canonical_review.py`, `handoff.py`, and `skills_install.py` below are the exceptions, since a generator, two recorders, an installer, and the handoff chain all exist to write. `build_dist.py --check` and `skills_install.py --report` are read-only modes for CI and for asking without changing anything. `local_review.py status` and `check` answer without recording anything, but they are not read-only in that same sense: reading the working tree stages it, which writes inside `.git` and runs any `filter.*.clean` the repository configures, and only the receipt is left untouched. `canonical_review.py` reads files rather than staging them, so its `list`, `status`, and `check` are read-only outright, and only `record` and `report` write. +Python only, standard library only, no third-party packages. Every check script is read-only and exits non-zero on a finding. `build_dist.py`, `local_review.py`, `canonical_review.py`, `handoff.py`, and `skills_install.py` below are the exceptions, since a generator, two recorders, an installer, and the handoff chain all exist to write. `build_dist.py --check` and `skills_install.py --report` are read-only modes for CI and for asking without changing anything. `local_review.py status` and `check` answer without recording anything, but they are not read-only in that same sense: reading the working tree stages it, which writes inside `.git` and runs any `filter.*.clean` the repository configures, and only the receipt is left untouched. `canonical_review.py` reads files rather than staging them, so its `list`, `status`, `sweep`, and `report` are read-only outright, and `record` alone writes. The directory separates its kinds by name and by tree. A gate checks and exits non-zero on a finding, and its name carries a `_lint` or `_gate` suffix saying what it gates. The `prose_lint.py` and `repo_gate.py` entry points delegate to the action-owned implementations that gate this tree in CI, and `host_gate.py` gates the machine it runs on. A utility does work rather than gating and carries no suffix: `build_dist.py`, `canonical_review.py`, `handoff.py`, `local_review.py`, `pr_review.py`, `skills_install.py`. The unit tests live apart under [`scripts/tests/`][tests], one `test_