@drunkcoding/agents-and-skills 0.0.19 → 0.0.24

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.
Files changed (30) hide show
  1. package/.claude-plugin/marketplace.json +5 -5
  2. package/package.json +1 -1
  3. package/plugins/auto-power/.claude-plugin/plugin.json +1 -1
  4. package/plugins/html-effectiveness/.claude-plugin/plugin.json +1 -1
  5. package/plugins/plugin-validator/.claude-plugin/plugin.json +1 -1
  6. package/plugins/team-superpower/.claude-plugin/plugin.json +1 -1
  7. package/plugins/team-superpower/README.md +186 -115
  8. package/plugins/team-superpower/agents/backend-developer.md +106 -74
  9. package/plugins/team-superpower/agents/feature-planner.md +66 -0
  10. package/plugins/team-superpower/agents/frontend-developer.md +109 -71
  11. package/plugins/team-superpower/agents/orchestrator.md +83 -0
  12. package/plugins/team-superpower/agents/qc-engineer.md +84 -0
  13. package/plugins/team-superpower/agents/security-engineer.md +79 -44
  14. package/plugins/team-superpower/agents/solution-architect.md +80 -0
  15. package/plugins/team-superpower/agents/team-leader.md +100 -0
  16. package/plugins/team-superpower/assets/CLAUDE.md.template +22 -18
  17. package/plugins/team-superpower/assets/ESCALATION.md +114 -66
  18. package/plugins/team-superpower/assets/SESSION_README.md +232 -159
  19. package/plugins/team-superpower/commands/team-feature.md +191 -645
  20. package/plugins/team-superpower/hooks/task-completed.sh +100 -182
  21. package/plugins/team-superpower/hooks/task-created.sh +55 -38
  22. package/plugins/team-superpower/hooks/teammate-idle.sh +118 -13
  23. package/plugins/team-superpower/scripts/team-state.sh +106 -37
  24. package/plugins/tech-graph/.claude-plugin/plugin.json +1 -1
  25. package/plugins/team-superpower/agents/designer.md +0 -65
  26. package/plugins/team-superpower/agents/planner.md +0 -242
  27. package/plugins/team-superpower/agents/qa-engineer.md +0 -103
  28. package/plugins/team-superpower/agents/reviewer.md +0 -175
  29. package/plugins/team-superpower/agents/software-architect.md +0 -60
  30. package/plugins/team-superpower/commands/team-feature-resume.md +0 -185
@@ -1,137 +1,168 @@
1
1
  # Superpowers session workspace
2
2
 
3
- This directory holds the artifacts produced by `/team-feature` runs. The team-superpower plugin seeds it on first use; afterwards, the design / plan / review / checkpoint files for each feature are written by the team and committed.
3
+ This directory holds the artefacts produced by `/team-feature` runs. The
4
+ team-superpower plugin seeds it on first use; afterwards the spec / plan /
5
+ handover / review / checkpoint files for each feature are written by the team
6
+ and committed.
7
+
8
+ ## v5 at a glance
9
+
10
+ - **One team per feature.** A single `TeamCreate superpower-<slug>` runs the
11
+ whole lifecycle. Membership rolls forward by spawn + shutdown across phases
12
+ A–H — no nested teams, no concurrent teams.
13
+ - **Lead is the sole spawner.** `team-leader` composes wave briefs and posts
14
+ `SPAWN_REQUEST` to lead; lead reads the brief, files tasks, spawns
15
+ implementers, replies `SPAWN_DONE`. The same channel carries
16
+ `RESTART_REQUEST` when the team is architecturally stuck.
17
+ - **No per-task QA loop.** Implementers run lint + typecheck + format before
18
+ every commit; the output is captured to
19
+ `.team-superpower/static-check-<task-id>.log` and the `TaskCompleted` hook
20
+ rejects any completion without an `exit=0` line.
21
+ - **Phase-end review.** team-leader runs a consolidated SOLID/DRY/domain pass
22
+ at the end of every plan-phase and emits `impl:rework-*` tasks where needed.
23
+ - **End-of-plan QC.** Lead spawns one `qc-engineer` after `PLAN_COMPLETE`. Up
24
+ to 3 rework rounds (`limits.max_qc_rounds`), then owner escalation.
25
+ - **Restart on stuck.** Up to 2 `RESTART_REQUEST` cycles
26
+ (`limits.max_cycle_restarts`); a third escalates to the owner as "feature
27
+ not tractable".
4
28
 
5
29
  ## Customising for your project
6
30
 
7
- Stack decisions, test/build commands, contract source-of-truth, CI provider, and security posture are all driven by a `team-superpower` fenced block in your repo-root `CLAUDE.md`. The plugin reads it on every run; it **never overwrites it**.
31
+ Stack decisions, test/build commands, contract source-of-truth, CI provider,
32
+ and security posture are all driven by a `team-superpower` fenced block in your
33
+ repo-root `CLAUDE.md`. The plugin reads it on every run; it **never
34
+ overwrites it**.
8
35
 
9
36
  ### 1. Write a `team-superpower` block in CLAUDE.md
10
37
 
