claude-dev-env 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -1
- package/hooks/blocking/CLAUDE.md +1 -0
- package/hooks/blocking/code_rules_shared.py +126 -47
- package/hooks/blocking/config/CLAUDE.md +2 -0
- package/hooks/blocking/config/verified_commit_context_constants.py +21 -0
- package/hooks/blocking/config/verified_commit_gate_output_constants.py +14 -0
- package/hooks/blocking/conftest.py +36 -30
- package/hooks/blocking/convergence_gate_blocker.py +76 -8
- package/hooks/blocking/plain_language_blocker.py +8 -0
- package/hooks/blocking/state_description_blocker.py +4 -1
- package/hooks/blocking/test_code_rules_shared.py +120 -20
- package/hooks/blocking/test_convergence_gate_blocker.py +146 -0
- package/hooks/blocking/test_plain_language_blocker.py +15 -0
- package/hooks/blocking/test_state_description_blocker.py +15 -0
- package/hooks/blocking/test_verified_commit_config_bootstrap.py +18 -0
- package/hooks/blocking/test_verified_commit_gate_additional_context.py +134 -0
- package/hooks/blocking/tests/test_verified_commit_gate.py +41 -0
- package/hooks/blocking/verified_commit_config_bootstrap.py +22 -10
- package/hooks/blocking/verified_commit_gate.py +113 -568
- package/hooks/blocking/verified_commit_gate_parts/CLAUDE.md +28 -0
- package/hooks/blocking/verified_commit_gate_parts/__init__.py +1 -0
- package/hooks/blocking/verified_commit_gate_parts/command_tokenization.py +174 -0
- package/hooks/blocking/verified_commit_gate_parts/deny_payload.py +53 -0
- package/hooks/blocking/verified_commit_gate_parts/deny_reason.py +80 -0
- package/hooks/blocking/verified_commit_gate_parts/directory_resolution.py +170 -0
- package/hooks/blocking/verified_commit_gate_parts/gated_invocations.py +205 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/conftest.py +10 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/test_command_tokenization.py +94 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_payload.py +17 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_reason.py +38 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/test_directory_resolution.py +71 -0
- package/hooks/blocking/verified_commit_gate_parts/tests/test_gated_invocations.py +61 -0
- package/hooks/hooks_constants/CLAUDE.md +4 -1
- package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -0
- package/hooks/hooks_constants/convergence_gate_blocker_constants.py +36 -0
- package/hooks/hooks_constants/harness_scratchpad_constants.py +10 -9
- package/hooks/hooks_constants/mypy_integration_constants.py +16 -0
- package/hooks/validators/mypy_integration.py +145 -24
- package/hooks/validators/python_antipattern_checks.py +16 -0
- package/hooks/validators/run_all_validators.py +9 -3
- package/hooks/validators/test_mypy_integration.py +154 -0
- package/hooks/validators/test_python_antipattern_checks.py +112 -1
- package/hooks/validators/test_run_all_validators_pretooluse.py +16 -0
- package/package.json +1 -1
- package/rules/CLAUDE.md +1 -0
- package/rules/verified-commit-gate-skip.md +28 -0
- package/skills/auditing-claude-config/CLAUDE.md +2 -1
- package/skills/auditing-claude-config/SKILL.md +114 -176
- package/skills/auditing-claude-config/reference/probe-hook.md +74 -0
- package/skills/autoconverge/CLAUDE.md +1 -0
- package/skills/autoconverge/SKILL.md +310 -346
- package/skills/autoconverge/reference/CLAUDE.md +1 -0
- package/skills/autoconverge/reference/copilot-findings.md +51 -0
- package/skills/closeout/SKILL.md +7 -9
- package/skills/copilot-finding-triage/SKILL.md +5 -7
- package/skills/copilot-review/CLAUDE.md +3 -2
- package/skills/copilot-review/SKILL.md +119 -155
- package/skills/copilot-review/templates/subagent-prompt.md +49 -0
- package/skills/fresh-branch/CLAUDE.md +6 -9
- package/skills/fresh-branch/SKILL.md +84 -33
- package/skills/fresh-branch/scripts/create_fresh_branch.py +445 -0
- package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/__init__.py +1 -0
- package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/fresh_branch_cli_constants.py +74 -0
- package/skills/fresh-branch/scripts/test_create_fresh_branch.py +670 -0
- package/skills/pr-converge/SKILL.md +277 -422
- package/skills/pr-converge/reference/CLAUDE.md +1 -0
- package/skills/pr-converge/reference/progress-checklist.md +168 -0
- package/skills/pr-converge/test_step5_host_branch.py +8 -6
- package/skills/pr-loop-cloud-transport/SKILL.md +1 -1
- package/skills/privacy-hygiene/SKILL.md +68 -115
- package/skills/privacy-hygiene/reference/sweep-procedure.md +62 -0
- package/skills/session-log/CLAUDE.md +2 -1
- package/skills/session-log/SKILL.md +4 -26
- package/skills/session-log/templates/frontmatter.md +40 -0
- package/skills/skill-builder/CLAUDE.md +8 -7
- package/skills/skill-builder/SKILL.md +26 -11
- package/skills/skill-builder/references/CLAUDE.md +3 -1
- package/skills/skill-builder/references/delegation-map.md +21 -12
- package/skills/skill-builder/references/description-field.md +9 -11
- package/skills/skill-builder/references/deterministic-elements.md +218 -0
- package/skills/skill-builder/references/self-audit-checklist.md +62 -45
- package/skills/skill-builder/references/skill-modularity.md +8 -9
- package/skills/skill-builder/templates/CLAUDE.md +2 -2
- package/skills/skill-builder/templates/gap-analysis.md +15 -0
- package/skills/skill-builder/workflows/CLAUDE.md +5 -5
- package/skills/skill-builder/workflows/improve-skill.md +18 -9
- package/skills/skill-builder/workflows/new-skill.md +23 -15
- package/skills/skill-builder/workflows/polish-skill.md +28 -21
|
@@ -1,346 +1,310 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: autoconverge
|
|
3
|
-
description: >-
|
|
4
|
-
Drives one draft PR to convergence in one autonomous run:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
The
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
`
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
HEAD
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
--
|
|
142
|
-
--
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
`
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
the
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
the
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
`
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
##
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
the
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
the
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
## Multiple PRs
|
|
312
|
-
|
|
313
|
-
When the user names several PRs, run the multi-PR path in
|
|
314
|
-
[`reference/multi-pr.md`](reference/multi-pr.md): one worktree per PR
|
|
315
|
-
(`git worktree add` on each head ref, strict pre-flight per worktree, one
|
|
316
|
-
permission grant per repository, one Copilot quota check for the whole run),
|
|
317
|
-
then a single `workflow/converge_multi.mjs` launch with one entry per PR, then
|
|
318
|
-
the single-PR teardown once per `results` entry and a one-line-per-PR summary.
|
|
319
|
-
|
|
320
|
-
## Self-closing loop: converge the deferred PRs
|
|
321
|
-
|
|
322
|
-
Every autoconverge run — single-PR and multi-PR alike — ends with the
|
|
323
|
-
self-closing loop in
|
|
324
|
-
[`reference/self-closing-loop.md`](reference/self-closing-loop.md): the
|
|
325
|
-
orchestrating session converges the draft environment-hardening PRs the run
|
|
326
|
-
deferred (`deferredPrs` on a single-PR run, `allDeferredPrs` on a multi-PR
|
|
327
|
-
run), then the PRs those runs defer, generation by generation, until a
|
|
328
|
-
generation opens none. An empty seed list ends the loop at once. The reference
|
|
329
|
-
also carries the Conventional-Commit title rule each hardening PR must meet.
|
|
330
|
-
|
|
331
|
-
## Folder map
|
|
332
|
-
|
|
333
|
-
- `SKILL.md` — this hub.
|
|
334
|
-
- `workflow/converge.mjs` — the convergence workflow script.
|
|
335
|
-
- `workflow/converge_multi.mjs` — the multi-PR fan-out driver: one `converge.mjs` child run per PR in parallel, each pinned to its PR worktree via `repoPath`.
|
|
336
|
-
- `workflow/aggregate_runs.py` — merges every autoconverge journal for a PR into one journal and returns its deduped findings, fix summaries, round count, and final SHA.
|
|
337
|
-
- `workflow/convergence_summary.py` — builds the convergence-summary agent prompt over a PR's merged findings.
|
|
338
|
-
- `workflow/render_report.py` — builds the closing convergence insights HTML report, taking the summary from `--summary-file`.
|
|
339
|
-
- `workflow/autoconverge_report_constants/` — named constants for the report builder and the summary prompt.
|
|
340
|
-
- `reference/convergence.md` — the whole loop: reuse pass, round shape, terminal gates, model tiers, ready definition.
|
|
341
|
-
- `reference/stop-conditions.md` — every way the run ends short of ready, including the budget stop.
|
|
342
|
-
- `reference/gotchas.md` — hard-won failure lessons.
|
|
343
|
-
- `reference/closing-report.md` — the closing HTML report: data source, build steps, publishing.
|
|
344
|
-
- `reference/multi-pr.md` — the several-PRs path: per-PR worktrees, the `converge_multi.mjs` launch, per-PR teardown.
|
|
345
|
-
- `reference/self-closing-loop.md` — the deferred-PR generations and the Conventional-Commit title rule.
|
|
346
|
-
- `reference/headless-safety.md` — the agent-prompt preamble and the rm auto-allow paths.
|
|
1
|
+
---
|
|
2
|
+
name: autoconverge
|
|
3
|
+
description: >-
|
|
4
|
+
Drives one draft PR to convergence in one autonomous run: static sweep, then
|
|
5
|
+
code review, bug audit, and self-review on one HEAD, fixes in one commit, then
|
|
6
|
+
Bugbot, Copilot, and Codex as terminal gates before ready. Use when the user
|
|
7
|
+
says '/autoconverge', 'autoconverge this PR', 'converge this PR in one run',
|
|
8
|
+
'run the converge workflow', or 'drive the PR to ready autonomously'.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Autoconverge
|
|
12
|
+
|
|
13
|
+
One launch drives the whole loop to convergence. The `/autoconverge` skill
|
|
14
|
+
resolves PR scope, enters a worktree, grants project permissions, then hands
|
|
15
|
+
the loop to the **`converge.mjs` workflow**, which runs every round and every
|
|
16
|
+
reviewer wait inside one background pass — no ticks, no `ScheduleWakeup`, no
|
|
17
|
+
state file. State lives in the workflow's own variables; resume is handled by
|
|
18
|
+
the workflow journal.
|
|
19
|
+
|
|
20
|
+
`pr-converge` paces the same four-reviewer loop across `ScheduleWakeup` ticks;
|
|
21
|
+
autoconverge runs it as a deterministic workflow. The two skills share the same
|
|
22
|
+
helper scripts and the same convergence gate.
|
|
23
|
+
|
|
24
|
+
## Run scope: one PR or several
|
|
25
|
+
|
|
26
|
+
Decide the scope from how many PRs the user named, then follow that path:
|
|
27
|
+
|
|
28
|
+
1. **One PR** → the single-PR run described below (`workflow/converge.mjs`): one
|
|
29
|
+
worktree, one workflow launch, one teardown.
|
|
30
|
+
2. **Several PRs** → the [Multiple PRs](reference/multi-pr.md) run
|
|
31
|
+
(`workflow/converge_multi.mjs`): one worktree per PR and a single workflow
|
|
32
|
+
launch that drives every PR's converge run in parallel, then one teardown per
|
|
33
|
+
PR.
|
|
34
|
+
|
|
35
|
+
The single-PR sections (Requirements, Pre-flight, Run the workflow, Teardown)
|
|
36
|
+
each describe one converge run. The multi-PR reference reuses them once per PR
|
|
37
|
+
and adds only what fanning out needs: a per-PR worktree and a per-PR teardown
|
|
38
|
+
loop.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
Scan the tool list at the top of this conversation for the literal string
|
|
43
|
+
`Workflow`. If it is absent, report `autoconverge requires the Workflow tool;
|
|
44
|
+
aborting` and stop. The workflow also needs the `gh` CLI authenticated for the
|
|
45
|
+
PR's owner.
|
|
46
|
+
|
|
47
|
+
## Review-lens boundary
|
|
48
|
+
|
|
49
|
+
The code-review lens boundary (workflow agent versus the built-in `/code-review`
|
|
50
|
+
command) is defined on the **Code-review lens** bullet in
|
|
51
|
+
[`reference/convergence.md`](reference/convergence.md).
|
|
52
|
+
|
|
53
|
+
## Transport check (before any GitHub step)
|
|
54
|
+
|
|
55
|
+
Run `command -v gh`; when it succeeds, run `gh auth status`; once the PR
|
|
56
|
+
scope is resolved, run `gh api repos/<owner>/<repo> --jq .permissions.push`
|
|
57
|
+
and take `true` as the pass. When any check fails, run the
|
|
58
|
+
`pr-loop-cloud-transport` skill first and route every `gh` operation in this
|
|
59
|
+
skill through its substitution matrix. The workflow script
|
|
60
|
+
(`workflow/converge.mjs`) embeds `gh` commands and gh-backed helper scripts in
|
|
61
|
+
its agent prompts, so a cloud run also applies the same substitution to those
|
|
62
|
+
agent prompts when it authors the launch — the transport skill covers the
|
|
63
|
+
orchestrating session's own steps, and the script's agent-prompt text carries
|
|
64
|
+
`gh` calls the spawned agents cannot run in a cloud session.
|
|
65
|
+
|
|
66
|
+
## Pre-flight (main session)
|
|
67
|
+
|
|
68
|
+
1. **Enter a worktree.** Call `EnterWorktree` with no arguments before any
|
|
69
|
+
`gh`, `git`, file read, or edit. `gh`/`git` Bash calls do not auto-isolate,
|
|
70
|
+
so this is mandatory. If it fails, report and stop. A bare `EnterWorktree`
|
|
71
|
+
branches from `origin/main`; step 2 positions the worktree on the PR's head
|
|
72
|
+
ref, which the workflow needs.
|
|
73
|
+
|
|
74
|
+
2. **Resolve PR scope.** When the user passed a PR URL or number, parse owner,
|
|
75
|
+
repo, and number from it. Otherwise read the current branch's PR:
|
|
76
|
+
`gh pr view --json number,headRefName,url,isDraft,baseRefName`. Capture
|
|
77
|
+
`owner`, `repo`, `prNumber`. Confirm the PR is a draft; if it is already
|
|
78
|
+
ready, mark it draft first (`gh pr ready <n> --repo <o>/<r> --undo`) so the
|
|
79
|
+
loop owns the ready transition.
|
|
80
|
+
|
|
81
|
+
**Position the worktree on the PR branch.** The workflow reviews
|
|
82
|
+
`git diff origin/main...HEAD` against this worktree's local `HEAD` and pushes
|
|
83
|
+
each fix to the PR branch, so the worktree sits on the PR's head ref at the PR
|
|
84
|
+
HEAD before the workflow launches. A worktree fresh off `origin/main` has
|
|
85
|
+
`HEAD == origin/main`, shows an empty diff, and reports a false convergence
|
|
86
|
+
with zero findings. When a local worktree already tracks the PR branch, enter
|
|
87
|
+
that one by passing its path to `EnterWorktree`; otherwise put the entered
|
|
88
|
+
worktree on the branch with `gh pr checkout <number> --repo <owner>/<repo>`
|
|
89
|
+
(or `git fetch origin <headRefName>` then `git switch <headRefName>`). Confirm
|
|
90
|
+
before launching: `git rev-parse --abbrev-ref HEAD` equals the PR's head ref
|
|
91
|
+
and local `HEAD` equals the PR head SHA.
|
|
92
|
+
|
|
93
|
+
3. **Verify the worktree is the PR's repo (strict pre-flight).** Run
|
|
94
|
+
`python "$HOME/.claude/skills/_shared/pr-loop/scripts/preflight_worktree.py" --owner <owner> --repo <repo> --mode strict`.
|
|
95
|
+
It confirms the working directory is a checkout of the PR's own repo and
|
|
96
|
+
that `git worktree` machinery is healthy, so `EnterWorktree` can create and
|
|
97
|
+
enter the branch worktree. A non-zero exit prints a `PREFLIGHT_OUTCOME` line
|
|
98
|
+
and an `ABORT` line: report that line and stop. Autoconverge runs inside the
|
|
99
|
+
PR's own repo, so a working directory rooted in a different repo (for
|
|
100
|
+
example, `claude-dev-env` while the PR lives in `llm-settings`) or in no
|
|
101
|
+
git checkout at all cannot continue.
|
|
102
|
+
|
|
103
|
+
4. **Grant project permissions.** Apply the `pr-loop-lifecycle` skill's Open
|
|
104
|
+
section (`../pr-loop-lifecycle/SKILL.md`) — the grant command
|
|
105
|
+
(`grant_project_claude_permissions.py`) and the auto-mode `AskUserQuestion`
|
|
106
|
+
escalation for a blocked grant both live there.
|
|
107
|
+
|
|
108
|
+
5. **Copilot quota pre-check.** Before the `Workflow` call, apply the
|
|
109
|
+
`reviewer-gates` skill's Copilot quota gate (`../reviewer-gates/SKILL.md`)
|
|
110
|
+
once. Exit 0 maps to `copilotDisabled: false` in the Workflow call; any
|
|
111
|
+
non-zero exit maps to `copilotDisabled: true`, and the workflow then skips
|
|
112
|
+
the Copilot gate with no agent spawned.
|
|
113
|
+
|
|
114
|
+
## Run the workflow
|
|
115
|
+
|
|
116
|
+
Call the `Workflow` tool against the colocated script:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
Workflow({
|
|
120
|
+
scriptPath: "<this skill dir>/workflow/converge.mjs",
|
|
121
|
+
args: { owner: "<O>", repo: "<R>", prNumber: <N>, bugbotDisabled: false, copilotDisabled: false }
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`scriptPath` is the absolute path to `workflow/converge.mjs` inside this skill's
|
|
126
|
+
own directory (on this install,
|
|
127
|
+
`<home>/.claude/skills/autoconverge/workflow/converge.mjs`). Set
|
|
128
|
+
`bugbotDisabled: true` only when the user has opted Cursor Bugbot out for the
|
|
129
|
+
run; otherwise the workflow detects an opt-out or an unreachable Bugbot on its
|
|
130
|
+
own. Set `copilotDisabled: true` when the step 5 quota pre-check exits non-zero,
|
|
131
|
+
and `false` when it exits 0; on `true` the workflow skips the Copilot gate with
|
|
132
|
+
no agent spawned. The workflow runs in the background and notifies this session
|
|
133
|
+
on completion. Watch live progress with `/workflows`.
|
|
134
|
+
|
|
135
|
+
The moment the `Workflow` call returns its run id, write the durable handoff so a
|
|
136
|
+
fresh session can resume the same run:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
python "$HOME/.claude/skills/_shared/pr-loop/scripts/write_handoff.py" \
|
|
140
|
+
--pr-number <N> --head-ref <branch> --phase workflow \
|
|
141
|
+
--resume-command "Workflow({scriptPath, resumeFromRunId: '<runId>'})" \
|
|
142
|
+
--run-id <runId>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Write it again when the result lands, so the handoff carries the final run id and
|
|
146
|
+
names the teardown phase the fresh session picks up from.
|
|
147
|
+
|
|
148
|
+
The workflow returns
|
|
149
|
+
`{ converged, rounds, finalSha, blocker, standardsNote, copilotNote, cleanAuditNote, reuseNote, deferredPrs }`,
|
|
150
|
+
plus a `userReview` field on a `blocker: "user-review"` return. `cleanAuditNote` is
|
|
151
|
+
non-null when the environment refused the CLEAN bugteam review post and the run
|
|
152
|
+
recorded the bypass — see
|
|
153
|
+
[`reference/stop-conditions.md`](reference/stop-conditions.md) § Clean-audit post
|
|
154
|
+
bypassed.
|
|
155
|
+
`deferredPrs` is the list of draft environment-hardening PRs the standards-deferral
|
|
156
|
+
path opened this run, each as `{ owner, repo, prNumber, copilotDisabled, bugbotDisabled }`.
|
|
157
|
+
The two flags carry this run's Copilot and Bugbot availability, so the next generation
|
|
158
|
+
skips a reviewer that is down or out of quota without re-probing. This list is the seed the
|
|
159
|
+
[self-closing loop](reference/self-closing-loop.md) converges next.
|
|
160
|
+
|
|
161
|
+
## Copilot findings — tier, verify, then route
|
|
162
|
+
|
|
163
|
+
The Copilot gate tiers each finding (self-healing vs code-concern), verifies
|
|
164
|
+
each code concern with an executed check against the flagged HEAD, and returns a
|
|
165
|
+
confirmed / refuted / inconclusive verdict — full semantics and the `userReview`
|
|
166
|
+
return contract in
|
|
167
|
+
[`reference/copilot-findings.md`](reference/copilot-findings.md). Only
|
|
168
|
+
inconclusive findings return `blocker: "user-review"`; the orchestrating session
|
|
169
|
+
handles that hold in Teardown via the
|
|
170
|
+
[`copilot-finding-triage`](../copilot-finding-triage/SKILL.md) skill.
|
|
171
|
+
|
|
172
|
+
## Budget stop
|
|
173
|
+
|
|
174
|
+
`converge.mjs` paces itself against the workflow `budget` API and stops at a
|
|
175
|
+
round boundary when a full round does not fit —
|
|
176
|
+
[`reference/stop-conditions.md`](reference/stop-conditions.md) § Budget stop
|
|
177
|
+
gives the rule. On a `blocker: "budget"` return, write the durable handoff with
|
|
178
|
+
the run id and the `Workflow({scriptPath, resumeFromRunId})` resume command
|
|
179
|
+
before stopping, so a fresh session resumes the paced run without the stopped
|
|
180
|
+
session's transcript.
|
|
181
|
+
|
|
182
|
+
## Teardown (on workflow completion)
|
|
183
|
+
|
|
184
|
+
Teardown runs as an ordered checkpoint list. After each checkpoint finishes,
|
|
185
|
+
re-write the durable handoff with `--phase teardown`, the run id, and the
|
|
186
|
+
checkpoints done so far, so a fresh session that resumes reads `handoff.json`
|
|
187
|
+
`completed_steps` and skips the checkpoints already done:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
python "$HOME/.claude/skills/_shared/pr-loop/scripts/write_handoff.py" \
|
|
191
|
+
--pr-number <N> --head-ref <branch> --phase teardown \
|
|
192
|
+
--resume-command "/autoconverge <PR URL>" \
|
|
193
|
+
--run-id <runId> \
|
|
194
|
+
--completed-steps "<checkpoints done so far>"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The checkpoints run in this order: `report`, `close`. Write the
|
|
198
|
+
handoff after each one finishes.
|
|
199
|
+
|
|
200
|
+
On teardown entry, when `~/.claude/runtime/pr-loop/bugteam-pr-<N>/handoff.json`
|
|
201
|
+
exists, read its `completed_steps` and skip any checkpoint the list already
|
|
202
|
+
names, so a resumed run performs only the checkpoints left.
|
|
203
|
+
|
|
204
|
+
On a `blocker: "user-review"` return, the workflow held one or more code-concern
|
|
205
|
+
findings that stayed inconclusive after the executed-check verification stage.
|
|
206
|
+
Run the [`copilot-finding-triage`](../copilot-finding-triage/SKILL.md) gate before
|
|
207
|
+
teardown: send the ntfy alert with the per-finding summary and evidence note and
|
|
208
|
+
the `userReview.reviewUrl` link, then hold with a 45-minute `ScheduleWakeup`. Act
|
|
209
|
+
on the user's direction when it arrives inside the window; when the window closes
|
|
210
|
+
with no response, fall through to normal teardown and report the
|
|
211
|
+
`userReview.findings` un-reviewed. The PR stays a draft in this path — the
|
|
212
|
+
workflow marked nothing ready.
|
|
213
|
+
|
|
214
|
+
Before the checkpoints, when the workflow returned a non-null `copilotNote`
|
|
215
|
+
(the Copilot gate was bypassed), query the PR's reviews once more for a
|
|
216
|
+
`copilot-pull-request-reviewer[bot]` review on the final HEAD
|
|
217
|
+
(`fetch_copilot_reviews.py`, or the GitHub MCP `pull_request_read` method
|
|
218
|
+
`get_reviews`). Copilot typically posts within 10–15 minutes of a request, so
|
|
219
|
+
a review can land between the bypass and teardown. When one exists and
|
|
220
|
+
carries findings, mark the PR draft, route the findings through one fix
|
|
221
|
+
round per the `pr-fix-protocol` skill, re-verify, push, and mark the PR
|
|
222
|
+
ready again — then run the checkpoints.
|
|
223
|
+
|
|
224
|
+
1. **When `converged` is true — build and publish the closing report.**
|
|
225
|
+
Skip this entire step (report, artifact publish, comment, Chrome open) when
|
|
226
|
+
the workflow returned a non-null `blocker`. Follow
|
|
227
|
+
[`reference/closing-report.md`](reference/closing-report.md) § Building the
|
|
228
|
+
report and § Publishing: resolve the seed journal from the run id, merge the
|
|
229
|
+
PR's runs with `aggregate_runs.py`, spawn the `convergence-summary` agent
|
|
230
|
+
(a `general-purpose` subagent) on the prompt it builds, draw the report with
|
|
231
|
+
`render_report.py`, publish the HTML via the `Artifact` tool, post the
|
|
232
|
+
one marker-keyed `<!-- autoconverge-report -->` PR comment, and open the
|
|
233
|
+
artifact URL in Chrome. After the report is published, write the handoff
|
|
234
|
+
with `--completed-steps "report"`.
|
|
235
|
+
|
|
236
|
+
2. **Close the run.** Apply the `pr-loop-lifecycle` skill's Close section
|
|
237
|
+
(`../pr-loop-lifecycle/SKILL.md`): when `converged` is true, rewrite the PR
|
|
238
|
+
description and clean the working tree — see
|
|
239
|
+
[`pr-loop-lifecycle/reference/teardown-publish-permissions.md` § Clean working tree and § Publish the final PR description](../pr-loop-lifecycle/reference/teardown-publish-permissions.md);
|
|
240
|
+
the workflow already marked the PR ready. The permission revoke always runs,
|
|
241
|
+
including on a blocker exit. Write the handoff with
|
|
242
|
+
`--completed-steps "report,close"`.
|
|
243
|
+
|
|
244
|
+
3. **Print the final report:**
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
/autoconverge exit: <converged | blocked>
|
|
248
|
+
Rounds: <N>
|
|
249
|
+
Final commit: <finalSha>
|
|
250
|
+
Blocker: <blocker> # only when blocked
|
|
251
|
+
Standards: <standardsNote> # only when a round deferred code-standard findings
|
|
252
|
+
Copilot: <copilotNote> # only when Copilot was down or out of quota
|
|
253
|
+
Clean-audit: <cleanAuditNote> # only when the CLEAN bugteam post was bypassed
|
|
254
|
+
Reuse: <reuseNote> # only when the reuse pass identified an improvement
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## What the workflow does each round
|
|
258
|
+
|
|
259
|
+
[`reference/convergence.md`](reference/convergence.md) defines the whole loop:
|
|
260
|
+
the merge-conflict pre-flight, the reuse pass and its three landing criteria,
|
|
261
|
+
the round shape (static sweep, the three parallel reading lenses, dedup, the
|
|
262
|
+
one-commit fix flow, the standards-deferral path), the terminal Bugbot, Copilot,
|
|
263
|
+
and Codex gates, the per-role model tiers, the full-diff rule, and the exact
|
|
264
|
+
ready definition `check_convergence.py` enforces.
|
|
265
|
+
[`reference/stop-conditions.md`](reference/stop-conditions.md) lists every way
|
|
266
|
+
the run ends short of ready. Hard-won failure lessons live in
|
|
267
|
+
[`reference/gotchas.md`](reference/gotchas.md).
|
|
268
|
+
|
|
269
|
+
Every agent prompt the workflow authors carries a headless-safety preamble —
|
|
270
|
+
read-only agents get a trimmed form, edit agents the full form with the rm
|
|
271
|
+
auto-allow paths — specified in
|
|
272
|
+
[`reference/headless-safety.md`](reference/headless-safety.md).
|
|
273
|
+
|
|
274
|
+
## Multiple PRs
|
|
275
|
+
|
|
276
|
+
When the user names several PRs, run the multi-PR path in
|
|
277
|
+
[`reference/multi-pr.md`](reference/multi-pr.md): one worktree per PR
|
|
278
|
+
(`git worktree add` on each head ref, strict pre-flight per worktree, one
|
|
279
|
+
permission grant per repository, one Copilot quota check for the whole run),
|
|
280
|
+
then a single `workflow/converge_multi.mjs` launch with one entry per PR, then
|
|
281
|
+
the single-PR teardown once per `results` entry and a one-line-per-PR summary.
|
|
282
|
+
|
|
283
|
+
## Self-closing loop: converge the deferred PRs
|
|
284
|
+
|
|
285
|
+
Every autoconverge run — single-PR and multi-PR alike — ends with the
|
|
286
|
+
self-closing loop in
|
|
287
|
+
[`reference/self-closing-loop.md`](reference/self-closing-loop.md): the
|
|
288
|
+
orchestrating session converges the draft environment-hardening PRs the run
|
|
289
|
+
deferred (`deferredPrs` on a single-PR run, `allDeferredPrs` on a multi-PR
|
|
290
|
+
run), then the PRs those runs defer, generation by generation, until a
|
|
291
|
+
generation opens none. An empty seed list ends the loop at once. The reference
|
|
292
|
+
also carries the Conventional-Commit title rule each hardening PR must meet.
|
|
293
|
+
|
|
294
|
+
## Folder map
|
|
295
|
+
|
|
296
|
+
- `SKILL.md` — this hub.
|
|
297
|
+
- `workflow/converge.mjs` — the convergence workflow script.
|
|
298
|
+
- `workflow/converge_multi.mjs` — the multi-PR fan-out driver: one `converge.mjs` child run per PR in parallel, each pinned to its PR worktree via `repoPath`.
|
|
299
|
+
- `workflow/aggregate_runs.py` — merges every autoconverge journal for a PR into one journal and returns its deduped findings, fix summaries, round count, and final SHA.
|
|
300
|
+
- `workflow/convergence_summary.py` — builds the convergence-summary agent prompt over a PR's merged findings.
|
|
301
|
+
- `workflow/render_report.py` — builds the closing convergence insights HTML report, taking the summary from `--summary-file`.
|
|
302
|
+
- `workflow/autoconverge_report_constants/` — named constants for the report builder and the summary prompt.
|
|
303
|
+
- `reference/convergence.md` — the whole loop: reuse pass, round shape, terminal gates, model tiers, ready definition.
|
|
304
|
+
- `reference/copilot-findings.md` — the Copilot gate tiering, per-finding verification, and the `userReview` return contract.
|
|
305
|
+
- `reference/stop-conditions.md` — every way the run ends short of ready, including the budget stop.
|
|
306
|
+
- `reference/gotchas.md` — hard-won failure lessons.
|
|
307
|
+
- `reference/closing-report.md` — the closing HTML report: data source, build steps, publishing.
|
|
308
|
+
- `reference/multi-pr.md` — the several-PRs path: per-PR worktrees, the `converge_multi.mjs` launch, per-PR teardown.
|
|
309
|
+
- `reference/self-closing-loop.md` — the deferred-PR generations and the Conventional-Commit title rule.
|
|
310
|
+
- `reference/headless-safety.md` — the agent-prompt preamble and the rm auto-allow paths.
|