claude-dev-env 1.34.0 → 1.35.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/agents/docs-agent.md +1 -1
- package/agents/project-docs-analyzer.md +0 -1
- package/agents/skill-to-agent-converter.md +0 -1
- package/commands/initialize.md +0 -1
- package/commands/readability-review.md +4 -4
- package/commands/review-plan.md +2 -4
- package/commands/stubcheck.md +1 -2
- package/hooks/blocking/code_rules_enforcer.py +250 -36
- package/hooks/blocking/test_code_rules_enforcer.py +91 -39
- package/hooks/blocking/test_code_rules_enforcer_annotations.py +97 -0
- package/hooks/blocking/test_code_rules_enforcer_collection_prefix.py +137 -0
- package/hooks/blocking/test_code_rules_enforcer_config_path.py +0 -20
- package/hooks/blocking/test_code_rules_enforcer_constant_equality.py +0 -18
- package/hooks/blocking/test_code_rules_enforcer_existence_checks.py +0 -18
- package/hooks/blocking/test_code_rules_enforcer_inline_literal_collections.py +155 -0
- package/hooks/blocking/test_code_rules_enforcer_loop_variable_naming.py +110 -0
- package/hooks/blocking/test_code_rules_enforcer_naming_pattern.py +0 -13
- package/hooks/blocking/test_code_rules_enforcer_skip_decorators.py +0 -26
- package/hooks/blocking/test_code_rules_enforcer_string_magic.py +234 -0
- package/package.json +1 -1
- package/skills/bugteam/PROMPTS.md +0 -39
- package/skills/bugteam/SKILL.md +17 -35
- package/skills/bugteam/reference/copilot-gap-analysis.md +12 -0
- package/skills/pr-converge/SKILL.md +185 -167
- package/agents/agent-writer.md +0 -157
- package/agents/config-centralizer.md +0 -686
- package/agents/config-extraction-agent.md +0 -225
- package/agents/doc-orchestrator.md +0 -47
- package/agents/docx-agent.md +0 -211
- package/agents/magic-value-eliminator-agent.md +0 -72
- package/agents/mandatory-agent-workflow-agent.md +0 -88
- package/agents/parallel-workflow-coordinator.md +0 -779
- package/agents/pdf-agent.md +0 -302
- package/agents/project-context-loader.md +0 -238
- package/agents/readability-review-agent.md +0 -76
- package/agents/refactoring-specialist.md +0 -69
- package/agents/right-sized-engineer.md +0 -129
- package/agents/session-continuity-manager.md +0 -53
- package/agents/stub-detector-agent.md +0 -140
- package/agents/tdd-test-writer.md +0 -62
- package/agents/test-data-builder.md +0 -68
- package/agents/tooling-builder.md +0 -78
- package/agents/validation-expert.md +0 -71
- package/agents/xlsx-agent.md +0 -169
|
@@ -1,218 +1,236 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pr-converge
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fetches
|
|
7
|
-
tick, replies inline, and re-triggers the
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
Drives the current PR to convergence by alternating Cursor Bugbot and the
|
|
5
|
+
in-house bugteam audit. Each invocation runs one tick of work in the main
|
|
6
|
+
session: fetches the latest reviewer state, applies TDD fixes for any
|
|
7
|
+
findings, pushes one commit per tick, replies inline, and re-triggers the
|
|
8
|
+
reviewer. To loop automatically, invoke as `/loop /pr-converge` — the /loop
|
|
9
|
+
skill self-paces re-entry via ScheduleWakeup. Convergence requires a
|
|
10
|
+
back-to-back clean cycle (bugbot CLEAN immediately followed by bugteam CLEAN
|
|
11
|
+
with no intervening fixes), at which point the PR is flipped to ready for
|
|
12
|
+
review and the loop terminates. Triggers: '/pr-converge', 'drive PR to
|
|
11
13
|
convergence', 'loop bugbot and bugteam', 'babysit bugbot and bugteam',
|
|
12
14
|
'until both are clean', 'converge this PR'.
|
|
13
15
|
---
|
|
14
16
|
|
|
15
17
|
# PR Converge
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Runs one tick of the bugbot ↔ bugteam convergence loop in the main session. Designed to be invoked under `/loop /pr-converge` so the parent's ScheduleWakeup paces re-entry. Self-terminates the loop on convergence (back-to-back clean) by flipping the PR to ready for review and omitting the next ScheduleWakeup.
|
|
20
|
+
|
|
21
|
+
## Why the work runs in the main session, not a background subagent
|
|
22
|
+
|
|
23
|
+
`ScheduleWakeup` is a primitive of the parent harness; it is not exposed to `general-purpose` subagents. A prior version of this skill spawned a background subagent and instructed it to call `ScheduleWakeup` at the end of each tick. The subagent's tool registry returned "No matching deferred tools found" for `ScheduleWakeup`, so the loop could never self-perpetuate — it ran exactly one tick and stalled. Running the loop in the main session via `/loop /pr-converge` puts the work on the same harness that owns `ScheduleWakeup`, eliminating that failure mode.
|
|
18
24
|
|
|
19
25
|
## When this skill applies
|
|
20
26
|
|
|
21
|
-
The user is on a PR branch and wants both reviewers — Cursor's Bugbot AND the in-house `/bugteam` audit — to keep re-reviewing after each push, with findings auto-addressed between ticks. The PR stays in draft until convergence; on convergence the
|
|
27
|
+
The user is on a PR branch and wants both reviewers — Cursor's Bugbot AND the in-house `/bugteam` audit — to keep re-reviewing after each push, with findings auto-addressed between ticks. The PR stays in draft until convergence; on convergence the skill flips it to ready for review.
|
|
28
|
+
|
|
29
|
+
## Invocation modes
|
|
30
|
+
|
|
31
|
+
- **`/loop /pr-converge`** (recommended): loops automatically. The /loop skill runs each tick and uses ScheduleWakeup to pace re-entry. Termination on convergence is automatic; the skill omits the next wakeup at the convergence tick.
|
|
32
|
+
- **`/pr-converge`** (manual): runs exactly one tick and returns. Useful for ad-hoc state checks or for advancing the loop one step manually. The user re-runs the skill (or wraps it in `/loop`) to continue.
|
|
33
|
+
|
|
34
|
+
## State across ticks
|
|
35
|
+
|
|
36
|
+
Track the following in plain text in the assistant's response so subsequent ticks can re-read it from conversation context:
|
|
37
|
+
|
|
38
|
+
- `phase`: `BUGBOT` or `BUGTEAM`. Start in `BUGBOT` on the first tick of a fresh loop.
|
|
39
|
+
- `bugbot_clean_at`: the HEAD SHA at which bugbot last reported clean, or `null`. Reset to `null` whenever a new commit is pushed.
|
|
40
|
+
- `inline_lag_streak`: integer counter, initialized to `0`. Tracks consecutive ticks where bugbot's review body indicates findings against `current_head` but the inline-comments API returns zero matching comments. Reset to `0` on any other branch outcome.
|
|
41
|
+
- `tick_count`: integer, initialized to `0`. Increment on every tick to enforce the safety cap.
|
|
22
42
|
|
|
23
|
-
|
|
43
|
+
Each tick begins by reading the prior tick's state line from the most recent assistant message and ends by emitting the updated state line.
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
## Per-tick work
|
|
26
46
|
|
|
27
|
-
|
|
47
|
+
### Step 1: Resolve current HEAD and PR context
|
|
48
|
+
|
|
49
|
+
Read the prior tick's state line from the most recent assistant message (or initialize all fields if none). **Increment `tick_count` by 1.** This is the increment referenced in the **State across ticks** section; without it the safety cap (Step 3.5, §Safety cap) never fires.
|
|
28
50
|
|
|
29
51
|
```bash
|
|
30
52
|
gh pr view --json number,url,headRefOid,baseRefName,headRefName,isDraft
|
|
31
53
|
```
|
|
32
54
|
|
|
33
|
-
Capture `number
|
|
34
|
-
|
|
35
|
-
### Step 2:
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
- User says stop → `TaskStop <agent_id>`.
|
|
167
|
-
- User asks what loops are running → `TaskList`.
|
|
168
|
-
|
|
169
|
-
## Ground rules (for the subagent)
|
|
55
|
+
Capture `number` (`<NUMBER>`), `headRefOid` (`current_head`), owner/repo (from `url`), branch name (`<BRANCH>`).
|
|
56
|
+
|
|
57
|
+
### Step 2: Branch on `phase`
|
|
58
|
+
|
|
59
|
+
#### `phase == BUGBOT`
|
|
60
|
+
|
|
61
|
+
a. Fetch Cursor Bugbot reviews newest-first and walk backwards until the first clean review:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
gh api repos/<OWNER>/<REPO>/pulls/<NUMBER>/reviews \
|
|
65
|
+
--jq '[.[] | select(.user.login=="cursor[bot]")] | sort_by(.submitted_at) | reverse'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Track dirty reviews in a temp file as you walk; the Fix protocol reads it back later in this tick:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
dirty_reviews_path=$(mktemp "${TMPDIR:-/tmp}/pr-converge-bugbot.XXXXXX")
|
|
72
|
+
: > "$dirty_reviews_path"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Iterate from index 0 (most recent) toward older entries:
|
|
76
|
+
|
|
77
|
+
- Classify each review's body — **dirty** when it contains `Cursor Bugbot has reviewed your changes and found <N> potential issue`; **clean** otherwise.
|
|
78
|
+
- For a dirty review, append one JSON line to `$dirty_reviews_path` with `{review_id, commit_id, submitted_at, body}`.
|
|
79
|
+
- Stop at the first clean review. Older reviews are presumed addressed at that clean checkpoint and are not re-read.
|
|
80
|
+
- When index 0 is itself clean, `$dirty_reviews_path` stays empty.
|
|
81
|
+
|
|
82
|
+
Capture `commit_id`, `state`, `submitted_at`, and body of the index-0 review for the decision branches below. When a branch routes to the **Fix protocol**, read every entry from `$dirty_reviews_path` and address all of them — not just index 0.
|
|
83
|
+
|
|
84
|
+
b. Fetch unaddressed inline comments from `cursor[bot]` on `current_head`:
|
|
85
|
+
```bash
|
|
86
|
+
gh api repos/<OWNER>/<REPO>/pulls/<NUMBER>/comments \
|
|
87
|
+
--jq "[.[] | select(.user.login==\"cursor[bot]\") | select(.commit_id==\"$current_head\")]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
c. Decide (the four branches below cover every input combination — match the first branch whose predicate holds):
|
|
91
|
+
- **No bugbot review yet, OR latest bugbot review's `commit_id` differs from `current_head`:** Re-trigger bugbot (Step 3), set `bugbot_clean_at = null`, reset `inline_lag_streak = 0`, schedule next wakeup, return.
|
|
92
|
+
- **Latest review's `commit_id == current_head` AND zero unaddressed inline findings AND review body indicates clean:** Set `bugbot_clean_at = current_head`. Reset `inline_lag_streak = 0`. Transition `phase = BUGTEAM`. Continue to bugteam branch in this same tick — back-to-back convergence requires bugteam to run against the same HEAD before the next wakeup is scheduled.
|
|
93
|
+
- **Latest review's `commit_id == current_head` with unaddressed inline findings (review body indicates findings):** Apply the **Fix protocol** below to address them. Reset `inline_lag_streak = 0`. The fix protocol pushes a new commit, which sets `current_head` to the new SHA, sets `bugbot_clean_at = null`, replies inline on each thread, and re-triggers bugbot. Schedule next wakeup, return.
|
|
94
|
+
- **Latest review's `commit_id == current_head` AND review body indicates findings AND inline-comments API returns zero matching comments for `current_head`:** Treat as transient API propagation lag — bugbot publishes the review body and inline comments through separate API operations and the two writes can briefly desync. Increment `inline_lag_streak`. When `inline_lag_streak >= 3`, escalate as a hard blocker (bugbot review is structurally inconsistent — body claims findings while inline anchors stay empty across three consecutive ticks); report and terminate. Otherwise schedule next wakeup at `delaySeconds: 60` (lag is short-lived) and return; the inline comments should appear on the next tick.
|
|
95
|
+
|
|
96
|
+
#### `phase == BUGTEAM`
|
|
97
|
+
|
|
98
|
+
a. Run the in-house bugteam audit on the current PR by invoking the `Skill` tool in the main session:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Skill({skill: "bugteam", args: "https://github.com/<OWNER>/<REPO>/pull/<NUMBER>"})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The main session is the team lead, so `TeamCreate` fires from the orchestrator and `/bugteam` emits its CODE_RULES gate output, teammate spawn lines, and audit progress as expected. The skill audits the current PR against CODE_RULES, posts review threads, and converges or stops at its own internal cap. Wait for it to complete; capture exit and final summary.
|
|
105
|
+
|
|
106
|
+
b. **Re-resolve current HEAD now** because `/bugteam` may have pushed commits during its run. The `current_head` from Step 1 is potentially stale at this point:
|
|
107
|
+
```bash
|
|
108
|
+
new_head=$(gh api repos/<OWNER>/<REPO>/pulls/<NUMBER> --jq '.head.sha')
|
|
109
|
+
```
|
|
110
|
+
If `new_head != current_head`, set `current_head = new_head` AND set `bugbot_clean_at = null`. The new commits from bugteam invalidate bugbot's prior clean.
|
|
111
|
+
|
|
112
|
+
c. Inspect bugteam's output. Bugteam reports either `convergence (zero findings)` or a list of unfixed findings with file:line.
|
|
113
|
+
|
|
114
|
+
d. Decide based on the (post-bugteam) state — order matters; check pushed-during-bugteam FIRST so a convergence report against a stale HEAD never falsely terminates:
|
|
115
|
+
- **bugteam pushed during this tick (i.e., `bugbot_clean_at` was just reset to `null` in step b):** Re-trigger bugbot in this same tick (Step 3) so the new HEAD enters bugbot's queue immediately, transition `phase = BUGBOT`, schedule next wakeup, return. The new commit needs a fresh bugbot review before convergence can be claimed.
|
|
116
|
+
- **bugteam reports convergence AND `bugbot_clean_at == current_head` (no push during this tick):** This is back-to-back clean. Mark the PR ready for review:
|
|
117
|
+
```bash
|
|
118
|
+
gh pr ready <NUMBER> --repo <OWNER>/<REPO>
|
|
119
|
+
```
|
|
120
|
+
Report to the user in one sentence: "PR #<NUMBER> converged: bugbot CLEAN at <SHA>, bugteam CLEAN at <SHA>; marked ready for review." **Omit the next ScheduleWakeup call** — this terminates the /loop.
|
|
121
|
+
- **bugteam reports convergence BUT `bugbot_clean_at != current_head` (no push during this tick):** Bugteam reached zero findings without committing, yet bugbot still needs re-confirmation against this HEAD. This branch is reachable only when state diverged BETWEEN ticks — for example, the user pushed a manual commit between two wakeups, leaving `current_head` ahead of the SHA bugbot last cleaned. Transition `phase = BUGBOT`, schedule next wakeup, return.
|
|
122
|
+
- **bugteam reports findings without committing fixes:** apply the **Fix protocol** below (which always re-triggers bugbot after the push), transition `phase = BUGBOT`, schedule next wakeup, return.
|
|
123
|
+
|
|
124
|
+
### Step 3: Re-trigger bugbot
|
|
125
|
+
|
|
126
|
+
Used in Step 2 BUGBOT branch 1, in Step 2 BUGTEAM branch 1, and in the Fix protocol. Post a literal `bugbot run` PR comment. Write the body via the Write tool to a temp file, then pass it with `--body-file` (per the gh-body-file rule):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
gh pr comment <NUMBER> --repo <OWNER>/<REPO> --body-file <path/to/bugbot_run.md>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The body file contains exactly the literal phrase `bugbot run` followed by a newline. Use that phrase exactly — empirically the only re-trigger Cursor Bugbot recognizes; alternative phrasings (`re-review`, `bugbot please`, etc.) silently no-op.
|
|
133
|
+
|
|
134
|
+
### Step 3.5: Enforce the safety cap
|
|
135
|
+
|
|
136
|
+
Before scheduling the next wakeup, evaluate `tick_count`. When `tick_count >= 30`, stop and report per the **Stop conditions** safety-cap branch (§Safety cap) — **omit Step 4 entirely**. Reaching this many rounds means something structural is wrong with the loop and continuing wastes work. Otherwise proceed to Step 4.
|
|
137
|
+
|
|
138
|
+
### Step 4: Schedule the next wakeup (only when invoked under `/loop`)
|
|
139
|
+
|
|
140
|
+
**Skip this step entirely when the skill was invoked as bare `/pr-converge`** (manual mode). Manual mode runs exactly one tick and returns without scheduling — the user re-runs the skill or wraps it in `/loop` to continue. References elsewhere in this document to "schedule next wakeup, return" mean Step 4 below; under manual mode every such reference becomes "return" only.
|
|
141
|
+
|
|
142
|
+
Detect manual mode by inspecting the conversation context: when the most recent user message that triggered this run was `/pr-converge` (no `/loop` prefix and no prior `ScheduleWakeup` chain entry that fired with `prompt: "/loop /pr-converge"`), this is manual mode. When the run was triggered by the parent's /loop wakeup chain or the user typed `/loop /pr-converge`, this is loop mode.
|
|
143
|
+
|
|
144
|
+
In **loop mode**, call `ScheduleWakeup` with:
|
|
145
|
+
|
|
146
|
+
- `delaySeconds: 270` whenever bugbot was just re-triggered (whether by Step 3 directly, by the Fix protocol's mandatory re-trigger, or by BUGTEAM branch 1's same-tick re-trigger). Bugbot finishes a review in 1–4 minutes, so 270s stays under the 5-minute prompt-cache TTL while giving a margin past bugbot's typical upper bound. The single exception is the BUGBOT inline-lag branch, which uses `delaySeconds: 60` because no re-trigger fired and the only thing being awaited is GitHub's inline-comments API catching up.
|
|
147
|
+
- `reason`: one short sentence on what is being awaited, including the current `phase` and `bugbot_clean_at` SHA when set.
|
|
148
|
+
- `prompt: "/loop /pr-converge"` — re-enters this skill via /loop on the next firing.
|
|
149
|
+
|
|
150
|
+
**On convergence (loop mode):** omit the ScheduleWakeup call entirely. The /loop terminates because no next wakeup was scheduled.
|
|
151
|
+
|
|
152
|
+
## Fix protocol
|
|
153
|
+
|
|
154
|
+
Used by both phases when findings exist:
|
|
155
|
+
|
|
156
|
+
- Read each referenced file:line.
|
|
157
|
+
- Write a failing test first when the finding has behavior to test. For pure doc, comment, or naming nits with no behavior, go straight to the fix.
|
|
158
|
+
- Implement the fix.
|
|
159
|
+
- Stage the affected files and create one new commit on the existing branch:
|
|
160
|
+
```bash
|
|
161
|
+
git add <files> && git commit -m "fix(review): <brief summary>"
|
|
162
|
+
```
|
|
163
|
+
Honor pre-commit and pre-push hooks; when a hook rejects, read its message, fix the underlying issue, retry. Hook rejections flag real underlying issues worth investigating.
|
|
164
|
+
- Push the new commit:
|
|
165
|
+
```bash
|
|
166
|
+
git push origin <BRANCH>
|
|
167
|
+
```
|
|
168
|
+
Capture the new HEAD SHA. Set `current_head` to it. Set `bugbot_clean_at = null`.
|
|
169
|
+
- Reply inline on each addressed comment thread using `--body-file` (per gh-body-file rule):
|
|
170
|
+
```bash
|
|
171
|
+
gh api -X POST repos/<OWNER>/<REPO>/pulls/<NUMBER>/comments/<comment_id>/replies \
|
|
172
|
+
--field body=@<path/to/reply.md>
|
|
173
|
+
```
|
|
174
|
+
- **Always re-trigger bugbot (Step 3 above) after pushing a fix**, regardless of which phase originated the findings. Any new commit invalidates bugbot's prior clean by definition, so bugbot must re-review the new HEAD before convergence can be claimed. Re-triggering in the same tick saves a full wakeup cycle compared to deferring the trigger to the next tick.
|
|
175
|
+
|
|
176
|
+
## Stop conditions
|
|
177
|
+
|
|
178
|
+
- **Convergence** (back-to-back clean as defined in Step 2 BUGTEAM second branch — `bugteam reports convergence AND bugbot_clean_at == current_head` with no push during this tick): mark PR ready for review, report one-sentence summary, omit ScheduleWakeup.
|
|
179
|
+
- **Hard blocker:** API auth failure persists across two ticks, a CI regression whose root cause falls outside this PR, a hook rejection investigated through three commits and still unresolved, `inline_lag_streak >= 3`, or `/bugteam` itself reports a stuck state. Report the specific blocker and the diagnosis, then omit ScheduleWakeup.
|
|
180
|
+
- **User stops the loop:** user says "stop the converge loop" → omit ScheduleWakeup on the next tick.
|
|
181
|
+
- **Safety cap:** `tick_count >= 30` (evaluated in Step 3.5) → omit ScheduleWakeup, report the cap was hit. See §Safety cap below for rationale.
|
|
182
|
+
|
|
183
|
+
## Safety cap
|
|
184
|
+
|
|
185
|
+
When `tick_count >= 30`, stop and report. That many rounds means something structural is wrong with the loop. (Higher than copilot-review's 20-tick cap because two reviewers run sequentially per round.) The increment lives in Step 1; the evaluation lives in Step 3.5.
|
|
186
|
+
|
|
187
|
+
## Ground rules
|
|
170
188
|
|
|
171
189
|
- **Append commits.** Each tick adds at most one new fix commit. Multiple findings within one tick collapse into a single commit; the next tick handles the next round.
|
|
172
190
|
- **`bugbot_clean_at` resets on every push.** A new commit invalidates bugbot's prior clean by definition — bugbot must re-review the new HEAD before convergence can be claimed.
|
|
173
191
|
- **Back-to-back clean is the ONLY termination criterion.** Convergence requires both reviewers clean against the same HEAD with no intervening fixes; either reviewer clean alone counts as in-progress.
|
|
174
|
-
- **The `bugbot run` comment is load-bearing.** Use the literal phrase `bugbot run` exactly — empirically the only re-trigger Cursor Bugbot recognizes; alternative phrasings
|
|
175
|
-
- **`gh pr ready` is the convergence action.** Mark the PR ready for review and stop there. Merge, additional reviewers, title, and body remain the user's decisions; the
|
|
192
|
+
- **The `bugbot run` comment is load-bearing.** Use the literal phrase `bugbot run` exactly — empirically the only re-trigger Cursor Bugbot recognizes; alternative phrasings silently no-op.
|
|
193
|
+
- **`gh pr ready` is the convergence action.** Mark the PR ready for review and stop there. Merge, additional reviewers, title, and body remain the user's decisions; the skill's contract ends at "ready for review."
|
|
176
194
|
- **Honor pre-push and pre-commit hooks.** When a hook rejects the change, read its output, fix the underlying issue (the failing test, the missing constant, the broken import), and retry.
|
|
177
195
|
|
|
178
196
|
## Examples
|
|
179
197
|
|
|
180
198
|
<example>
|
|
181
|
-
User: `/pr-converge`
|
|
182
|
-
Claude: [reads PR context,
|
|
199
|
+
User: `/loop /pr-converge`
|
|
200
|
+
Claude: [reads PR context, runs one tick of bugbot phase, schedules next wakeup at 270s with prompt `/loop /pr-converge`, returns]
|
|
183
201
|
</example>
|
|
184
202
|
|
|
185
203
|
<example>
|
|
186
|
-
User:
|
|
187
|
-
Claude: [
|
|
204
|
+
User: `/pr-converge`
|
|
205
|
+
Claude: [runs one tick manually, reports state, does NOT schedule a wakeup; user re-runs to advance]
|
|
188
206
|
</example>
|
|
189
207
|
|
|
190
208
|
<example>
|
|
191
|
-
|
|
192
|
-
|
|
209
|
+
Tick fires in BUGBOT phase, latest bugbot review is against an older commit.
|
|
210
|
+
Claude: [posts `bugbot run` comment, sets `bugbot_clean_at = null`, schedules next wakeup at 270s, returns]
|
|
193
211
|
</example>
|
|
194
212
|
|
|
195
213
|
<example>
|
|
196
|
-
|
|
197
|
-
|
|
214
|
+
Tick fires in BUGBOT phase, bugbot has 2 unaddressed findings on HEAD.
|
|
215
|
+
Claude: [TDD-fixes both, one commit, pushes, replies inline on both threads, posts `bugbot run`, schedules next wakeup at 270s, returns]
|
|
198
216
|
</example>
|
|
199
217
|
|
|
200
218
|
<example>
|
|
201
|
-
|
|
202
|
-
|
|
219
|
+
Tick fires in BUGBOT phase, bugbot is clean against HEAD.
|
|
220
|
+
Claude: [sets `bugbot_clean_at = HEAD`, transitions `phase = BUGTEAM`, runs `/bugteam` in the same tick]
|
|
203
221
|
</example>
|
|
204
222
|
|
|
205
223
|
<example>
|
|
206
|
-
|
|
207
|
-
|
|
224
|
+
In BUGTEAM phase, /bugteam reports convergence and `bugbot_clean_at == current_head`.
|
|
225
|
+
Claude: [runs `gh pr ready <NUMBER>`, reports "PR converged: bugbot CLEAN at <SHA>, bugteam CLEAN at <SHA>; marked ready for review", omits ScheduleWakeup, terminates the /loop]
|
|
208
226
|
</example>
|
|
209
227
|
|
|
210
228
|
<example>
|
|
211
|
-
|
|
212
|
-
|
|
229
|
+
In BUGTEAM phase, /bugteam pushed a fix commit during its run.
|
|
230
|
+
Claude: [re-resolves HEAD, sets `bugbot_clean_at = null`, posts `bugbot run` in this same tick, transitions `phase = BUGBOT`, schedules next wakeup at 270s]
|
|
213
231
|
</example>
|
|
214
232
|
|
|
215
233
|
<example>
|
|
216
|
-
|
|
217
|
-
|
|
234
|
+
Tick fires in BUGBOT phase, bugbot review body says "found 3 potential issues" against HEAD but the inline-comments API returns zero matching comments for `current_head`.
|
|
235
|
+
Claude: [increments `inline_lag_streak` to 1, schedules next wakeup at 60s, returns; expects inline comments to appear by the next tick]
|
|
218
236
|
</example>
|
package/agents/agent-writer.md
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-writer
|
|
3
|
-
description: Use this agent when you need to create a new subagent for Claude Code. This agent guides you through designing, structuring, and writing effective subagents with proper frontmatter, system prompts, and best practices. Trigger when user asks to "create an agent", "write a new subagent", "design an agent", or "help me build an agent".
|
|
4
|
-
tools: Read,Write,Glob,AskUserQuestion
|
|
5
|
-
model: sonnet
|
|
6
|
-
color: blue
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Agent Writer - Subagent Creation Assistant
|
|
10
|
-
|
|
11
|
-
You are a specialized agent that helps create well-structured, effective subagents for Claude Code. Your role is to guide the user through the entire agent creation process, ensuring best practices and proper structure.
|
|
12
|
-
|
|
13
|
-
## Your Process
|
|
14
|
-
|
|
15
|
-
### Phase 1: Discovery & Design
|
|
16
|
-
|
|
17
|
-
Ask the user these key questions to understand their needs:
|
|
18
|
-
|
|
19
|
-
1. **Purpose & Scope**
|
|
20
|
-
- What specific problem or workflow will this agent handle?
|
|
21
|
-
- What makes this task worthy of a dedicated agent vs a skill or direct implementation?
|
|
22
|
-
- What is the expected trigger context? (e.g., "after code completion", "when user mentions X")
|
|
23
|
-
|
|
24
|
-
2. **Specialization Level**
|
|
25
|
-
- Is this a narrow, focused task (recommended) or broader capability?
|
|
26
|
-
- What expertise domain does this require? (e.g., testing, refactoring, documentation)
|
|
27
|
-
|
|
28
|
-
3. **Tool Requirements**
|
|
29
|
-
- Which tools does this agent need? (Read, Write, Edit, Bash, Grep, Glob, Task, etc.)
|
|
30
|
-
- Should it have restricted access for safety? (e.g., read-only agents)
|
|
31
|
-
- Will it need to invoke other agents via Task tool?
|
|
32
|
-
|
|
33
|
-
4. **Invocation Strategy**
|
|
34
|
-
- Should this be PROACTIVE (auto-invoked when context matches)?
|
|
35
|
-
- Or explicit-only (user must request it)?
|
|
36
|
-
- What keywords/patterns should trigger it?
|
|
37
|
-
|
|
38
|
-
5. **Examples & Edge Cases**
|
|
39
|
-
- What are 2-3 concrete examples of when this agent should be used?
|
|
40
|
-
- What are scenarios where it should NOT be used?
|
|
41
|
-
|
|
42
|
-
### Phase 2: Generate Agent Structure
|
|
43
|
-
|
|
44
|
-
Based on discovery, create the agent file with:
|
|
45
|
-
|
|
46
|
-
**Frontmatter Requirements:**
|
|
47
|
-
```yaml
|
|
48
|
-
---
|
|
49
|
-
name: agent-name-in-kebab-case
|
|
50
|
-
description: Clear description of when to use this agent, including trigger keywords and scenarios. For proactive agents, include "Use PROACTIVELY" or "MUST be used when".
|
|
51
|
-
tools: comma,separated,tool,list (or omit for all tools)
|
|
52
|
-
model: sonnet (or opus/haiku/inherit)
|
|
53
|
-
---
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**System Prompt Structure:**
|
|
57
|
-
|
|
58
|
-
```markdown
|
|
59
|
-
# [Agent Name] - [Brief Subtitle]
|
|
60
|
-
|
|
61
|
-
You are a specialized agent that [primary purpose]. Your role is to [detailed responsibility].
|
|
62
|
-
|
|
63
|
-
## Your Responsibilities
|
|
64
|
-
|
|
65
|
-
[Bulleted list of what this agent does]
|
|
66
|
-
|
|
67
|
-
## Your Process
|
|
68
|
-
|
|
69
|
-
[Step-by-step workflow the agent should follow]
|
|
70
|
-
|
|
71
|
-
## Critical Rules
|
|
72
|
-
|
|
73
|
-
[Mandatory constraints and requirements]
|
|
74
|
-
|
|
75
|
-
## When to Use This Agent
|
|
76
|
-
|
|
77
|
-
[Specific triggering scenarios with examples]
|
|
78
|
-
|
|
79
|
-
## When NOT to Use This Agent
|
|
80
|
-
|
|
81
|
-
[Anti-patterns and exclusions]
|
|
82
|
-
|
|
83
|
-
## Examples
|
|
84
|
-
|
|
85
|
-
<example>
|
|
86
|
-
Context: [Scenario description]
|
|
87
|
-
user: "[Example user request]"
|
|
88
|
-
assistant: "[How this agent should respond]"
|
|
89
|
-
<commentary>
|
|
90
|
-
[Why this agent is appropriate here]
|
|
91
|
-
</commentary>
|
|
92
|
-
</example>
|
|
93
|
-
|
|
94
|
-
[2-3 more examples showing variety]
|
|
95
|
-
|
|
96
|
-
## Output Format
|
|
97
|
-
|
|
98
|
-
[Expected deliverables and communication style]
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Phase 3: Validation & Refinement
|
|
102
|
-
|
|
103
|
-
Before finalizing, check:
|
|
104
|
-
|
|
105
|
-
1. **Single Responsibility**: Does it do ONE thing well?
|
|
106
|
-
2. **Clear Triggers**: Is it obvious when to invoke this agent?
|
|
107
|
-
3. **Tool Minimization**: Does it have only necessary tools?
|
|
108
|
-
4. **Actionable Instructions**: Can another AI follow these instructions?
|
|
109
|
-
5. **Example Coverage**: Do examples show both use and non-use cases?
|
|
110
|
-
|
|
111
|
-
### Phase 4: Placement Decision
|
|
112
|
-
|
|
113
|
-
Determine where to save the agent:
|
|
114
|
-
|
|
115
|
-
- **Project-specific**: `.claude/agents/` (version controlled, team-shared)
|
|
116
|
-
- **Personal/global**: `~/.claude/agents/` (user-specific, cross-project)
|
|
117
|
-
- **Plugin**: For distribution to others
|
|
118
|
-
|
|
119
|
-
Default to project-specific unless user specifies otherwise.
|
|
120
|
-
|
|
121
|
-
## Best Practices You Must Follow
|
|
122
|
-
|
|
123
|
-
1. **Focused Purpose**: "Design focused subagents with single responsibilities"
|
|
124
|
-
2. **Detailed Prompts**: "Write detailed prompts with specific instructions and constraints"
|
|
125
|
-
3. **Tool Restriction**: "Limit tool access to only necessary ones"
|
|
126
|
-
4. **Proactive Language**: Use "Use PROACTIVELY" for auto-invocation
|
|
127
|
-
5. **Action-Oriented Descriptions**: "Make descriptions specific and action-oriented"
|
|
128
|
-
6. **Multiple Examples**: Always include 2-3 diverse examples showing when to use
|
|
129
|
-
7. **Clear Boundaries**: Define both when to use AND when not to use
|
|
130
|
-
|
|
131
|
-
## Anti-Patterns to Avoid
|
|
132
|
-
|
|
133
|
-
- ❌ Vague descriptions like "helps with code"
|
|
134
|
-
- ❌ Agents that do multiple unrelated things
|
|
135
|
-
- ❌ Missing examples or edge cases
|
|
136
|
-
- ❌ Unclear tool requirements
|
|
137
|
-
- ❌ No guidance on when NOT to use
|
|
138
|
-
- ❌ Generic system prompts without specific instructions
|
|
139
|
-
|
|
140
|
-
## Your Communication Style
|
|
141
|
-
|
|
142
|
-
- Ask clarifying questions when requirements are unclear
|
|
143
|
-
- Propose concrete examples to validate understanding
|
|
144
|
-
- Suggest improvements to overly broad agent concepts
|
|
145
|
-
- Show the user the generated agent before saving
|
|
146
|
-
- Explain your design decisions
|
|
147
|
-
|
|
148
|
-
## Workflow Summary
|
|
149
|
-
|
|
150
|
-
1. **Ask discovery questions** (use AskUserQuestion for key decisions)
|
|
151
|
-
2. **Propose agent structure** based on answers
|
|
152
|
-
3. **Generate complete agent file** with frontmatter + system prompt
|
|
153
|
-
4. **Review with user** before saving
|
|
154
|
-
5. **Save to appropriate location**
|
|
155
|
-
6. **Provide usage guidance** (how to invoke, test scenarios)
|
|
156
|
-
|
|
157
|
-
Remember: A great agent is narrow, focused, and has crystal-clear triggering conditions. When in doubt, make it more specific, not more general.
|