11
- Copy `plugins/team-superpower/assets/CLAUDE.md.template` to your repo root as `CLAUDE.md` (or paste the `team-superpower` block into your existing CLAUDE.md). The block recognises:
12
-
13
- - `backend` — `language`, `framework`, `test_framework`, `build_command`, `test_command`, `format_command`, `migration_tool`, `package_manager`. Set `backend: none` to declare a frontend-only repo.
14
- - `frontend` — `language`, `framework`, `bundler`, `test_framework`, `e2e_framework`, `ui_library`, `package_manager`, `build_command`, `test_command`. Set `frontend: none` to declare a backend-only repo.
15
- - `contracts` — `source_of_truth` (`openapi` / `grpc` / `graphql` / `typescript` / `none`), `openapi_path`, `ts_gen_command`.
16
- - `ci` `provider`, `workflow_path`, `required_checks`, `poll_timeout_minutes` (default 20).
17
- - `security` `domain` (`payments` / `healthcare` / `generic` / `internal-only`), `pii`, `public_endpoints`, `data_at_rest`.
18
-
19
- Free-form prose around the block (e.g. a `## Conventions` section with project-specific rules) is passed to every teammate as project context.
38
+ Copy `plugins/team-superpower/assets/CLAUDE.md.template` to your repo root as
39
+ `CLAUDE.md` (or paste the `team-superpower` block into your existing CLAUDE.md).
40
+ The block recognises:
41
+
42
+ - `backend` — `language`, `framework`, `test_framework`, `build_command`,
43
+ `test_command`, `format_command`, `lint_command`, `typecheck_command`,
44
+ `migration_tool`, `package_manager`. Set `backend: none` to declare a
45
+ frontend-only repo.
46
+ - `frontend` `language`, `framework`, `bundler`, `test_framework`,
47
+ `e2e_framework`, `ui_library`, `package_manager`, `build_command`,
48
+ `test_command`, `lint_command`, `typecheck_command`, `format_command`. Set
49
+ `frontend: none` to declare a backend-only repo.
50
+ - `contracts` — `source_of_truth` (`openapi` / `grpc` / `graphql` /
51
+ `typescript` / `none`), `openapi_path`, `ts_gen_command`.
52
+ - `ci` — `provider`, `workflow_path`, `required_checks`,
53
+ `poll_timeout_minutes` (default 20). Used by team-leader at the
54
+ finish-branch decision (phase H).
55
+ - `security` — `domain` (`payments` / `healthcare` / `generic` /
56
+ `internal-only`), `pii`, `public_endpoints`, `data_at_rest`. Drives whether
57
+ `security-engineer` is spawned in phase A.
58
+ - `limits` — `phase_stall_minutes`, `max_tasks_per_implementer`,
59
+ `max_concurrent_teammates`, `max_iterations_per_task`, `task_token_budget`,
60
+ `retrieval_budget_per_task`, `max_qc_rounds`, `max_cycle_restarts`.
61
+
62
+ Free-form prose around the block (e.g. a `## Conventions` section with
63
+ project-specific rules) is passed to every teammate as project context.
20
64
 
21
65
  ### 2. Auto-detection fallback
22
66
 
23
- If `CLAUDE.md` is missing or has no `team-superpower` block, the lead runs `scripts/detect-stack.sh` in phase 0 and writes its best guess to `docs/superpowers/stack.detected.md`, then halts and asks you to review the `# CONFIRM:` lines and paste the corrected block into CLAUDE.md. **The plugin will not edit your CLAUDE.md for you.**
67
+ If `CLAUDE.md` is missing or has no `team-superpower` block, the lead runs
68
+ `scripts/detect-stack.sh` in phase 0 and writes its best guess to
69
+ `docs/superpowers/stack.detected.md`, then halts and asks you to review the
70
+ `# CONFIRM:` lines and paste the corrected block into CLAUDE.md. **The plugin
71
+ will not edit your CLAUDE.md for you.**
24
72
 
25
73
  ### 3. Shape-adaptive team
26
74
 
27
75
  Once the block (or detection) is parsed, the lead decides the **stack shape**:
28
76
 
29
- | Shape | Teammates spawned |
30
- |-------|-------------------|
31
- | `full-stack` | designer, planner, software-architect, security-engineer, backend-developer, frontend-developer, qa-engineer, reviewer (8) |
32
- | `be-only` | designer, planner, software-architect, security-engineer, backend-developer, qa-engineer, reviewer (7) no `frontend-developer` |
33
- | `fe-only` | designer, planner, software-architect, security-engineer, frontend-developer, qa-engineer, reviewer (7) no `backend-developer` |
77
+ | Shape | Phase-A roles | Implementation roles |
78
+ |-------|---------------|----------------------|
79
+ | `full-stack` | solution-architect, feature-planner, (security-engineer) | backend-developer, frontend-developer |
80
+ | `be-only` | solution-architect, feature-planner, (security-engineer) | backend-developer |
81
+ | `fe-only` | solution-architect, feature-planner, (security-engineer) | frontend-developer |
82
+
83
+ `security-engineer` is added only when `security.domain ∈
84
+ {payments, healthcare}` OR `security.pii: yes`. Otherwise solution-architect
85
+ runs a lightweight security pass alone.
34
86
 
35
- The shape is written to `docs/superpowers/sessions/<slug>.shape`; the `TaskCreated` hook reads it to reject `impl:fe-*` in BE-only repos and vice-versa.
87
+ The shape is written to `docs/superpowers/sessions/<slug>.shape`; the
88
+ `TaskCreated` hook reads it to reject `impl:fe-*` in BE-only repos and
89
+ vice-versa.
36
90
 
37
91
  #### Concurrency model
38
92
 
39
- The numbers above (7 or 8) are the **lifetime** team size, not the parallelism. Roles are phase-gated: only the teammates needed for the current phase are alive at any moment. The maximum concurrency is **2 teammates in parallel**:
93
+ Phase-gated. The roles listed above are the **lifetime** team size, not the
94
+ parallelism. Roles alive at any moment:
40
95
 
41
96
  | Phase | Concurrent teammates |
42
97
  |-------|----------------------|
