
























@@ -1,35 +1,58 @@
11---
22name: clawsweeper
3-description: Inspect ClawSweeper commit-review and issue/PR-sweeper reports for OpenClaw, including recent per-commit reports, finding summaries, GitHub Checks, Actions monitoring, manual backfills, and report links.
3+description: Use for all ClawSweeper work: OpenClaw issue/PR sweep reports, commit-review reports, repair jobs, cloud fix PRs, comment commands, trusted ClawSweeper-reviewed automerge, GitHub Actions monitoring, permissions, gates, and manual backfills.
44---
5566# ClawSweeper
778-ClawSweeper lives at `~/Projects/clawsweeper`. Use this skill when Peter asks
9-about ClawSweeper reports, commit-review checks, recent findings, historic
10-backfills, or whether the sweeper/dispatch lane is healthy.
8+ClawSweeper lives at `~/Projects/clawsweeper`. It is the one OpenClaw
9+maintenance bot for sweeping, commit review, repair jobs, and guarded fix PRs.
10+Use this skill whenever Peter asks about reports, findings, dispatch health,
11+repair/cloud PR creation, comment commands, automerge, permissions, or gates.
11121213## Start
13141415```bash
1516cd ~/Projects/clawsweeper
16-git status --short
17+git status --short --branch
1718git pull --ff-only
18-pnpm run build
19+pnpm run build:all
1920```
202121-Do not overwrite unrelated local edits. If the tree is dirty, inspect status
22-and keep report-reading commands read-only unless Peter asked to commit.
22+Do not overwrite unrelated edits. If the tree is dirty, inspect first and keep
23+read-only report work read-only unless Peter asked to commit.
232424-## Recent Commit Reports
25+## One Bot, One App
252626-Canonical reports are flat:
27+Use the ClawSweeper repo and the `openclaw-ci` GitHub App. Use only
28+`CLAWSWEEPER_*` configuration for this automation.
29+30+Required app setup:
31+32+- `CLAWSWEEPER_APP_CLIENT_ID`: public app client ID for `openclaw-ci`.
33+- `CLAWSWEEPER_APP_PRIVATE_KEY`: private key used only inside
34+`actions/create-github-app-token` steps.
35+- Target app permissions: read target scan context; write issues and pull
36+ requests; optional Checks write for commit check runs; optional Actions write
37+ on `openclaw/clawsweeper` for app-token dispatch/cancellation.
38+39+Token boundary:
40+41+- Codex workers do not get mutation credentials.
42+- Review workers run with stripped secret/token env.
43+- Deterministic scripts own comments, labels, branch pushes, PR creation,
44+ closes, and merges through short-lived GitHub App tokens.
45+- Merge and write gates default closed.
46+47+## Commit Reports
48+49+Canonical commit reports:
27502851```text
2952records/<repo-slug>/commits/<40-char-sha>.md
3053```
315432-Use the lister instead of browsing date folders:
55+Use the lister:
33563457```bash
3558pnpm commit-reports -- --since 6h
@@ -39,100 +62,222 @@ pnpm commit-reports -- --repo openclaw/openclaw --author steipete --since 7d
3962pnpm commit-reports -- --since 24h --json
4063```
416442-One report per commit. Reruns overwrite the same SHA-named file. Results:
43-`nothing_found`, `findings`, `inconclusive`, `failed`, `skipped_non_code`.
65+Results: `nothing_found`, `findings`, `inconclusive`, `failed`,
66+`skipped_non_code`. One report per SHA; reruns overwrite the SHA-named report.
67+68+Manual rerun/backfill:
69+70+```bash
71+gh workflow run commit-review.yml --repo openclaw/clawsweeper \
72+ -f target_repo=openclaw/openclaw \
73+ -f commit_sha=<end-sha> \
74+ -f before_sha=<start-or-parent-sha> \
75+ -f create_checks=false \
76+ -f enabled=true
77+```
78+79+Use `create_checks=true` only when Peter explicitly wants target commit Check
80+Runs. Add `-f additional_prompt="..."` for focused one-off review instructions.
81+82+## Sweep Reports
83+84+Issue/PR reports live at:
448545-## Monitor Actions
86+```text
87+records/<repo-slug>/items/<number>.md
88+records/<repo-slug>/closed/<number>.md
89+```
469047-Receiver lane in `openclaw/clawsweeper`:
91+Lead with counts, concrete findings, and report links. Do not post unsolicited
92+GitHub comments from report-reading work. Public surfaces are markdown reports,
93+durable ClawSweeper review comments, and optional checks.
94+95+Useful commands:
48964997```bash
50-gh run list --repo openclaw/clawsweeper --workflow "ClawSweeper Commit Review" \
51- --limit 12 --json databaseId,displayTitle,event,status,conclusion,createdAt,updatedAt,url
52-gh run list --repo openclaw/clawsweeper --workflow "ClawSweeper Commit Review" \
53- --status in_progress --limit 20 --json databaseId,displayTitle,event,status,createdAt,url
98+pnpm run status
99+pnpm run audit
100+pnpm run reconcile
101+pnpm run apply-decisions -- --dry-run
54102```
5510356-Target dispatcher in `openclaw/openclaw`:
104+## Create One Repair Job
105+106+Create a job from issue/PR refs and a maintainer prompt:
5710758108```bash
59-gh run list --repo openclaw/openclaw --workflow "ClawSweeper Dispatch" \
60- --event push --limit 8 --json databaseId,displayTitle,event,status,conclusion,headSha,url
61-git ls-remote https://github.com/openclaw/openclaw.git refs/heads/main
109+pnpm run repair:create-job -- \
110+ --repo openclaw/openclaw \
111+ --refs 123,456 \
112+ --prompt-file /tmp/clawsweeper-prompt.md
62113```
6311464-Check the target commit's published report check:
115+Create from an existing ClawSweeper report:
6511666117```bash
67-gh api "repos/openclaw/openclaw/commits/<sha>/check-runs?per_page=100" \
68- --jq '.check_runs[] | select(.name=="ClawSweeper Commit Review") | [.status,.conclusion,.details_url] | @tsv'
118+pnpm run repair:create-job -- \
119+ --from-report ../clawsweeper/records/openclaw-openclaw/items/123.md
120+```
121+122+The job creator checks for an existing open PR, body match, or remote
123+`clawsweeper/<cluster-id>` branch before writing another job. Use `--dry-run`
124+to inspect. Use `--force` only after deciding the duplicate guard is stale.
125+126+Validate, commit, then dispatch:
127+128+```bash
129+pnpm run repair:validate-job -- jobs/openclaw/inbox/clawsweeper-openclaw-openclaw-123.md
130+pnpm run repair:dispatch -- jobs/openclaw/inbox/clawsweeper-openclaw-openclaw-123.md \
131+ --mode autonomous \
132+ --runner blacksmith-4vcpu-ubuntu-2404 \
133+ --execution-runner blacksmith-16vcpu-ubuntu-2404 \
134+ --model gpt-5.5
135+```
136+137+Do not dispatch a just-created job before the job file is committed and pushed;
138+the workflow reads the job path from GitHub.
139+140+## Replacement PRs
141+142+For a useful but uneditable/stale/unsafe source PR, make the maintainer prompt
143+explicit:
144+145+```md
146+Treat #123 as useful source work. If the source branch cannot be safely updated
147+because it is uneditable, stale, draft-only, unmergeable, or unsafe, create a
148+narrow ClawSweeper replacement PR instead of waiting. Preserve the source PR
149+author as co-author, credit the source PR in the replacement PR body, and close
150+only that source PR after the replacement PR is opened.
69151```
7015271-## Manual Commit Rerun / Backfill
153+The worker should emit `repair_strategy=replace_uneditable_branch` and list the
154+source PR URL in `source_prs`. The deterministic executor opens or updates
155+`clawsweeper/<cluster-id>`, adds non-bot source authors as `Co-authored-by`
156+trailers, and closes superseded source PRs only after replacement exists.
7215773-Use the receiver workflow when Peter asks to rerun a specific commit report,
74-review a specific commit, or backfill a historic range. Reruns overwrite the
75-same canonical report file:
76-`records/<repo-slug>/commits/<40-char-sha>.md`.
158+## Gates
7715978-Single-commit rerun:
160+Open execution windows intentionally and close them after the run:
7916180162```bash
81-gh workflow run commit-review.yml --repo openclaw/clawsweeper \
82- -f target_repo=openclaw/openclaw \
83- -f commit_sha=<sha> \
84- -f before_sha=<parent-sha> \
85- -f create_checks=false \
86- -f enabled=true
163+gh variable set CLAWSWEEPER_REPAIR_ALLOW_EXECUTE --repo openclaw/clawsweeper --body 1
164+gh variable set CLAWSWEEPER_REPAIR_ALLOW_FIX_PR --repo openclaw/clawsweeper --body 1
165+gh variable set CLAWSWEEPER_REPAIR_ALLOW_MERGE --repo openclaw/clawsweeper --body 0
166+gh variable set CLAWSWEEPER_REPAIR_ALLOW_AUTOMERGE --repo openclaw/clawsweeper --body 0
87167```
8816889-Historic range backfill:
169+Reset execute/fix gates to `0` after the window. Keep merge gates closed unless
170+Peter explicitly opens a merge/automerge window.
171+172+Important gates:
173+174+- `CLAWSWEEPER_REPAIR_ALLOW_EXECUTE`: allows deterministic write lanes.
175+- `CLAWSWEEPER_REPAIR_ALLOW_FIX_PR`: allows branch repair/replacement PRs.
176+- `CLAWSWEEPER_REPAIR_ALLOW_MERGE`: allows merge-capable applicators.
177+- `CLAWSWEEPER_REPAIR_ALLOW_AUTOMERGE`: allows comment-router automerge.
178+- `CLAWSWEEPER_REPAIR_COMMENT_ROUTER_EXECUTE`: lets scheduled comment routing
179+ post replies and dispatch repair.
180+181+## Comment Commands
182+183+Maintainers can use:
184+185+```text
186+/clawsweeper status
187+/clawsweeper fix ci
188+/clawsweeper address review
189+/clawsweeper rebase
190+/clawsweeper automerge
191+/clawsweeper explain
192+/clawsweeper stop
193+@openclaw-clawsweeper fix ci
194+```
195+196+Default accepted maintainers: `OWNER`, `MEMBER`, `COLLABORATOR`; fallback
197+repository permission accepts `admin`, `maintain`, or `write`. Contributor
198+comments are ignored without a reply.
199+200+Run router manually:
9020191202```bash
92-gh workflow run commit-review.yml --repo openclaw/clawsweeper \
93- -f target_repo=openclaw/openclaw \
94- -f commit_sha=<end-sha> \
95- -f before_sha=<start-sha> \
96- -f create_checks=false \
97- -f enabled=true
203+pnpm run repair:comment-router -- --repo openclaw/openclaw --lookback-minutes 180
204+pnpm run repair:comment-router -- --repo openclaw/openclaw --execute --wait-for-capacity
98205```
99206100-Use `create_checks=true` only when Peter explicitly wants target commit check
101-runs. Checks are opt-in; markdown reports are the primary surface.
207+Scheduled routing stays dry unless
208+`CLAWSWEEPER_REPAIR_COMMENT_ROUTER_EXECUTE=1`.
209+210+## Trusted Automerge
102211103-For a targeted rerun with extra instructions, add `additional_prompt`:
212+`/clawsweeper automerge` opts an existing PR into the bounded loop. The router:
213+214+- verifies maintainer authorization;
215+- labels the PR `clawsweeper:automerge`;
216+- dispatches ClawSweeper review for the current head SHA;
217+- creates or reuses a durable adopted job;
218+- repairs at most the configured caps;
219+- merges only when ClawSweeper passed the exact current head, checks are green,
220+ GitHub says mergeable, no human-review label is present, and both merge gates
221+ are open.
222+223+If ClawSweeper passes while merge gates are closed, it labels
224+`clawsweeper:merge-ready` and comments instead of merging. `/clawsweeper stop`
225+adds `clawsweeper:human-review`.
226+227+Repair caps:
104228105229```bash
106--f additional_prompt="Review this commit with focus on <topic>."
230+CLAWSWEEPER_REPAIR_MAX_REPAIRS_PER_PR=5
231+CLAWSWEEPER_REPAIR_MAX_REPAIRS_PER_HEAD=1
107232```
108233109-After dispatch, monitor and then pull the regenerated report:
234+## Security Boundary
235+236+Do not stage security-sensitive work for ClawSweeper Repair. Route vulnerability
237+reports, CVE/GHSA/advisory work, leaked secrets/tokens/keys, plaintext secret
238+storage, SSRF, XSS, CSRF, RCE, auth bypass, privilege escalation, and sensitive
239+data exposure to central OpenClaw security handling.
240+241+For adopted automerge jobs, trust deterministic ClawSweeper security markers,
242+labels, and job frontmatter; do not infer security handling from vague prose.
243+244+## Monitoring
245+246+Receiver workflows:
110247111248```bash
112249gh run list --repo openclaw/clawsweeper --workflow "ClawSweeper Commit Review" \
113- --limit 5 --json databaseId,displayTitle,status,conclusion,url
114-gh run watch <run-id> --repo openclaw/clawsweeper --interval 30 --exit-status
115-git pull --ff-only
116-sed -n '1,180p' records/openclaw-openclaw/commits/<sha>.md
250+ --limit 12 --json databaseId,displayTitle,event,status,conclusion,createdAt,updatedAt,url
251+gh run list --repo openclaw/clawsweeper --workflow "repair cluster worker" \
252+ --limit 12 --json databaseId,displayTitle,event,status,conclusion,createdAt,updatedAt,url
253+gh run list --repo openclaw/clawsweeper --workflow "repair comment router" \
254+ --limit 12 --json databaseId,displayTitle,event,status,conclusion,createdAt,updatedAt,url
117255```
118256119-## Report Reading
257+Target dispatcher:
120258121-Lead with counts and useful findings:
259+```bash
260+gh run list --repo openclaw/openclaw --workflow "ClawSweeper Dispatch" \
261+ --event push --limit 8 --json databaseId,displayTitle,event,status,conclusion,headSha,url
262+```
263+264+Target commit check:
122265123266```bash
124-pnpm commit-reports -- --since 24h
125-pnpm commit-reports -- --since 24h --findings
267+gh api "repos/openclaw/openclaw/commits/<sha>/check-runs?per_page=100" \
268+ --jq '.check_runs[] | select(.name=="ClawSweeper Commit Review") | [.status,.conclusion,.details_url] | @tsv'
126269```
127270128-If findings exist, open the markdown report and summarize:
271+## Reading Output
272+273+For findings or failures, summarize:
129274130-- SHA and author/co-authors
131-- result, confidence, severity, check conclusion
132-- concrete finding and affected file
133-- whether the report includes tests/live checks
134-- GitHub report URL:
135- `https://github.com/openclaw/clawsweeper/blob/main/<report-path>`
275+- target repo, item/PR/commit, run, report path
276+- result, confidence, severity, and exact blocker
277+- affected files or cluster refs
278+- validation commands and whether they passed
279+- whether mutation gates were open or closed
280+- next deterministic action
136281137-Do not post GitHub comments from this lane. Commit Sweeper's public surfaces are
138-markdown reports and the `ClawSweeper Commit Review` check.
282+Keep the broom small: one cluster, one branch, one PR, narrow proof, clear
283+owner-visible evidence.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。