Repository navigation
Description
Summary
node workflow/lib/budget.mjs --kind <name> exits 0 when writing.budgets names no <name>, so a typo'd or unnamed kind reads as a pass (budget.mjs:194). That silence hid the missing review-body budget for three weeks (#145, now being fixed by #153). The same script is the right home for the one mechanical item in preflight's never-cut rule — whether the text ends with identity.commentMarker — because CLAUDE.md gives mechanical rules to scripts, not prose.
This ticket is blocked by #153. Everything this ticket builds on beyond budget.mjs:194 exists only on claude/chore-145-review-body-budget, not on main. Verified in this run against main at a45fc7d: writing.budgets has no reviewBody key, handler-preflight has no never-cut rule naming the marker, and budget.test.mjs has six tests and no corpus test. Do not start this until #153 merges.
Approach
Two phases, one PR, one commit each, Phase 1 first. Both change workflow/lib/budget.mjs, which every run in all five repos invokes, so the commits stay separately revertable — but they do not split into two PRs. (why: docs/why.md#a-ticket-is-built-in-phases-never-split)
Phase 1 — an unbudgeted kind is a failure, and the caller must still know which failure
check() returns UNBUDGETED (budget.mjs:53-55) and the CLI exits 0 on it (budget.mjs:194). Make it exit non-zero and name the kind.
The loop risk #145 deferred this for is real, and already live on the other path. --fit exits non-zero on UNBUDGETED today (budget.mjs:188), and handler-journal/SKILL.md:57 tells a run Exit 1 → cut prose from Friction. A run that hits UNBUDGETED there is told to cut prose that is not over budget, forever. Confirmed in this run:
printf 'x' | node workflow/lib/budget.mjs --fit --kind nosuchkind → UNBUDGETED, exit 1
printf 'x' | node workflow/lib/budget.mjs --kind nosuchkind → UNBUDGETED, exit 0
So Phase 1 is not only an exit code. The response must key on the printed verdict word, which already distinguishes the two, not on the exit code:
budget.mjs:194— exit non-zero onUNBUDGETED, naming the kind.handler-journal/SKILL.md:57— replaceExit 1 → cut prosewith a rule that cuts onOVERand stops onUNBUDGETED.handler-preflight/SKILL.md:97—Over means cutlikewise names the verdict, not the exit.
The standing guard #153 leaves is narrower than its PR body claims, which is the argument for this phase. Its corpus test scans SKILL.md for a literal --kind <name>. Run in this session against main's skills, the set it finds is ['journalEntry']; with #153 merged it becomes journalEntry and reviewBody. comment and reviewReply are referenced only as writing.budgets.comment in prose, so a run types them by hand and no test ever covers them — exactly the case #153's own detail admits it misses.
Phase 2 — the marker check moves into the script
budget.mjs already holds the text on stdin and loadLoopConfig() on identity.commentMarker. The requirement is per-kind, not blanket: handler-journal entries carry no marker.
Shape: a sibling list, not a per-kind object. budget.mjs is the only reader of writing.budgets — grepped across workflow/, dispatcher/ and .github/ in this run, nothing else touches the key. Both of its lookups require a number (budget.mjs:51-53, budget.mjs:106-107), and #153 adds a deepEqual of DEFAULT_BUDGETS against the config. So:
writing.markerRequired: ["comment", "reviewReply", "reviewBody"]besidewriting.budgetskeeps the number contract and both of feat(loop): a review body gets its own budget kind, and the rules that spend it #153's tests untouched.- Turning each budget value into
{chars, marker}breaks both lookups, thedeepEqual, and every existing--kindcall. budget.mjsreads the new key and fails a listed kind whose text does not end with the marker.handler-preflight/SKILL.md:95-96keeps the rule as an imperative and cites the script where the script decides.
Acceptance criteria
-
--kind <name>with no budget for<name>exits non-zero and names the kind. - Every
--kindthe skills name still measures and passes as before. -
handler-journalandhandler-preflighttell a run to cut onOVERand to stop, not cut, onUNBUDGETED. - A kind declared to require the marker fails when the text does not end with
identity.commentMarker. - A kind not declared to require it passes without one.
-
writing.budgetsvalues are still plain integers. -
handler-preflight's never-cut rule cites the script wherever the script decides. -
workflow/.claude-plugin/plugin.jsonversionis raised above whatevermaincarries when this lands —mainand feat(loop): a review body gets its own budget kind, and the rules that spend it #153's branch are both at2.5.0today.
Verification checklist
-
printf 'x' | node workflow/lib/budget.mjs --kind nosuchkindexits non-zero and printsnosuchkind -
printf 'x' | node workflow/lib/budget.mjs --fit --kind nosuchkindexits non-zero and printsUNBUDGETED, notOVER -
printf 'x' | node workflow/lib/budget.mjs --kind journalEntryexits 0 -
printf 'x' | node workflow/lib/budget.mjs --kind commentexits non-zero, naming the missing marker -
printf 'x<sub>…marker…</sub>' | node workflow/lib/budget.mjs --kind commentexits 0, with the realidentity.commentMarkerfromloop-config.jsonappended -
node --test workflow/lib/budget.test.mjspasses — 8 of 8 or more once feat(loop): a review body gets its own budget kind, and the rules that spend it #153 is in -
node --test dispatcher/test/*.test.mjspasses — 106 passed onmainin this run -
claude plugin validate ./workflow --strictprints√ Validation passedand exits 0 — this is whatmainreports in this run, not the four${CLAUDE_PLUGIN_ROOT}warnings feat(loop): a review body gets its own budget kind, and the rules that spend it #153's body quotes -
node workflow/lib/rule-delta.mjs --base main workflow/skills— account for every removed directive, since both phases rewrite run-loaded prose
Downstream impact
No consumer repo file changes, so contractSync is not involved. But budget.mjs is invoked by every run in all five repos, and after Phase 1 a mistyped --kind fails a run instead of passing it. The two skills whose instruction changes are read on every dispatch.
Open questions
- Does
--fitenforce the marker too?fit()cuts list items from the end of📄 Didand is journal-only, andjournalEntryis not marker-required — so the interaction may be unreachable. Confirm before adding a guard for it. - Does
check()enforce the marker unconditionally, or behind a flag? Unconditional means a maintainer measuring a draft before appending the marker gets a failure. Arguably correct — that draft is not the artifact the budget measures — but it is a behaviour change for a human at a terminal.
Notes
Blocked by: #145 — this ticket's reviewBody budget, never-cut rule and corpus test all land with #153, which closes #145.
- Found while reviewing feat(loop): a review body gets its own budget kind, and the rules that spend it #153, which named both gaps without filing either. chore(loop): a review body has no budget kind, so reviews cut their own evidence to fit #145's own Notes names the
budget.mjs:194gap as "named, not filed", so this ticket is that filing. Phase 2 came from feat(loop): a review body gets its own budget kind, and the rules that spend it #153's review thread, which asked whether the prose rule is the final home. @sydevs-bot implementstarts the work. Nothing here is permission to begin.- Anomaly.
claude plugin validate ./workflow --strictreports√ Validation passedwith zero warnings onmainata45fc7d, under Claude Code 2.1.290. chore(loop): a review body has no budget kind, so reviews cut their own evidence to fit #145 reports three unquoted-${CLAUDE_PLUGIN_ROOT}warnings and feat(loop): a review body gets its own budget kind, and the rules that spend it #153 reports four.workflow/hooks/hooks.jsonquotes all four occurrences onmaintoday. Recorded, not explained. - Not verified: SahajAtlasWeb#233 and the other cited PRs. They live in repos outside this run's scope, so their measurements stand as the filing sessions' own.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Oct 6, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Oct 6, 2026
✍️ Revised against
mainata45fc7d. The title and type stand.Blocked by #145. Three of this ticket's premises exist only on #153's unmerged branch: the
reviewBodybudget, preflight's never-cut rule, and the corpus test. Onmainthere is noreviewBodykey andbudget.test.mjshas six tests. Added the marker line, so the dispatcher parks this until #153 merges and closes #145.Two parts became two phases on one PR. The body said each lands on its own. A ticket is built in phases, never split.
Both decisions are now taken, from the code.
--fitexits 1 onUNBUDGETEDandhandler-journalsaysExit 1 → cut prose. So the fix must key on the verdict word, not the exit code.budget.mjsis the only reader ofwriting.budgets, and both lookups need a number. A siblingmarkerRequiredlist keeps that contract; a per-kind object breaks it.Also: the lean gate is clean on
main, so checklist item 6's four warnings are gone.@sydevs-bot implementstarts the work.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
sydevs-bot commentedon Oct 6, 2026
@Ardnived unblocked: every blocker is closed. Say
@sydevs-bot implementto start.🤖 sydevs dispatcher
Ardnived commentedon Oct 6, 2026
@sydevs-bot implement
fix(loop): an unbudgeted kind fails, and budget.mjs owns the marker r…