Repository navigation
perf(loop): cut the four fixed costs every run pays - #62
Merged
Merged
Conversation
This was referenced Sep 7, 2026
`preflight/SKILL.md` and `journal/SKILL.md` both document the invocation as
`${CLAUDE_PLUGIN_ROOT}/lib/budget.mjs`, with no interpreter. The file shipped
`-rw-r--r--`, so that line fails with `Permission denied` and every run pays a
turn learning to retry it with `node`. The 2026-09-07 15:04 run lost four
checks to it at once, one per review reply.
Mode only. No content change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`check()` answers over or under and nothing else, so a run that went over regenerated the whole body, re-checked, and repeated. On 2026-09-07 the 17:03 run did that thirteen times between 17:38:45 and 17:49:38 to shed 1,557 characters. It converged at 3,999 of 4,000, then wrote a fresher `Last:` timestamp into the same body and spent four more re-checks. The 15:04 run, twelve minutes long in total, spent 1 minute 43 on five rewrites of the same shape. Every one of those rewrites applied a rule already written down and already fixed: drop the oldest `Did` lines first, never cut a failure. So `--fit` applies it once. The section is the only thing it touches — a failure, a ceiling, a friction line and the run table all survive, and the heading goes when the section empties, which the skill already required. `--fit` writes the fitted body to stdout and its verdict to stderr, so a redirect never swallows the report. It exits 1 only when dropping every `Did` line still leaves the body over, which is the one case a run must judge. `--kind` mode is unchanged, since both skills document it. `FIT_RESERVE` is 200, and it is a script constant rather than a `loop-config.json` value so this ships without a ceiling change beside it. A body fitted to the last character breaks on the next edit, and the next edit is a timestamp the journal step always writes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… blocked A run learns this by failing. On 2026-09-07 the 17:03 run issued `sleep 200; echo done` in the foreground, the bash hook refused it, and the run retried it backgrounded. That is one blocked call per run that waits. The same run then left five overlapping waiters alive at once — three background sleeps and two `until` loops — and each one notified separately. So the rule names the count as well as the form. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Fields are readable but not searchable, so the census fetches a whole repo's issues to see `Stage` at all. That call is unavoidable. Making it five times a run is not. The searches above it already name every repo holding a candidate. A repo none of them named has no issue to attach a field to, so its response — 8 to 29 KB, measured on 2026-09-07 — is read, carried through the rest of the run's context, and used for nothing. Four consecutive runs that day, 12:05 to 15:04, stopped at `wipCapPerRepo` with no work to start, and each paid for all five. Nothing downstream loses data. `list_issues` only attaches fields to issues the searches already returned, and the WIP gate counts PRs from the PR search. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…refuses `EnterWorktree` names its own branch `worktree-<name>`. A cloud session can only push to `claude/*`, so the run renames it, and `ExitWorktree` then holds bookkeeping for a branch that no longer exists. On 2026-09-07 the 17:03 run hit exactly that: `ExitWorktree` refused with "15 commits on `worktree-claude+feat-lecture-user-choices`", a name `git branch -vv` did not list. The run kept the worktree rather than force a destructive removal with no human present, the stop hook then flagged the leftover directory as untracked, and proving it safe to delete took seven more calls. The journal records the same tool refusing twice. So step 6 creates the worktree with `git worktree add -b claude/<type>-<slug>` and enters it by path, which the tool supports and which never renames anything. Step 12 removes it with `git worktree remove`, since `ExitWorktree` does not remove a worktree entered by path. `discard_changes` stays forbidden: the refusal it silences is the one guard against dropping unpushed work. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The installed plugin caches by `version`, so an unchanged string keeps the old skills however far `main` has moved. Four skills changed here. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Ardnived
force-pushed
the
claude/perf-run-speed
branch
from
September 7, 2026 19:02
515b9ee to
c3e3772
Compare
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four of the six findings from a timing audit of
sydevs-work-hourlyandsydevs-survey-nightly— 16 run sessions, three transcripts read end to end. Every figure below is measured from a run log, not estimated.The two findings left out are the CI watch and the webhook triggers. Both are bigger, and both change what a run decides, not what it spends. They follow in a second PR.
Why these ship together
Each is a fixed cost every run pays, none of them changes a rule about what work to pick, and each commit reverts on its own. Naming the failure each one prevents:
10a3ac3executablebudget.mjs${CLAUDE_PLUGIN_ROOT}/lib/budget.mjswith no interpreter. At-rw-r--r--that line returnsPermission denied, and every run pays a turn retrying it withnode. Mode only.cfb6518--fitf78c348the wait idiomsleep 200; echo donein the foreground, the hook refused it, and it retried backgrounded — then left five overlapping waiters alive at once.fe1f082two-stage censuslist_issuescalls at 8–29 KB each fire every run, including on repos no search named. Four runs that day (12:05–15:04) stopped atwipCapPerRepowith nothing to start, and each paid for all five.3d0fce6worktree on its final branchExitWorktreerefused with "15 commits onworktree-claude+feat-lecture-user-choices" — a branchgit branch -vvdid not list, because the run had renamed it to push. Proving the leftover directory safe to delete took seven more calls. The journal records this tool refusing twice.515b9eeversion bumpversion. Four skills changed here.No ceiling change
loop-config.jsonis untouched, so the hard split holds.FIT_RESERVE(200 characters of headroom) is a script constant with a--reserveoverride, not awriting.budgetskey, for exactly that reason. Moving it into config is a value-only follow-up if you want it tunable.What
--fitwill and will not cutIt drops the oldest
📄 Didlines, which is the cut orderjournal/SKILL.mdalready fixed, and takes the heading with them when the section empties — also already required. It never touches⚠️ Failed,⏭️ Ceiling,🧭 Frictionor the run table. It exits 1 only when dropping every📄 Didline still leaves the body over, which is the one case a run must judge for itself.--kindmode is unchanged, since both skills document it.Verification
claude plugin validate ./workflow --strict— passed.rule-delta.mjs --base origin/main workflow/skills— 57 → 58 directives, one added (Never pass discard_changes), none removed.ste-lint.pyon the three changed skills — 21 violations, all on pre-existing lines; no added line is flagged.--fitexercised against synthetic journal bodies at 3.6 KB, 7.3 KB and 18.9 KB: fits to 3,636/4,000 in one call each, keeps every⚠️/⏭️/🧭line and all three table rows, and returns exit 1 with the shortfall when an oversized🧭 Frictionsection makes the body unfittable.What is not fixed here
.claude/worktrees/is gitignored only in this repo, so the stop hook flags it as untracked at the end of every implementation run in the other four. That fix cannot live in this PR — one PR per repo. Four one-line PRs follow.