specrails-core 2.1.2 → 3.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/commands/setup.md +143 -49
- package/install.sh +100 -15
- package/package.json +5 -1
- package/templates/commands/sr/team-debug.md +286 -0
- package/templates/commands/sr/team-review.md +341 -0
- package/update.sh +3 -3
package/commands/setup.md
CHANGED
|
@@ -176,8 +176,10 @@ grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken
|
|
|
176
176
|
|
|
177
177
|
For each command in the "changed commands" list from Phase U3:
|
|
178
178
|
|
|
179
|
-
1. Read the NEW template
|
|
180
|
-
|
|
179
|
+
1. Read the NEW template:
|
|
180
|
+
- If `cli_provider == "claude"`: from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md`
|
|
181
|
+
- If `cli_provider == "codex"`: from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md`
|
|
182
|
+
2. Read stored backlog configuration from `$SPECRAILS_DIR/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
|
|
181
183
|
- `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
|
|
182
184
|
- `BACKLOG_WRITE` → `write_access` field
|
|
183
185
|
- `JIRA_BASE_URL` → `jira_base_url` field
|
|
@@ -192,12 +194,19 @@ For each command in the "changed commands" list from Phase U3:
|
|
|
192
194
|
- `{{BACKLOG_VIEW_CMD}}` → provider-specific view command from backlog config
|
|
193
195
|
- `{{BACKLOG_PREFLIGHT}}` → provider-specific preflight check from backlog config
|
|
194
196
|
- Any other `{{PLACEHOLDER}}` values → use Phase U2 analysis data
|
|
195
|
-
4. Write the updated
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
4. Write the updated file:
|
|
198
|
+
- If `cli_provider == "claude"`: to `.claude/commands/sr/<name>.md`
|
|
199
|
+
- If `cli_provider == "codex"`: to `.agents/skills/sr-<name>/SKILL.md`
|
|
200
|
+
5. Show:
|
|
201
|
+
- If `cli_provider == "claude"`: `✓ Updated /sr:<name>`
|
|
202
|
+
- If `cli_provider == "codex"`: `✓ Updated $sr-<name>`
|
|
203
|
+
|
|
204
|
+
After updating all changed commands/skills, verify no unresolved placeholders remain:
|
|
199
205
|
```bash
|
|
206
|
+
# If cli_provider == "claude":
|
|
200
207
|
grep -l '{{[A-Z_]*}}' .claude/commands/sr/*.md 2>/dev/null || echo "OK: no broken placeholders"
|
|
208
|
+
# If cli_provider == "codex":
|
|
209
|
+
grep -rl '{{[A-Z_]*}}' .agents/skills/sr-*/SKILL.md 2>/dev/null || echo "OK: no broken placeholders"
|
|
201
210
|
```
|
|
202
211
|
If any placeholders remain unresolved, warn the user:
|
|
203
212
|
> "⚠ Some placeholders in `<filename>` could not be resolved automatically. Please review the file and fill them in manually."
|
|
@@ -221,24 +230,32 @@ For each agent in the "new" list:
|
|
|
221
230
|
|
|
222
231
|
For each command in the "new commands" list from Phase U3:
|
|
223
232
|
|
|
224
|
-
1. Read the template
|
|
233
|
+
1. Read the template:
|
|
234
|
+
- If `cli_provider == "claude"`: from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md`
|
|
235
|
+
- If `cli_provider == "codex"`: from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md`
|
|
225
236
|
2. Prompt the user:
|
|
226
|
-
|
|
237
|
+
- If `cli_provider == "claude"`: `"New command available: /sr:<name> — [one-line description]. Install it? [Y/n]"`
|
|
238
|
+
- If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
|
|
227
239
|
3. If the user accepts (or presses Enter):
|
|
228
240
|
- Apply placeholder substitution using the same rules as Phase U4b (backlog config + codebase analysis)
|
|
229
|
-
-
|
|
230
|
-
-
|
|
241
|
+
- If `cli_provider == "claude"`: write to `.claude/commands/sr/<name>.md` — show `✓ Added /sr:<name>`
|
|
242
|
+
- If `cli_provider == "codex"`: write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name>`
|
|
231
243
|
4. If the user declines:
|
|
232
|
-
-
|
|
244
|
+
- If `cli_provider == "claude"`: show `→ Skipped /sr:<name>`
|
|
245
|
+
- If `cli_provider == "codex"`: show `→ Skipped $sr-<name>`
|
|
233
246
|
|
|
234
247
|
### Phase U6: Update Workflow Commands
|
|
235
248
|
|
|
236
249
|
If any new agents were added in Phase U5:
|
|
237
250
|
|
|
238
|
-
1. Read
|
|
251
|
+
1. Read the implement command/skill:
|
|
252
|
+
- If `cli_provider == "claude"`: `.claude/commands/sr/implement.md`
|
|
253
|
+
- If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
|
|
239
254
|
2. Check if the file references agent names in its orchestration steps (look for `sr-architect`, `sr-developer`, `sr-reviewer` etc.)
|
|
240
255
|
3. If newly added agents belong in the implementation pipeline (i.e., they are layer-specific developers such as `sr-frontend-developer` or `sr-backend-developer`), add them to the appropriate step in the implement command — specifically where parallel developer agents are launched
|
|
241
|
-
4. Write the updated
|
|
256
|
+
4. Write the updated file if any changes were made:
|
|
257
|
+
- If `cli_provider == "claude"`: `.claude/commands/sr/implement.md`
|
|
258
|
+
- If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
|
|
242
259
|
5. Show which commands were updated, or "No command updates needed" if nothing changed
|
|
243
260
|
|
|
244
261
|
This is a lightweight check — only update commands where the sr- agent clearly belongs. Do not restructure the entire command.
|
|
@@ -297,21 +314,14 @@ When no flags are passed (the default), run this streamlined 3-question setup. D
|
|
|
297
314
|
|
|
298
315
|
### QS1: Ask the 3 questions
|
|
299
316
|
|
|
300
|
-
|
|
317
|
+
Display the following prompt EXACTLY ONCE and then wait for the user's responses. Do NOT repeat the questions — output them a single time only.
|
|
301
318
|
|
|
302
|
-
```
|
|
303
319
|
Welcome to specrails! Let's get your AI agent team set up in 3 quick questions.
|
|
304
320
|
|
|
305
321
|
1. What is this project? (one sentence)
|
|
306
|
-
> _
|
|
307
|
-
|
|
308
322
|
2. Who are the target users?
|
|
309
|
-
> _
|
|
310
|
-
|
|
311
323
|
3. Git access for agents — read-only or read-write?
|
|
312
324
|
(read-only = agents can read and suggest; read-write = agents can commit)
|
|
313
|
-
> _
|
|
314
|
-
```
|
|
315
325
|
|
|
316
326
|
Store the answers as:
|
|
317
327
|
- `QS_PROJECT_DESCRIPTION` — answer to question 1
|
|
@@ -341,20 +351,31 @@ Store as `QS_IS_EXISTING_CODEBASE=true/false`.
|
|
|
341
351
|
|
|
342
352
|
Before generating files, check if this is a re-run:
|
|
343
353
|
|
|
344
|
-
1. Check if
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
354
|
+
1. Check if commands/skills already exist:
|
|
355
|
+
- If `cli_provider == "claude"`: check if `.claude/commands/sr/` directory exists with any `.md` files:
|
|
356
|
+
```bash
|
|
357
|
+
ls .claude/commands/sr/*.md 2>/dev/null
|
|
358
|
+
```
|
|
359
|
+
- If `cli_provider == "codex"`: check if `.agents/skills/sr-*/SKILL.md` files exist:
|
|
360
|
+
```bash
|
|
361
|
+
ls .agents/skills/sr-*/SKILL.md 2>/dev/null
|
|
362
|
+
```
|
|
363
|
+
2. If files are found → this is a **re-run**. Store `QS_IS_RERUN=true`.
|
|
349
364
|
3. If the directory does not exist or is empty → this is a **fresh install**. Store `QS_IS_RERUN=false`.
|
|
350
365
|
|
|
351
|
-
In re-run mode, QS3 executes in **gap-fill mode** for command files:
|
|
352
|
-
- For each command in the list, check if it already exists
|
|
353
|
-
- If
|
|
354
|
-
- If
|
|
366
|
+
In re-run mode, QS3 executes in **gap-fill mode** for command/skill files:
|
|
367
|
+
- For each command in the list, check if it already exists:
|
|
368
|
+
- If `cli_provider == "claude"`: at `.claude/commands/sr/<name>.md`
|
|
369
|
+
- If `cli_provider == "codex"`: at `.agents/skills/sr-<name>/SKILL.md`
|
|
370
|
+
- If it exists: skip it and show:
|
|
371
|
+
- Claude: `✓ Already installed: /sr:<name>`
|
|
372
|
+
- Codex: `✓ Already installed: $sr-<name>`
|
|
373
|
+
- If it does NOT exist: install it and show:
|
|
374
|
+
- Claude: `✓ Added /sr:<name> (was missing)`
|
|
375
|
+
- Codex: `✓ Added $sr-<name> (was missing)`
|
|
355
376
|
- Do NOT prompt the user for confirmation on missing files — install them automatically
|
|
356
377
|
|
|
357
|
-
For CLAUDE.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
|
|
378
|
+
For CLAUDE.md/AGENTS.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
|
|
358
379
|
|
|
359
380
|
### QS3: Generate files
|
|
360
381
|
|
|
@@ -404,11 +425,21 @@ Core commands (always install if missing):
|
|
|
404
425
|
|
|
405
426
|
Do NOT copy `product-backlog.md` or `update-product-driven-backlog.md` (no backlog provider configured).
|
|
406
427
|
|
|
407
|
-
If `
|
|
428
|
+
**If `cli_provider == "claude"`:**
|
|
429
|
+
|
|
430
|
+
If `QS_IS_RERUN=false` (fresh install): copy all core commands from `$SPECRAILS_DIR/setup-templates/commands/sr/` to `.claude/commands/sr/`.
|
|
408
431
|
|
|
409
432
|
If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.claude/commands/sr/<name>.md` already exists:
|
|
410
433
|
- If it exists: skip it — show `✓ Already installed: /sr:<name>`
|
|
411
|
-
- If it does NOT exist: copy from
|
|
434
|
+
- If it does NOT exist: copy from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md` — show `✓ Added /sr:<name> (was missing)`
|
|
435
|
+
|
|
436
|
+
**If `cli_provider == "codex"`:**
|
|
437
|
+
|
|
438
|
+
If `QS_IS_RERUN=false` (fresh install): for each core command, copy the corresponding skill from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md` to `.agents/skills/sr-<name>/SKILL.md` (create the directory first).
|
|
439
|
+
|
|
440
|
+
If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.agents/skills/sr-<name>/SKILL.md` already exists:
|
|
441
|
+
- If it exists: skip it — show `✓ Already installed: $sr-<name>`
|
|
442
|
+
- If it does NOT exist: copy from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name> (was missing)`
|
|
412
443
|
|
|
413
444
|
**4. Cleanup**
|
|
414
445
|
|
|
@@ -954,9 +985,11 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
|
|
|
954
985
|
- Use the VPC personas generated in Phase 2
|
|
955
986
|
- File naming: kebab-case of persona nickname (e.g., `the-developer.md`, `the-admin.md`)
|
|
956
987
|
|
|
957
|
-
### 4.3 Generate commands
|
|
988
|
+
### 4.3 Generate commands / skills
|
|
958
989
|
|
|
959
|
-
For each selected command, read the template and adapt
|
|
990
|
+
For each selected command, read the template and adapt.
|
|
991
|
+
|
|
992
|
+
**If `cli_provider == "claude"` (default):**
|
|
960
993
|
- `setup-templates/commands/sr/implement.md` → `.claude/commands/sr/implement.md`
|
|
961
994
|
- `setup-templates/commands/sr/batch-implement.md` → `.claude/commands/sr/batch-implement.md`
|
|
962
995
|
- `setup-templates/commands/sr/propose-spec.md` → `.claude/commands/sr/propose-spec.md`
|
|
@@ -967,6 +1000,32 @@ For each selected command, read the template and adapt:
|
|
|
967
1000
|
- `setup-templates/commands/sr/refactor-recommender.md` → `.claude/commands/sr/refactor-recommender.md`
|
|
968
1001
|
- `setup-templates/commands/sr/why.md` → `.claude/commands/sr/why.md`
|
|
969
1002
|
|
|
1003
|
+
**If `cli_provider == "codex"`:**
|
|
1004
|
+
- `setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
|
|
1005
|
+
- `setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
|
|
1006
|
+
- `setup-templates/commands/sr/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
|
|
1007
|
+
- `setup-templates/commands/sr/product-backlog.md` → `.agents/skills/sr-product-backlog/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1008
|
+
- `setup-templates/commands/sr/update-product-driven-backlog.md` → `.agents/skills/sr-update-product-driven-backlog/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1009
|
+
- `setup-templates/skills/sr-health-check/SKILL.md` → `.agents/skills/sr-health-check/SKILL.md`
|
|
1010
|
+
- `setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
|
|
1011
|
+
- `setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
|
|
1012
|
+
- `setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
|
|
1013
|
+
|
|
1014
|
+
**Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in `setup-templates/skills/` for a command, generate the `SKILL.md` by prepending YAML frontmatter to the command content:
|
|
1015
|
+
```yaml
|
|
1016
|
+
---
|
|
1017
|
+
name: sr-<name>
|
|
1018
|
+
description: "<one-line description from the command's first heading>"
|
|
1019
|
+
license: MIT
|
|
1020
|
+
compatibility: "Requires git."
|
|
1021
|
+
metadata:
|
|
1022
|
+
author: specrails
|
|
1023
|
+
version: "1.0"
|
|
1024
|
+
---
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
For both providers, create the output directory before writing (`mkdir -p` for `.claude/commands/sr/` or `.agents/skills/sr-<name>/`).
|
|
1028
|
+
|
|
970
1029
|
Adapt:
|
|
971
1030
|
- CI commands to match detected stack
|
|
972
1031
|
- **Persona references** to match generated personas (see substitution rules below)
|
|
@@ -980,7 +1039,7 @@ When adapting `update-product-driven-backlog.md` and `product-backlog.md`, subst
|
|
|
980
1039
|
|
|
981
1040
|
| Placeholder | Substitution rule |
|
|
982
1041
|
|-------------|------------------|
|
|
983
|
-
| `{{PERSONA_FILE_READ_LIST}}` | One bullet per persona file: `- Read
|
|
1042
|
+
| `{{PERSONA_FILE_READ_LIST}}` | One bullet per persona file: `- Read \`$SPECRAILS_DIR/agents/personas/{name}.md\`` |
|
|
984
1043
|
| `{{PERSONA_SCORE_HEADERS}}` | Column headers for each persona nickname: e.g., `Alex \| Sara \| Kai` |
|
|
985
1044
|
| `{{PERSONA_SCORE_SEPARATORS}}` | One `------` separator per persona column |
|
|
986
1045
|
| `{{PERSONA_FIT_FORMAT}}` | Inline score display: e.g., `Alex: X/5, Sara: X/5, Kai: X/5` |
|
|
@@ -1017,7 +1076,7 @@ When adapting `update-product-driven-backlog.md` and `product-backlog.md`, subst
|
|
|
1017
1076
|
- Issue view: `jira issue view {key}` or REST API
|
|
1018
1077
|
- VPC scores stored in the issue description body (same markdown format, parsed from description)
|
|
1019
1078
|
- Pre-flight check: `jira me` or test API connectivity
|
|
1020
|
-
- Store JIRA config in
|
|
1079
|
+
- Store JIRA config in `$SPECRAILS_DIR/backlog-config.json`:
|
|
1021
1080
|
```json
|
|
1022
1081
|
{
|
|
1023
1082
|
"provider": "jira",
|
|
@@ -1033,16 +1092,18 @@ The command templates use `{{BACKLOG_FETCH_CMD}}`, `{{BACKLOG_CREATE_CMD}}`, `{{
|
|
|
1033
1092
|
### 4.4 Generate rules
|
|
1034
1093
|
|
|
1035
1094
|
For each detected layer, read the layer rule template and generate a layer-specific rules file:
|
|
1036
|
-
- `setup-templates/rules/layer.md` →
|
|
1095
|
+
- `setup-templates/rules/layer.md` → `$SPECRAILS_DIR/rules/{layer-name}.md`
|
|
1037
1096
|
|
|
1038
1097
|
Each rule file must:
|
|
1039
1098
|
- Have the correct `paths:` frontmatter matching the layer's directory
|
|
1040
1099
|
- Contain conventions specific to that layer (from Phase 1 analysis)
|
|
1041
1100
|
- Reference actual file paths and patterns from the codebase
|
|
1042
1101
|
|
|
1043
|
-
### 4.5 Generate root
|
|
1102
|
+
### 4.5 Generate root instructions file
|
|
1103
|
+
|
|
1104
|
+
**If `cli_provider == "claude"`:** If no `CLAUDE.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
|
|
1044
1105
|
|
|
1045
|
-
If no
|
|
1106
|
+
**If `cli_provider == "codex"`:** If no `AGENTS.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
|
|
1046
1107
|
|
|
1047
1108
|
### 4.6 Generate settings
|
|
1048
1109
|
|
|
@@ -1154,13 +1215,14 @@ ls .claude/agent-memory/
|
|
|
1154
1215
|
# If cli_provider == "codex":
|
|
1155
1216
|
ls .codex/agents/sr-*.toml
|
|
1156
1217
|
ls .codex/agents/personas/*.md
|
|
1157
|
-
ls .
|
|
1218
|
+
ls .agents/skills/sr-*/SKILL.md
|
|
1158
1219
|
ls .codex/rules/*.md
|
|
1159
1220
|
ls .codex/agent-memory/
|
|
1160
1221
|
|
|
1161
1222
|
# These should NOT exist (scaffolding):
|
|
1162
1223
|
# $SPECRAILS_DIR/setup-templates/ — GONE
|
|
1163
|
-
# $SPECRAILS_DIR/commands/setup.md — GONE
|
|
1224
|
+
# If cli_provider == "claude": $SPECRAILS_DIR/commands/setup.md — GONE
|
|
1225
|
+
# If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
|
|
1164
1226
|
```
|
|
1165
1227
|
|
|
1166
1228
|
If any scaffolding artifact remains, remove it.
|
|
@@ -1198,7 +1260,8 @@ Display the complete installation summary:
|
|
|
1198
1260
|
[For each user-generated persona:]
|
|
1199
1261
|
| "[Name]" — The [Role] | $SPECRAILS_DIR/agents/personas/[name].md | Generated |
|
|
1200
1262
|
|
|
1201
|
-
### Commands Installed
|
|
1263
|
+
### Commands / Skills Installed
|
|
1264
|
+
[If cli_provider == "claude":]
|
|
1202
1265
|
| Command | File |
|
|
1203
1266
|
|---------|------|
|
|
1204
1267
|
| /sr:implement | .claude/commands/sr/implement.md |
|
|
@@ -1210,33 +1273,58 @@ Display the complete installation summary:
|
|
|
1210
1273
|
| /sr:compat-check | .claude/commands/sr/compat-check.md |
|
|
1211
1274
|
| /sr:refactor-recommender | .claude/commands/sr/refactor-recommender.md |
|
|
1212
1275
|
| /sr:why | .claude/commands/sr/why.md |
|
|
1213
|
-
|
|
1214
|
-
|
|
1276
|
+
[If cli_provider == "codex":]
|
|
1277
|
+
| Skill | File |
|
|
1278
|
+
|-------|------|
|
|
1279
|
+
| $sr-implement | .agents/skills/sr-implement/SKILL.md |
|
|
1280
|
+
| $sr-batch-implement | .agents/skills/sr-batch-implement/SKILL.md |
|
|
1281
|
+
| $sr-propose-spec | .agents/skills/sr-propose-spec/SKILL.md |
|
|
1282
|
+
| $sr-product-backlog | .agents/skills/sr-product-backlog/SKILL.md |
|
|
1283
|
+
| $sr-update-product-driven-backlog | .agents/skills/sr-update-product-driven-backlog/SKILL.md |
|
|
1284
|
+
| $sr-health-check | .agents/skills/sr-health-check/SKILL.md |
|
|
1285
|
+
| $sr-compat-check | .agents/skills/sr-compat-check/SKILL.md |
|
|
1286
|
+
| $sr-refactor-recommender | .agents/skills/sr-refactor-recommender/SKILL.md |
|
|
1287
|
+
| $sr-why | .agents/skills/sr-why/SKILL.md |
|
|
1288
|
+
|
|
1289
|
+
Note: Only commands/skills selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
|
|
1215
1290
|
|
|
1216
1291
|
### Rules Created
|
|
1217
1292
|
| Layer | File |
|
|
1218
1293
|
|-------|------|
|
|
1219
|
-
| Backend |
|
|
1220
|
-
| Frontend |
|
|
1294
|
+
| Backend | $SPECRAILS_DIR/rules/backend.md |
|
|
1295
|
+
| Frontend | $SPECRAILS_DIR/rules/frontend.md |
|
|
1221
1296
|
|
|
1222
1297
|
### Scaffolding Removed
|
|
1223
1298
|
| Artifact | Status |
|
|
1224
1299
|
|----------|--------|
|
|
1225
|
-
|
|
|
1226
|
-
| .claude/commands/setup.md | Deleted |
|
|
1300
|
+
| $SPECRAILS_DIR/setup-templates/ | Deleted |
|
|
1301
|
+
[If cli_provider == "claude":] | .claude/commands/setup.md | Deleted |
|
|
1302
|
+
[If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
|
|
1227
1303
|
| specrails/ | [User's choice] |
|
|
1228
1304
|
|
|
1229
1305
|
### Next Steps
|
|
1306
|
+
[If cli_provider == "claude":]
|
|
1230
1307
|
1. Review the generated files in .claude/
|
|
1231
1308
|
2. Run `/sr:product-backlog` to see your backlog (if GitHub Issues exist)
|
|
1232
1309
|
3. Run `/sr:update-product-driven-backlog` to generate feature ideas
|
|
1233
1310
|
4. Run `/sr:implement #issue-number` to implement a feature
|
|
1234
1311
|
5. Commit the .claude/ directory to version control
|
|
1312
|
+
[If cli_provider == "codex":]
|
|
1313
|
+
1. Review the generated files in .codex/ and .agents/skills/
|
|
1314
|
+
2. Run `$sr-product-backlog` to see your backlog (if GitHub Issues exist)
|
|
1315
|
+
3. Run `$sr-update-product-driven-backlog` to generate feature ideas
|
|
1316
|
+
4. Run `$sr-implement #issue-number` to implement a feature
|
|
1317
|
+
5. Commit the .codex/ and .agents/ directories to version control
|
|
1235
1318
|
|
|
1236
1319
|
### Quick Start
|
|
1320
|
+
[If cli_provider == "claude":]
|
|
1237
1321
|
- `/sr:implement "describe a feature"` — implement something right now
|
|
1238
1322
|
- `/sr:product-backlog` — see prioritized feature ideas
|
|
1239
1323
|
- `/sr:update-product-driven-backlog` — discover new features using VPC
|
|
1324
|
+
[If cli_provider == "codex":]
|
|
1325
|
+
- `$sr-implement "describe a feature"` — implement something right now
|
|
1326
|
+
- `$sr-product-backlog` — see prioritized feature ideas
|
|
1327
|
+
- `$sr-update-product-driven-backlog` — discover new features using VPC
|
|
1240
1328
|
```
|
|
1241
1329
|
|
|
1242
1330
|
## First Task Prompt (Advanced Mode)
|
|
@@ -1248,7 +1336,10 @@ After displaying the setup complete summary above, detect the project type and o
|
|
|
1248
1336
|
✅ Setup complete.
|
|
1249
1337
|
|
|
1250
1338
|
Try your first spec:
|
|
1339
|
+
[If cli_provider == "claude":]
|
|
1251
1340
|
> /sr:product-backlog
|
|
1341
|
+
[If cli_provider == "codex":]
|
|
1342
|
+
> $sr-product-backlog
|
|
1252
1343
|
```
|
|
1253
1344
|
|
|
1254
1345
|
**Existing codebase** (one or more of the above files found in root):
|
|
@@ -1256,7 +1347,10 @@ Try your first spec:
|
|
|
1256
1347
|
✅ Setup complete.
|
|
1257
1348
|
|
|
1258
1349
|
Try your first spec:
|
|
1350
|
+
[If cli_provider == "claude":]
|
|
1259
1351
|
> /sr:health-check
|
|
1352
|
+
[If cli_provider == "codex":]
|
|
1353
|
+
> $sr-health-check
|
|
1260
1354
|
```
|
|
1261
1355
|
|
|
1262
1356
|
Then stop.
|
package/install.sh
CHANGED
|
@@ -44,6 +44,7 @@ SPECRAILS_DIR=""
|
|
|
44
44
|
INSTRUCTIONS_FILE=""
|
|
45
45
|
HAS_CLAUDE=false
|
|
46
46
|
HAS_CODEX=false
|
|
47
|
+
AGENT_TEAMS=false
|
|
47
48
|
|
|
48
49
|
while [[ $# -gt 0 ]]; do
|
|
49
50
|
case "$1" in
|
|
@@ -98,7 +99,7 @@ if [[ -z "$CUSTOM_ROOT_DIR" && -f "$SCRIPT_DIR/install.sh" && -d "$SCRIPT_DIR/te
|
|
|
98
99
|
echo -e "${YELLOW}⚠${NC} You're running the installer from inside the specrails source repo."
|
|
99
100
|
echo -e " specrails installs into a ${BOLD}target${NC} repository, not into itself."
|
|
100
101
|
echo ""
|
|
101
|
-
read -p " Enter the path to the target repo (or 'q' to quit): " TARGET_PATH
|
|
102
|
+
read -p " Enter the path to the target repo (or 'q' to quit): " TARGET_PATH || TARGET_PATH="q"
|
|
102
103
|
if [[ "$TARGET_PATH" == "q" || -z "$TARGET_PATH" ]]; then
|
|
103
104
|
echo " Aborted. No changes made."
|
|
104
105
|
exit 0
|
|
@@ -229,7 +230,7 @@ elif [ "$HAS_CLAUDE" = true ] && [ "$HAS_CODEX" = true ]; then
|
|
|
229
230
|
echo " 1) Claude Code (claude) → output to .claude/"
|
|
230
231
|
echo " 2) Codex (codex) → output to .codex/"
|
|
231
232
|
echo ""
|
|
232
|
-
read -p " Select provider (1 or 2, default: 1): " PROVIDER_CHOICE
|
|
233
|
+
read -p " Select provider (1 or 2, default: 1): " PROVIDER_CHOICE || PROVIDER_CHOICE="1"
|
|
233
234
|
PROVIDER_CHOICE="${PROVIDER_CHOICE:-1}"
|
|
234
235
|
if [[ "$PROVIDER_CHOICE" == "2" ]]; then
|
|
235
236
|
CLI_PROVIDER="codex"
|
|
@@ -266,6 +267,35 @@ else
|
|
|
266
267
|
INSTRUCTIONS_FILE="CLAUDE.md"
|
|
267
268
|
fi
|
|
268
269
|
|
|
270
|
+
# 1.2b Agent Teams opt-in (Claude Code only)
|
|
271
|
+
if [[ "$CLI_PROVIDER" == "claude" ]]; then
|
|
272
|
+
echo ""
|
|
273
|
+
if [ "$AUTO_YES" = true ]; then
|
|
274
|
+
# --yes flag: default to NOT installing (opt-in, not opt-out)
|
|
275
|
+
AGENT_TEAMS=false
|
|
276
|
+
info "Agent Teams commands: skipped (opt-in, use interactive mode to enable)"
|
|
277
|
+
else
|
|
278
|
+
echo -e " ${BOLD}Agent Teams commands are available (experimental):${NC}"
|
|
279
|
+
echo " /sr:team-review — Multi-perspective code review with AI reviewers"
|
|
280
|
+
echo " /sr:team-debug — Collaborative debugging with competing hypotheses"
|
|
281
|
+
echo ""
|
|
282
|
+
echo " These require Claude Code Agent Teams (experimental feature)."
|
|
283
|
+
read -p " Install Agent Teams commands? (y/n, default: n): " INSTALL_AGENT_TEAMS || INSTALL_AGENT_TEAMS="n"
|
|
284
|
+
if [[ "$INSTALL_AGENT_TEAMS" == "y" || "$INSTALL_AGENT_TEAMS" == "Y" ]]; then
|
|
285
|
+
AGENT_TEAMS=true
|
|
286
|
+
ok "Agent Teams commands will be installed"
|
|
287
|
+
echo ""
|
|
288
|
+
info "Remember to set the feature flag before using these commands:"
|
|
289
|
+
echo ""
|
|
290
|
+
echo " export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1"
|
|
291
|
+
echo ""
|
|
292
|
+
else
|
|
293
|
+
AGENT_TEAMS=false
|
|
294
|
+
info "Agent Teams commands: skipped"
|
|
295
|
+
fi
|
|
296
|
+
fi
|
|
297
|
+
fi
|
|
298
|
+
|
|
269
299
|
# 1.3 API key / authentication (provider-specific)
|
|
270
300
|
if [[ "$CLI_PROVIDER" == "claude" ]]; then
|
|
271
301
|
CLAUDE_AUTHED=false
|
|
@@ -334,7 +364,7 @@ elif [ -f "$REPO_ROOT/node_modules/.bin/openspec" ]; then
|
|
|
334
364
|
else
|
|
335
365
|
warn "OpenSpec CLI not found."
|
|
336
366
|
if [ "$HAS_NPM" = true ]; then
|
|
337
|
-
if [ "$AUTO_YES" = true ]; then INSTALL_OPENSPEC="y"; else read -p " Install OpenSpec CLI globally? (y/n): " INSTALL_OPENSPEC; fi
|
|
367
|
+
if [ "$AUTO_YES" = true ]; then INSTALL_OPENSPEC="y"; else read -p " Install OpenSpec CLI globally? (y/n): " INSTALL_OPENSPEC || INSTALL_OPENSPEC="n"; fi
|
|
338
368
|
if [ "$INSTALL_OPENSPEC" = "y" ] || [ "$INSTALL_OPENSPEC" = "Y" ]; then
|
|
339
369
|
info "Installing OpenSpec CLI..."
|
|
340
370
|
npm install -g @openspec/cli 2>/dev/null && {
|
|
@@ -439,7 +469,7 @@ fi
|
|
|
439
469
|
if [ "$EXISTING_SETUP" = true ]; then
|
|
440
470
|
echo ""
|
|
441
471
|
warn "This repo already has some agent/command/openspec artifacts."
|
|
442
|
-
if [ "$AUTO_YES" = true ]; then CONTINUE="y"; else read -p " Continue and merge with existing setup? (y/n): " CONTINUE; fi
|
|
472
|
+
if [ "$AUTO_YES" = true ]; then CONTINUE="y"; else read -p " Continue and merge with existing setup? (y/n): " CONTINUE || CONTINUE="n"; fi
|
|
443
473
|
if [ "$CONTINUE" != "y" ] && [ "$CONTINUE" != "Y" ]; then
|
|
444
474
|
info "Aborted. No changes made."
|
|
445
475
|
exit 0
|
|
@@ -456,7 +486,13 @@ step "Phase 3: Installing specrails artifacts"
|
|
|
456
486
|
|
|
457
487
|
# Create directory structure
|
|
458
488
|
mkdir -p "$REPO_ROOT/specrails"
|
|
459
|
-
|
|
489
|
+
if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
490
|
+
# Codex: install as Agent Skills (Codex doesn't support .codex/commands/)
|
|
491
|
+
mkdir -p "$REPO_ROOT/.agents/skills/setup"
|
|
492
|
+
mkdir -p "$REPO_ROOT/.agents/skills/doctor"
|
|
493
|
+
else
|
|
494
|
+
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/commands"
|
|
495
|
+
fi
|
|
460
496
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/agents"
|
|
461
497
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/commands"
|
|
462
498
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/skills"
|
|
@@ -467,13 +503,46 @@ mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/settings"
|
|
|
467
503
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/prompts"
|
|
468
504
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/agent-memory/explanations"
|
|
469
505
|
|
|
470
|
-
# Copy the /setup
|
|
471
|
-
|
|
472
|
-
|
|
506
|
+
# Copy the /setup and /doctor commands (or skills for Codex)
|
|
507
|
+
if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
508
|
+
# Codex uses Agent Skills in .agents/skills/<name>/SKILL.md
|
|
509
|
+
{
|
|
510
|
+
echo '---'
|
|
511
|
+
echo 'name: setup'
|
|
512
|
+
echo 'description: "Interactive wizard to configure the full specrails agent workflow system for this repository."'
|
|
513
|
+
echo 'license: MIT'
|
|
514
|
+
echo 'compatibility: "Requires npm, git."'
|
|
515
|
+
echo 'metadata:'
|
|
516
|
+
echo ' author: specrails'
|
|
517
|
+
echo ' version: "1.0"'
|
|
518
|
+
echo '---'
|
|
519
|
+
echo ''
|
|
520
|
+
cat "$SCRIPT_DIR/commands/setup.md"
|
|
521
|
+
} > "$REPO_ROOT/.agents/skills/setup/SKILL.md"
|
|
522
|
+
ok "Installed \$setup skill"
|
|
523
|
+
|
|
524
|
+
{
|
|
525
|
+
echo '---'
|
|
526
|
+
echo 'name: doctor'
|
|
527
|
+
echo 'description: "Health check for the specrails agent workflow system — validates agents, commands, rules, and configuration."'
|
|
528
|
+
echo 'license: MIT'
|
|
529
|
+
echo 'compatibility: "Requires npm, git."'
|
|
530
|
+
echo 'metadata:'
|
|
531
|
+
echo ' author: specrails'
|
|
532
|
+
echo ' version: "1.0"'
|
|
533
|
+
echo '---'
|
|
534
|
+
echo ''
|
|
535
|
+
cat "$SCRIPT_DIR/commands/doctor.md"
|
|
536
|
+
} > "$REPO_ROOT/.agents/skills/doctor/SKILL.md"
|
|
537
|
+
ok "Installed \$doctor skill"
|
|
538
|
+
else
|
|
539
|
+
# Claude Code uses commands in .claude/commands/
|
|
540
|
+
cp "$SCRIPT_DIR/commands/setup.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/setup.md"
|
|
541
|
+
ok "Installed /setup command"
|
|
473
542
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
543
|
+
cp "$SCRIPT_DIR/commands/doctor.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/doctor.md"
|
|
544
|
+
ok "Installed /doctor command"
|
|
545
|
+
fi
|
|
477
546
|
|
|
478
547
|
# Install bin/doctor.sh for standalone use
|
|
479
548
|
mkdir -p "$REPO_ROOT/.specrails/bin"
|
|
@@ -482,7 +551,9 @@ chmod +x "$REPO_ROOT/.specrails/bin/doctor.sh"
|
|
|
482
551
|
ok "Installed specrails doctor (bin/doctor.sh)"
|
|
483
552
|
|
|
484
553
|
# Copy templates (includes commands, skills, agents, rules, personas, settings)
|
|
485
|
-
|
|
554
|
+
# Use tar to exclude node_modules and package-lock.json for performance
|
|
555
|
+
tar -C "$SCRIPT_DIR/templates" --exclude='node_modules' --exclude='package-lock.json' -cf - . \
|
|
556
|
+
| tar -C "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/" -xf -
|
|
486
557
|
ok "Installed setup templates (commands + skills)"
|
|
487
558
|
|
|
488
559
|
# Write OSS detection results for /setup
|
|
@@ -503,7 +574,8 @@ cat > "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/.provider-detection.json" << EO
|
|
|
503
574
|
{
|
|
504
575
|
"cli_provider": "$CLI_PROVIDER",
|
|
505
576
|
"specrails_dir": "$SPECRAILS_DIR",
|
|
506
|
-
"instructions_file": "$INSTRUCTIONS_FILE"
|
|
577
|
+
"instructions_file": "$INSTRUCTIONS_FILE",
|
|
578
|
+
"agent_teams": $AGENT_TEAMS
|
|
507
579
|
}
|
|
508
580
|
EOF
|
|
509
581
|
ok "Provider detection results written ($CLI_PROVIDER → $SPECRAILS_DIR/)"
|
|
@@ -550,9 +622,18 @@ echo ""
|
|
|
550
622
|
echo -e "${BOLD}${GREEN}Installation summary:${NC}"
|
|
551
623
|
echo ""
|
|
552
624
|
echo " Provider: $CLI_PROVIDER → output to $SPECRAILS_DIR/"
|
|
625
|
+
if [[ "$AGENT_TEAMS" == "true" ]]; then
|
|
626
|
+
echo " Agent Teams: installed (/sr:team-review, /sr:team-debug)"
|
|
627
|
+
echo " Feature flag: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 (required)"
|
|
628
|
+
fi
|
|
553
629
|
echo ""
|
|
554
630
|
echo " Files installed:"
|
|
555
|
-
|
|
631
|
+
if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
632
|
+
echo " .agents/skills/setup/SKILL.md ← The \$setup skill"
|
|
633
|
+
echo " .agents/skills/doctor/SKILL.md ← The \$doctor skill"
|
|
634
|
+
else
|
|
635
|
+
echo " $SPECRAILS_DIR/commands/setup.md ← The /setup command"
|
|
636
|
+
fi
|
|
556
637
|
echo " $SPECRAILS_DIR/setup-templates/ ← Templates: commands + skills (temporary, removed after setup)"
|
|
557
638
|
echo " .specrails-version ← Installed specrails version"
|
|
558
639
|
echo " .specrails-manifest.json ← Artifact checksums for update detection"
|
|
@@ -574,7 +655,11 @@ echo -e " ${BOLD}cd $REPO_ROOT && $CLI_PROVIDER${NC}"
|
|
|
574
655
|
echo ""
|
|
575
656
|
echo " 2. Run the setup wizard:"
|
|
576
657
|
echo ""
|
|
577
|
-
|
|
658
|
+
if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
659
|
+
echo -e " ${BOLD}\$setup${NC}"
|
|
660
|
+
else
|
|
661
|
+
echo -e " ${BOLD}/setup${NC}"
|
|
662
|
+
fi
|
|
578
663
|
echo ""
|
|
579
664
|
if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
580
665
|
echo " Codex will analyze your codebase, ask about your users,"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specrails-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "AI agent workflow system for Claude Code — installs 12 specialized agents, orchestration commands, and persona-driven product discovery into any repository",
|
|
5
5
|
"bin": {
|
|
6
6
|
"specrails-core": "bin/specrails-core.js"
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/fjpulidop/specrails-core/issues"
|
|
52
52
|
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"test": "bash tests/run-all.sh",
|
|
55
|
+
"test:coverage": "bash tests/run-coverage.sh"
|
|
56
|
+
},
|
|
53
57
|
"license": "MIT",
|
|
54
58
|
"author": "fjpulidop"
|
|
55
59
|
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Team Debug"
|
|
3
|
+
description: "Collaborative debugging using Claude Code Agent Teams. Multiple investigators pursue competing hypotheses independently, challenge each other's findings, and produce a root cause analysis ranked by confidence."
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, debugging, agent-teams, investigation]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Collaborative debugging for **{{PROJECT_NAME}}** using Claude Code Agent Teams. Multiple investigators pursue competing hypotheses about a bug, challenge each other's findings, and produce a confidence-ranked root cause analysis.
|
|
9
|
+
|
|
10
|
+
**Input:** $ARGUMENTS — required: a bug description in one of these forms:
|
|
11
|
+
- `"Login fails silently when email has uppercase letters"` — free text bug description
|
|
12
|
+
- `tests/auth.test.ts` — a failing test file path
|
|
13
|
+
- `"TypeError: Cannot read property 'id' of undefined"` — an error message or stack trace
|
|
14
|
+
- `#42` — a GitHub issue number
|
|
15
|
+
|
|
16
|
+
Optional flags:
|
|
17
|
+
- `--scope <paths>` — comma-separated file/directory paths to constrain investigation (default: entire repo)
|
|
18
|
+
- `--depth <level>` — investigation depth: `shallow`, `normal` (default), `deep`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Phase 0: Feature Flag Guard
|
|
23
|
+
|
|
24
|
+
**This check is mandatory and runs before anything else.**
|
|
25
|
+
|
|
26
|
+
Check whether Agent Teams is enabled:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-}"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If the variable is unset or not equal to `1`, print this message and **stop immediately**:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Error: Agent Teams is an experimental feature that requires opt-in.
|
|
36
|
+
|
|
37
|
+
To enable it, set the environment variable before starting Claude Code:
|
|
38
|
+
|
|
39
|
+
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
|
|
40
|
+
|
|
41
|
+
Agent Teams requires Claude Code v2.1.32 or later.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Do NOT proceed past this point if the guard fails.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Phase 1: Bug Context Gathering
|
|
49
|
+
|
|
50
|
+
Parse `$ARGUMENTS` to determine the bug context and flags.
|
|
51
|
+
|
|
52
|
+
**Variables to set:**
|
|
53
|
+
|
|
54
|
+
- `BUG_DESCRIPTION` — the user's description of the bug
|
|
55
|
+
- `INPUT_TYPE` — `"text"`, `"test"`, `"error"`, or `"issue"`
|
|
56
|
+
- `SCOPE_PATHS` — from `--scope` flag or `["."]` (entire repo)
|
|
57
|
+
- `INVESTIGATION_DEPTH` — from `--depth` flag or `"normal"`
|
|
58
|
+
|
|
59
|
+
**Detection rules:**
|
|
60
|
+
|
|
61
|
+
1. If input starts with `#` or is a bare integer -> `INPUT_TYPE="issue"`, fetch issue body via `gh issue view <number> --json title,body`
|
|
62
|
+
2. If input is a file path that exists and contains `test` or `spec` -> `INPUT_TYPE="test"`, run the test to capture failure output
|
|
63
|
+
3. If input contains common error patterns (stack trace, `Error:`, `Exception`, `FATAL`) -> `INPUT_TYPE="error"`
|
|
64
|
+
4. Otherwise -> `INPUT_TYPE="text"`
|
|
65
|
+
|
|
66
|
+
If `$ARGUMENTS` is empty, print usage and stop:
|
|
67
|
+
```
|
|
68
|
+
Usage: /sr:team-debug <bug-description> [--scope <paths>] [--depth <level>]
|
|
69
|
+
|
|
70
|
+
Examples:
|
|
71
|
+
/sr:team-debug "Login fails silently when email has uppercase letters"
|
|
72
|
+
/sr:team-debug tests/auth.test.ts --depth deep
|
|
73
|
+
/sr:team-debug "TypeError: Cannot read property 'id' of undefined" --scope src/api
|
|
74
|
+
/sr:team-debug #42
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Phase 2: Hypothesis Generation
|
|
80
|
+
|
|
81
|
+
Analyze the bug context and generate competing hypotheses:
|
|
82
|
+
|
|
83
|
+
1. **Analyze symptoms**: Read relevant source files within `SCOPE_PATHS`, examine recent git changes (`git log --oneline -20` for the relevant paths), check related tests
|
|
84
|
+
2. **Generate hypotheses**: Produce 2-3 distinct, testable hypotheses about the root cause. Each must target a different subsystem, mechanism, or failure mode.
|
|
85
|
+
3. **Rank hypotheses**: Order by initial likelihood based on available evidence
|
|
86
|
+
|
|
87
|
+
Each hypothesis MUST include:
|
|
88
|
+
- **Title**: One-line description of the proposed cause
|
|
89
|
+
- **Rationale**: Why this is plausible given the symptoms
|
|
90
|
+
- **Investigation plan**: Specific files to examine, commands to run, patterns to search for
|
|
91
|
+
- **Expected evidence**: What would confirm or refute this hypothesis
|
|
92
|
+
|
|
93
|
+
Decide whether to launch 2 or 3 investigators:
|
|
94
|
+
- Default: 2 investigators (Hypothesis A and B)
|
|
95
|
+
- Launch 3 when: `--depth deep` is set, OR the bug description is ambiguous enough to warrant three genuinely distinct hypotheses
|
|
96
|
+
|
|
97
|
+
Print the hypothesis summary:
|
|
98
|
+
```
|
|
99
|
+
## Bug Analysis
|
|
100
|
+
|
|
101
|
+
**Input type:** <text / test / error / issue>
|
|
102
|
+
**Scope:** <SCOPE_PATHS>
|
|
103
|
+
**Depth:** <INVESTIGATION_DEPTH>
|
|
104
|
+
|
|
105
|
+
### Hypotheses
|
|
106
|
+
|
|
107
|
+
1. **<Hypothesis A title>** (initial confidence: X%)
|
|
108
|
+
<one-line rationale>
|
|
109
|
+
|
|
110
|
+
2. **<Hypothesis B title>** (initial confidence: Y%)
|
|
111
|
+
<one-line rationale>
|
|
112
|
+
|
|
113
|
+
3. **<Hypothesis C title>** (initial confidence: Z%) [if applicable]
|
|
114
|
+
<one-line rationale>
|
|
115
|
+
|
|
116
|
+
Launching <N> investigators...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Phase 3: Launch Investigation Team
|
|
122
|
+
|
|
123
|
+
Create 2-3 investigator teammates using Agent Teams. Each teammate receives the bug context and their assigned hypothesis.
|
|
124
|
+
|
|
125
|
+
**IMPORTANT:** Use the Agent Teams teammate mechanism — NOT the Agent tool's `subagent_type`. Teammates share a task list and can message each other via mailbox.
|
|
126
|
+
|
|
127
|
+
### Investigator A: Primary Hypothesis
|
|
128
|
+
|
|
129
|
+
**Prompt:**
|
|
130
|
+
```
|
|
131
|
+
You are Investigator A on a debugging team. Your job is to prove or disprove your assigned hypothesis through systematic investigation.
|
|
132
|
+
|
|
133
|
+
## Bug Context
|
|
134
|
+
<BUG_DESCRIPTION>
|
|
135
|
+
<additional context gathered in Phase 1: test output, error details, issue body>
|
|
136
|
+
|
|
137
|
+
## Your Hypothesis
|
|
138
|
+
**<Hypothesis A title>**
|
|
139
|
+
<Hypothesis A rationale>
|
|
140
|
+
|
|
141
|
+
## Investigation Plan
|
|
142
|
+
<Hypothesis A investigation plan>
|
|
143
|
+
|
|
144
|
+
## Scope
|
|
145
|
+
Limit your investigation to: <SCOPE_PATHS>
|
|
146
|
+
|
|
147
|
+
## Instructions
|
|
148
|
+
1. Follow your investigation plan systematically
|
|
149
|
+
2. Read source files, search for patterns, examine git history within scope
|
|
150
|
+
3. Collect concrete evidence — file paths, line numbers, code snippets, command output
|
|
151
|
+
4. Determine a confidence level (0-100%) that your hypothesis is the root cause
|
|
152
|
+
5. After completing your investigation, read the other investigators' findings from the task list
|
|
153
|
+
6. If you find evidence that supports or contradicts another investigator's hypothesis, send a mailbox message challenging or endorsing their findings
|
|
154
|
+
7. Do NOT modify any files — this is a read-only investigation
|
|
155
|
+
|
|
156
|
+
## Report Format
|
|
157
|
+
Post your findings as a task list update:
|
|
158
|
+
|
|
159
|
+
### Investigator A: <Hypothesis Title>
|
|
160
|
+
|
|
161
|
+
#### Evidence Found
|
|
162
|
+
| # | Type | Location | Finding |
|
|
163
|
+
|---|------|----------|---------|
|
|
164
|
+
| 1 | code/git/test/config | file:line | What was found |
|
|
165
|
+
|
|
166
|
+
#### Evidence Against
|
|
167
|
+
<any evidence that contradicts this hypothesis>
|
|
168
|
+
|
|
169
|
+
#### Confidence: X%
|
|
170
|
+
<explanation of confidence level>
|
|
171
|
+
|
|
172
|
+
#### Verdict
|
|
173
|
+
<CONFIRMED / REFUTED / INCONCLUSIVE>
|
|
174
|
+
<brief explanation>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Investigator B: Alternative Hypothesis
|
|
178
|
+
|
|
179
|
+
Same structure as Investigator A, with Hypothesis B title, rationale, investigation plan, and expected evidence.
|
|
180
|
+
|
|
181
|
+
### Investigator C: Contrarian Hypothesis (when applicable)
|
|
182
|
+
|
|
183
|
+
Same structure as Investigator A, with Hypothesis C title, rationale, investigation plan, and expected evidence. Only launched when 3 hypotheses are generated.
|
|
184
|
+
|
|
185
|
+
### Team Coordination
|
|
186
|
+
|
|
187
|
+
After launching all investigators:
|
|
188
|
+
|
|
189
|
+
1. Wait for all investigators to complete their independent investigations (posted to the shared task list)
|
|
190
|
+
2. Allow one round of cross-investigation challenge via mailbox — each investigator may respond to findings from the others
|
|
191
|
+
3. Collect all findings and challenge outcomes
|
|
192
|
+
|
|
193
|
+
If any teammate fails to respond, proceed with available findings and note the gap in the final report.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Phase 4: Root Cause Synthesis
|
|
198
|
+
|
|
199
|
+
After all investigations and challenges are complete, the team lead produces the root cause analysis.
|
|
200
|
+
|
|
201
|
+
### Step 1: Evidence Aggregation
|
|
202
|
+
|
|
203
|
+
1. Read all investigator reports from the task list
|
|
204
|
+
2. Identify converging evidence (multiple investigators pointing to the same cause)
|
|
205
|
+
3. Identify conflicting evidence and note unresolved disagreements
|
|
206
|
+
4. Read any mailbox challenge messages for cross-investigator insights
|
|
207
|
+
|
|
208
|
+
### Step 2: Confidence Recalibration
|
|
209
|
+
|
|
210
|
+
Adjust hypothesis confidence levels based on cross-investigation challenges:
|
|
211
|
+
- A hypothesis endorsed by evidence from another investigator: confidence boost (+10-20%)
|
|
212
|
+
- A hypothesis contradicted by another investigator's evidence: confidence reduction (-10-30%)
|
|
213
|
+
- A hypothesis with no cross-investigation interaction: confidence unchanged
|
|
214
|
+
- Converging evidence from multiple investigators: strongest signal for root cause
|
|
215
|
+
|
|
216
|
+
### Step 3: Render Report
|
|
217
|
+
|
|
218
|
+
```markdown
|
|
219
|
+
## Root Cause Analysis
|
|
220
|
+
|
|
221
|
+
**Bug:** <one-line bug description>
|
|
222
|
+
**Scope:** <SCOPE_PATHS>
|
|
223
|
+
**Depth:** <INVESTIGATION_DEPTH>
|
|
224
|
+
**Investigators:** <N>
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### Most Likely Root Cause
|
|
229
|
+
|
|
230
|
+
**<Winning hypothesis title>** — Confidence: X%
|
|
231
|
+
|
|
232
|
+
<2-3 sentence explanation of the root cause with specific file and line references>
|
|
233
|
+
|
|
234
|
+
#### Key Evidence
|
|
235
|
+
| # | Location | Finding |
|
|
236
|
+
|---|----------|---------|
|
|
237
|
+
| 1 | file:line | Evidence supporting this conclusion |
|
|
238
|
+
|
|
239
|
+
#### Suggested Fix
|
|
240
|
+
<specific, actionable fix recommendation with file and line references>
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### Alternative Hypotheses
|
|
245
|
+
|
|
246
|
+
| # | Hypothesis | Initial | Final | Verdict | Key Evidence |
|
|
247
|
+
|---|-----------|---------|-------|---------|-------------|
|
|
248
|
+
| 1 | <title> | X% | Y% | CONFIRMED/REFUTED/INCONCLUSIVE | <one-line> |
|
|
249
|
+
| 2 | <title> | X% | Y% | CONFIRMED/REFUTED/INCONCLUSIVE | <one-line> |
|
|
250
|
+
|
|
251
|
+
### Investigation Trail
|
|
252
|
+
|
|
253
|
+
<for each investigator, a 2-3 line summary of what they investigated and what they found>
|
|
254
|
+
|
|
255
|
+
### Cross-Investigation Notes
|
|
256
|
+
|
|
257
|
+
<any points of challenge or agreement between investigators, with resolution>
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### Recommended Next Steps
|
|
262
|
+
|
|
263
|
+
1. <most important action — typically the fix>
|
|
264
|
+
2. <verification step — test to confirm the fix>
|
|
265
|
+
3. <preventive step — how to avoid this class of bug>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Step 4: Cost Notice
|
|
269
|
+
|
|
270
|
+
Print a brief cost notice after the report:
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
Note: Team debug used ~<N>x the tokens of a single-agent investigation (<N> parallel investigators + challenge round).
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Rules
|
|
279
|
+
|
|
280
|
+
- This command is **read-only** — it MUST NOT create, modify, or delete any files
|
|
281
|
+
- All investigators run as Agent Teams teammates, not as Agent tool subagents
|
|
282
|
+
- If Agent Teams is unavailable at runtime (API error, version mismatch), fall back to running 2-3 sequential Agent tool subagents and skip the challenge phase. Print a warning about the fallback.
|
|
283
|
+
- The challenge phase is limited to one round per investigator to control token costs
|
|
284
|
+
- Findings MUST include file paths and line numbers — vague findings are not acceptable
|
|
285
|
+
- Investigation MUST stay within `SCOPE_PATHS` if specified
|
|
286
|
+
- This command is Claude Code only — it is NOT installed when the provider is `codex`
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Team Review"
|
|
3
|
+
description: "Multi-perspective code review using Claude Code Agent Teams. Three specialized reviewers (security, performance, correctness) independently review changes, debate findings, and produce a consolidated report."
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, review, agent-teams, security, performance]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Multi-perspective code review for **{{PROJECT_NAME}}** using Claude Code Agent Teams. Three specialized reviewers analyze changes independently, debate cross-cutting findings, and produce a consolidated report.
|
|
9
|
+
|
|
10
|
+
**Input:** $ARGUMENTS — required: a review target in one of these forms:
|
|
11
|
+
- `#123` — review a pull request by number
|
|
12
|
+
- `feat/my-feature` — review a branch diff against base
|
|
13
|
+
- `abc1234..def5678` — review a commit range
|
|
14
|
+
|
|
15
|
+
Optional flags:
|
|
16
|
+
- `--base <branch>` — override base branch for comparison (default: repository default branch)
|
|
17
|
+
- `--focus <areas>` — comma-separated focus areas to weight: `security`, `performance`, `correctness`, `tests`, `types`
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Phase 0: Feature Flag Guard
|
|
22
|
+
|
|
23
|
+
**This check is mandatory and runs before anything else.**
|
|
24
|
+
|
|
25
|
+
Check whether Agent Teams is enabled:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-}"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If the variable is unset or not equal to `1`, print this message and **stop immediately**:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Error: Agent Teams is an experimental feature that requires opt-in.
|
|
35
|
+
|
|
36
|
+
To enable it, set the environment variable before starting Claude Code:
|
|
37
|
+
|
|
38
|
+
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
|
|
39
|
+
|
|
40
|
+
Agent Teams requires Claude Code v2.1.32 or later.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do NOT proceed past this point if the guard fails.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Phase 1: Input Parsing
|
|
48
|
+
|
|
49
|
+
Parse `$ARGUMENTS` to determine the review target and flags.
|
|
50
|
+
|
|
51
|
+
**Variables to set:**
|
|
52
|
+
|
|
53
|
+
- `REVIEW_TARGET` — the PR number, branch name, or commit range
|
|
54
|
+
- `REVIEW_TYPE` — `"pr"`, `"branch"`, or `"range"`
|
|
55
|
+
- `BASE_BRANCH` — from `--base` flag or detect via `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name'` or fall back to `main`
|
|
56
|
+
- `FOCUS_AREAS` — array from `--focus` flag or `["all"]`
|
|
57
|
+
|
|
58
|
+
**Detection rules:**
|
|
59
|
+
|
|
60
|
+
1. If input starts with `#` or is a bare integer → `REVIEW_TYPE="pr"`, strip `#` prefix
|
|
61
|
+
2. If input contains `..` → `REVIEW_TYPE="range"`
|
|
62
|
+
3. Otherwise → `REVIEW_TYPE="branch"`
|
|
63
|
+
|
|
64
|
+
If `$ARGUMENTS` is empty, print usage and stop:
|
|
65
|
+
```
|
|
66
|
+
Usage: /sr:team-review <target> [--base <branch>] [--focus <areas>]
|
|
67
|
+
|
|
68
|
+
Examples:
|
|
69
|
+
/sr:team-review #42
|
|
70
|
+
/sr:team-review feat/new-auth --focus security
|
|
71
|
+
/sr:team-review abc123..def456
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Phase 2: Gather Diff
|
|
77
|
+
|
|
78
|
+
Collect the code changes based on `REVIEW_TYPE`:
|
|
79
|
+
|
|
80
|
+
- **PR**: Run `gh pr diff <REVIEW_TARGET>` and `gh pr diff <REVIEW_TARGET> --name-only`
|
|
81
|
+
- **Branch**: Run `git diff ${BASE_BRANCH}...${REVIEW_TARGET}` and `git diff --name-only ${BASE_BRANCH}...${REVIEW_TARGET}`
|
|
82
|
+
- **Range**: Run `git diff ${REVIEW_TARGET}` and `git diff --name-only ${REVIEW_TARGET}`
|
|
83
|
+
|
|
84
|
+
Also collect file-level stats: `git diff --stat <appropriate-range>`
|
|
85
|
+
|
|
86
|
+
**Store these variables for Phase 3:**
|
|
87
|
+
- `DIFF_CONTENT` — full unified diff
|
|
88
|
+
- `CHANGED_FILES` — list of changed file paths
|
|
89
|
+
- `DIFF_STATS` — file-level line count changes
|
|
90
|
+
|
|
91
|
+
If the diff is empty, print `No changes found for the given review target.` and stop.
|
|
92
|
+
|
|
93
|
+
Print a summary:
|
|
94
|
+
```
|
|
95
|
+
## Review Target
|
|
96
|
+
Type: <PR / Branch / Range>
|
|
97
|
+
Target: <REVIEW_TARGET>
|
|
98
|
+
Base: <BASE_BRANCH>
|
|
99
|
+
Changed files: <N>
|
|
100
|
+
Focus: <FOCUS_AREAS or "all areas">
|
|
101
|
+
|
|
102
|
+
<DIFF_STATS output>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Phase 3: Launch Team Review
|
|
108
|
+
|
|
109
|
+
Create three reviewer teammates using Agent Teams. Each teammate receives the full diff and file list.
|
|
110
|
+
|
|
111
|
+
**IMPORTANT:** Use the Agent Teams teammate mechanism — NOT the Agent tool's `subagent_type`. Teammates share a task list and can message each other via mailbox.
|
|
112
|
+
|
|
113
|
+
### Teammate 1: Security Reviewer
|
|
114
|
+
|
|
115
|
+
**Persona:** sr-security-reviewer (or sr-reviewer with security focus if persona not available)
|
|
116
|
+
|
|
117
|
+
**Prompt:**
|
|
118
|
+
```
|
|
119
|
+
You are the Security Reviewer on a team code review.
|
|
120
|
+
|
|
121
|
+
## Your Focus Areas
|
|
122
|
+
- Authentication and authorization flaws
|
|
123
|
+
- Input validation and injection vulnerabilities (SQL, XSS, command injection)
|
|
124
|
+
- Secrets or credentials in code
|
|
125
|
+
- OWASP Top 10 vulnerabilities
|
|
126
|
+
- Insecure dependencies or configurations
|
|
127
|
+
- Missing rate limiting or access controls
|
|
128
|
+
|
|
129
|
+
## Changed Files
|
|
130
|
+
<CHANGED_FILES>
|
|
131
|
+
|
|
132
|
+
## Diff
|
|
133
|
+
<DIFF_CONTENT>
|
|
134
|
+
|
|
135
|
+
## Instructions
|
|
136
|
+
1. Review every changed file through a security lens
|
|
137
|
+
2. Report findings using the format below — be specific about file, line, and fix
|
|
138
|
+
3. After completing your review, read the other reviewers' findings from the task list
|
|
139
|
+
4. If you have security-relevant context on their findings, send a mailbox message
|
|
140
|
+
|
|
141
|
+
## Report Format
|
|
142
|
+
Post your findings as a task list update:
|
|
143
|
+
|
|
144
|
+
### Security Review Findings
|
|
145
|
+
|
|
146
|
+
#### Summary
|
|
147
|
+
<1-2 sentences>
|
|
148
|
+
|
|
149
|
+
#### Findings
|
|
150
|
+
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
151
|
+
|---|----------|------|---------|---------|----------------|
|
|
152
|
+
|
|
153
|
+
#### Verdict
|
|
154
|
+
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Teammate 2: Performance Reviewer
|
|
158
|
+
|
|
159
|
+
**Persona:** sr-performance-reviewer (or sr-reviewer with performance focus if persona not available)
|
|
160
|
+
|
|
161
|
+
**Prompt:**
|
|
162
|
+
```
|
|
163
|
+
You are the Performance Reviewer on a team code review.
|
|
164
|
+
|
|
165
|
+
## Your Focus Areas
|
|
166
|
+
- Database query complexity and N+1 queries
|
|
167
|
+
- Missing or broken caching
|
|
168
|
+
- Memory leaks and excessive allocations
|
|
169
|
+
- Algorithmic complexity (O(n^2) or worse in hot paths)
|
|
170
|
+
- Bundle size and lazy loading concerns (frontend)
|
|
171
|
+
- Missing pagination or unbounded data fetching
|
|
172
|
+
|
|
173
|
+
## Changed Files
|
|
174
|
+
<CHANGED_FILES>
|
|
175
|
+
|
|
176
|
+
## Diff
|
|
177
|
+
<DIFF_CONTENT>
|
|
178
|
+
|
|
179
|
+
## Instructions
|
|
180
|
+
1. Review every changed file through a performance lens
|
|
181
|
+
2. Report findings using the format below — be specific about file, line, and fix
|
|
182
|
+
3. After completing your review, read the other reviewers' findings from the task list
|
|
183
|
+
4. If you have performance-relevant context on their findings, send a mailbox message
|
|
184
|
+
|
|
185
|
+
## Report Format
|
|
186
|
+
Post your findings as a task list update:
|
|
187
|
+
|
|
188
|
+
### Performance Review Findings
|
|
189
|
+
|
|
190
|
+
#### Summary
|
|
191
|
+
<1-2 sentences>
|
|
192
|
+
|
|
193
|
+
#### Findings
|
|
194
|
+
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
195
|
+
|---|----------|------|---------|---------|----------------|
|
|
196
|
+
|
|
197
|
+
#### Verdict
|
|
198
|
+
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Teammate 3: Correctness Reviewer
|
|
202
|
+
|
|
203
|
+
**Persona:** sr-reviewer
|
|
204
|
+
|
|
205
|
+
**Prompt:**
|
|
206
|
+
```
|
|
207
|
+
You are the Correctness Reviewer on a team code review.
|
|
208
|
+
|
|
209
|
+
## Your Focus Areas
|
|
210
|
+
- Logic errors and edge cases
|
|
211
|
+
- Missing or inadequate test coverage
|
|
212
|
+
- Type safety violations
|
|
213
|
+
- Error handling gaps (uncaught exceptions, missing error paths)
|
|
214
|
+
- API contract mismatches
|
|
215
|
+
- Race conditions and concurrency issues
|
|
216
|
+
|
|
217
|
+
## Changed Files
|
|
218
|
+
<CHANGED_FILES>
|
|
219
|
+
|
|
220
|
+
## Diff
|
|
221
|
+
<DIFF_CONTENT>
|
|
222
|
+
|
|
223
|
+
## Instructions
|
|
224
|
+
1. Review every changed file through a correctness and test coverage lens
|
|
225
|
+
2. Report findings using the format below — be specific about file, line, and fix
|
|
226
|
+
3. After completing your review, read the other reviewers' findings from the task list
|
|
227
|
+
4. If you have correctness-relevant context on their findings, send a mailbox message
|
|
228
|
+
|
|
229
|
+
## Report Format
|
|
230
|
+
Post your findings as a task list update:
|
|
231
|
+
|
|
232
|
+
### Correctness Review Findings
|
|
233
|
+
|
|
234
|
+
#### Summary
|
|
235
|
+
<1-2 sentences>
|
|
236
|
+
|
|
237
|
+
#### Findings
|
|
238
|
+
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
239
|
+
|---|----------|------|---------|---------|----------------|
|
|
240
|
+
|
|
241
|
+
#### Verdict
|
|
242
|
+
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Team Coordination
|
|
246
|
+
|
|
247
|
+
After launching all three teammates:
|
|
248
|
+
|
|
249
|
+
1. Wait for all three to complete their independent reviews (posted to the shared task list)
|
|
250
|
+
2. Allow one round of cross-review debate via mailbox — each reviewer may respond to findings from the other two
|
|
251
|
+
3. Collect all findings and debate outcomes
|
|
252
|
+
|
|
253
|
+
If any teammate fails to respond, proceed with available reviews and note the gap in the final report.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Phase 4: Synthesize Consolidated Report
|
|
258
|
+
|
|
259
|
+
After all reviews and debate are complete, the team lead produces the final report.
|
|
260
|
+
|
|
261
|
+
### Step 1: Collect and Deduplicate
|
|
262
|
+
|
|
263
|
+
1. Read all three reviewer reports from the task list
|
|
264
|
+
2. Identify duplicate findings (same file + overlapping lines + similar issue)
|
|
265
|
+
3. For duplicates: keep the highest-severity version, note which reviewers flagged it
|
|
266
|
+
|
|
267
|
+
### Step 2: Apply Focus Weighting
|
|
268
|
+
|
|
269
|
+
If `FOCUS_AREAS` is not `["all"]`:
|
|
270
|
+
- Findings in focus areas get their severity preserved
|
|
271
|
+
- Findings outside focus areas: Critical stays Critical, but High→Medium, Medium→Low for display purposes
|
|
272
|
+
- Note the weighting in the report header
|
|
273
|
+
|
|
274
|
+
### Step 3: Render Report
|
|
275
|
+
|
|
276
|
+
```markdown
|
|
277
|
+
## Team Review Report
|
|
278
|
+
|
|
279
|
+
**Target:** <PR #N / branch-name / commit-range>
|
|
280
|
+
**Base:** <BASE_BRANCH>
|
|
281
|
+
**Reviewers:** Security, Performance, Correctness
|
|
282
|
+
**Changed files:** N files (+X/-Y lines)
|
|
283
|
+
**Focus:** <FOCUS_AREAS or "all areas equally weighted">
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### Critical Findings (action required before merge)
|
|
288
|
+
|
|
289
|
+
| # | Severity | Domain | File | Line(s) | Finding | Recommendation | Flagged By |
|
|
290
|
+
|---|----------|--------|------|---------|---------|----------------|------------|
|
|
291
|
+
|
|
292
|
+
### High-Priority Findings
|
|
293
|
+
|
|
294
|
+
| # | Severity | Domain | File | Line(s) | Finding | Recommendation | Flagged By |
|
|
295
|
+
|---|----------|--------|------|---------|---------|----------------|------------|
|
|
296
|
+
|
|
297
|
+
### Medium & Low Findings
|
|
298
|
+
|
|
299
|
+
| # | Severity | Domain | File | Line(s) | Finding | Recommendation |
|
|
300
|
+
|---|----------|--------|------|---------|---------|----------------|
|
|
301
|
+
|
|
302
|
+
### Praise (things done well)
|
|
303
|
+
<positive observations from reviewers>
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### Cross-Review Notes
|
|
308
|
+
<any points of debate or disagreement between reviewers, with resolution>
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
### Reviewer Verdicts
|
|
313
|
+
|
|
314
|
+
| Reviewer | Verdict | Critical | High | Medium | Low | Info |
|
|
315
|
+
|----------|---------|----------|------|--------|-----|------|
|
|
316
|
+
| Security | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
317
|
+
| Performance | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
318
|
+
| Correctness | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
319
|
+
|
|
320
|
+
### Overall Verdict: <APPROVE / REQUEST_CHANGES>
|
|
321
|
+
|
|
322
|
+
<one-paragraph summary: key risks, recommended actions, and overall assessment>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Step 4: Cost Notice
|
|
326
|
+
|
|
327
|
+
Print a brief cost notice after the report:
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
Note: Team review used ~3x the tokens of a single-reviewer run (3 parallel reviewers + debate round).
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Rules
|
|
336
|
+
|
|
337
|
+
- This command is **read-only** — it MUST NOT create, modify, or delete any files
|
|
338
|
+
- All three reviewers run as Agent Teams teammates, not as Agent tool subagents
|
|
339
|
+
- If Agent Teams is unavailable at runtime (API error, version mismatch), fall back to running three sequential Agent tool subagents with `subagent_type: sr-reviewer` and skip the debate phase. Print a warning about the fallback.
|
|
340
|
+
- The debate phase is limited to one round per reviewer to control token costs
|
|
341
|
+
- Findings MUST include file paths and line numbers — vague findings are not acceptable
|
package/update.sh
CHANGED
|
@@ -94,7 +94,7 @@ if [[ -z "$CUSTOM_ROOT_DIR" && -f "$SCRIPT_DIR/install.sh" && -d "$SCRIPT_DIR/te
|
|
|
94
94
|
echo -e "${YELLOW}⚠${NC} You're running the updater from inside the specrails source repo."
|
|
95
95
|
echo -e " specrails updates a ${BOLD}target${NC} repository, not itself."
|
|
96
96
|
echo ""
|
|
97
|
-
read -p " Enter the path to the target repo (or 'q' to quit): " TARGET_PATH
|
|
97
|
+
read -p " Enter the path to the target repo (or 'q' to quit): " TARGET_PATH || TARGET_PATH="q"
|
|
98
98
|
if [[ "$TARGET_PATH" == "q" || -z "$TARGET_PATH" ]]; then
|
|
99
99
|
echo " Aborted. No changes made."
|
|
100
100
|
exit 0
|
|
@@ -107,7 +107,7 @@ if [[ -z "$CUSTOM_ROOT_DIR" && -f "$SCRIPT_DIR/install.sh" && -d "$SCRIPT_DIR/te
|
|
|
107
107
|
}
|
|
108
108
|
if [[ ! -d "$REPO_ROOT/.git" ]]; then
|
|
109
109
|
echo -e "${YELLOW}⚠${NC} Warning: $REPO_ROOT does not appear to be a git repository."
|
|
110
|
-
read -p " Continue anyway? (y/n): " CONTINUE_NOGIT
|
|
110
|
+
read -p " Continue anyway? (y/n): " CONTINUE_NOGIT || CONTINUE_NOGIT="n"
|
|
111
111
|
if [[ "$CONTINUE_NOGIT" != "y" && "$CONTINUE_NOGIT" != "Y" ]]; then
|
|
112
112
|
echo " Aborted. No changes made."
|
|
113
113
|
exit 0
|
|
@@ -658,7 +658,7 @@ except Exception:
|
|
|
658
658
|
fi
|
|
659
659
|
|
|
660
660
|
local answer
|
|
661
|
-
read -p " Regenerate agents? (y/N): " answer
|
|
661
|
+
read -p " Regenerate agents? (y/N): " answer || answer="n"
|
|
662
662
|
if [[ "$answer" == "y" ]] || [[ "$answer" == "Y" ]]; then
|
|
663
663
|
NEEDS_SETUP_UPDATE=true
|
|
664
664
|
ok "Will regenerate agents via /setup --update"
|