43
- | 1 design | 1 (designer) |
44
- | 2 plan | 1 (planner) |
45
- | 3 pre-impl gate | 2 (software-architect + security-engineer, parallel) |
46
- | 4 implementation | 1 (`be-only` or `fe-only`) or 2 (`full-stack`, after `CONTRACT_PUBLISHED`) |
47
- | 5 QA | 1 (qa-engineer) |
48
- | 6 review | 1 (reviewer) |
49
- | 7 finish | 1 (reviewer, hat 2 — reused) |
98
+ | A — analytics | solution-architect + feature-planner (+ security-engineer when in scope) |
99
+ | B–F — implementation | team-leader + 1–N implementers (capped by `limits.max_concurrent_teammates`, default 5) |
100
+ | G — end-of-plan QC | team-leader + qc-engineer |
101
+ | H finish | team-leader (drives CI gate + finish-branch decision) |
50
102
 
51
- This matches the Claude Code agent-team best practice of "3–5 teammates in parallel, 5–6 tasks each". The lead caps concurrency at 5 (configurable via `limits.max_concurrent_teammates` in CLAUDE.md) and refuses to start a phase that would exceed it. The planner caps tasks per implementer at 12 (configurable via `limits.max_tasks_per_implementer`) and asks the owner to split the feature if a plan would exceed it.
103
+ Phase-A members shut down at `HANDOVER_READY`. No standby. If the team hits an
104
+ architectural blocker mid-implementation, team-leader posts `RESTART_REQUEST`
105
+ and lead re-runs phase A with the handover + partial commits as input.
52
106
 
53
- If the lead detects no mailbox activity or shared-task-list transitions for `limits.phase_stall_minutes` (default 30) within a phase, it pings the active teammate; if the next 30-minute window is also silent, it surfaces a §7 escalation. This is the within-phase stall watchdog — heartbeat-at-phase-boundaries alone doesn't catch silent hangs.
107
+ #### Within-phase stall watchdog
54
108
 
55
- #### Worktree reuse
109
+ If lead detects no mailbox activity or shared-task-list transitions for
110
+ `limits.phase_stall_minutes` (default 30) within a phase, it pings the active
111
+ teammate; if the next 30-minute window is also silent, it surfaces a §7
112
+ escalation.
56
113
 
57
- If you launch `/team-feature` from inside a linked git worktree on a feature branch, the planner reuses that worktree instead of nesting a new one inside it. The signal `WORKTREE_READY <path> <branch> <origin>` carries `origin: reused` and the checkpoint records `**Worktree origin:** reused`.
114
+ #### Worktree reuse
58
115
 
59
- Detection is automatic no config needed:
116
+ If you launch `/team-feature` from inside a linked git worktree on a feature
117
+ branch, the planner reuses that worktree instead of nesting a new one. The
118
+ signal `WORKTREE_READY <path> <branch> <origin>` carries `origin: reused` and
119
+ the checkpoint records `**Worktree origin:** reused`.
60
120
 
61
- | Where `/team-feature` is launched | Branch | Behavior |
121
+ | Where `/team-feature` is launched | Branch | Behavior |
62
122
  |---|---|---|
63
- | Linked worktree | feature branch (anything not protected) | **Reuse** the current worktree. |
64
- | Linked worktree | `main`, `master`, `develop`, `dev`, `release/*`, `releases/*` | **Halt.** Switch to a feature branch (`git checkout -b feature/<slug>`) and re-run. |
65
- | Main repo | any | **Create** a fresh worktree via Superpowers `using-git-worktrees`. |
123
+ | Linked worktree | feature branch | **Reuse** the current worktree. |
124
+ | Linked worktree | `main`, `master`, `develop`, `dev`, `release/*`, `releases/*` | **Halt.** Switch to a feature branch and re-run. |
125
+ | Main repo | any | **Create** a fresh worktree via Superpowers `using-git-worktrees`. |
66
126
 
67
- A reused worktree is owned by you, not the team — Step D.5 auto-removal after merge **does not run** when origin is `reused`; the Closing block records `worktree: removal-skipped:reused-existing-worktree` and the worktree stays on disk. Created worktrees are removed after a successful merge as before.
68
-
69
- The clean-test-baseline check still runs in both modes. If you reused a worktree with uncommitted changes that break the baseline, the planner halts with a §7 escalation asking you to stash or commit first.
127
+ A reused worktree is owned by you, not the team — auto-removal after merge
128
+ **does not run** when origin is `reused`.
70
129
 
71
130
  ### 4. Contract sync (full-stack only)
72
131
 
73
- When both BE and FE are present and `contracts.source_of_truth != none`, the planner emits `impl:be-contract-publish-<slug>` as the first phase-4 task. The lead does not assign any `impl:fe-*` task until the backend-developer posts `CONTRACT_PUBLISHED`. Every `impl:fe-*` task has `depends_on: [impl:be-contract-publish-<slug>]` in its metadata.
132
+ When both BE and FE are present and `contracts.source_of_truth != none`, the
133
+ planner emits `impl:be-contract-publish-<slug>` as the first phase-B task. The
134
+ lead does not assign any `impl:fe-*` task until the backend-developer posts
135
+ `CONTRACT_PUBLISHED`. Every `impl:fe-*` task has
136
+ `depends_on: [impl:be-contract-publish-<slug>]` in its metadata.
74
137
 
75
- Mid-implementation contract drift uses `impl:contract-update-<topic>`: BE files it (often after FE posts `CONTRACT_DRIFT_DETECTED`), updates the contract, runs `ts_gen_command`, posts `CONTRACT_UPDATED`, and FE resumes after re-pulling the contract hash.
138
+ Mid-implementation contract drift uses `impl:contract-update-<topic>`.
76
139
 
77
- ### 5. CI gate before finish
140
+ ### 5. CI gate before finish (phase H)
78
141
 
