@drunkcoding/agents-and-skills 0.0.19 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +5 -5
- package/package.json +1 -1
- package/plugins/auto-power/.claude-plugin/plugin.json +1 -1
- package/plugins/html-effectiveness/.claude-plugin/plugin.json +1 -1
- package/plugins/plugin-validator/.claude-plugin/plugin.json +1 -1
- package/plugins/team-superpower/.claude-plugin/plugin.json +1 -1
- package/plugins/team-superpower/README.md +186 -115
- package/plugins/team-superpower/agents/backend-developer.md +105 -73
- package/plugins/team-superpower/agents/feature-planner.md +66 -0
- package/plugins/team-superpower/agents/frontend-developer.md +108 -70
- package/plugins/team-superpower/agents/orchestrator.md +83 -0
- package/plugins/team-superpower/agents/qc-engineer.md +84 -0
- package/plugins/team-superpower/agents/security-engineer.md +79 -44
- package/plugins/team-superpower/agents/solution-architect.md +80 -0
- package/plugins/team-superpower/agents/team-leader.md +100 -0
- package/plugins/team-superpower/assets/CLAUDE.md.template +22 -18
- package/plugins/team-superpower/assets/ESCALATION.md +114 -66
- package/plugins/team-superpower/assets/SESSION_README.md +232 -159
- package/plugins/team-superpower/commands/team-feature.md +191 -645
- package/plugins/team-superpower/hooks/task-completed.sh +100 -182
- package/plugins/team-superpower/hooks/task-created.sh +55 -38
- package/plugins/team-superpower/hooks/teammate-idle.sh +118 -13
- package/plugins/team-superpower/scripts/team-state.sh +106 -37
- package/plugins/tech-graph/.claude-plugin/plugin.json +1 -1
- package/plugins/team-superpower/agents/designer.md +0 -65
- package/plugins/team-superpower/agents/planner.md +0 -242
- package/plugins/team-superpower/agents/qa-engineer.md +0 -103
- package/plugins/team-superpower/agents/reviewer.md +0 -175
- package/plugins/team-superpower/agents/software-architect.md +0 -60
- package/plugins/team-superpower/commands/team-feature-resume.md +0 -185
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Launch a Superpowers-compliant agent team to deliver a feature end-to-end with at most 3 owner touchpoints, with automatic
|
|
2
|
+
description: Launch a Superpowers-compliant agent team (v5 single-team lifecycle) to deliver a feature end-to-end with at most 3 owner touchpoints, with automatic cleanup after the finish phase.
|
|
3
3
|
argument-hint: <one-line feature idea>
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
You are the **lead** of an agent
|
|
6
|
+
You are the **lead** of the team-superpower v5 single-team lifecycle. You do not implement; you spawn an `orchestrator` agent and pass through the owner's launch message. The orchestrator runs the full lifecycle (mode pick, TeamCreate, phase A → H, SPAWN_REQUEST handling, RESTART_REQUEST handling, qc-engineer spawn, cleanup, push).
|
|
7
7
|
|
|
8
|
-
> **Lead model:** run this command in an **Opus** session. The lead carries
|
|
8
|
+
> **Lead model:** run this command in an **Opus** session. The lead carries cross-phase reasoning (mode pick, escalation triage, restart approval, finish-branch recovery). Teammates are pinned via their agent frontmatter — they spawn on their pinned model regardless of the lead's model. If the lead is started on Sonnet, halt and ask the owner to relaunch on Opus.
|
|
9
9
|
>
|
|
10
|
-
> **Lead thinking discipline:** adaptive. Use extended (high-effort) thinking for every gate decision,
|
|
10
|
+
> **Lead thinking discipline:** adaptive. Use extended (high-effort) thinking for every gate decision, SPAWN_REQUEST classification, RESTART_REQUEST approval, escalation triage, FINISH_BLOCKED recovery, worktree cleanup branching. Routine heartbeats, SendMessage forwarding, and shared-task-list status reads may be quick.
|
|
11
11
|
|
|
12
12
|
Owner's feature request:
|
|
13
13
|
|
|
@@ -15,757 +15,303 @@ $ARGUMENTS
|
|
|
15
15
|
|
|
16
16
|
## Parsing the launch flags
|
|
17
17
|
|
|
18
|
-
Before doing anything else, parse override flags from the owner's request.
|
|
18
|
+
Before doing anything else, parse override flags from the owner's request. Tokens are space-separated, may appear before the feature description, and use `=` to bind their value:
|
|
19
19
|
|
|
20
|
-
- `--mode=<solo|single-agent|team>` — force
|
|
21
|
-
- `--size=<minimal|standard|full>` — force
|
|
22
|
-
- `--explain` — run
|
|
20
|
+
- `--mode=<solo|single-agent|team>` — force execution mode; skip the heuristic ladder.
|
|
21
|
+
- `--size=<minimal|standard|full>` — force team size (only meaningful with `--mode=team`).
|
|
22
|
+
- `--explain` — run mode pick, print the decision, and STOP. Do not spawn anything.
|
|
23
23
|
|
|
24
|
-
If any of these flags appear, strip them from `$ARGUMENTS` and treat the remainder as the actual launch message. Record the flags used in the checkpoint field `overrides_applied
|
|
25
|
-
|
|
26
|
-
Examples:
|
|
27
|
-
- `/team-feature --mode=solo update copy in welcome banner` → mode=solo, launch_message="update copy in welcome banner".
|
|
28
|
-
- `/team-feature --explain redesign the checkout flow` → run heuristic, print decision, stop.
|
|
29
|
-
- `/team-feature --mode=team --size=full add /healthcheck` → mode=team, size=full, launch_message="add /healthcheck".
|
|
24
|
+
If any of these flags appear, strip them from `$ARGUMENTS` and treat the remainder as the actual launch message. Record the flags used in the checkpoint field `overrides_applied:`.
|
|
30
25
|
|
|
31
26
|
## Your job
|
|
32
27
|
|
|
33
|
-
You are a **conductor
|
|
28
|
+
You are a **conductor**. Spawn the orchestrator (see `plugins/team-superpower/agents/orchestrator.md`) with the owner's launch message and forward owner replies. Do not run Superpowers skills yourself — every skill is delegated to the correct teammate by the orchestrator.
|
|
34
29
|
|
|
35
30
|
## Required prechecks (run these first, in order)
|
|
36
31
|
|
|
37
|
-
0. **Lead-model self-attestation.**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
0. **Lead-model self-attestation.** State which model you are running on. If not Opus, halt and instruct the owner: "Lead must be on Opus. Relaunch with `claude --model opus` and rerun `/team-feature`."
|
|
33
|
+
1. Confirm Superpowers plugin is installed: `claude plugin list | grep superpowers`. If missing, halt and instruct: `/plugin install superpowers@claude-plugins-official`. Capture version (`claude plugin list --json`) — orchestrator writes it to the checkpoint.
|
|
34
|
+
2. Confirm Claude Code version `2.1.32` or later: `claude --version`. If older, halt.
|
|
35
|
+
3. Confirm `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set. If not, halt and instruct the owner to add it to `~/.claude/settings.json` under `env`.
|
|
36
|
+
4. Generate a kebab-case `<slug>` from the owner's request. Use it in every artifact filename. The team MUST be named exactly `superpower-<slug>` — every cleanup primitive depends on that convention.
|
|
37
|
+
5. Create directories if missing: `docs/superpowers/{sessions,specs,plans,handovers,reviews}`.
|
|
38
|
+
6. Seed `docs/superpowers/ESCALATION.md` from `${CLAUDE_PLUGIN_ROOT}/assets/ESCALATION.md` if not present. Seed `docs/superpowers/README.md` from `${CLAUDE_PLUGIN_ROOT}/assets/SESSION_README.md` if missing. Commit any seeded files.
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
## Lead behavior (v5 — single-team lifecycle)
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
You spawn the `orchestrator` agent type to perform all in-feature work; do not act as orchestrator yourself. Pass through to the orchestrator the full owner launch message (post-flag-strip), the slug, and the recorded `overrides_applied:`.
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
1. Confirm Superpowers plugin is installed: `claude plugin list | grep superpowers`. If missing, **halt** and instruct the owner: `/plugin install superpowers@claude-plugins-official`. Capture the version string from `claude plugin list --json` (e.g. `5.0.7`) — you'll write it to the checkpoint in phase 0 step 5 below.
|
|
50
|
-
2. Confirm Claude Code version is `2.1.32` or later: `claude --version`. If older, halt.
|
|
51
|
-
3. Confirm `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set in the environment. If not, halt and instruct the owner to add it to `~/.claude/settings.json` under `env`.
|
|
52
|
-
4. Generate a kebab-case `<slug>` from the owner's request. Use it in every artifact filename for the rest of the run. The team you create MUST be named exactly `superpower-<slug>` — every cleanup and resume primitive depends on that convention.
|
|
53
|
-
5. Create directories if missing: `docs/superpowers/{sessions,specs,plans,reviews}`.
|
|
54
|
-
6. Seed `docs/superpowers/ESCALATION.md` from `${CLAUDE_PLUGIN_ROOT}/assets/ESCALATION.md` if it does not already exist. Seed `docs/superpowers/README.md` from `${CLAUDE_PLUGIN_ROOT}/assets/SESSION_README.md` if missing. Commit any seeded files.
|
|
44
|
+
The orchestrator handles: auto-resume detection (spec §8.13), mode pick, TeamCreate, phase-A spawn, phase transitions, SPAWN_REQUEST/RESTART_REQUEST handling, qc-engineer spawn, cleanup, push. See `plugins/team-superpower/agents/orchestrator.md` for full responsibilities.
|
|
55
45
|
|
|
56
|
-
|
|
46
|
+
In team mode the orchestrator runs the single-team lifecycle (spec §3.1):
|
|
57
47
|
|
|
58
|
-
|
|
48
|
+
1. `TeamCreate(superpower-<slug>)`.
|
|
49
|
+
2. Spawn solution-architect + feature-planner (+ security-engineer if regulated).
|
|
50
|
+
3. Phase A: spec sign-off → arch-map → plan approval → handover.
|
|
51
|
+
4. Shut down solution-architect + feature-planner + security-engineer.
|
|
52
|
+
5. Spawn team-leader.
|
|
53
|
+
6. team-leader posts `SPAWN_REQUEST` per wave; orchestrator spawns implementers.
|
|
54
|
+
7. Per plan-phase end: team-leader posts `PHASE_COMPLETE`; orchestrator acks.
|
|
55
|
+
8. Final plan-phase: team-leader posts `PLAN_COMPLETE`; orchestrator shuts down the dev team.
|
|
56
|
+
9. Spawn qc-engineer.
|
|
57
|
+
10. qc-engineer posts `QC_PASS` or `QC_REWORK_NEEDED` (max `limits.max_qc_rounds`, default 3).
|
|
58
|
+
11. On pass: push + cleanup + notify owner.
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
There is **no architect standby**. Architecturally significant questions during phases B–F trigger `RESTART_REQUEST`, which presents a recovery touchpoint to the owner.
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/parse-claudemd.sh extract CLAUDE.md
|
|
65
|
-
```
|
|
66
|
-
- Exit 0: a block was extracted. Parse it. Skip to 0.2.
|
|
67
|
-
- Exit 1 (file missing or no block): run detection.
|
|
62
|
+
## Auto-resume detection (orchestrator runs before mode pick)
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/detect-stack.sh "$PWD" > /tmp/team-superpower-detected.yaml
|
|
72
|
-
```
|
|
73
|
-
- Exit 0 (confident): write the detected YAML (plus a one-line header) to `docs/superpowers/stack.detected.md` and commit. Halt with this message to the owner (via §7 escalation): "I detected this stack — `docs/superpowers/stack.detected.md`. Review the `# CONFIRM:` lines, paste the corrected block into a `team-superpower` fenced section of your CLAUDE.md (or create CLAUDE.md from `${CLAUDE_PLUGIN_ROOT}/assets/CLAUDE.md.template`), then re-run `/team-feature`." **Do NOT auto-edit CLAUDE.md — the spec forbids it.**
|
|
74
|
-
- Exit 1 (no signal): halt. Escalate to the owner: "No backend or frontend signal found in the repo. Create a CLAUDE.md from `${CLAUDE_PLUGIN_ROOT}/assets/CLAUDE.md.template` and re-run."
|
|
75
|
-
- Exit 2 (ambiguous): write the detected YAML to `docs/superpowers/stack.detected.md` with both candidate BE languages marked; halt and escalate so the owner picks one.
|
|
64
|
+
On invocation, before picking mode, scan for in-progress features:
|
|
76
65
|
|
|
77
|
-
|
|
66
|
+
1. List `~/.claude/teams/superpower-*/config.json` files. Each is a candidate slug.
|
|
67
|
+
2. List `docs/superpowers/handovers/*-handover.md` files with NO matching `docs/superpowers/reviews/*-qc-report.md`.
|
|
68
|
+
3. List plans referenced by handovers in (2) with incomplete `PHASE_COMPLETE` markers.
|
|
69
|
+
4. Check `git log --oneline <base>..HEAD` for partial plan-task commits not pushed.
|
|
70
|
+
5. Match slug against the worktree dir name or the owner's launch text.
|
|
78
71
|
|
|
79
|
-
|
|
72
|
+
If any candidate matches, present:
|
|
80
73
|
|
|
81
|
-
```bash
|
|
82
|
-
shape="$(bash ${CLAUDE_PLUGIN_ROOT}/scripts/parse-claudemd.sh shape CLAUDE.md)"
|
|
83
74
|
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- `frontend.framework: react` → `package.json` declares `react`.
|
|
94
|
-
- `contracts.source_of_truth: openapi` → an OpenAPI file exists at `contracts.openapi_path` if specified.
|
|
95
|
-
|
|
96
|
-
If any claimed component has no file evidence, halt and escalate. CLAUDE.md is the contract, but a contract that contradicts the filesystem is a bug to flag, not a configuration to act on.
|
|
97
|
-
|
|
98
|
-
### 0.4 — Write the shape marker
|
|
99
|
-
|
|
100
|
-
Write the resolved shape to a marker file the hooks read:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
mkdir -p docs/superpowers/sessions
|
|
104
|
-
echo "$shape" > docs/superpowers/sessions/<slug>.shape
|
|
105
|
-
git add docs/superpowers/sessions/<slug>.shape
|
|
75
|
+
Found in-progress feature: <slug> at phase <X>
|
|
76
|
+
Spec: <path>
|
|
77
|
+
Arch-map: <path>
|
|
78
|
+
Plan: <path>
|
|
79
|
+
Handover: <path>
|
|
80
|
+
Last commit: <sha> "<msg>"
|
|
81
|
+
Continue this feature, or start fresh?
|
|
82
|
+
[1] Continue (re-spawn teammates per current phase)
|
|
83
|
+
[2] Start fresh (archive prior artefacts; new feature)
|
|
106
84
|
```
|
|
107
85
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|---------------|--------------------|
|
|
114
|
-
| `full-stack` | designer, planner, software-architect, security-engineer, backend-developer, frontend-developer, qa-engineer, reviewer (**8 total**) |
|
|
115
|
-
| `be-only` | designer, planner, software-architect, security-engineer, backend-developer, qa-engineer, reviewer (**7 total**) |
|
|
116
|
-
| `fe-only` | designer, planner, software-architect, security-engineer, frontend-developer, qa-engineer, reviewer (**7 total**) |
|
|
117
|
-
|
|
118
|
-
`software-architect`, `security-engineer`, `qa-engineer`, and `reviewer` are stack-agnostic and ALWAYS spawn. Designer, planner, and the implementers adapt.
|
|
119
|
-
|
|
120
|
-
Spawning happens at phase boundaries (you don't spawn implementers until phase 4 starts; you don't spawn the reviewer until phase 6) — this section just decides which teammates the team will EVER spawn for this feature. Record the list in the checkpoint.
|
|
86
|
+
On `[1] Continue`:
|
|
87
|
+
- If team config (`~/.claude/teams/superpower-<slug>/`) still exists: skip TeamCreate.
|
|
88
|
+
- If gone: `TeamCreate(superpower-<slug>)`.
|
|
89
|
+
- Re-spawn teammates per current phase (team-leader for B–F, qc-engineer for G, finish flow for H).
|
|
90
|
+
- Spawn prompts include `"this is a resume; read existing handover/spec/plan; continue from current state; do not re-run completed work"`.
|
|
121
91
|
|
|
122
|
-
|
|
92
|
+
On `[2] Start fresh`:
|
|
93
|
+
- Move existing artefacts under `docs/superpowers/archive/YYYY-MM-DD-<slug>/`.
|
|
94
|
+
- Run cleanup on stale team config.
|
|
95
|
+
- Proceed to mode pick for new feature.
|
|
123
96
|
|
|
124
|
-
|
|
97
|
+
If multiple candidates: list all, owner picks one or `[0] start fresh`.
|
|
98
|
+
If none: skip to mode pick.
|
|
125
99
|
|
|
126
|
-
|
|
127
|
-
if [ ! -f docs/superpowers/AGENTS.md ]; then
|
|
128
|
-
mkdir -p docs/superpowers
|
|
129
|
-
cp "${CLAUDE_PLUGIN_ROOT}/assets/AGENTS.md.template" docs/superpowers/AGENTS.md
|
|
130
|
-
git add docs/superpowers/AGENTS.md
|
|
131
|
-
fi
|
|
132
|
-
```
|
|
100
|
+
## Modes
|
|
133
101
|
|
|
134
|
-
|
|
102
|
+
### Solo mode (1 touchpoint)
|
|
135
103
|
|
|
136
|
-
|
|
104
|
+
For bug fix, typo, rename, version bump, single-file/≤10-line diff.
|
|
137
105
|
|
|
138
|
-
|
|
106
|
+
The orchestrator does not TeamCreate. It runs the work itself: locates affected files, drafts a combined briefing (bug statement + diff preview + verification step), presents to owner for approval (touchpoint 1), applies the change, runs `test_command`, commits, pushes, notifies. See spec §9.1.
|
|
139
107
|
|
|
140
|
-
|
|
108
|
+
### Single-agent mode (1 touchpoint)
|
|
141
109
|
|
|
142
|
-
|
|
143
|
-
superpowers_version: <e.g. 5.0.7>
|
|
144
|
-
plugin_version: <team-superpower plugin version>
|
|
145
|
-
claude_code_version: <e.g. 2.1.32>
|
|
146
|
-
stack_shape: full-stack | be-only | fe-only
|
|
147
|
-
```
|
|
110
|
+
For small enhancement, 1–3 files, no architecture impact.
|
|
148
111
|
|
|
149
|
-
|
|
112
|
+
The orchestrator drafts a combined briefing (one-paragraph spec + one-task plan), presents to owner for combined approval (touchpoint 1). On approval: `TeamCreate`, spawn one implementer (Sonnet/medium). Implementer runs TDD, static checks, commits. Orchestrator shuts down implementer, spawns qc-engineer for a single round. On pass: push + cleanup + notify. On blocking after 3 rounds: recovery escalation. See spec §9.2.
|
|
150
113
|
|
|
151
|
-
|
|
114
|
+
### Team mode (2 touchpoints + finish)
|
|
152
115
|
|
|
153
|
-
|
|
116
|
+
For feature work spanning ≥2 modules or ≥4 files, or introducing a new component.
|
|
154
117
|
|
|
155
|
-
|
|
156
|
-
2. Otherwise, run the heuristic ladder:
|
|
157
|
-
```bash
|
|
158
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/assess-complexity.sh "$LAUNCH_MESSAGE" "$PWD"
|
|
159
|
-
```
|
|
160
|
-
Capture stdout — it is YAML containing `mode:`, optionally `size:`, `shape:`, and `mode_reasoning:`. Exit 0 = confident; exit 1 = ambiguous (the script defaults to team and includes the ambiguity in `mode_reasoning`).
|
|
161
|
-
3. If `--size=` was supplied AND the resolved mode is `team`, override the `size:` field with the flag value. If the resolved mode is `solo` or `single-agent`, log that `--size=` was ignored.
|
|
118
|
+
The orchestrator runs the full single-team lifecycle above. Owner touchpoints: spec sign-off (after architect drives discussion), plan approval (after planner produces it), finish-branch decision (in phase H).
|
|
162
119
|
|
|
163
|
-
|
|
120
|
+
#### Heuristic ladder (when `--mode` is not set)
|
|
164
121
|
|
|
165
|
-
|
|
122
|
+
1. Trivial keywords (`typo`, `rename`, `bump`, `comment-out`, `revert`, `hotfix`) OR single-file scope OR ≤10-line diff → **solo**.
|
|
123
|
+
2. Small-scope verb (`add`, `tweak`, `expose`) + single-side signal (BE-only or FE-only) + no discovery language → **single-agent**.
|
|
124
|
+
3. Otherwise → **team**.
|
|
166
125
|
|
|
167
|
-
|
|
168
|
-
|
|
126
|
+
Forced overrides:
|
|
127
|
+
- `security.domain ∈ {payments, healthcare}` OR `security.pii: yes` in CLAUDE.md → forces `team` mode + `size=full` (security-engineer must run in phase A).
|
|
128
|
+
- Regulated keywords (`PCI`, `HIPAA`, `GDPR`, `audit`, `compliance`, `legal`) in launch message → same.
|
|
169
129
|
|
|
170
|
-
|
|
130
|
+
#### Team size (team mode only)
|
|
171
131
|
|
|
172
|
-
|
|
173
|
-
|
|
132
|
+
- **minimal** — solution-architect + feature-planner + team-leader + 1 BE or 1 FE + qc-engineer (5).
|
|
133
|
+
- **standard** (default) — adds the second implementer side when shape is full-stack (6).
|
|
134
|
+
- **full** — adds security-engineer in phase A (7 lifetime).
|
|
174
135
|
|
|
175
|
-
|
|
136
|
+
## SPAWN_REQUEST handling (orchestrator behavior)
|
|
176
137
|
|
|
177
|
-
|
|
138
|
+
When team-leader posts:
|
|
178
139
|
|
|
179
|
-
```bash
|
|
180
|
-
mkdir -p docs/superpowers/sessions
|
|
181
|
-
echo "$mode" > docs/superpowers/sessions/<slug>.mode
|
|
182
|
-
git add docs/superpowers/sessions/<slug>.mode
|
|
183
140
|
```
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Extend the checkpoint frontmatter with:
|
|
190
|
-
|
|
191
|
-
```yaml
|
|
192
|
-
mode: solo | single-agent | team
|
|
193
|
-
size: minimal | standard | full # only when mode=team
|
|
194
|
-
mode_reasoning: |
|
|
195
|
-
<copy of mode_reasoning from assess-complexity.sh output, or "owner override via --mode=..." when flagged>
|
|
196
|
-
overrides_applied: [] # list of flag strings, e.g. ["--mode=team", "--size=full"]
|
|
141
|
+
SPAWN_REQUEST wave=<plan-phase>.<wave>
|
|
142
|
+
roles_needed: { backend-developer: N, frontend-developer: M }
|
|
143
|
+
brief_path: .team-superpower/spawn-briefs/wave-<plan-phase>.<wave>.md
|
|
144
|
+
expected_tasks: [<task-id-1>, <task-id-2>, ...]
|
|
197
145
|
```
|
|
198
146
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
## Mode-specific execution
|
|
147
|
+
Orchestrator:
|
|
148
|
+
1. Reads the brief file.
|
|
149
|
+
2. `TaskCreate` for each expected_task. Title carries the `impl:` prefix per spec §8.2; metadata carries `wave: <plan-phase>.<wave>`; body excerpted from brief.
|
|
150
|
+
3. Spawns the requested counts. Each implementer spawn prompt:
|
|
204
151
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
- Do NOT spawn any teammates. Do NOT create a team. Skip `TeamCreate`.
|
|
210
|
-
- The lead does the work itself in its own session.
|
|
211
|
-
- Touchpoint 1 — **Plan-and-diff review**: write a one-paragraph description of the change + the proposed diff; ask the owner "Approve and apply?".
|
|
212
|
-
- On approval, apply the change.
|
|
213
|
-
- Touchpoint 2 — **Finish decision**: present the change as applied and ask the owner "Commit / discard?".
|
|
214
|
-
- On commit, write the commit and stop. Do NOT run a CI gate — solo changes are too small to justify it.
|
|
215
|
-
- The 3-touchpoint promise becomes 2 for solo mode (spec §4.6).
|
|
152
|
+
```
|
|
153
|
+
You are a <role> on team superpower-<slug>. Read the next unclaimed unblocked task in the shared task list at ~/.claude/tasks/superpower-<slug>/. Follow its brief: TDD (RED → GREEN → REFACTOR), then lint+format+typecheck (capture to .team-superpower/static-check-<task-id>.log), then commit per team format. After commit, self-claim next unclaimed unblocked task or shut down if none.
|
|
154
|
+
```
|
|
216
155
|
|
|
217
|
-
|
|
156
|
+
4. Replies to team-leader: `SPAWN_DONE wave=<plan-phase>.<wave> agent_ids=[...]`.
|
|
218
157
|
|
|
219
|
-
|
|
220
|
-
- Spawn exactly ONE implementer matching shape: `backend-developer` if `side: be-only`, `frontend-developer` if `side: fe-only`. (Use the `side_signal:` line from `assess-complexity.sh`'s `mode_reasoning` to decide.)
|
|
221
|
-
- Touchpoint 1 — **Inline spec sign-off**: lead writes a one-paragraph spec at `docs/superpowers/specs/<slug>.md` and asks the owner "Ok to proceed?".
|
|
222
|
-
- Touchpoint 2 — **Plan approval**: lead writes a one-task inline plan at `docs/superpowers/plans/<slug>.md` (the single task usually 5 lines: `Files`, `Depends on: []`, `Verification`, code outline) and asks the owner "Approve plan?".
|
|
223
|
-
- Dispatch the implementer with that single task. Wait for `done`.
|
|
224
|
-
- Lead reviews the implementer's diff itself in a single pass (no separate reviewer teammate).
|
|
225
|
-
- Touchpoint 3 — **Finish decision**: run `superpowers:finishing-a-development-branch` (CI gate per `CLAUDE.md`'s `ci` block).
|
|
158
|
+
Concurrency cap: orchestrator refuses to spawn beyond `limits.max_concurrent_teammates` (default 5). Excess spawns are queued; reply notes `queued: <ids>`.
|
|
226
159
|
|
|
227
|
-
|
|
160
|
+
## RESTART_REQUEST handling (orchestrator behavior)
|
|
228
161
|
|
|
229
|
-
|
|
162
|
+
When team-leader (or qc-engineer) posts `RESTART_REQUEST <reason>`:
|
|
230
163
|
|
|
231
|
-
-
|
|
232
|
-
|
|
233
|
-
- `full`: + `software-architect` + `security-engineer`.
|
|
164
|
+
1. Read `.team-superpower/restart-count` (default 0). If ≥ `limits.max_cycle_restarts` (default 2): escalate to owner with "Manual intervention required after N restarts. Feature appears not tractable in this shape."
|
|
165
|
+
2. Otherwise present recovery touchpoint to owner:
|
|
234
166
|
|
|
235
|
-
|
|
167
|
+
```
|
|
168
|
+
Cycle restart needed: <reason>
|
|
169
|
+
Current state:
|
|
170
|
+
Phase: <X>
|
|
171
|
+
Last commit: <sha> "<msg>"
|
|
172
|
+
Restart count: <n>/<max>
|
|
173
|
+
|
|
174
|
+
Approve restart from phase A?
|
|
175
|
+
[1] Approve restart
|
|
176
|
+
[2] Cancel feature (manual takeover)
|
|
177
|
+
```
|
|
236
178
|
|
|
237
|
-
|
|
179
|
+
3. On approval: increment `.team-superpower/restart-count`. Shut down all current teammates. Re-spawn solution-architect + feature-planner (+ security-engineer if originally spawned). Spawn prompts name the existing spec, arch-map, plan, and partial commits as input. Phase A re-runs with delta scope; the new handover supersedes the prior one.
|
|
238
180
|
|
|
239
|
-
|
|
181
|
+
Recovery touchpoints from RESTART_REQUEST do **not** count against the 3-touchpoint budget.
|
|
240
182
|
|
|
241
|
-
|
|
242
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh scan
|
|
243
|
-
```
|
|
183
|
+
## Phase H — finish-branch and CI gate
|
|
244
184
|
|
|
245
|
-
|
|
185
|
+
After QC pass, team-leader drives the finish-branch decision:
|
|
246
186
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
187
|
+
1. Push the branch.
|
|
188
|
+
2. If `ci.provider != none`: poll the CI provider for `ci.required_checks` up to `ci.poll_timeout_minutes` (default 20).
|
|
189
|
+
3. Surface one finish-branch menu (see below) to owner. This is the third (and final) touchpoint in team mode.
|
|
250
190
|
|
|
251
|
-
|
|
191
|
+
### CI-specific menus
|
|
252
192
|
|
|
253
|
-
|
|
|
193
|
+
| CI state | Menu |
|
|
254
194
|
|---|---|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
| Other slugs have configs but not this one | Note in the checkpoint that other in-flight runs exist; proceed with this slug. |
|
|
259
|
-
|
|
260
|
-
Same-session check: if the current Claude Code session already manages an agent team (the runtime enforces "one team per session"), halt. The owner must finish or `/team-cleanup` the current team before launching a new feature.
|
|
261
|
-
|
|
262
|
-
## Initial checkpoint and heartbeat
|
|
263
|
-
|
|
264
|
-
After preflight clears AND phase 0 has decided the shape AND phase 0.5 has decided the mode/size:
|
|
265
|
-
|
|
266
|
-
1. Write the initial checkpoint `docs/superpowers/sessions/YYYY-MM-DD-<slug>.md` per the format in the **Checkpointing** section — including the v2 frontmatter fields (`superpowers_version`, `plugin_version`, `claude_code_version`, `stack_shape`) — and commit it.
|
|
267
|
-
2. `touch docs/superpowers/sessions/<slug>.heartbeat` and commit (or leave uncommitted — the file is intentionally ephemeral; either is fine). **Touch this heartbeat at every phase boundary** and any time you remain active for more than ~10 minutes inside a phase. The cleanup script uses its mtime to decide whether a future session is allowed to wipe state.
|
|
268
|
-
3. Ensure `docs/superpowers/sessions/<slug>.shape` was written in phase 0.4 and is committed.
|
|
269
|
-
4. Write checkpoint updates atomically: write to `<file>.tmp` then `mv -f <file>.tmp <file>`. Half-written checkpoints corrupt recovery.
|
|
270
|
-
|
|
271
|
-
## Create the team (canonical primitive)
|
|
272
|
-
|
|
273
|
-
Immediately after writing the initial checkpoint and **before** spawning any teammate, create the team via the canonical Claude Code `TeamCreate` tool. Do NOT mkdir `~/.claude/teams/...` by hand — the runtime owns that directory and the inbox files inside it.
|
|
195
|
+
| green | `merge / pr_opened / keep / discarded` |
|
|
196
|
+
| red | `merge / pr_opened / keep / discarded / show_ci_logs` |
|
|
197
|
+
| timeout | `re-poll / switch_to_pr_opened / escalate` |
|
|
274
198
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
TeamCreate({
|
|
279
|
-
team_name: "superpower-<slug>",
|
|
280
|
-
agent_type: "team-lead",
|
|
281
|
-
description: "<one-line owner request, ≤120 chars>"
|
|
282
|
-
})
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
This creates:
|
|
286
|
-
|
|
287
|
-
```
|
|
288
|
-
~/.claude/teams/superpower-<slug>/
|
|
289
|
-
├── config.json ← team configuration & members (lead-managed)
|
|
290
|
-
└── inboxes/
|
|
291
|
-
├── team-lead.json ← your inbox (auto-populated as teammates SendMessage you)
|
|
292
|
-
├── designer.json ← created when the designer teammate is spawned
|
|
293
|
-
├── planner.json ← created when the planner is spawned
|
|
294
|
-
└── ... ← one file per teammate name (= the agent's role)
|
|
295
|
-
|
|
296
|
-
~/.claude/tasks/superpower-<slug>/
|
|
297
|
-
└── ... ← shared task list (TaskCreate / TaskUpdate)
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
The runtime appends every inbound `SendMessage` to the recipient's JSON array with shape:
|
|
301
|
-
|
|
302
|
-
```json
|
|
303
|
-
{
|
|
304
|
-
"from": "<sender role name>",
|
|
305
|
-
"text": "<message body>",
|
|
306
|
-
"summary": "<5-10 word preview>",
|
|
307
|
-
"timestamp": "<ISO 8601 UTC>",
|
|
308
|
-
"read": false,
|
|
309
|
-
"color": "<UI hint>"
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
You never write these files directly. Always use `SendMessage` to deliver, and read your inbox through the automatic delivery the runtime hands you (see "Automatic Message Delivery" in the TeamCreate tool docs). The only hand-read is `~/.claude/teams/superpower-<slug>/config.json` when you need to discover member roles by name.
|
|
314
|
-
|
|
315
|
-
### Spawning teammates (canonical Agent call)
|
|
316
|
-
|
|
317
|
-
When you spawn a teammate (per the phase chain below), use the `Agent` tool with **all four** of these parameters:
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
Agent({
|
|
321
|
-
subagent_type: "<role>", // e.g. "team-superpower:designer"; matches the agent .md filename
|
|
322
|
-
team_name: "superpower-<slug>",
|
|
323
|
-
name: "<role>", // e.g. "designer"; becomes the inbox filename (designer.json) and the SendMessage `to` value
|
|
324
|
-
prompt: "<filled Spawn prompt template, see below>"
|
|
325
|
-
})
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
Hard rules for the spawn call:
|
|
329
|
-
|
|
330
|
-
- `name` MUST equal the role string (`designer`, `planner`, `software-architect`, `security-engineer`, `backend-developer`, `frontend-developer`, `qa-engineer`, `reviewer`). Inbox filenames depend on this.
|
|
331
|
-
- `team_name` MUST equal `superpower-<slug>` — every cleanup, resume, and `team-state.sh` primitive depends on this convention.
|
|
332
|
-
- `subagent_type` MUST match the agent definition shipped by this plugin (`team-superpower:<role>`).
|
|
333
|
-
- Do NOT spawn the same role twice in parallel. If a role needs a second pass, mailbox the existing teammate instead of spawning a duplicate.
|
|
334
|
-
|
|
335
|
-
## Spawn prompt template (use verbatim — do NOT improvise per role)
|
|
336
|
-
|
|
337
|
-
Every teammate spawn MUST hand over the same minimum context. A teammate inherits project context (`CLAUDE.md`, MCP servers, skills) automatically but does NOT inherit your conversation history — anything implicit on your side is invisible on theirs. Use this template:
|
|
338
|
-
|
|
339
|
-
```
|
|
340
|
-
You are the <role> teammate for feature `<slug>`.
|
|
341
|
-
|
|
342
|
-
Stack shape: <full-stack | be-only | fe-only> (read docs/superpowers/sessions/<slug>.shape if you need to confirm)
|
|
343
|
-
Worktree: <absolute path> (planner records this in WORKTREE_READY)
|
|
344
|
-
Resume: <yes | no> (yes when spawned by /team-feature-resume; pick up at the next pending task)
|
|
345
|
-
|
|
346
|
-
Read first:
|
|
347
|
-
- CLAUDE.md (free-form prose AND the `team-superpower` block)
|
|
348
|
-
- Your role brief: <relative path to plugins/team-superpower/agents/<role>.md>
|
|
349
|
-
- <role-relevant artefact paths — list them all; e.g. design doc, plan, ARCH/SEC reports, QA report>
|
|
350
|
-
|
|
351
|
-
Open escalations:
|
|
352
|
-
<one-line summary per open escalation in the checkpoint, or "(none)">
|
|
353
|
-
|
|
354
|
-
Your task: <one sentence describing the specific phase work the role is being spawned for>
|
|
355
|
-
Mailbox signal expected back: <e.g. DESIGN_APPROVED <path>, PLAN_READY <path>, ARCH_PASSED <path>, BE_DONE <task-id>, etc.>
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
Fill every field. If a field is genuinely N/A for a role (e.g. there is no QA report when spawning the designer), write `n/a` rather than omitting the line — the template's stability is what keeps respawns deterministic.
|
|
199
|
+
### 5-option merge-failure menu
|
|
359
200
|
|
|
360
|
-
|
|
201
|
+
If merge fails (`conflict` / `non-ff` / `dirty-worktree` / `push-rejected`):
|
|
361
202
|
|
|
362
203
|
```
|
|
363
|
-
|
|
364
|
-
|
|
204
|
+
FINISH_BLOCKED <reason>
|
|
205
|
+
[1] retry — re-attempt merge (cap 3)
|
|
206
|
+
[2] pr_opened — open PR instead of merging
|
|
207
|
+
[3] kept — leave branch alone, end session
|
|
208
|
+
[4] discarded — discard branch
|
|
209
|
+
[5] escalate — open an escalation
|
|
365
210
|
```
|
|
366
211
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
## Phase chain (strict order — no skipping, no inlining)
|
|
370
|
-
|
|
371
|
-
1. **Design (designer).** Spawn the `designer` teammate. Hand it `<slug>` and the owner's request. Wait for `DESIGN_APPROVED <path>` in your mailbox. If the designer asks a clarifying question, answer from project context if unambiguous; otherwise batch with any open questions and use the §7 escalation template to the owner. Checkpoint: `phase: design, status: complete`. Touch heartbeat.
|
|
372
|
-
|
|
373
|
-
2. **Plan (planner).** Spawn the `planner` teammate. Hand it `<slug>` and the design doc path. Wait for `WORKTREE_READY <path> <branch> <origin>` (`<origin>` ∈ {`reused`, `created`} — if the planner posts the legacy 2-arg form, treat as `created` for backward compatibility) then `PLAN_READY <path>`. Record both `**Worktree:** <path>` and `**Worktree origin:** <origin>` in the checkpoint. Route the plan to the owner for approval (second owner touchpoint). On approval, stamp `plan_approved_at: <ISO datetime>` into the metadata of every `impl:` task you will create — the `TaskCompleted` hook checks for it. Checkpoint: `phase: plan, status: approved`. Touch heartbeat.
|
|
374
|
-
|
|
375
|
-
3. **Pre-impl review gate (software-architect + security-engineer, parallel).** Spawn both. Hand each the design doc path AND the plan path. Wait for `ARCH_PASSED <path>` AND `SEC_PASSED <path>`. If either posts `ARCH_BLOCKED` / `SEC_BLOCKED`, route the findings to `planner` for a plan revision, then re-route to whichever gate is still blocking. Cap at three plan-revision rounds — escalate to owner via §7 if it does not converge. Checkpoint: `phase: pre_impl_review, status: passed | blocked`. Touch heartbeat.
|
|
376
|
-
|
|
377
|
-
4. **Implementation — Phase 4 wave dispatcher (wave-based, shape-adaptive).** Read the approved plan's `## Waves` section. For each wave N in order:
|
|
378
|
-
|
|
379
|
-
**4.1 Collision check.** Build a wave manifest by concatenating each task's `id` + space-separated `files:` metadata, one task per line. Pipe it to `bash ${CLAUDE_PLUGIN_ROOT}/scripts/wave-collision-check.sh`. Exit 0 → proceed. Exit 1 → halt the wave, do NOT dispatch any task in it, post `WAVE_COLLISION wave=N tasks=[…] shared_files=[…]` to the planner's mailbox (verbatim from the helper output), and wait for a fresh `PLAN_READY <path>`. Re-read the plan, re-build the manifest, re-run the collision check. Cap the loop at **3 re-plan retries on the same wave** (`wave_replans: K/3` in the checkpoint). On the 4th attempt, escalate to owner via §7 template — planner cannot converge on this dependency graph.
|
|
380
|
-
|
|
381
|
-
**4.2 Create task entries.** For every task in this wave, create one shared-task-list entry with title from the plan (`impl:be-*`, `impl:fe-*`, `impl:be-migration-*`, `impl:be-contract-publish-*`, `impl:contract-update-*`). Set metadata: `wave: N`, `depends_on: [...]`, `files: [...]`, `tests: [...]`, `estimated_minutes`, `plan_approved_at`, `iteration_count: 0`. The `TaskCreated` hook will warn on missing wave.
|
|
382
|
-
|
|
383
|
-
**4.3 Spawn counts.**
|
|
384
|
-
- `be_count = count(impl:be-* tasks in wave N)`; `fe_count = count(impl:fe-* tasks in wave N)`.
|
|
385
|
-
- Live BE instances target = `min(be_count, 2)`; FE target = `min(fe_count, 2)`.
|
|
386
|
-
- If a live instance is below target, spawn additional implementer(s) for that side using the canonical spawn-prompt template (§Spawn prompt template). Reuse already-spawned implementers across waves — do NOT respawn.
|
|
387
|
-
- If a live instance is above target (previous wave had more tasks than this one), let it idle. Idle instances do NOT trigger `TeammateIdle` because that hook checks unanswered peer mail, not work activity.
|
|
388
|
-
|
|
389
|
-
**4.4 Task claim.** Each implementer self-claims one task from the wave queue matching its side prefix. The lead does NOT assign tasks explicitly — implementers pull from the queue. If a side has more tasks than instances, the extras get claimed serially by whichever instance frees up first.
|
|
390
|
-
|
|
391
|
-
**4.5 Contract gate.** If the wave contains `impl:be-contract-publish-<slug>`, do NOT release any `impl:fe-*` queue items until `CONTRACT_PUBLISHED <task-id>` arrives, even if the FE tasks technically live in a later wave. Plan dependencies already enforce this; the gate is a backstop.
|
|
392
|
-
|
|
393
|
-
**4.6 Migration serialization.** `impl:be-migration-*` tasks must occupy a wave alone on the BE side. The planner enforces upfront via `Depends on:`; the `TaskCompleted` hook is a final backstop with `MIGRATION_RACE`.
|
|
394
|
-
|
|
395
|
-
**4.7 Mid-wave collision.** If an implementer posts `WAVE_COLLISION` mid-wave (an undeclared overlap surfaced during work), halt the wave: keep in-flight tasks running to completion, do not claim any further task, route the collision to planner as in 4.1. Same 3-retry cap.
|
|
396
|
-
|
|
397
|
-
**4.8 Mid-implementation contract drift.** If `CONTRACT_DRIFT_DETECTED` arrives from frontend-developer, or backend-developer files `impl:contract-update-*` on its own, pause all `impl:fe-*` claims until `CONTRACT_UPDATED <task-id>` arrives. Frontend-developer re-pulls the contract hash on resume.
|
|
398
|
-
|
|
399
|
-
**4.9 Wave completion.** A wave completes when:
|
|
400
|
-
- every task in the wave has status `done`,
|
|
401
|
-
- every task's `TaskCompleted` hook returned 0 (verified via the JSONL log),
|
|
402
|
-
- no implementer holds unanswered peer mail relevant to this wave.
|
|
403
|
-
|
|
404
|
-
On completion, checkpoint: `phase: implementation, wave: N/M, tasks_complete: X/Y` and advance to wave N+1.
|
|
405
|
-
|
|
406
|
-
**4.10 Task failure inside a wave.** If any task fails (`iteration_count` exceeded with no reflection, two-stage review rejects, test never goes green), halt the wave at that task. Other in-flight tasks finish; no new claims until the failure resolves via the four-class clarification routing. On resolution: resume the wave from where it stopped — do NOT restart.
|
|
407
|
-
|
|
408
|
-
**4.11 Idle implementer cleanup.** Between waves, if any implementer instance has been idle for the entire previous wave AND no upcoming wave will use it, the lead MAY shut it down to free context. Fresh implementers spawn for later waves on demand. (Optional; harmless to leave idle implementers alive.)
|
|
409
|
-
|
|
410
|
-
Checkpoint after each wave: `phase: implementation, wave: N/M, tasks_complete: X/Y`. Touch heartbeat. Do not advance to phase 5 until wave M/M completes.
|
|
411
|
-
|
|
412
|
-
5. **QA gate (qa-engineer).** Once every `impl:` task is complete, spawn `qa-engineer`. Wait for `QA_PASSED <path>` or `QA_BLOCKED <path>`. If blocked, the QA report contains `impl:qa-fix-be-` / `impl:qa-fix-fe-` tasks — file them in the shared task list and loop to phase 4. Checkpoint: `phase: qa, status: passed | blocked`. Touch heartbeat.
|
|
413
|
-
|
|
414
|
-
6. **Code review (reviewer).** Once `QA_PASSED`, file a `review:` task and spawn the `reviewer` teammate. Wait for `REVIEW_PASSED <path>`. If critical issues come back instead, the reviewer report names the responsible implementer (`backend-developer` or `frontend-developer`) and the failing task — file `impl:review-fix-be-` / `impl:review-fix-fe-` tasks and loop to phase 4. Checkpoint: `phase: review, status: pass | critical_issues_returned`. Touch heartbeat.
|
|
415
|
-
|
|
416
|
-
7. **Finish (reviewer, with CI gate).** Same reviewer runs `finishing-a-development-branch`. Before presenting the finish menu, the reviewer pushes the branch and (if `ci.provider != none`) polls CI per the `ci` block in CLAUDE.md until all `required_checks` go green, time out, or fail. On CI red, the reviewer posts `FINISH_BLOCKED ci-red <failed-checks>` and you surface the merge-failure menu with an added option F **"Show CI logs"**. On CI timeout, the reviewer posts `FINISH_BLOCKED ci-timeout` and you surface a 3-option menu (re-poll / switch to `pr_opened` / escalate). The CI gate is the **same finish-branch touchpoint** — no new touchpoint.
|
|
417
|
-
|
|
418
|
-
The owner makes the merge / PR / keep / discard decision (third and last owner touchpoint). On `FINISH_DONE <decision> <ref>`, checkpoint: `phase: finish, status: <merged|pr_opened|kept|discarded>`. Touch heartbeat. If the reviewer posts `FINISH_BLOCKED <reason>` (any reason — merge or CI), follow **Phase 7 merge-failure handling** below.
|
|
419
|
-
|
|
420
|
-
## Phase 7 merge-failure handling
|
|
421
|
-
|
|
422
|
-
When the reviewer posts `FINISH_BLOCKED <reason>` (instead of `FINISH_DONE`), the merge step or the CI gate failed. Handle it inline — this is the same owner touchpoint as the finish-branch decision continued, NOT a new touchpoint.
|
|
423
|
-
|
|
424
|
-
`<reason>` is one of `conflict` / `non-ff` / `dirty-worktree` / `push-rejected` / `ci-red <failed-checks>` / `ci-timeout` / `other:<short-string>` (see `agents/reviewer.md` § Hat 2 for the full enum and what each reason means).
|
|
425
|
-
|
|
426
|
-
### CI-specific menus
|
|
427
|
-
|
|
428
|
-
For `ci-red <failed-checks>` use the standard 5-option merge-failure menu **plus an option F: Show CI logs**, which runs `gh run view --log-failed` (or the provider equivalent the reviewer is using) and pipes the output into the conversation, then re-presents the menu.
|
|
429
|
-
|
|
430
|
-
For `ci-timeout` use a 3-option menu:
|
|
431
|
-
|
|
432
|
-
> **CI did not finish within the poll window.** Pick one:
|
|
433
|
-
> - **A. Re-poll** — wait another `ci.poll_timeout_minutes` for CI to finish.
|
|
434
|
-
> - **B. Switch to pr_opened** — open a PR; the owner deals with CI on the PR side.
|
|
435
|
-
> - **E. Escalate** — §7 escalation, full reviewer status appended.
|
|
436
|
-
|
|
437
|
-
Re-poll is the same finish-branch touchpoint continued. The `merge_retries` counter does NOT apply to CI re-polls (it tracks merge attempts, not CI polls); cap re-polls at 3 instead, recorded as `ci_repolls: K/3` in the checkpoint.
|
|
438
|
-
|
|
439
|
-
1. Read the mailbox message. Stash `<reason>` and the verbatim git stderr.
|
|
440
|
-
2. Update the checkpoint: `phase: finish, status: merge_blocked, reason: <reason>, merge_retries: K/3` where `K` is the count of prior retry attempts in this run (start at 0).
|
|
441
|
-
3. Touch the heartbeat.
|
|
442
|
-
4. Present the 5-option menu below to the owner.
|
|
443
|
-
5. Translate the owner's choice into the next instruction to the reviewer per the table.
|
|
444
|
-
|
|
445
|
-
### 5-option merge-failure menu
|
|
446
|
-
|
|
447
|
-
Present verbatim:
|
|
448
|
-
|
|
449
|
-
> **Merge failed:** `<reason>`. Pick one:
|
|
450
|
-
> - **A. Retry merge** — re-attempt the merge now (you've resolved conflicts externally or upstream has stabilised).
|
|
451
|
-
> - **B. Switch to pr_opened** — open a PR for human merge instead.
|
|
452
|
-
> - **C. Switch to kept** — keep the worktree as-is, you'll handle the merge later.
|
|
453
|
-
> - **D. Switch to discarded** — drop the branch entirely.
|
|
454
|
-
> - **E. Escalate** — pause and surface a §7 escalation with full git output.
|
|
455
|
-
|
|
456
|
-
Translation:
|
|
457
|
-
|
|
458
|
-
| Choice | Reviewer instruction | Expected next signal |
|
|
459
|
-
|---|---|---|
|
|
460
|
-
| **A** | "Retry the merge step only. Do not re-do design/plan/etc." Increment `merge_retries`. | `FINISH_DONE merged <ref>` OR a new `FINISH_BLOCKED <reason>` |
|
|
461
|
-
| **B** | "Re-run `finishing-a-development-branch` with `decision=pr_opened`." | `FINISH_DONE pr_opened <ref>` |
|
|
462
|
-
| **C** | "Post `FINISH_DONE kept <branch>` directly. Do not attempt another merge." | `FINISH_DONE kept <ref>` |
|
|
463
|
-
| **D** | "Run the discard path of `finishing-a-development-branch`." | `FINISH_DONE discarded <ref>` |
|
|
464
|
-
| **E** | Lead posts §7 template to owner with verbatim git stderr; halts until owner responds. | Owner directs manually |
|
|
465
|
-
|
|
466
|
-
### Retry cap
|
|
467
|
-
|
|
468
|
-
`merge_retries` is bounded at 3. Before presenting the menu, check the current value:
|
|
469
|
-
|
|
470
|
-
- `merge_retries < 3` → present all five options.
|
|
471
|
-
- `merge_retries == 3` → drop option A. The menu shows B/C/D/E only.
|
|
472
|
-
|
|
473
|
-
The counter is persisted in the checkpoint so `/team-feature-resume` honours it across sessions.
|
|
474
|
-
|
|
475
|
-
### Flow rejoin
|
|
476
|
-
|
|
477
|
-
On any `FINISH_DONE <decision>` (any decision), flow rejoins normal phase 7: checkpoint `phase: finish, status: <decision>`, then run **Automatic cleanup** below. Auto-cleanup Step D.5 (worktree removal) runs only when `decision == merged`.
|
|
212
|
+
Retry cap: 3. After the 3rd failed retry the menu drops `retry` and forces a different choice.
|
|
478
213
|
|
|
479
214
|
## Automatic cleanup (runs after `FINISH_DONE`)
|
|
480
215
|
|
|
481
|
-
|
|
216
|
+
Orchestrator runs cleanup immediately after `FINISH_DONE`:
|
|
482
217
|
|
|
483
218
|
### Step A — Verify safety preconditions
|
|
484
219
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
- Every
|
|
488
|
-
-
|
|
489
|
-
- Phase 7 returned a recognised decision: `merged`, `pr_opened`, `kept`, or `discarded`.
|
|
490
|
-
- The expected git commits exist on the worktree branch. Run `git log --oneline -30` and confirm:
|
|
491
|
-
- A design doc commit under `docs/superpowers/specs/`
|
|
492
|
-
- A plan commit under `docs/superpowers/plans/`
|
|
493
|
-
- An ARCH report commit AND a SEC report commit under `docs/superpowers/reviews/` (phase-3 gate)
|
|
494
|
-
- One or more implementation commits (TDD pairs of test + code on the same files; the test commit precedes the code commit per the `test-driven-development` skill)
|
|
495
|
-
- A QA report commit under `docs/superpowers/reviews/` (phase-5 gate)
|
|
496
|
-
- A code-review report commit under `docs/superpowers/reviews/`
|
|
497
|
-
- If the finish decision is `merged` or `pr_opened`, the corresponding merge / PR-prep commit
|
|
220
|
+
- All phases marked complete in checkpoint.
|
|
221
|
+
- Every expected commit present on the branch.
|
|
222
|
+
- Every teammate `idle` (no in-flight task).
|
|
223
|
+
- `restart_count` and `qc_rounds` recorded in checkpoint.
|
|
498
224
|
|
|
499
|
-
If any
|
|
225
|
+
If any precondition fails, halt with the failed item and leave platform state intact for `/team-cleanup`.
|
|
500
226
|
|
|
501
227
|
### Step B — Shut down teammates gracefully
|
|
502
228
|
|
|
503
|
-
For each
|
|
504
|
-
|
|
505
|
-
1. Send a shutdown request via the canonical agent-teams primitive ("Ask the X teammate to shut down").
|
|
506
|
-
2. Wait for graceful exit.
|
|
507
|
-
3. If a teammate rejects shutdown, surface the rejection reason to the owner via the §7 template and halt cleanup.
|
|
508
|
-
|
|
509
|
-
The agent-teams runtime refuses team cleanup while any teammate is alive — this step is non-optional.
|
|
229
|
+
For each remaining teammate: orchestrator requests shutdown via SendMessage; teammate approves and exits. If any teammate refuses, escalate; do not force.
|
|
510
230
|
|
|
511
231
|
### Step C — Run the canonical team cleanup
|
|
512
232
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
```bash
|
|
516
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh scan <slug>
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
Expected after the runtime cleanup:
|
|
520
|
-
|
|
521
|
-
- `team_config_state: absent`
|
|
522
|
-
- `task_list_state: absent`
|
|
523
|
-
- `tmux_state: absent` (or `tmux` not installed)
|
|
233
|
+
Invoke the canonical Agent-Teams "clean up the team" primitive (removes `~/.claude/teams/superpower-<slug>/` and `~/.claude/tasks/superpower-<slug>/`).
|
|
524
234
|
|
|
525
235
|
### Step D — Manual sweep (only if Step C left residue)
|
|
526
236
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
```bash
|
|
530
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh cleanup <slug> --force
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
The heartbeat refusal check applies. If it fires, you are still touching the heartbeat (or another lead is alive) — investigate before forcing. If the only reason is your own fresh heartbeat from this session, pass `--ignore-heartbeat` (you know the lead is you and you are about to exit).
|
|
237
|
+
Remove residual files via `bash plugins/team-superpower/scripts/team-state.sh cleanup <slug>` — this also clears `.team-superpower/spawn-briefs/` and `.team-superpower/static-check-*.log`.
|
|
534
238
|
|
|
535
239
|
### Step D.5 — Worktree removal (on successful merge only)
|
|
536
240
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
**Trigger conditions** (ALL must be true; any miss → skip and record the reason in the Closing block):
|
|
241
|
+
If `decision = merged` AND `worktree_origin != reused`: `git worktree remove <path>`. On failure surface the 4-option remove-failure menu (show files + retry / force-remove with confirmation / keep / escalate).
|
|
540
242
|
|
|
541
|
-
|
|
542
|
-
2. Step A precondition check passed.
|
|
543
|
-
3. Step B teammate shutdown was clean.
|
|
544
|
-
4. The post-Step-C (or post-Step-D) scan shows `team_config_state: absent`, `task_list_state: absent`, `tmux_state: absent`.
|
|
545
|
-
5. The checkpoint has a non-empty `**Worktree:**` field.
|
|
546
|
-
6. The checkpoint records `**Worktree origin:** created`. A `reused` origin means the worktree existed before this run — it is the owner's, not ours to remove.
|
|
547
|
-
|
|
548
|
-
If any condition fails, record `worktree: removal-skipped:<reason>` in the Closing block (Step E) where `<reason>` is one of:
|
|
549
|
-
|
|
550
|
-
- `not-merged-decision` — finish decision was `pr_opened`, `kept`, or `discarded`.
|
|
551
|
-
- `team-cleanup-incomplete` — Step C/D left platform state present.
|
|
552
|
-
- `no-worktree-recorded` — checkpoint has no `**Worktree:**` line.
|
|
553
|
-
- `reused-existing-worktree` — `**Worktree origin:** reused`; the owner pre-existed the worktree and keeps it.
|
|
554
|
-
|
|
555
|
-
**Procedure** (only when all trigger conditions pass):
|
|
556
|
-
|
|
557
|
-
1. Read the worktree path from the checkpoint's `**Worktree:**` line. Call it `WT_PATH`.
|
|
558
|
-
2. `cd` to the repo root (the **main** worktree, NOT `WT_PATH`). `git worktree remove` refuses when the current directory is inside the target.
|
|
559
|
-
3. Run `git worktree list --porcelain`. If `WT_PATH` is not listed (already pruned, manual removal, etc.), record `worktree: already-absent` in the Closing block and skip to Step E.
|
|
560
|
-
4. Touch the heartbeat.
|
|
561
|
-
5. Run `git worktree remove "$WT_PATH"` (non-forced).
|
|
562
|
-
6. On success → record `worktree: removed` in the Closing block. Touch heartbeat. Proceed to Step E.
|
|
563
|
-
7. On non-zero exit → enter the **4-option remove-failure menu** below.
|
|
564
|
-
|
|
565
|
-
**Branch handling:** `git worktree remove` does NOT delete the branch. The feature branch survives this step. Branch deletion is left to the owner.
|
|
566
|
-
|
|
567
|
-
### 4-option remove-failure menu
|
|
568
|
-
|
|
569
|
-
Triggered when `git worktree remove "$WT_PATH"` exits non-zero. Common causes: untracked files, locked worktree, in-progress git operation, owner pre-seeded files.
|
|
570
|
-
|
|
571
|
-
Present verbatim:
|
|
572
|
-
|
|
573
|
-
> **Could not remove worktree** `<WT_PATH>`. Git said: `<stderr>`. Pick one:
|
|
574
|
-
> - **A. Show files + retry** — list what's blocking, then retry the remove.
|
|
575
|
-
> - **B. Force remove** — discard uncommitted work in `<WT_PATH>` and remove. (Confirmation required.)
|
|
576
|
-
> - **C. Keep worktree** — leave it on disk; you'll remove it manually later.
|
|
577
|
-
> - **D. Escalate** — pause and surface a §7 escalation with the verbatim stderr.
|
|
578
|
-
|
|
579
|
-
Translation:
|
|
580
|
-
|
|
581
|
-
| Choice | Action | Closing-block record |
|
|
582
|
-
|---|---|---|
|
|
583
|
-
| **A** | Run `git -C "$WT_PATH" status --short` and `git -C "$WT_PATH" diff --stat`. Surface output to owner. Retry `git worktree remove "$WT_PATH"`. Cap: 3 retries per Step D.5. On success: record `worktree: removed (after manual fix)` and proceed to Step E. On 3rd retry still failing: drop option A from the next menu and force B/C/D. | See action column. |
|
|
584
|
-
| **B** | Lead prompts: `"This will discard uncommitted work in <WT_PATH>. Confirm force-remove? (type 'yes' to confirm)"`. On `yes`: snapshot the file list from the pre-remove `git -C "$WT_PATH" status --short` (or take a snapshot now if option A hasn't run), then run `git worktree remove --force "$WT_PATH"`. On any other input: abort B, re-present the menu. | `worktree: force-removed`, `dropped_files: [<path>, ...]` |
|
|
585
|
-
| **C** | Log `WT_PATH` in the Closing block. Tell the owner: `"Worktree retained at <WT_PATH>. Remove manually with 'git worktree remove <WT_PATH>' once you've handled it."` Proceed to Step E. | `worktree: kept-by-owner`, `worktree_path: <WT_PATH>` |
|
|
586
|
-
| **D** | Halt Step D.5. Post the §7 template to the owner with the verbatim stderr from the failed remove. Wait for direction. | `worktree: escalated`, `worktree_path: <WT_PATH>` |
|
|
587
|
-
|
|
588
|
-
In all four cases, Step E still runs after Step D.5 closes (whether by success or by the owner's menu choice). Step E records the outcome in the Closing block.
|
|
243
|
+
If `worktree_origin = reused`, skip; record `worktree: removal-skipped:reused-existing-worktree`.
|
|
589
244
|
|
|
590
245
|
### Step E — Final checkpoint commit
|
|
591
246
|
|
|
592
|
-
Append
|
|
593
|
-
|
|
594
|
-
```markdown
|
|
595
|
-
## Closing
|
|
596
|
-
- finished at: <ISO datetime>
|
|
597
|
-
- decision: <merged|pr_opened|kept|discarded>
|
|
598
|
-
- cleanup: complete
|
|
599
|
-
- worktree: <removed | already-absent | removal-skipped:<reason> | removed (after manual fix) | force-removed | kept-by-owner | escalated>
|
|
600
|
-
- worktree_path: <path> # present whenever the worktree directory still exists on disk after cleanup (states: kept-by-owner, escalated, or removal-skipped where the path exists)
|
|
601
|
-
- merge_retries: K # only when K > 0; matches the final value of the mid-phase counter
|
|
602
|
-
- dropped_files: [<path>, ...] # only when state == force-removed
|
|
603
|
-
```
|
|
247
|
+
Append `## Closing` block to the checkpoint:
|
|
604
248
|
|
|
605
|
-
|
|
249
|
+
```
|
|
250
|
+
finished at: <ISO datetime>
|
|
251
|
+
decision: <merged|pr_opened|kept|discarded>
|
|
252
|
+
cleanup: complete
|
|
253
|
+
cycle_restart_count: <N>
|
|
254
|
+
qc_rounds: <N>
|
|
255
|
+
worktree: <state>
|
|
256
|
+
worktree_path: <path> (only when state implies the dir still exists)
|
|
257
|
+
```
|
|
606
258
|
|
|
607
|
-
|
|
259
|
+
Commit the checkpoint.
|
|
608
260
|
|
|
609
261
|
### Step F — If anything failed
|
|
610
262
|
|
|
611
|
-
|
|
263
|
+
Halt with the failure mode. The owner runs `/team-cleanup <slug>` from a fresh session.
|
|
612
264
|
|
|
613
265
|
## Within-phase stall watchdog
|
|
614
266
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
1. Read `limits.phase_stall_minutes` from CLAUDE.md (`bash ${CLAUDE_PLUGIN_ROOT}/scripts/parse-claudemd.sh get limits.phase_stall_minutes CLAUDE.md`). Default to **30** if unset.
|
|
618
|
-
2. Inside any phase, if the watchdog window elapses with **no mailbox message AND no shared-task-list state transition** from the active teammate(s):
|
|
619
|
-
- Send a ping to the teammate's mailbox: `STATUS_CHECK <slug> — no activity for <N> minutes; reply with current status or progress note.`
|
|
620
|
-
- Start a second watchdog window of the same length.
|
|
621
|
-
3. If a second watchdog window also elapses with no reply: surface a §7 escalation to the owner with the teammate's last-known status, the elapsed wall time, and the current phase. Halt — do NOT silently respawn or force-cancel; the owner decides.
|
|
622
|
-
|
|
623
|
-
The watchdog is **not** an owner touchpoint by itself — pinging the teammate is internal. Escalation step 3 is what reaches the owner, and only via the §7 template (so it doesn't count against the 3 allowed touchpoints either).
|
|
624
|
-
|
|
625
|
-
Reset the watchdog on every received mailbox message and every task transition. Touch the heartbeat each time you reset.
|
|
626
|
-
|
|
627
|
-
## v4 mailbox handlers (per-task QA, token budget, retrieval)
|
|
628
|
-
|
|
629
|
-
These handlers run inside your normal mailbox-processing loop. They are non-touchpoint by construction — handle inline, never page the owner.
|
|
630
|
-
|
|
631
|
-
### Handler: `BUDGET_85_REACHED <task-id> tokens=<used>/<cap> current_state=<...> blocker=<...>`
|
|
267
|
+
Orchestrator detects no SendMessage activity AND no shared-task-list transitions for `limits.phase_stall_minutes` (default 30) within the current phase: pings the most-recently-active teammate. If the next 30-minute window is also silent, surfaces a §7 escalation. Heartbeat-at-phase-boundaries alone does not catch silent hangs.
|
|
632
268
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
- If `current_state` is `QA-loop round=2`, `QA-loop round=3`, or `REFACTOR` → respond `BUDGET_EXTEND <task-id> additional=50000` (close to completion, worth extending).
|
|
636
|
-
- If `blocker` mentions "task scope larger than estimated" / "scope" / "decomposition" → respond `BUDGET_ABORT <task-id>` and post `TASK_OVERSCOPED <task-id>` to the planner for re-decomposition.
|
|
637
|
-
- If `current_state` is `RED` or `GREEN` and `tokens > 200000` (mostly exploration with no clear completion path) → respond `BUDGET_REASSIGN <task-id>` (kill, unclaim, let a fresh implementer try).
|
|
638
|
-
- Otherwise respond `BUDGET_EXTEND <task-id> additional=50000` and log a warning to the checkpoint for retrospective tuning.
|
|
639
|
-
|
|
640
|
-
Increment the task's `task_token_budget` metadata by `additional` on EXTEND so subsequent 85% checks use the new ceiling.
|
|
641
|
-
|
|
642
|
-
### Handler: `RETRIEVAL_REQUEST <task-id> cycle=<N> need=<...> because=<...>`
|
|
643
|
-
|
|
644
|
-
Steps:
|
|
645
|
-
|
|
646
|
-
1. Validate `because` clause is specific. Reject vague phrasings (matches: "might need", "more context", "to be safe", "in case", "not sure if"). If vague → respond `RETRIEVAL_DENIED <task-id> reason="be specific — what exactly and why?"`. Vague rejections DO NOT count against the budget.
|
|
647
|
-
2. Validate `cycle ≤ 2`. If exceeded → respond `RETRIEVAL_DENIED <task-id> reason="budget exhausted, produce best-effort with Flagged-assumptions:"`.
|
|
648
|
-
3. Locate the requested files / symbols / ADR contents. Read them with `Read` tool.
|
|
649
|
-
4. Respond `RETRIEVAL_RESPONSE <task-id> cycle=<N> content=<inline file contents>`.
|
|
650
|
-
5. Increment the task's `retrieval_requests` metadata counter (this is the value the hook checks against the cap).
|
|
651
|
-
|
|
652
|
-
### Handler: AGENTS.md suggestions (post-`REVIEW_PASSED`)
|
|
653
|
-
|
|
654
|
-
After `reviewer` posts `REVIEW_PASSED`, check `docs/superpowers/AGENTS.suggestions.md`:
|
|
655
|
-
|
|
656
|
-
1. Count the `## Candidate <N>` entries (if any).
|
|
657
|
-
2. Read the `## Stale entries to remove` section; count its non-empty bullets.
|
|
658
|
-
3. When you compose the owner's finish notification (in phase 7 after `FINISH_DONE`), include:
|
|
659
|
-
```
|
|
660
|
-
📝 Reviewer suggested <N> lessons for AGENTS.md<and flagged <M> stale entry|stale entries> — see docs/superpowers/AGENTS.suggestions.md
|
|
661
|
-
```
|
|
662
|
-
Show the line only when N > 0 or M > 0. Omit entirely otherwise.
|
|
663
|
-
|
|
664
|
-
Never auto-promote a candidate to `AGENTS.md` — the owner is the only role that may promote entries. The hook backstops this (`AGENT_WROTE_AGENTS_MD`).
|
|
269
|
+
## Owner touchpoints (the ONLY allowed pings to the owner)
|
|
665
270
|
|
|
666
|
-
|
|
271
|
+
Team mode (3 max):
|
|
272
|
+
1. **Spec sign-off** (mid phase A).
|
|
273
|
+
2. **Plan approval** (end phase A).
|
|
274
|
+
3. **Finish-branch decision** (phase H).
|
|
667
275
|
|
|
668
|
-
|
|
276
|
+
Single-agent mode (1):
|
|
277
|
+
1. **Combined spec + plan approval**.
|
|
669
278
|
|
|
670
|
-
|
|
279
|
+
Solo mode (1):
|
|
280
|
+
1. **Diff preview + verification step**.
|
|
671
281
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
282
|
+
Recovery touchpoints (these do **not** count against the budget):
|
|
283
|
+
- Model fallback (teammate running on different model than pinned).
|
|
284
|
+
- `RESTART_REQUEST` approval.
|
|
285
|
+
- CI timeout decision.
|
|
286
|
+
- Manual intervention after restart cap.
|
|
675
287
|
|
|
676
|
-
|
|
288
|
+
Anything else that reaches the owner MUST use the §7 escalation template in `assets/ESCALATION.md`.
|
|
677
289
|
|
|
678
290
|
## Checkpointing
|
|
679
291
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
```markdown
|
|
683
|
-
---
|
|
684
|
-
slug: <slug>
|
|
685
|
-
started: <ISO datetime>
|
|
686
|
-
superpowers_version: <e.g. 5.0.7>
|
|
687
|
-
plugin_version: <team-superpower plugin version>
|
|
688
|
-
claude_code_version: <e.g. 2.1.32>
|
|
689
|
-
stack_shape: full-stack | be-only | fe-only
|
|
690
|
-
mode: solo | single-agent | team # v3, written in phase 0.5
|
|
691
|
-
size: minimal | standard | full # v3, only when mode=team
|
|
692
|
-
mode_reasoning: | # v3, populated by scripts/assess-complexity.sh or "owner override via ..."
|
|
693
|
-
<multi-line reasoning trace>
|
|
694
|
-
overrides_applied: [] # v3, list of flag strings, e.g. ["--mode=team", "--size=full"]
|
|
695
|
-
wave: 0/0 # v3, current wave / total waves during phase 4 (set when phase 4 starts)
|
|
696
|
-
wave_replans: 0/3 # v3, collision-driven re-plans for the current wave; cap 3 before owner escalation
|
|
697
|
-
tasks_complete: 0/0 # v3, tasks complete in current wave / wave size
|
|
698
|
-
---
|
|
292
|
+
`docs/superpowers/sessions/YYYY-MM-DD-<slug>.md` is updated by the orchestrator at every phase boundary. Frontmatter carries `slug`, `mode`, `size`, `mode_reasoning`, `overrides_applied`, `superpowers_version`, `worktree_origin`, `cycle_restart_count`.
|
|
699
293
|
|
|
700
|
-
|
|
701
|
-
**Started:** <ISO datetime>
|
|
702
|
-
**Last update:** <ISO datetime>
|
|
703
|
-
**Team:** superpower-<slug>
|
|
704
|
-
**Worktree:** <path>
|
|
705
|
-
**Worktree origin:** created | reused # `reused` means the owner launched `/team-feature` from inside a linked worktree; Step D.5 skips removal in that case
|
|
706
|
-
|
|
707
|
-
## Phases
|
|
708
|
-
- [x] design → docs/superpowers/specs/YYYY-MM-DD-<slug>-design.md
|
|
709
|
-
- [x] worktree → <branch>
|
|
710
|
-
- [x] plan → docs/superpowers/plans/YYYY-MM-DD-<slug>-plan.md (approved <datetime>)
|
|
711
|
-
- [x] pre_impl_review → arch + sec PASSED
|
|
712
|
-
- [ ] implementation (M/N tasks complete)
|
|
713
|
-
- [ ] qa
|
|
714
|
-
- [ ] review
|
|
715
|
-
- [ ] finish — when `FINISH_BLOCKED <reason>` is in flight, this line reads `- [ ] finish (blocked: <reason>, merge_retries: K/3)` instead, and stays unchecked until `FINISH_DONE` arrives.
|
|
716
|
-
|
|
717
|
-
## Teammates
|
|
718
|
-
(list reflects stack_shape — omit the implementer that doesn't exist for be-only / fe-only)
|
|
719
|
-
- designer (agent-id: ...) — idle
|
|
720
|
-
- planner (agent-id: ...) — idle
|
|
721
|
-
- software-architect (agent-id: ...) — idle
|
|
722
|
-
- security-engineer (agent-id: ...) — idle
|
|
723
|
-
- backend-developer (agent-id: ...) — active on task impl:be-<name> # full-stack | be-only
|
|
724
|
-
- frontend-developer (agent-id: ...) — idle # full-stack | fe-only
|
|
725
|
-
- qa-engineer (agent-id: ...) — idle
|
|
726
|
-
- reviewer (agent-id: ...) — idle
|
|
294
|
+
Body sections:
|
|
727
295
|
|
|
296
|
+
```
|
|
297
|
+
## Phases — checklist with file paths to artefacts
|
|
298
|
+
## Teammates — role / agent id / current task or idle
|
|
728
299
|
## Open escalations
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
##
|
|
732
|
-
(appended after each phase; one entry per non-owner decision)
|
|
733
|
-
- <ISO ts> <role> [class=<tactical|cross-role|architectural>]: <one-line decision> (peer: <role|none>, evidence: <link to mailbox msg | n/a>)
|
|
734
|
-
|
|
735
|
-
## Resume protocol
|
|
736
|
-
1. Owner runs /team-feature-resume with this filename.
|
|
737
|
-
2. Lead respawns teammates using same role definitions.
|
|
738
|
-
3. Lead reads this checkpoint, identifies next pending task, resumes.
|
|
300
|
+
## Assumptions — one line per non-owner decision
|
|
301
|
+
## Cycle history — one row per RESTART_REQUEST
|
|
302
|
+
## Closing — final block written by Step E
|
|
739
303
|
```
|
|
740
304
|
|
|
305
|
+
The orchestrator commits this file after every phase transition. If the orchestrator crashes, the feature lives in this file.
|
|
306
|
+
|
|
741
307
|
## Hard rules
|
|
742
308
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
- **Never** run Step D.5 worktree removal unless the finish decision is `merged` AND the platform-cleanup scan (Step C, or Step D fallback) shows every state `absent`. Other decisions or partial cleanups must record `worktree: removal-skipped:<reason>` and leave the worktree on disk.
|
|
753
|
-
- **Never** force-remove a worktree (`--force`) without explicit owner confirmation in the 4-option menu. The default remove is non-forced; force only on option B with a typed `yes`.
|
|
754
|
-
- **Never** retry merge more than 3 times. After the 3rd `FINISH_BLOCKED`, drop option A from the 5-option menu and require B/C/D/E.
|
|
755
|
-
- **Never** treat the `FINISH_BLOCKED` menu as a new owner touchpoint. It is the same finish-branch touchpoint continued — the 3-touchpoint cap stays at 3.
|
|
756
|
-
|
|
757
|
-
## Hard rules (v2 additions)
|
|
758
|
-
|
|
759
|
-
- **Never** spawn `frontend-developer` in a `be-only` shape, or `backend-developer` in a `fe-only` shape. The shape was decided in phase 0.5 from CLAUDE.md (or the auto-detection fallback the owner has confirmed); deviating means a different team than the owner agreed to.
|
|
760
|
-
- **Never** auto-edit the user's `CLAUDE.md`. Phase 0 writes to `docs/superpowers/stack.detected.md` only and asks the owner to paste/edit. The user's CLAUDE.md is theirs.
|
|
761
|
-
- **Never** release an `impl:fe-*` task before `CONTRACT_PUBLISHED` arrives (full-stack with `contracts.source_of_truth != none`).
|
|
762
|
-
- **Never** release a second `impl:be-migration-*` task while one is `in_progress`. The hook is a backstop; you are the primary control.
|
|
763
|
-
- **Never** present the finish-branch menu before the CI gate either passes or is explicitly bypassed (CI red → menu with "Show CI logs"; CI timeout → 3-option menu; `ci.provider: none` → skip the gate entirely but still push).
|
|
764
|
-
- **Never** wait passively on a teammate for longer than `limits.phase_stall_minutes` (default 30) without running the within-phase stall watchdog above. Two consecutive stall windows with no teammate activity must escalate via §7.
|
|
765
|
-
- **Never** improvise a spawn prompt. Use the **Spawn prompt template** verbatim — leave fields as `n/a` rather than omitting them.
|
|
766
|
-
- **Never** spawn more than 5 teammates concurrently. The plugin defines up to 8 lifetime roles but phase-gating must keep ≤ 5 active at any moment. If a future change would break this, halt and escalate.
|
|
767
|
-
- **Never** run Step D.5 worktree removal when `**Worktree origin:** reused`. The worktree existed before `/team-feature` started; the owner owns it. Record `worktree: removal-skipped:reused-existing-worktree` and leave the worktree on disk.
|
|
768
|
-
- **Never** let the planner run inside a linked worktree on a protected branch (`main`, `master`, `develop`, `dev`, `release/*`, `releases/*`). The planner halts and escalates; the owner switches to a feature branch and re-runs.
|
|
769
|
-
- **Never** forward an owner-bound escalation when the originator's `class` is not `owner-only` AND `Peer attempts` lists fewer than one round-trip with a peer. The lead returns the escalation to the originator with `RETRY_PEER: try <suggested role> first`. Touchpoint count is NOT decremented (this is a routing reject, not an owner touch). The lead also returns it with `LOG_ASSUMPTION: tactical questions log to checkpoint § Assumptions, not the mailbox` when `class=tactical`. The 4-class table is in `assets/ESCALATION.md`. Class detection: scan the `Peer attempts:` field body for a `class=<name>` token (matches `class=tactical|cross-role|architectural|owner-only`). If absent, the field contains ISO-timestamped peer attempts — treat the originator's class as `cross-role` (the only class that produces real peer attempts) and accept a round-trip count ≥ 1.
|
|
770
|
-
|
|
771
|
-
Begin with the prechecks, then preflight, then run phase 0 (stack detection / shape decision / version pin / shape marker), then spawn `designer`.
|
|
309
|
+
1. **Lead never implements.** All feature work is delegated. The lead's only job is `Agent({type: "orchestrator", ...})` plus owner-reply pass-through.
|
|
310
|
+
2. **Orchestrator is the sole spawner.** team-leader, qc-engineer, and implementers never call `Agent` themselves — they post `SPAWN_REQUEST` and let the orchestrator handle it. This honours the Claude Code Agent Teams "no nested teams" constraint.
|
|
311
|
+
3. **One team per feature.** A single `TeamCreate superpower-<slug>` runs the entire lifecycle. Membership rolls forward by spawn + shutdown across phases A–H.
|
|
312
|
+
4. **No per-task QA loop.** Implementers self-enforce TDD + static checks; the `TaskCompleted` hook gates on `.team-superpower/static-check-<task-id>.log`.
|
|
313
|
+
5. **Owner-touchpoint budget is sacred.** 3 in team mode, 1 in single-agent / solo. Recovery touchpoints are separate.
|
|
314
|
+
6. **Restart cap is sacred.** 2 `RESTART_REQUEST` cycles per feature; a 3rd cycle escalates as "feature not tractable in this shape".
|
|
315
|
+
7. **QC rounds cap is sacred.** 3 end-of-plan QC rounds; a 4th triggers owner escalation.
|
|
316
|
+
8. **AGENTS.md is a read-only contract for agents.** The `TaskCompleted` hook rejects any commit that modifies it from inside a teammate; only the orchestrator may write it.
|
|
317
|
+
9. **No `--dangerously-skip-permissions`.** Hooks exist because Superpowers gates exist. Use the §7 escalation template instead.
|