beads-cleanup
Use when a Beads coordinator needs to reconcile stale worker state, PR-review bookkeeping, or orphaned worktrees before dispatching new work.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- beads-cleanup
- metadata
- { "owner": "tze", "status": "active", "authors": [ "tze", "OpenAI Codex", "Claude Opus 5.5" ], "last_reviewed": "2026-10-27" }
- description
- Use when a Beads coordinator needs to reconcile stale worker state, PR-review bookkeeping, or orphaned worktrees before dispatching new work.
- compatibility
- Requires a Beads-backed git repository with `bd`, `git`, `gh`, `jq`, and git worktree support. Authenticated GitHub access is required for report-only PR reconciliation.
02 资源文件 7
- 参考文档agents/openai.yaml280 B
- 参考文档references/local-state-reconciliation.md4.3 KB
- 参考文档references/pr-review-reconciliation.md5.2 KB
- 参考文档references/reporting.md3.3 KB
- 脚本scripts/cleanup_scan.py50.3 KB
- 脚本tests/test_cleanup_scan.py89.3 KB
- 脚本tests/test_skill_package.py6.2 KB
03 SKILL.md 正文
Beads Cleanup
Run this skill before a beads-coordinator loop when stale worker state may
have been left behind by crashes, compaction, out-of-token exits, or missed
handoffs.
This skill is a read-only reconciliation pass. It reports Beads and Git evidence for the coordinator; it does not implement code, dispatch workers, or mutate lifecycle state.
Use This Skill When
- starting or resuming a
beads-coordinatorloop - recovering after a crashed coordinator or killed worker
- auditing stuck
in_progress,blocked,pr-review, orreview-runningstate - reporting orphaned coordinator worktrees or branches tied to Beads issues
- sizing build-artifact directories (
--artifact-root) whose bead is closed or whose PR merged, so the coordinator can reclaim disk
Do Not Use This Skill When
- implementing the assigned issue itself
- performing normal ready-work selection or worker dispatch
- creating new beads for discovered work
- repairing GitHub review threads inside an active PR review worker
Source Of Truth
This skill is a routing layer over the existing Beads operating model.
- Repository workflow and ownership model:
../../../../../README.md - Coordinator mutation authority, atomic claim, and stall-heartbeat rules:
../beads-coordinator/references/runtime-and-safety.md - Coordinator loop and PR-review lane behavior:
../beads-coordinator/references/coordinator-loop.md - PR-review worker closure boundary and review-lock vocabulary:
../beads-pr-reviewer-worker/SKILL.md
If these sources disagree with this skill, fix this skill. Do not let cleanup become a competing doctrine.
Non-Negotiable Boundaries
- Never implement code.
- The coordinator is the sole mutation authority. Cleanup never claims, releases, creates, closes, relabels, unblocks, removes a worktree, deletes a branch, or repairs Dolt. It reports evidence and recommendations only.
- Never mutate a bead held by a live actor. A holder is live when its bead
heartbeat is fresh or its assignee is a live registered coordinator (peers
sleeping between wakes let bead heartbeats lapse), per
../beads-coordinator/references/runtime-and-safety.md→ "Parallel Coordinators". Another coordinator's claims, worktrees, and PRs are not orphans while it is live. - Never mutate PR-review bead state from PR outcome. Cleanup inspects PR state and reports the finding plus a recommended action; the coordinator's Step 0 is the sole PR-state mutator.
- Never create new beads from cleanup. Missing wiring should be reported for the coordinator loop to self-heal.
- Never touch
.beads/dolt/manually. - Inspect token-efficiently (
../../references/token-efficiency.md): project everybd/ghlisting throughjqto the fields the pass needs, batch related checks into one composite command, and keep the final report to findings and recommendations — not raw command output.
Load Only The Reference You Need
references/local-state-reconciliation.mdLoad for stalein_progressclaims, dependency unblocking, Dolt/worktree health, and stalereview-runninglabels.references/pr-review-reconciliation.mdLoad for blocked originalpr-reviewbeads and blockedpr-review-taskreview beads.references/reporting.mdLoad for the cleanup report shape, rig-routing notes, command quick reference, and coordinator handoff summary.scripts/cleanup_scan.pyRun first for one compactbeads-cleanup-scan/v1read model covering claims, dependencies, Dolt, worktrees/branches, review locks, and nested PR findings. It is report-only: it has no apply mode and never replaces fresh verification before a coordinator-owned mutation.
Workflow
- Read
../beads-coordinator/references/runtime-and-safety.mdif you need the exact claim, stall-heartbeat, and mutation-authority rules before handing a finding to the coordinator. - From the cleanup package directory, run
uv run scripts/cleanup_scan.py --repo-root "${REPO_ROOT}"(plus one--artifact-root <dir>per artifact root the repo'sAGENTS.mdnames) to collect compact read-only findings. Treatpartialandfatalas manual-triage reports; do not forward command output or infer a mutation from them. - Use the relevant passes from the reference files to interpret the report. When evidence is incomplete or a bead is held by a live actor (fresh heartbeat), report manual triage. For PR-review beads, report findings only.
- Keep canonical PR metadata on the original implementation bead only; review
beads must not invent their own
external_ref. - Report worktrees and branches conservatively. Preserve anything that may still contain useful unpublished work.
- Produce the structured report from
references/reporting.mdso the coordinator has a clear evidence ledger before dispatch begins.
04 同仓库更多 Skills
progress-dashboard
Use when asked to "give this session a dashboard", "show loop progress", "monitor subagents", or "steer this run in a browser": a durable local workspace for current work, findings, agents, measured usage and feedback.
spec-concretization
Use when specs and implementation must be fully reconciled in both directions — code doing things no spec describes, specs requiring things the code doesn't do yet, or the two disagreeing — and the result must land as vision-gated spec updates plus a complete, backlog-deduplicated work plan. Also the read-only audit form ("does code match the spec?"), and re-runs that must not duplicate prior findings. Triggers: "reconcile spec vs implementation", "does code match the spec", "what's implemented but undocumented", "what's specified but not built", "the code is ahead of the spec", "plan the work to finish the spec", "concretize the specs".
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.