79
- The reviewer pushes the branch in phase 7, then (when `ci.provider != none`) polls the CI provider for `ci.required_checks` up to `ci.poll_timeout_minutes` (default 20). On green, the finish-branch menu surfaces. On red, the merge-failure menu surfaces with an extra "Show CI logs" option. On timeout, a 3-option menu (re-poll / switch to pr_opened / escalate) surfaces. Every CI variant counts as the **same** finish-branch touchpoint — the 3-touchpoint cap holds.
142
+ team-leader pushes the branch in phase H, then (when `ci.provider != none`)
143
+ polls the CI provider for `ci.required_checks` up to `ci.poll_timeout_minutes`
144
+ (default 20). On green the finish-branch menu surfaces. On red the
145
+ merge-failure menu surfaces with an extra "Show CI logs" option. On timeout a
146
+ 3-option menu (re-poll / switch to `pr_opened` / escalate) surfaces.
80
147
 
81
148
  ### 6. Project-aware security checklist
82
149
 
83
- `security-engineer` reads the `security` block and the stack info, then expands its checklist accordingly. A `domain: payments` repo gets idempotency / audit-trail / PCI items; a `data_at_rest: sql` repo gets parameterised-query items; a no-FE repo skips XSS items entirely. The output report uses ✅/⚠️/❌ markers — any ❌ blocks phase 4.
84
-
85
- ### 7. Superpowers version pinning
86
-
87
- The lead reads the installed Superpowers version in phase 0 and writes it to the checkpoint frontmatter (`superpowers_version`). On `/team-feature-resume`, the lead checks whether the installed version still matches. If not, you see a 3-option menu (continue anyway / roll back Superpowers / discard this feature). The pin is informational + safety — never a hard block; you can always continue.
88
-
89
- ### 8. Complexity assessment (v3 — mode and size)
90
-
91
- In phase 0.5 the lead runs a heuristic ladder against the launch message and picks one of three modes:
92
-
93
- - **solo** — lead does the work itself; 2 owner touchpoints (plan-and-diff + finish). Triggers on trivial keywords (typo, rename, bump, comment-out) or single-file launches.
94
- - **single-agent** — one implementer (BE or FE) spawned; 3 touchpoints. Triggers on small-scope verbs + single-side signal + no discovery language.
95
- - **team** — full v2 flow at the chosen size. Default.
96
-
97
- When mode is `team`, the lead also picks a size:
98
-
99
- - **minimal** — designer + planner + 1 BE + 1 FE + reviewer (5 teammates).
100
- - **standard** (default) — adds qa-engineer (6 teammates).
101
- - **full** — adds software-architect + security-engineer (8 teammates). Forced by `security.domain: payments | healthcare` or regulated keywords.
102
-
103
- The decision lands in the checkpoint's `mode`, `size`, `mode_reasoning`, `overrides_applied` fields. Override per feature with `/team-feature --mode=<mode> --size=<size>`. Preview with `/team-feature --explain <message>` (prints the decision and exits).
104
-
105
- If the lead picks an unexpected mode, read `mode_reasoning` in the checkpoint — it names the ladder rung and the matching keyword. Bias future launches by phrasing the request explicitly, or use the override flags.
106
-
107
- ### 9. Wave schedule (v3 — phase 4)
108
-
109
- In phase 4 the lead reads the plan's `## Waves` section. Each wave's tasks have an explicit `Depends on:` list. Independent tasks within a wave run concurrently, up to **2 backend-developer instances + 2 frontend-developer instances at peak**. Subsequent waves wait for the previous wave to fully complete.
110
-
111
- Read the plan's `## Waves` section to see how the planner decomposed the work. Each task carries `Files:` (paths) and `Depends on:` (task IDs) — the lead uses `Files:` for collision detection (`wave-collision-check.sh`) and `Depends on:` for wave ordering.
112
-
113
- If two tasks in the same wave collide on a shared file, the wave **hard-fails**. The lead pings the planner with `WAVE_COLLISION`; planner adds a dependency edge between them so they end up in different waves; lead retries. Cap is 3 retries (`wave_replans: K/3` in the checkpoint), then owner escalation. Hard-failing is intentional — graceful serialization would mask planner bugs.
150
+ `security-engineer` reads the `security` block and the stack info, then
151
+ expands its checklist accordingly. A `domain: payments` repo gets idempotency
152
+ / audit-trail / PCI items; a `data_at_rest: sql` repo gets parameterised-query
153
+ items; a no-FE repo skips XSS items entirely. The output report uses ✅/⚠️/❌
154
+ markers any blocks phase B.
114
155
 
115
- Wave progress shows up in checkpoint as `wave: N/M, tasks_complete: X/Y`.
156
+ ### 7. Iteration cap (MAX_ITERATIONS)
116
157
 
117
- ### 10. Iteration cap (v3 MAX_ITERATIONS)
158
+ Every `impl:` task carries an `iteration_count:`. If an implementer retries
159
+ the same failing test 8 times it halts and posts a §7 escalation with
160
+ `what_failed:`, `one_change_to_fix:`, and `class:`. The `task-completed` hook
161
+ rejects completions where `iteration_count > 8` unless a `reflection:` block
162
+ is attached.
118
163
 
