Repository navigation
feat(loop): a review body gets its own budget kind, and the rules that spend it - #153
Conversation
`writing.budgets` had no kind for a submitted review body, so `adversarial-review` measured its body as `comment` (1200) while prescribing a holistic assessment, ranked findings and a What-was-checked section. Reviews paid for it: SahajAtlasWeb#237 cut evidence to land at 1200/1200, SahajCloud#874 dropped a PR-size note it did not think wrong, and SahajAtlasWeb#233 shipped with no `identity.commentMarker` at 1197/1200. Trimming prose is what a budget is for. Dropping a finding and losing the attribution are not. 2000 is set against overhead measured in this run, not guessed: the marker is 124 characters, the harness footer 58, `review.bodyHeader` 24 — 206 before a word of review. Observed review prose ran 1318-1913, so 2000 clears the 1318-1659 band with room and still binds at the outlier. A budget that never binds is not one. `check()` resolves any key in `writing.budgets` (budget.mjs:51), so the only code change is keeping `DEFAULT_BUDGETS` equal to the config, which budget.mjs's own doc comment requires. Two tests take over checks a maintainer was doing by hand: the fallback equals the config, and every `--kind` a skill names is a key in it. The second is the general form — `check()` returns UNBUDGETED for an unnamed kind and the CLI exits 0, so a typo passes silently, and that silence is how this gap stayed invisible for three weeks. Against this branch's skills and `main`'s config it fails, naming `reviewBody`. `writing.$comment` loses "Bodies are deliberately unbudgeted" for "Ticket and PR bodies", which is what it always meant and is now load-bearing. Bumps the plugin to 2.5.0. It lands in this commit, not the next, so a revert of the skill rules leaves the cache key ahead of the `workflow/lib` change that stays. This commit moves no run's output by itself. A kind is inert until a skill names it, so it lands first and reverts last. Refs #145 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fpw7GY9oDLCdrHMJBUBRwa
… take A budget kind is inert until a skill names it. `check()` returns UNBUDGETED for a kind nothing configured, and the CLI exits 0 on it, so the previous commit moved no run's output. This commit is what spends it, and it is the one to revert first. `handler-preflight` enumerates the kinds, so leaving `reviewBody` out of that list would have kept it unreachable. The same sentence now reads "ticket and PR bodies are unbudgeted" — unqualified, "bodies" now reads as covering the one body that is measured. "Over means cut" becomes "cut prose, never `identity.commentMarker`, a finding, or a section the skill requires", and it goes in preflight rather than in `adversarial-review` alone. Nothing about SahajAtlasWeb#233 dropping its marker was specific to a review body: `answer-ticket`, `address-review` and `revise-ticket` all require the marker inside the 1200 of `comment`, and preflight's "shorten by leaving things out" named no exception. One line on the per-dispatch read now covers four skills instead of one. `adversarial-review` keeps only what is new where the body is written: the kind to measure with, and the marker on a body that its own inline rule did not reach. `docs/why.md` takes the six cited reviews, the measured overhead, why the never-cut rule is general, and why the value and the rules shipped as two commits on one PR. Refs #145 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fpw7GY9oDLCdrHMJBUBRwa
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
This PR is the size of its ticket: two lines of value, thirteen of rule, two tests. Every number it claims verifies here: marker 124, header 24, and the four budgets match between config and fallback. The judgement call it flags is the right one — neither commit moves a run's output alone, so the hard split's purpose survives two commits on one PR, and the corpus test makes the revert order checkable.
What is unsettled is where the new rules stop. A review body now has two budgets, depending on which path posts it. The never-cut rule is prose, in a repo whose guide gives mechanical rules to scripts. Neither is a reason to hold the PR.
Findings
should-fix—adversarial-review/SKILL.md:101— the fallback path posts the identical body as a PR issue comment, which preflight budgets at 1200. A 2000-character body cannot go through it.consider—handler-preflight/SKILL.md:95— "never the marker" is enforced by prose alone, and it is the one item in that list a script could decide.consider—budget.test.mjs:102— the root cause stays unfixed and unfiled. No open issue names the exit-0 silence.consider—docs/why.md:567— one paragraph is this PR's commit order, not the failure behind the rule.
What was checked
Read whole: budget.mjs, budget.test.mjs, config.mjs, handler-preflight, adversarial-review, handler-journal, ticket #145, CLAUDE.md, the profile. node --test workflow/lib/budget.test.mjs — 8 pass. loadLoopConfig(path) throws rather than searching, so the drift test's cwd fix holds. The corpus test sees journalEntry and reviewBody only, since preflight writes --kind <kind>; both other kinds are already keys. check() returns UNBUDGETED and the CLI exits 0 at budget.mjs:194. fit() cuts no required section — handler-journal omits an empty 📄 Did.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The fallback path posts the identical review body as one PR issue comment, and handler-preflight budgets a PR comment at 1200. With reviewBody at 2000 a body between 1201 and 2000 could not take that path without cutting what the new never-cut rule forbids losing. The budget follows the artifact, not the transport, so the fallback comment is measured as reviewBody too. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FSG5aQgqzvqVh48dbpKJ1M
docs/why.md is scoped to the failure behind each rule, one heading per rule. The closing paragraph was this PR's commit structure instead, already stated nearly verbatim in the PR body, and it explained a process decision rather than the budget the section is about. The failure it carried stays: a kind no skill names is inert, which is how the gap stayed invisible for three weeks. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FSG5aQgqzvqVh48dbpKJ1M
|
Review round addressed: two commits, one follow-up ticket, one thread left for you. Adopted
Filed
Open for you
Gate: 4 pre-existing 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Resolve the plugin version against #151. main bumped to 2.6.0 after this branch took 2.5.0, so both sides wanted the next cache key and neither number is still free. `version` keys the installed plugin's cache directory, so it has to land strictly ahead of main or the skill change never reaches an installed consumer. Resolved to 2.7.0, which is what each side was asking for. Everything else auto-merged into disjoint sections: this branch rewrote preflight's Budgets paragraph while main rewrote its step 6, and this branch added the review-body rules to adversarial-review while main corrected the diff command in its Reads. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Sfnn5gDuQ2mqUiP6pDRVhZ
|
Merged Resolved to 2.7.0. #151 took 2.6.0 after this branch took 2.5.0, so both sides wanted the next cache key and neither number is free now. Everything else auto-merged into disjoint sections. Lean gate now passes with no warnings — 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
GitHub reported this PR conflicting after #151 and #153 merged. One hunk conflicted: plugin.json's version. Both sides bump it for the same reason, so neither side wins — main took 2.6.0 in #151 and 2.7.0 in #153, and the plugin cache key is the version string, so this branch's 2.6.0 would have resolved to a no-op and reached no installed plugin. 2.8.0 is the first value above main's. Everything else merged clean and additive: the incidental-finding bullet sits beside #153's reviewBody rules in handler-preflight, findings beside writing.budgets in loop-config.json, and main's budget.mjs, finalize-pr and reflect changes come through untouched. rule-delta still reports 62 → 62 directives with the same one removal the body adjudicates, so the merge dropped no rule. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013NdyinyrMRWyxZowgEtQ5D
Summary
reviewBodybudget, so a review stops cutting a finding or its attribution to fit the 1200 meant for comments.Over means cutnow says what a cut may never take, inhandler-preflight— the same exposure sits in three other skills.Change outline
Contract — the budget kinds every run measures against
writing.budgetsis the list a run checks its output against. A submitted review body was not in it, soadversarial-reviewmeasured its body as a comment.writing.budgets loop-config.json comment: 1200 # a ticket or PR comment reviewReply: 600 # a thread reply + reviewBody: 2000 # a submitted review body journalEntry: 1500DEFAULT_BUDGETSinworkflow/lib/budget.mjscarries the identical four, reached only when noloop-config.jsonis found. Two tests take over checks a maintainer was doing by hand: the fallback equals the config, and every--kindanySKILL.mdnames is a key in it.Behaviour — what a run does when it measures over
The never-cut rule is general, so it sits in the paragraph every dispatch reads, not only in the skill that tripped over it.
Behaviour — the guard that enforces the commit order
check()returnsUNBUDGETEDfor a kind no config names and the CLI exits 0, so a typo'd--kindpasses silently. The new corpus test closes that for anything a skill names, and it is why the two commits cannot land out of order.Phases
writing.budgets.reviewBody, the matchingDEFAULT_BUDGETSentry, two tests, the version bumpdocs/why.mdstoryTest results
claude plugin validate ./workflow --strict— 4 warnings, the same 4origin/mainreports (unquoted${CLAUDE_PLUGIN_ROOT}inhooks.json, pre-existing and untouched)node --test workflow/lib/budget.test.mjs(6 before, 2 added), and 8 again run from an ancestor cwdnode --test dispatcher/test/*.test.mjs— 106 passednode workflow/lib/rule-delta.mjs --base origin/main workflow/skills— 62 → 62 directives, none disappearednode workflow/lib/comment-lint.mjs --base origin/main— no banned comment added/security-reviewran, since the diff matches two arms ofsecurityReview.triggerPattern— no findings. Noallowed-toolsand no hook changed, and the new instruction is inside preflight's existingBash(node:*).Manual verification
adversarial-reviewbody. It is the one artifact no test here can check. It should carryidentity.commentMarker, and its journal entry should report no trim.Notes for reviewer
The ticket left four open questions. Three were decisions, and this PR took them.
CLAUDE.mdforbids shipping a skill change and a ceiling change together;implement-issueforbids splitting a ticket across PRs. The split exists so a changed output has one candidate cause. Here neither commit changes any output alone — a kind no skill names returnsUNBUDGETED— so there is one behaviour and one cause. Each phase is a separately revertable commit, Phase 1 first, and the corpus test now fails if they land the other way round. This is the judgement call to check.reviewReply. The ticket's Phase 3, out of scope without evidence. The cited replies live in repos this run cannot read, andreflect/SKILL.mdforbids raising a threshold without evidence it was the binding constraint.The plugin bumps to 2.5.0, in Phase 1's commit rather than Phase 2's, so reverting the skill rules leaves the cache key ahead of the
workflow/libchange that stays.Detail
The overhead, measured in this run rather than quoted.
identity.commentMarkeris 124 characters, the harness attribution footer 58,review.bodyHeader24 — 206 before a word of review. Observed review prose ran 1318–1913 (the ticket's figures, from SahajCloud#861's four rounds). 2000 clears the 1318–1659 band with room (1659 + 206 = 1865) and still binds at the outlier (1913 + 206 = 2119).Refused: raising
commentto buy that room. It would loosen every ticket and PR comment the loop writes in order to fix one artifact.No code change beyond the fallback.
check()looks its limit up by key (budget.mjs:51), so--kind reviewBodyresolved from config the moment the key existed.fit()is untouched: it cuts list items from the end of📄 Didand is journal-only, so a review body is checked, never fitted.budget.mjs's CLI still exits 0 onUNBUDGETED(budget.mjs:194). The ticket names that under Notes and does not file it; changing the exit code is a live-behaviour change to shared infrastructure in all five repos and belongs in its own PR. The corpus test is the standing guard in the meantime: it catches any kind a skill names, which is every kind a run reaches without someone typing one by hand.Review findings taken, from
/simplify's four passes:loop-config.jsonfrom the cwd first, so run from an ancestor checkout it comparedDEFAULT_BUDGETSagainst a different config and failed. Reproduced: 7 of 8 from the parent checkout, 8 of 8 from the worktree. Now resolved fromimport.meta.url.reviewBody-only test was a special case for the defect its own comment stated generally. Replaced with the corpus test.writing.$commentinloop-config.jsonstill said "Bodies are deliberately unbudgeted", three lines above the new key. Corrected, asdocs/why.mdandhandler-preflightwere.handler-preflight.Dismissed, with reasons:
cut-releasetiesversionto the skill change. The documented revert order is Phase 2 first, and under it the bump must sit in Phase 1 or the cache key falls behind aworkflow/libchange that stays.reviewBody. Real exposure — the marker and the header are data, and growing either silently eats the headroom. The fix needs a margin constant nobody has derived, and the harness footer is not in config at all. Worth a ticket, not an invented number here.--kind reviewBodyfromadversarial-reviewas duplicating preflight's list. Preflight lists the kinds; the skill at the call site is what makes one live. Per the ticket, a run usesreviewBodyonly because a skill names it.Verification run, in the worktree:
printf 'x' | node workflow/lib/budget.mjs --kind reviewBody→OK — 1/2000 (config), exit 0OVER — 2001 chars, 1 over the 2000 budget, exit 1fallback matches config, comment = 1200origin/main's config →unbudgeted: [ 'reviewBody' ], so it would have caught thisOne correction to the ticket. It says
--strictalready fails onmainwith three unquoted-${CLAUDE_PLUGIN_ROOT}warnings. It is four, onmainand on this branch alike.Docs sync.
AGENTS.md's budget line is generic and stays true.docs/cleanup.md's mention of a removedjournalCommentkey is history, not a live reference.docs/why.mdgains the section.One anomaly.
node workflow/lib/comment-rule-sync.mjsexits withcanonical rule not found: ../claude-workflow/docs/code-comments.md— it resolves a sibling checkout, so it cannot run from inside this repo. Unrelated to this diff, and not retried.Closes #145
🤖 Generated with Claude Code
https://claude.ai/code/session_01Fpw7GY9oDLCdrHMJBUBRwa
Generated by Claude Code