cleanup-fleet
Take one bucket of audit findings (a label like documentation, drift, or bug) and fan out one background agent per repo to fix every open issue carrying it fleet-wide. The fix-half of /audit-fleet — e
Files1
View on GitHubSKILL.md.claude/skills/cleanup-fleet/SKILL.md
GitHubcleanup-fleet
Capability preflight: read workflow-capabilities and bind dispatch, results, waits, cancellation, model tiers and questions to this session’s actual tools before proceeding. Tool names below are conditional examples (Claude Code only); the contract governs adaptation. Keep this skill’s worktree, independent-review, human-review and shipping gates.
Goal: /audit-fleet finds and files codebase findings, bucketed into seven labels, /design-sweep files an eighth (design-drift) /prompt-audit a ninth (prompt-drift) and /system-map --coupling a tenth (fleet-contracts); this skill fixes one bucket fleet-wide in a single pass. Pick a bucket → gather every open issue carrying that label → score each for complexity → deploy one background sub-agent per repo, sized via the easy/hard tier policy (docs/model-tiers.md) → aggregate.
security is not a cleanup bucket. /codebase-audit's seven finding buckets (incl. slop) are all queued here; security is the exception — self-healed inline by /codebase-audit itself (step 8b: redacted issue + auto-fix + auto-merge, or escalate on failure). /design-sync's eighth queued bucket is design-drift; its sibling cert-drift is likewise review-only (a tailnet-cert migration must never be auto-applied). /prompt-audit's prompt-drift is the ninth, and it is queued — its tier rule and preservation gate below keep an instruction-file rewrite from dropping a directive. A security or cert-drift label never appears in this skill.
One agent per repo, never two: the audit files exactly one managed issue per (repo, bucket), so one issue → one repo → one agent → one branch → one PR. Two agents on one checkout collide, so the skill hard-caps at one agent per repo per run and defers extras.
Two execution paths, both delegating to existing skills — don't reinvent them:
- Easy tier → full YOLO. The agent runs the
/issue-yolo <N>flow end-to-end: branch, build, validate hard, PR, wait for CI, merge, delete branch, tray restart. No human gate. Each agent fires its own🚀 Shipped #N — PR · <url>ping (the per-PR link is valuable — not suppressed). - Hard tier → build-and-stop. The agent runs
/issue-start <N> now→ build → run the verification gate → STOP before push/PR (the/issue-batchin-place contract). Instead of a diff to review, the agent hands back a plain-English rationale summary — what it did, why, and why it believes the change is correct (see prompt 8b) — so you approve or push back on the logic, not by reading code. You then ship each with/issue-finish.
Arguments
/cleanup-fleet [<bucket>] [<mode>] — both optional, order-independent.
Bucket — fuzzy-matched to one of the ten queued audit labels (case-insensitive; voice-dictation friendly):
| Says | Label |
|---|---|
documentation, docs, doc |
documentation |
drift, claude-drift, cloud drift, claude-md-drift, md-drift |
claude-md-drift |
duplication, dupes, dup, dupe |
duplication |
stale, dead, dead-code |
stale |
maintainability, maint, structure |
maintainability |
slop, bloat, ai-slop |
slop |
bug, bugs |
bug |
design, design-drift, css, css-drift |
design-drift |
prompt, prompt-drift, prompting |
prompt-drift |
contracts, fleet-contracts, coupling, depends-on |
fleet-contracts |
(security is intentionally absent — self-healed inline by /codebase-audit; cert-drift is likewise absent — it's /design-sync's review-only kind, never auto-fixed here.)
If no bucket is given → run step 2's count query, then ask through the available user-input channel, listing the ten queued buckets each with its live open-issue count, and let the user pick.
Mode — hard (default) or easy / silent. (This is the CLI argument, distinct from the per-issue complexity tier below — always read as "hard mode" vs. "hard-tier issue" to keep the two straight.)
hardmode (default) — full sweep: easy-tier issues take the YOLO path, hard-tier issues build-and-stop for review. The plan is presented for approval first.easy/silentmode — only the easy-tier issues, fully unattended (no approval gate). Hard-tier issues are listed but never run ("left for a hard run"). This is the mode to run alongside/audit-fleeton a schedule. Safety property: easy mode can only ever auto-merge work that scored genuinely simple — any hard-tier finding is never executed in this mode.
Execution rules (read before running any command)
- Shell: use the actual execution tool’s declared shell; translate examples without mixing Bash and PowerShell syntax.
- The orchestrator only does cheap, safe work: resolve the bucket, one issue-fetch call, score, plan, per-repo pre-flight, fan-out, aggregate. It never edits source, commits, pushes, or merges — every write happens inside a spawned agent.
- Read the issue JSON directly. Do not spawn jq / python / awk to process the output — group, score, and select model-side.
- One agent per repo, period. Never spawn two agents against the same checkout.
- Never disturb in-progress work. A repo that is dirty or off its default branch is skipped and reported — never stashed, never force-switched.
- Degrade, don't block (so
easy/silentcan run unattended viaclaude -p): a per-repo failure is reported and skipped; only a pre-flight failure stops the whole run. - Drain every worker in the current turn in all modes. Use the capability contract’s dispatch/collect loop. Neither attended mode nor background launch proves automatic reinvocation; scheduled process launching remains owned by the existing runner.
Steps
1. Pre-flight
gh auth status— must be authenticated asferraroroberto. Else stop: "Not authenticated — rungh auth login."- Confirm
E:\automation\exists (the fleet root). Else stop.
2. Resolve bucket + mode
Parse the args (order-independent): the mode token is hard/easy/silent; anything else is the bucket. Map the bucket through the synonym table to its canonical label. Default mode hard. If no bucket token was given, fetch the per-bucket counts and ask:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/gh_issue_fetch.py fetch
Tally open issues per bucket label (drop audit-meta rows; a security or cert-drift row should never appear — neither is queued here — but drop them too if one somehow exists), then ask through the available user-input channel, listing the ten queued buckets with counts.
3. Fetch candidates — direct Issues API, one repo-scoped call per repo
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/gh_issue_fetch.py fetch --label <bucket-label>
Preferred primary fetch, not gh search issues --owner ferraroroberto (Search-API-backed, eventually consistent — observed reporting issues open 5+ weeks after they closed, at real agent and token cost — fleet-config#623). gh_issue_fetch.py uses the direct Issues API, one gh issue list --repo <owner>/<name> --state open per repo. Avoids a known-bad source, not "proven immune" — step 8 still re-checks each selected issue's state immediately before dispatch; the two checks cover different failure modes. Dormant repos (docs/fleet-scope.md) are skipped and named on the SKIPPED_DORMANT= stderr line; add --include-dormant to fetch them.
Read the JSON directly. Drop any row carrying the audit-meta label — those are the per-repo codebase-audit ledger and the audit-fleet digest state issues, never actionable. If the result is empty, print No open <bucket> issues across the fleet 🎉 and stop. If the helper's stderr summary reports any ERROR <repo>: <reason> lines, note them in the plan — those repos are simply absent from this run's candidates, not a run-wide failure.
4. Group by repo + enforce one-agent-per-repo
Bucket the surviving issues by repository.name. For each repo:
- Exactly one candidate → that's the issue for this repo.
- More than one (e.g. the audit-managed bucket issue plus a hand-filed one) → select one and defer the rest to keep a single branch per repo. Preference: (1) the audit-managed bucket issue (body contains
<!-- audit-managed:) — it's the curated checklist; else (2) the smallest / clearest-acceptance one. Record the deferred issues for the plan ("caught next run").
5. Score each selected issue → easy tier or hard tier
Read each selected issue's title + body (for an audit bucket issue, also weigh the checklist length and the nature of its items). Two tiers, S/M/L calibration collapsed to two (see docs/model-tiers.md for how each tier resolves to a model):
- easy tier: narrow surface, mechanical, clear acceptance, no design decision. Doc fixes, a handful of stale-code deletions, a missing README flag, a rename, a few tightly-scoped checklist items.
- hard tier: multi-module, real design choices, a refactor, an unbounded body, or a mixed checklist (trivial and hard items together → treat the whole issue as hard-tier; it absorbs the easy parts too).
design-driftspecifically: pure token/palette/spacing drift is easy-tier; any structural finding — a hand-rolled nav, a forked or re-authored vendored component, a layout rewrite — is hard-tier./design-sync's rule is never re-author nav/components (reuse the vendored snippet, don't rewrite), so adesign-driftissue carrying one is worked build-and-stop for review, never auto-merged.fleet-contractsspecifically (one issue per repo, filed frombuild_data.py --coupling). Fix recipe: declare every real cross-repo reference in the repo's.fleet.tomldepends_on; exempt a reviewed false positive (a path in a docstring example, sample data) with a[contracts] ignore_refsentry{ path, repo, why },whyrequired. A build-time sibling read and a URL in.env.exampleor a sample config are real dependencies: declare them, never ignore them. Edits touch only.fleet.toml, so every such issue is easy-tier; re-runbuild_data.py --couplingand confirm the repo's undeclared count is 0 before merging.prompt-driftspecifically (the one home of this rule;/cleanup-fleet-alllinks here). Tier follows how consequential the rewrite is, not which model runs it (docs/model-tiers.md). Easy: soften ALL-CAPS, delete a verification / re-check / "if in doubt" line, fix a description to third person, add an agent-neutrality marker, trim a time-sensitive phrase, add a contents list to a long reference file (R-35), rewrite a backslash path with forward slashes (R-36), qualify an MCP tool name (R-37), name a default among interchangeable options (R-42), state a bundled script's run-or-read intent and its packages (R-43). Hard (build-and-stop): remove or restructure a step list, resolve a contradiction, flatten a nested reference chain (R-34), re-pin a step's degree of freedom (R-38), add a copyable workflow checklist (R-39), add a validate-fix-repeat loop (R-40), unify a skill's terminology (R-41), fix a skill that regressed on its evals (R-44), any change toglobal-CLAUDE.mdorproject-scaffolding/CLAUDE.md, any fix touching a double-quoted trigger phrase or a marked block./prompt-audittags every checklist item· easy/· hardby this rule and states the issue's tier in its body; take that line as the score, and a mixed checklist is hard per the rounding rule below.
When genuinely on the fence, round up to hard-tier in hard mode (a human will still review it) and down-or-defer in easy/silent mode (never auto-merge something you weren't sure about).
6. Build + present the plan
Render one table and the headline counts:
/cleanup-fleet <bucket> — <mode> mode
repo # title tier model path
---------------- --- ----------------------------- ------- ------ -----------------
photo-ocr 44 audit: documentation findings easy sonnet YOLO → merged
app-launcher 71 audit: documentation findings hard opus build → review
reporting 12 README missing --watch flag easy sonnet YOLO → merged
7 issues: 5 easy-tier (YOLO → merged), 2 hard-tier (build → review)
deferred (1+ per repo): grocery-shopping#9 (hand-filed, next run)
skipped (dirty/off-branch): website
The model column shows sonnet for easy-tier and opus for hard-tier (Claude Code only, today) — the tier split drives both execution shape (full-autonomy vs. review-gated) and model choice; see docs/model-tiers.md.
hardmode: present this plan and wait for explicit approval before spawning. The user may deselect issues or retier them. Do not spawn until approved.easy/silentmode: print the plan to stdout (run-log record), skip the approval gate, and proceed with only the easy-tier rows. List the hard-tier rows as "left for a hard run" — never spawn them.
7. Pre-flight per selected repo
For each repo with a selected (and, in easy/silent mode, easy-tier) issue:
E:\automation\<repo>exists. Else skip + report.git -C E:\automation\<repo> status --porcelainempty. Else skip + report (never stash) — drop it from the run.git -C E:\automation\<repo> fetch origin(once per repo).git -C E:\automation\<repo> worktree list— anything beyond the primary is pre-existing residue or a live human session. Skip + report; never remove a worktree you did not create.
Worktrees always (fleet-config#515): every dispatched agent forces MODE=worktree and works <repo>-wt-<N>, never the primary checkout, for every repo. A running app or a live junction is not a claim holder, so MODE=primary on an unattended dispatch means editing files a live process is serving. Easy-tier agents tear their worktree down themselves (ship or fail); hard-tier agents leave theirs standing for the human's /issue-finish, and report its path.
8. Fan out — one background sub-agent per selected issue
Re-read state first, in one batch. Step 3's fetch is not proven immune to every staleness source (see its caveat), and hard mode's approval wait can itself take long enough for an issue to close meanwhile. Build one JSON array of every still-selected issue ([{"repo": ..., "number": ..., ...other fields...}, ...] — repo a bare name like "task-os", never "owner/name": the helper prepends the owner itself, and a prefixed repo produces a doubled-owner gh argv that fails with a network-sounding error unrelated to the network, fleet-config#706) and pipe it through:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/issue_state_gate.py partition
Read the stdout JSON directly — {"dispatch": [...], "skipped_closed": [...], "unresolved": [...]}. Only dispatch items get a sub-agent below. For every skipped_closed item, drop it and report already closed — dropped, no agent dispatched. For every unresolved item — the check could not establish open vs. closed (network error, rate limit) — also drop it from this run, never guessed as open, and report state unresolved — dropped, not dispatched (<detail>) as its own category, never merged into either the closed count or the dispatched count. The run's final summary must show all three counts (dispatched / already-closed / unresolved) even when the latter two are zero — a run that silently shrank its own working set reads as "nothing to do" (fleet-config#623, #560, #612).
Before the mass easy-tier dispatch below, call
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/rate_gate.py check
once. DECISION=PAUSE → wait via the Monitor tool's until-loop pattern against
the printed WAIT_SECONDS (never RESETS_AT, fleet-config#891) before firing the batch (see
docs/rate-gate.md), then re-check. Cap: 3 pause cycles — still PAUSE
after the third → dispatch nothing and report every selected issue
SKIPPED (session limit — exceeded pause retries) with the gate's REASON/MODE.
OK/UNKNOWN → proceed immediately. A scheduled run (MODE=unattended) with no
fresh signal reads PAUSE, never UNKNOWN (fleet-config#825).
Dispatch one fresh worker per selected issue through the capability contract, with model/effort resolved from the tier. Respect available host slots and the ≤3 Opus window where that model is selected; refill after collecting terminal results. Easy tier does not bypass host slot limits. Without fresh spawn and collection, stop with a concrete standalone-worker handoff; this orchestrator never becomes its own builder or independent reviewer.
8a. Easy-tier prompt
You are clearing GitHub issue #<N> in the <repo> repo, end-to-end, in YOLO mode.
Repo root: E:\automation\<repo>. You are the only agent touching this repo.
HARD RULES — both are live-incident scars, never work around them:
- Never work the primary checkout. Build in an isolated sibling worktree,
always, for every repo — a RUNNING app (the launcher webapp, a tray) or a
live junction is not a claim holder, so an unattended agent otherwise wins
MODE=primary and edits files a live process is serving (fleet-config#515).
Force it, then cd into the printed WORKTREE= path before anything else:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/worktree_claim.py acquire E:\automation\<repo> --issue <N> --force-worktree
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/worktree_claim.py setup-worktree E:\automation\<repo> <N> <branch>
- A live-e2e guard refusal is a hard STOP. Report it and stop; setting
E2E_LIVE=1 or any equivalent override is FORBIDDEN. e2e never targets a
live production instance.
1. Force worktree mode as above and cd into the worktree.
2. Run the /issue-yolo <N> flow in full (it skips Phase 1 since the issue
already exists): Phase 2 branch + build, Phase 3 validate HARD (the
non-negotiable phase — do not weaken it), Phase 4 ship (PR, wait for CI
green unless the diff is provably CI-unrelated per /issue-yolo step 7,
merge and land per /issue-yolo step 8's WORKTREE branch — you forced
worktree mode in step 1, so: no --delete-branch, no `git checkout main`,
`remove-worktree` then `worktree_claim.py land-primary <repo> <N>`, then
delete the refs explicitly; report its PRIMARY= line, tray restart per the
repo's CLAUDE.md), Phase 5 fire the /issue-yolo completion ping.
KEEP Phase 5's ping — it carries this issue's PR link and must go out.
notify_complete.py is the ONLY sanctioned way to send it: never use an MCP
chat tool to find a chat or post it; a silent no-op is correct. Why:
E:/automation/fleet-config/docs/notify-ping.md
prompt-drift issues only (label prompt-drift): Phase 3 must also pass the
preservation gate — from the worktree root, exit 0 required:
E:/automation/fleet-config/.venv/Scripts/python.exe E:/automation/fleet-config/.claude/skills/context-purge/check.py --base origin/<default-branch>
then walk each edited instruction file's directive inventory: every rule,
prohibition, path, command and quoted trigger in the old text is still
discharged by the new. A FAIL, an UNKNOWN (exit 3) or an undischarged
directive is a Phase 3 failure, never a warning. Quote check.py's
PASS/FAIL lines in the PR body's Validation section.
Recurring issues only (body carries `<!-- audit-recurrence:
state=recurring`): Phase 2 also ships one structural check and declares it
in a commit body, with its Structural-scope: line, per the Hard rules'
structural-check rule. Phase 3 runs, from the worktree root, with the
issue body saved to a file outside the worktree:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/audit_issue.py structural-gate --repo-path . --base origin/<default-branch> --issue-body-file <file>
and quotes its STRUCTURAL= line, SCOPE= included, in the PR body's
Validation section and in the Structural line of your report.
STRUCTURAL=fail (REASON=no-scope included) or STRUCTURAL=unknown is a
Phase 3 failure. A body stamped `state=unknown` is not gated: say
`❓ recurrence unknown` in Validation.
3. If validation (Phase 3) fails at any point: STOP, do not push/merge, and
report the failure. YOLO means "no plan gate", not "no safety". Then clean
up after yourself — the open issue is the durable record, the branch is not
(fleet-config#518):
a. gh issue comment <N> --repo ferraroroberto/<repo> with the failure
reason and, if the branch has commits ahead of the default branch, its
HEAD SHA plus a note that it is reflog-recoverable for ~90 days.
b. Tear the worktree down via the helper, never by hand (rm -rf follows
the .venv junction and destroys the primary's real venv):
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/worktree_claim.py remove-worktree <worktree-path>
then `release` the claim and delete the local branch.
c. Verify: `git -C E:\automation\<repo> worktree list` shows the primary
only, `git branch` shows the default branch only, tree clean. Report
honestly if it does not — never claim clean you could not confirm.
Report back, in this exact shape:
- Issue: <repo>#<N> — <title>
- Branch: <branch>
- Result: MERGED (<merge-sha>) | FAILED (<phase + one-line reason>)
- PR: <url or n/a>
- Validation: <one line — what you ran in Phase 3>
- Structural: <the STRUCTURAL= line verbatim, recurring issues only; else n/a>
8b. Hard-tier prompt
You are working GitHub issue #<N> in the <repo> repo, then STOPPING for review.
Repo root: E:\automation\<repo>. You are the only agent touching this repo.
HARD RULES — both are live-incident scars, never work around them:
- Never work the primary checkout. Build in an isolated sibling worktree,
always, for every repo (fleet-config#515 — a RUNNING app or a live junction
is not a claim holder). Force it, then cd into the printed WORKTREE= path:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/worktree_claim.py acquire E:\automation\<repo> --issue <N> --force-worktree
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/worktree_claim.py setup-worktree E:\automation\<repo> <N> <branch>
Report the worktree path — the user needs it to run /issue-finish there.
- A live-e2e guard refusal is a hard STOP. Report it and stop; setting
E2E_LIVE=1 or any equivalent override is FORBIDDEN.
1. Force worktree mode as above and cd into the worktree.
2. Invoke /issue-start <N> now — handles pre-flight, issue read, CLAUDE.md
read, main sync, branch cut, hand-off to implementation in fast mode.
3. Build the change.
4. Run the project's verification gate (per its CLAUDE.md — e.g.
`C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -File scripts/verify-before-ship.ps1`).
prompt-drift issues only (label prompt-drift): also run the preservation
gate from the worktree root and walk each edited instruction file's
directive inventory, exactly as prompt 8a states; a FAIL or UNKNOWN is
Verification: FAIL.
E:/automation/fleet-config/.venv/Scripts/python.exe E:/automation/fleet-config/.claude/skills/context-purge/check.py --base origin/<default-branch>
Recurring issues only (body carries `<!-- audit-recurrence:
state=recurring`): ship one structural check and declare it in the commit
body (step 5) with its Structural-scope: line, per the Hard rules'
structural-check rule, then before STOP run the structural-gate exactly
as prompt 8a states and quote its STRUCTURAL= line, SCOPE= included, in
your summary. STRUCTURAL=fail or STRUCTURAL=unknown is
Verification: FAIL. A `state=unknown` body is not gated: say
`❓ recurrence unknown`.
5. Commit your work on the branch — git add the files you changed and git
commit them (conventional `type: subject` message, no AI-attribution
trailer). Your handoff artefact is a committed branch, not a dirty working
tree: uncommitted work has no SHA, so a crash or an escalation before the
user ships it loses it outright instead of parking it recoverably in the
reflog (fleet-config#641). Changed nothing? Commit nothing and say so — a
clean tree with no new commits is a valid report, a dirty tree never is.
6. STOP. Do NOT push, open a PR, merge, or run /issue-finish. "Do not ship"
does not mean "do not commit": step 5 is required, and only the four
actions named here are forbidden. This issue is hard-tier enough that the
user validates the approach before it ships. The user will NOT read the
diff — they review your summary below, so make it count.
Report back, in this exact shape:
- Issue: <repo>#<N> — <title>
- Branch: <branch>
- Verification: PASS / SKIPPED (<reason>) / FAIL (<short reason>)
- What I did & why: <2-4 plain-English sentences aimed at someone who will
NOT read the diff — the decision you made and the reasoning behind it, not
a code walkthrough>
- Why I believe this is correct: <1-2 sentences — what gives confidence:
what you tested/verified, what edge cases you considered>
If verification FAILS, leave the branch as-is for the user to inspect — do NOT
try to "fix" the failure by guessing; just report.
Substitute every <…> placeholder with the concrete value from steps 2–7.
9. Confirm fan-out, then either stand by (attended) or poll in-turn (unattended)
Print a single confirmation block listing every sub-agent dispatched (repo, #N, model, path) — and, if any hard-tier issues are still queued behind the Opus window (see step 8), note how many are pending.
- All modes: collect every terminal result within this turn, refill the available window and keep timed-out workers pending. Hard-tier branches still stop for human review; easy-tier shipping still requires the independent review in
/issue-yolo.
10. Aggregate as agents return, then the closing ping
Before marking any repo complete, run the post-flight dirty-tree check yourself — never trust the agent's self-report. The agent reporting the result is the same actor that might have forgotten a commit or left something dirty, so this runs in the orchestrator:
- Easy-tier (reported
MERGED):E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/dirty_tree_check.py check E:\automation\<repo> --mode mergedSTATUS=DIRTY→ downgrade the status from✅ mergedto⚠️ merged but dirty tree — inspect <repo>and carry theREASON=line, instead of trustingResult: MERGED.STATUS=UNKNOWN→ the helper could not read that repo, so it has no verdict: mark it❓ tree unverified — <REASON>and never fold it into a pass or a fail (fleet-config#570). - Hard-tier (build-and-stop):
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/dirty_tree_check.py check E:\automation\<repo> --mode built --expect-branch <branch>STATUS=DIRTY→ keep the📋 ready for reviewmark but append an explicit⚠️ post-flight: <REASON>line right next to it, distinct from the rationale summary — this catches HEAD silently back onmain, a branch mismatch, or the agent reporting changes it never actually saved.STATUS=UNKNOWN→ the helper could not read that repo, so it has no verdict: mark it❓ tree unverified — <REASON>and never fold it into a pass or a fail (fleet-config#570).
This check only reports — it never blocks the run, never auto-commits, and never auto-fixes. A per-repo failure never stops the aggregation of the rest.
Then file scaffold promotions for merged generalizable checks. For every easy-tier MERGED report whose Structural: line is STRUCTURAL=pass ... PATH=<path> SCOPE=generalizable NAME=<rule-name>, the orchestrator (never the agent) runs:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/skills/_lib/audit_issue.py promote-check --name <rule-name> --repo-pr <repo>#<pr-number> --path <path>
It prints PROMOTION=created|commented|unknown URL=<url>: one project-scaffolding issue per rule name, deduped by a hidden marker, so a second repo writing the same rule comments instead of filing again (intake contract). Report each line as its own 🧱 summary line. PROMOTION=unknown (a gh failure, or a PR number you could not read from the report) is ❓, never dropped. A hard-tier review row whose summary carries SCOPE=generalizable shows the same command for the human to run after its /issue-finish; this run never files for an unmerged branch.
As each sub-agent finishes, surface its report with a status mark: ✅ merged / ❌ failed for easy-tier; 📋 ready for review / ⚠️ verification skipped / ❌ failed for hard-tier. For every hard-tier report, surface its "What I did & why" and "Why I believe this is correct" text directly, right next to the 📋 ready for review line — the user's approve/ship decision is made from that summary, not by opening the diff, so don't just point at a branch name.
When all agents have returned, fire one final roll-up ping — the closing message for the run. The per-issue 🚀 Shipped pings the easy-tier agents already fired are kept; this is in addition:
E:/automation/fleet-config/.venv/Scripts/python.exe C:/Users/rober/.claude/hooks/notify_complete.py \
--kind cleanup --summary "<bucket>" --merged <easy-tier-merged-count> --review <hard-tier-review-count>
(In easy mode --review 0 — the helper drops the review clause.) Silent no-op if no Telegram chat is configured; always exits 0.
notify_complete.py is the ONLY sanctioned way to send this roll-up ping — never use an MCP chat tool to find a chat or post it, and a silent no-op is correct, not a bug to route around. Why: notify-ping.
Then print the final summary block, with each hard-tier review row carrying its rationale summary inline, and any post-flight dirty-tree finding called out as its own line rather than folded silently into a clean-looking status:
Cleanup complete — <bucket> (<mode> mode)
candidates: 6 dispatched, 1 already-closed (skipped, no agent dispatched), 0 unresolved
✅ merged: <repo>#<N> <pr-url>, …
⚠️ merged but dirty tree — inspect <repo> (<reason>)
📋 review: <repo>#<N> — cd <repo>-wt-<N> && /issue-finish
What I did & why: <the agent's summary, verbatim>
Why correct: <the agent's confidence summary, verbatim>
⚠️ post-flight: <reason, only when the check flagged this repo>
…
❌ failed: <repo>#<N> — <reason> (commented on the issue; branch + worktree torn down)
❌ RESIDUE: <repo> — <what survived teardown> → <one-line recovery command>
🧱 promotion: rule no-raw-sql from <repo>#<pr> — PROMOTION=created URL=<url>
❓ promotion: rule <name> from <repo>#<pr> — PROMOTION=unknown REASON=<reason>
deferred: <repo>#<N> (next run)
Next: read each review row's summary above, then /issue-finish the ones you approve.
The candidates: line is mandatory even when the extra two counts are zero — step 8's state re-check can drop candidates before any agent is dispatched, and a summary that silently shrinks its own working set reads as "nothing to do" (fleet-config#623). already-closed and unresolved are always two separate counts, never combined into one "skipped" number.
11. Stop
No follow-up actions. The user reads each hard-tier row's rationale summary (not the diff) and decides, then ships the ones they approve. Two ways, user's choice — never auto-launch either:
/issue-finish-batch <branches>— once happy with several branches, fan out one background finisher per branch (all at once — this is easy-tier work itself, exempt from the Opus cap), each running/issue-finishone-shot and reporting back only on a genuine blocker. The parallel path./issue-finishper branch, one at a time — the always-available manual fallback.
Do not auto-launch either: the batch finish is user-triggered, exactly like the manual one.
Hard rules
Recap of the binding constraints above — see the referenced step for full detail:
- One agent per repo, period. A bucket is at most one issue per repo by construction; a repo with extras defers them — never two agents on one checkout.
- Easy-tier path is full-YOLO-to-merged; hard-tier path always stops before push/PR. Never let a hard-tier agent merge; never make an easy-tier agent stop early in
hard/easymode. - Whichever tier resolves to Opus on the current host dispatches through the global Opus concurrency window (≤3 in flight); every other tier is exempt. Claude Code only, today: hard-tier resolves to Opus. Refill as each capped agent returns; never a single-message fan-out of many Opus agents at once (
~/.claude/CLAUDE.md, "Spawning sub-agents — cap concurrent Opus at 3"). easy/silentmode never spawns hard-tier work and never merges hard-scored work. Hard-tier rows are listed only — the unattended-safety guarantee.- Hard-tier review is by rationale summary, not diff. Prompt 8b's agent must return "What I did & why" / "Why I believe this is correct"; the orchestrator surfaces both verbatim next to every
📋 ready for reviewrow (steps 9-10). - The orchestrator never edits source, commits, pushes, or merges. Every write happens inside a spawned agent.
- Never disturb in-progress work. Dirty/off-default-branch repos are skipped and reported, never stashed or force-switched.
- Post-flight dirty-tree check runs in the orchestrator, never the sub-agent, right before a repo is marked complete (step 10) — only corrects the reported status, never blocks/auto-commits/auto-fixes.
- Keep per-issue pings. Easy-tier agents fire their own
/issue-yoloping (PR link); the orchestrator's--kind cleanupping is an additional closing roll-up, not a replacement. - Degrade, don't block. A per-repo failure is reported and skipped; only a pre-flight failure stops the whole run.
easy/silentmust never wait on an interactive prompt. - Recurring buckets ship a structural check (fleet-config#1520). An issue whose body is stamped
<!-- audit-recurrence: state=recurring ... -->(findings in two consecutive audits, fleet-config#1513) must also ship one structural check that would have caught the class — a lint rule, a static test, a ratchet — declared on its own line in a branch commit body asStructural-check: <repo-relative path>, or, when no check can encode it,Structural-check: not encodable: <why, at least 8 words>. A real check also declares its scope on a commit-body line:Structural-scope: repo-specific: <why, at least 8 words>orStructural-scope: generalizable: <rule-name>; a check the scaffold already publishes (its[components]catalog), or one that only switches on an existing[conventions_ratchet]rule, isscaffold-ownedand needs none.skills/_lib/audit_issue.py structural-gatejudges the declaration and the scope (STRUCTURAL=pass|fail|n/a|unknownwithSCOPE=repo-specific|generalizable|scaffold-owned|n/a; a missing scope isREASON=no-scope, an unreadable scaffold catalog isunknown); prompts 8a and 8b run it. A merged generalizable check gets one deduped project-scaffolding promotion issue from step 10'spromote-check, run by the orchestrator. Astate=unknownstamp never gates and is reported as❓ recurrence unknown, never as fine. - No AI attribution; no hard-wrapped issue/PR-body paragraphs (per global CLAUDE.md).
Notes
- Where this sits:
/codebase-audit//audit-fleetfind and file (read-only on source);/cleanup-fleetfixes one bucket (write-capable via its agents). - Noise control starts at filing time, not here —
/codebase-audit's materiality bar (fleet-config#251) gates what becomes a checklist item; this skill's triage and approval gate are about execution shape and safety, not deselecting noise. - Compose
/issue-yoloand/issue-start+gate rather than re-implement — they own the branch/build/validate/ship choreography; this skill is just bucket selection, tiering, and fan-out. - Scheduling
easymode: it degrades rather than blocks and never merges hard work, soclaude -p "/cleanup-fleet documentation easy" --permission-mode bypassPermissionsis safe after a weekly/audit-fleet— the easy pass clears the mechanical findings, the rest wait for an attendedhardrun.