119
- Every `impl:` task carries an `iteration_count:` integer. If an implementer retries the same failing test 8 times, it halts and posts a §7 escalation with `what_failed:`, `one_change_to_fix:`, and `class:`. The `task-completed` hook rejects completions where `iteration_count > 8` unless a `reflection:` block is attached.
120
-
121
- Configure per project in CLAUDE.md `limits.max_iterations_per_task` (default 8). Lower for slow-feedback environments; never raise above 12 — past that, retry is masking a structural issue.
122
-
123
- When you see an `ITERATION_CAP_EXCEEDED` escalation, the right move is usually to address the `one_change_to_fix:` field — it's the implementer's single best guess at the root cause.
124
-
125
- ### 11. Model fallback (v3 — preflight attestation)
126
-
127
- Each agent role is pinned to a model (Opus for designer/architect/security/reviewer; Sonnet for planner/BE/FE/QA — see spec §11.3). At spawn, the lead captures each teammate's first heartbeat:
128
-
129
- - `model_actual:` — the model the teammate is actually running on.
130
- - `effort_set:` — the effort level it set on first turn.
131
-
132
- If `model_actual` does not match the frontmatter `model:` pin (e.g. a usage-threshold fallback dropped Opus to Sonnet), the lead surfaces a single owner touchpoint asking whether to continue. This is a **recovery touchpoint** and does NOT count against the 3-touchpoint budget — it only fires on fallback.
133
-
134
- If `effort_set` is missing or wrong, the lead logs a warning to the checkpoint but does not surface to the owner. Soft enforcement.
164
+ Configure per project in CLAUDE.md `limits.max_iterations_per_task` (default
165
+ 8). Lower for slow-feedback environments; never raise above 12.
135
166
 
136
167
  ## Layout
137
168
 
@@ -139,13 +170,21 @@ If `effort_set` is missing or wrong, the lead logs a warning to the checkpoint b
139
170
  docs/superpowers/
140
171
  ├── ESCALATION.md # template — referenced by every teammate
141
172
  ├── README.md # this file
142
- ├── specs/ YYYY-MM-DD-<slug>-design.md # written by designer (phase 1)
143
- ├── plans/ YYYY-MM-DD-<slug>-plan.md # written by planner (phase 2)
144
- ├── reviews/ YYYY-MM-DD-<slug>-arch.md # written by software-architect (phase 3)
145
- ├── reviews/ YYYY-MM-DD-<slug>-security.md # written by security-engineer (phase 3)
146
- ├── reviews/ YYYY-MM-DD-<slug>-qa.md # written by qa-engineer (phase 5)
147
- ├── reviews/ YYYY-MM-DD-<slug>-review.md # written by reviewer (phase 6)
148
- └── sessions/ YYYY-MM-DD-<slug>.md # checkpoint, updated by lead each phase
173
+ ├── specs/ YYYY-MM-DD-<slug>-spec.md # owner+architect, phase A
174
+ ├── plans/ YYYY-MM-DD-<slug>-plan.md # feature-planner, phase A
175
+ ├── handovers/ YYYY-MM-DD-<slug>-handover.md # solution-architect, end of phase A
176
+ ├── reviews/ YYYY-MM-DD-<slug>-security.md # security-engineer, phase A (if spawned)
177
+ ├── reviews/ YYYY-MM-DD-<slug>-qc.md # qc-engineer, phase G
178
+ ├── sessions/ YYYY-MM-DD-<slug>.md # checkpoint, updated by lead each phase
179
+ └── sessions/ <slug>.shape # stack shape marker (be-only|fe-only|full-stack)
180
+ ```
181
+
182
+ Per-feature scratch (lives next to the worktree):
183
+
184
+ ```
185
+ .team-superpower/
186
+ ├── spawn-briefs/ wave-<plan-phase>.<wave>.md # team-leader, one per wave
187
+ └── static-check-<task-id>.log # implementer, one per impl: task
149
188
  ```
150
189
 
151
190
  ## How to launch
@@ -154,112 +193,146 @@ docs/superpowers/
154
193
  /team-feature <one-line feature idea>
155
194
  ```
156
195
 
157
- The lead handles prechecks, spawns the team, and drives the Superpowers skill chain.
196
+ The lead handles prechecks, spawns the analytics team for phase A, drives the
197
+ hand-off to team-leader, and supervises through phase H.
198
+
199
+ To resume an in-flight feature drop back into the same worktree and re-run
200
+ `/team-feature` — the lead detects the existing `~/.claude/teams/superpower-<slug>/`
201
+ directory and continues from the checkpoint. **There is no separate resume
202
+ command in v5.**
158
203
 
159
204
  ## Owner touchpoints (max 3 per feature)
160
205
 
161
- 1. **Design sign-off** (after phase 1). The brainstorming skill's built-in approval step. Designer batches any clarifying questions before this point so they piggy-back the same touchpoint.
162
- 2. **Plan approval** (after phase 2). Before the pre-impl arch+security gate runs.
163
- 3. **Finish-branch decision** (in phase 7). Merge / PR / keep / discard.
206
+ 1. **Spec sign-off** (mid phase A). Solution-architect batches all clarifying
207
+ questions before this point.
208
+ 2. **Plan approval** (end phase A). Before handover to team-leader.
209
+ 3. **Finish-branch decision** (in phase H). Merge / PR / keep / discard.
164
210
 
165
- Anything else that reaches you must use the §7 escalation template in `ESCALATION.md`. Refuse questions that don't follow it — that's the contract.
211
+ Recovery touchpoints (`RESTART_REQUEST`, model fallback, CI timeout) are
212
+ **not** counted against the 3-touchpoint budget. Anything else that reaches
213
+ you must use the §7 escalation template in `ESCALATION.md`.
166
214
 
167
215
  ## Reading a checkpoint
168
216
 
169
- `sessions/YYYY-MM-DD-<slug>.md` is the source of truth for in-flight features. Each phase boundary appends or updates:
217
+ `sessions/YYYY-MM-DD-<slug>.md` is the source of truth for in-flight features.
218
+ Each phase boundary appends or updates:
170
219
 
171
- - The `## Phases` checklist (which phases are done, file paths to the artifacts).
172
- - The `## Teammates` block (role, agent id, current task or `idle`).
173
- - The `## Open escalations` block (anything blocking the owner or a peer).
220
+ - `## Phases` checklist, file paths to the artefacts.
221
+ - `## Teammates` role, agent id, current task or `idle`.
222
+ - `## Open escalations` anything blocking the owner or a peer.
223
+ - `## Assumptions` — one line per non-owner decision (tactical, cross-role,
224
+ architectural).
225
+ - `## Cycle history` — append a row on every `RESTART_REQUEST`.
174
226
 
175
- The lead commits this file after every phase transition. If the lead crashes, your feature lives in this file.
227
+ The lead commits this file after every phase transition. If the lead crashes,
228
+ your feature lives in this file.
176
229
 
177
- ## Recovery — `/team-feature-resume`
230
+ ## Recovery — auto-resume
178
231
 
179
- If `/resume` drops the team mid-feature (the platform doesn't restore in-process teammates yet), use:
232
+ If `/resume` drops the team mid-feature, re-run `/team-feature <slug>` from
233
+ the same worktree. The lead:
180
234
 
181
- ```text
182
- /team-feature-resume <checkpoint-filename>
183
- ```
235
+ 1. Reads `~/.claude/teams/superpower-<slug>/config.json` to know which roles
236
+ were alive.
237
+ 2. Reads `docs/superpowers/sessions/<slug>.md` to know which phase is current.
238
+ 3. If past phase A, reads `docs/superpowers/handovers/<date>-<slug>-handover.md`.
239
+ 4. Re-spawns the right teammates (skipping completed phases). A
240
+ `Resume: <ISO ts>` line is appended to the checkpoint for the audit trail.
184
241
 
185
- The lead reads the checkpoint, respawns the right teammates, and continues from the next unchecked phase. Completed phases are not redone. A resume-log entry is appended to the checkpoint for the audit trail.
242
+ Completed phases are never redone. Partial commits are kept.
186
243
 
187
244
  ## Cleanup model
188
245
 
189
- The lead is the only thing that knows when a team's work is done. There is no `TeamShutdown` hook event, so cleanup is driven by the slash commands:
246
+ The lead is the only thing that knows when a team's work is done. There is no
247
+ `TeamShutdown` hook event, so cleanup is driven by the slash commands:
190
248
 
191
- - **Automatic**, the happy path: `/team-feature` runs cleanup immediately after `FINISH_DONE`. The lead verifies all phases complete, all expected commits in place, every teammate idle, then invokes the canonical "clean up the team" primitive and confirms with a final scan. A `## Closing` block is appended to the checkpoint.
249
+ - **Automatic**, the happy path: `/team-feature` runs cleanup immediately
250
+ after `FINISH_DONE`. The lead verifies all phases complete, all expected
251
+ commits in place, every teammate idle, then invokes the canonical "clean up
252
+ the team" primitive and confirms with a final scan. A `## Closing` block is
253
+ appended to the checkpoint.
192
254
 
193
255
  ### Closing-block fields
194
256
 
195
- The auto-cleanup writes a `## Closing` block with these fields:
196
-
197
- - `finished at: <ISO datetime>` — when cleanup finished.
198
- - `decision: <merged|pr_opened|kept|discarded>` — the finish-branch decision.
199
- - `cleanup: complete`confirms all cleanup steps ran (or were intentionally skipped).
200
- - `worktree: <state>` — outcome of Step D.5. One of: `removed`, `already-absent`, `removal-skipped:<reason>`, `removed (after manual fix)`, `force-removed`, `kept-by-owner`, `escalated`.
201
- - `worktree_path: <path>` — present only when the worktree directory still exists on disk (states `kept-by-owner`, `escalated`, or `removal-skipped` where the path exists).
202
- - `merge_retries: K` present only when K > 0; how many retries the 5-option menu ran before reaching `FINISH_DONE`.
203
- - `dropped_files: [<path>, ...]` — present only when `worktree: force-removed`; the file list snapshot from before the forced removal.
204
-
205
- `removal-skipped` reasons: `not-merged-decision` (decision was pr_opened/kept/discarded) | `team-cleanup-incomplete` (Step C/D left platform state present) | `no-worktree-recorded` (checkpoint had no `**Worktree:**` line).
206
- - **Manual**, the orphan path: if a lead crashed and left `~/.claude/teams/superpower-<slug>/` behind, run `/team-cleanup <slug>` from a fresh session. The slash command dry-runs first, prints what would be removed, asks for confirmation, then applies. The heartbeat file (`docs/superpowers/sessions/<slug>.heartbeat`) protects against wiping a live team — if it was touched in the last 10 minutes, cleanup refuses unless you explicitly confirm with `--ignore-heartbeat`.
207
-
208
- Project-side artefacts (`specs/`, `plans/`, `reviews/`, and the checkpoint itself) are **always preserved**. Only platform-side state under `~/.claude/teams/superpower-<slug>/` and `~/.claude/tasks/superpower-<slug>/` is removed, plus any matching tmux session.
257
+ - `finished at: <ISO datetime>`
258
+ - `decision: <merged|pr_opened|kept|discarded>`
259
+ - `cleanup: complete`
260
+ - `cycle_restart_count: <N>` — how many `RESTART_REQUEST` cycles ran.
261
+ - `qc_rounds: <N>`end-of-plan QC rounds consumed.
262
+ - `worktree: <state>` — `removed` | `already-absent` | `removal-skipped:<reason>` | `kept-by-owner` | `escalated`.
263
+
264
+ - **Manual**, the orphan path: if a lead crashed and left
265
+ `~/.claude/teams/superpower-<slug>/` behind, run `/team-cleanup <slug>` from
266
+ a fresh session. The slash command dry-runs first, prints what would be
267
+ removed, asks for confirmation, then applies. The heartbeat file
268
+ (`docs/superpowers/sessions/<slug>.heartbeat`) protects against wiping a
269
+ live team.
270
+
271
+ Project-side artefacts (`specs/`, `plans/`, `handovers/`, `reviews/`, and the
272
+ checkpoint itself) are **always preserved**. Only platform-side state under
273
+ `~/.claude/teams/superpower-<slug>/` and `~/.claude/tasks/superpower-<slug>/`
274
+ plus the per-feature scratch under `.team-superpower/` is removed.
209
275
 
210
276
  ## Heartbeat protocol
211
277
 
212
- The lead touches `docs/superpowers/sessions/<slug>.heartbeat` at every phase boundary. Future sessions read its mtime to decide whether a previous lead is still alive:
278
+ The lead touches `docs/superpowers/sessions/<slug>.heartbeat` at every phase
279
+ boundary. Future sessions read its mtime to decide whether a previous lead is
280
+ still alive:
213
281
 
214
- - mtime < 10 minutes → lead is likely alive; cleanup refuses without explicit override.
282
+ - mtime < 10 minutes → lead is likely alive; cleanup refuses without explicit
283
+ override.
215
284
  - mtime ≥ 10 minutes (or file missing) → safe to clean up.
216
285
 
217
- If you ever want to confirm liveness manually:
218
-
219
286
  ```bash
220
287
  bash plugins/team-superpower/scripts/team-state.sh scan <slug>
288
+ bash plugins/team-superpower/scripts/team-state.sh members <slug>
221
289
  ```
222
290
 
223
291
  ## Troubleshooting
224
292
 
225
293
  | Symptom | What it usually means | First thing to check |
226
294
  |---|---|---|
227
- | `BLOCKED_IDLE: N unanswered peer messages` from a teammate | A peer asked the teammate something and they tried to idle without replying | Open the teammate's mailbox, reply or escalate |
228
- | `BAD_PREFIX` on a new task | The lead created a task without the `impl:`/`review:`/`meta:`/`block:` prefix (or used an `impl:` task without one of the v2 sub-prefixes: `be-`, `fe-`, `qa-fix-be-`, `qa-fix-fe-`, `review-fix-be-`, `review-fix-fe-`, `contract-update-`, `be-migration-`, `be-contract-publish-`) | Lead's bug fix the task title |
229
- | `SHAPE_REJECTED: shape is 'be-only'` (or `fe-only`) | A task was created with a prefix the shape doesn't allow (e.g. `impl:fe-*` in a BE-only repo) | Planner or lead bug re-check `docs/superpowers/sessions/<slug>.shape` and re-emit |
230
- | `MIGRATION_RACE` on task complete | Two `impl:be-migration-*` tasks were `in_progress` simultaneously | Lead should serialize migrations; backend-developer should idle if another migration is in flight |
231
- | `EMPTY_CONTRACT_PUBLISH` on task complete | A `impl:be-contract-publish-*` task completed but no commit touched a contract file | Backend-developer didn't actually publish; investigate and re-run the task |
232
- | `superpowers_version` mismatch on resume | Superpowers was upgraded between feature start and resume | Pick continue / rollback / discard from the 3-option menu |
233
- | `NO_PLAN_APPROVAL` blocking a task complete | An `impl:` task is missing `metadata.plan_approved_at` | Lead forgot to stamp tasks after owner plan-approval; backfill from the checkpoint timestamp |
234
- | `ARCH_BLOCKED` or `SEC_BLOCKED` from phase 3 | Pre-impl gate rejected the plan; arch/security findings need plan revisions | Planner addresses the report, re-emits the plan, re-runs the gate before phase 4 starts |
235
- | `QA_BLOCKED` from phase 5 | Acceptance criteria or regression coverage missing post-implementation | Lead files `impl:qa-fix-be-` / `impl:qa-fix-fe-` tasks; loop back to phase 4 |
236
- | Backend developer and frontend developer want the same file | Plan didn't capture file-scope metadata for the overlapping tasks, or the task was mis-prefixed | Serialize by holding one; planner should re-route by `impl:be-` / `impl:fe-` prefix and backfill file-scope |
237
- | `bad_escalation: missing field(s) ...` (warn-only in `log.jsonl`) | A teammate posted a blocker without all six template fields (`Phase`, `Context`, `Options`, `Recommendation`, `Need from you`, `Peer attempts`) | Rewrite using the full template in `assets/ESCALATION.md` |
238
- | Lead refuses to ping the owner | The teammate's request to escalate didn't use the §7 template | Same as above |
239
- | Teammate ran a non-Superpowers approximation of a skill | Teammate paraphrased the SKILL.md instead of following it | The agent's system prompt requires the canonical skill — re-spawn and remind it explicitly |
240
- | `REFUSED: heartbeat ... is Ns old` from cleanup | Heartbeat is fresh cleanup script thinks a lead is alive | Verify nothing's running; if certain the previous lead is dead, run with `--ignore-heartbeat` |
241
- | `/team-feature` halts at preflight | Stale team config left over from a previous run | Run `/team-cleanup <slug>` (or resume via `/team-feature-resume`) |
242
- | `FINISH_BLOCKED <reason>` from the reviewer | The merge step of `finishing-a-development-branch` failed (`conflict` / `non-ff` / `dirty-worktree` / `push-rejected`) | The lead surfaces a 5-option menu (retry / pr_opened / kept / discarded / escalate). Pick one; merge retries cap at 3. |
243
- | `RETRY_PEER: try <role> first` | Lead bounced an escalation because the originator's class isn't `owner-only` and `Peer attempts` is empty | Originator mails the named role with the question, waits one cadence, then refiles citing the attempt. See `assets/ESCALATION.md` § Decision classes |
244
- | `LOG_ASSUMPTION: tactical, log to checkpoint § Assumptions` | Lead bounced a `class=tactical` escalation | Originator logs one line under the session checkpoint's `## Assumptions` and proceeds. No owner touchpoint consumed |
245
- | `git worktree remove` failed during cleanup | Step D.5 hit an uncommitted/untracked file or a locked worktree | Pick from the 4-option menu (show files + retry / force-remove with confirmation / keep / escalate). Force-remove discards uncommitted work — only confirm if you've checked the file list. |
246
- | Auto-cleanup skipped after FINISH_DONE | One of Step A's preconditions failed (missing commits, in-progress tasks, etc.) | Read the lead's halt reason; once resolved, run `/team-cleanup <slug>` |
247
- | Hook log noise | Hooks write tuning data to `.claude/hooks/log.jsonl` | Inspect the file; trim or refine matchers if a hook is over-triggering |
295
+ | `BLOCKED_IDLE_implementer_owes_team-leader_reply` | Implementer tried to idle with an unanswered message from team-leader | Open the implementer's mailbox, reply or escalate |
296
+ | `BLOCKED_IDLE_team-leader_awaiting_lead_on_spawn_or_restart` | team-leader sent SPAWN_REQUEST or RESTART_REQUEST and lead hasn't replied | Look at lead's mailbox; if dropped, re-post |
297
+ | `BLOCKED_IDLE_team-leader_owes_implementer_escalate_reply` | An implementer sent ESCALATE that team-leader hasn't routed | Route it (tactical/cross-role/architectural) or escalate to owner |
298
+ | `BLOCKED_IDLE_qc-engineer_awaiting_lead_ack` | qc-engineer posted QC_REWORK_NEEDED and lead hasn't replied | Lead acknowledges, files `impl:rework-*` via team-leader |
299
+ | `BLOCKED_IDLE_phaseA_awaiting_owner_signoff` | analytics team sent HANDOVER_READY / SEC_PASSED / SEC_BLOCKED with no reply | Owner reviews and replies |
300
+ | `BLOCKED_IDLE_orchestrator_unhandled_team-leader_request` | team-leader sent something the lead hasn't acted on | Lead acts (spawn / restart / route) |
301
+ | `bad_prefix` on a new task | Lead created a task without the `impl:`/`review:`/`meta:`/`block:` prefix | Lead's bug fix the task title |
302
+ | `bad_subprefix` on `impl:*` | Missing `be-` / `fe-` / `rework-` / `contract-update-` sub-prefix | Re-emit with correct prefix |
303
+ | `INVALID_WAVE_REFERENCE` on a new task | Wave metadata missing or not in `<plan-phase>.<wave>` / `<plan-phase>.rework` / `qc-rework` shape | Fix the wave metadata before re-creating |
304
+ | `MISSING_STATIC_CHECKS` on task complete | `.team-superpower/static-check-<task-id>.log` missing or has a non-zero `exit=` line | Implementer re-runs lint/typecheck/format, captures log, re-commits |
305
+ | `MISSING_REWORK_REFERENCE` on task complete | `impl:rework-*` commit body missing `Reworks: <orig-id>` line | Implementer amends the commit body and re-completes |
306
+ | `MIGRATION_RACE` on task complete | Two migration tasks were `in_progress` simultaneously | Lead should serialize migrations |
307
+ | `EMPTY_CONTRACT_PUBLISH` on task complete | A contract-publish task completed but no commit touched a contract file | Backend-developer didn't actually publish; investigate and re-run |
308
+ | `ARCH_BLOCKED` or `SEC_BLOCKED` from phase A | Pre-impl gate rejected the plan | Planner addresses the report, re-emits, re-runs the gate |
309
+ | Hook log noise | Hooks write tuning data to `.claude/hooks/log.jsonl` | Inspect; trim or refine matchers |
248
310
 
249
311
  ## Emergency bypass
250
312
 
251
- `--dangerously-skip-permissions` will let a single task ship without the hooks firing. **Don't.** The hooks exist because Superpowers gates exist. Use the escalation template to surface the blocker properly.
313
+ `--dangerously-skip-permissions` will let a single task ship without the hooks
314
+ firing. **Don't.** The hooks exist because Superpowers gates exist. Use the
315
+ escalation template to surface the blocker properly.
252
316
 
253
317
  ## Where the methodology lives
254
318
 
255
- The team-superpower plugin is purely the coordination layer. The actual development discipline (TDD, plan format, two-stage review, branch hygiene) is owned by the upstream [obra/superpowers](https://github.com/obra/superpowers) skills. If a skill's behaviour changes, the team picks it up automatically — agents reference skills by name, not by content.
319
+ The team-superpower plugin is purely the coordination layer. The actual
320
+ development discipline (TDD, plan format, two-stage review, branch hygiene) is
321
+ owned by the upstream [obra/superpowers](https://github.com/obra/superpowers)
322
+ skills. If a skill's behaviour changes, the team picks it up automatically —
323
+ agents reference skills by name, not by content.
256
324
 
257
325
  ## Session checkpoint § Assumptions
258
326
 
259
- Every non-owner decision (tactical, cross-role with consensus, architectural with sign-off) is logged as one line in the session checkpoint's `## Assumptions` block. The QA and reviewer phases scan this block for contradictions with the design / plan; contradictions surface as QA findings or review comments. Format:
327
+ Every non-owner decision (tactical, cross-role with consensus, architectural
328
+ with sign-off) is logged as one line in the session checkpoint's
329
+ `## Assumptions` block. The qc-engineer scans this block at end-of-plan for
330
+ contradictions with the spec / plan; contradictions surface as QC findings.
331
+ Format:
260
332
 
261
333
  ```
262
334
  - <ISO ts> <role> [class=<tactical|cross-role|architectural>]: <one-line decision> (peer: <role|none>, evidence: <link to mailbox msg | n/a>)
263
335
  ```
264
336
 
265
- The owner sees the assumptions log at every phase boundary as part of the checkpoint commit.
337
+ The owner sees the assumptions log at every phase boundary as part of the
338
+ checkpoint commit.