@drunkcoding/agents-and-skills 0.0.18 → 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/README.md +23 -0
- 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 +161 -39
- package/plugins/team-superpower/agents/feature-planner.md +66 -0
- package/plugins/team-superpower/agents/frontend-developer.md +163 -34
- 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 +90 -40
- 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/AGENTS.md.template +23 -0
- package/plugins/team-superpower/assets/CLAUDE.md.template +25 -4
- package/plugins/team-superpower/assets/ESCALATION.md +114 -66
- package/plugins/team-superpower/assets/SESSION_README.md +233 -113
- package/plugins/team-superpower/commands/team-feature.md +195 -443
- package/plugins/team-superpower/hooks/task-completed.sh +180 -59
- package/plugins/team-superpower/hooks/task-created.sh +77 -19
- package/plugins/team-superpower/hooks/teammate-idle.sh +118 -13
- package/plugins/team-superpower/scripts/assess-complexity.sh +194 -0
- package/plugins/team-superpower/scripts/detect-stack.sh +39 -0
- package/plugins/team-superpower/scripts/team-state.sh +106 -37
- package/plugins/team-superpower/scripts/wave-collision-check.sh +60 -0
- package/plugins/tech-graph/.claude-plugin/plugin.json +1 -1
- package/plugins/html-effectiveness/tests/_tmp.test.js +0 -58
- package/plugins/html-effectiveness/tests/fixtures/01-exploration-code-approaches.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/02-exploration-visual-designs.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/03-code-review-pr.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/04-code-understanding.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/05-design-system.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/06-component-variants.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/07-prototype-animation.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/08-prototype-interaction.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/09-slide-deck.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/10-svg-illustrations.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/11-status-report.data.json +0 -37
- package/plugins/html-effectiveness/tests/fixtures/12-incident-report.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/13-flowchart-diagram.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/14-research-feature-explainer.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/15-research-concept-explainer.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/16-implementation-plan.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/17-pr-writeup.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/18-editor-triage-board.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/19-editor-feature-flags.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/20-editor-prompt-tuner.data.json +0 -3
- package/plugins/html-effectiveness/tests/fixtures/_canned.data.json +0 -7
- package/plugins/html-effectiveness/tests/fixtures/_canned.html.tmpl +0 -7
- package/plugins/html-effectiveness/tests/fixtures/_canned.manifest.json +0 -18
- package/plugins/html-effectiveness/tests/manifest.test.js +0 -61
- package/plugins/html-effectiveness/tests/mustache.test.js +0 -47
- package/plugins/html-effectiveness/tests/render.test.js +0 -118
- package/plugins/team-superpower/agents/designer.md +0 -50
- package/plugins/team-superpower/agents/planner.md +0 -186
- package/plugins/team-superpower/agents/qa-engineer.md +0 -47
- package/plugins/team-superpower/agents/reviewer.md +0 -110
- package/plugins/team-superpower/agents/software-architect.md +0 -45
- package/plugins/team-superpower/commands/team-feature-resume.md +0 -185
|
@@ -1,565 +1,317 @@
|
|
|
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
|
|
|
14
14
|
$ARGUMENTS
|
|
15
15
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
You are a **conductor**, not an implementer. Spawn teammates and coordinate them through the canonical Superpowers skill chain. Do not run skills yourself — delegate every skill to the correct teammate. The team-superpower agent definitions (`designer`, `planner`, `software-architect`, `security-engineer`, `backend-developer`, `frontend-developer`, `qa-engineer`, `reviewer`) shipped with this plugin tell each teammate exactly which Superpowers skill to run.
|
|
19
|
-
|
|
20
|
-
## Required prechecks (run these first, in order)
|
|
21
|
-
|
|
22
|
-
0. **Lead-model self-attestation.** Before doing anything else, state which model you (the lead) are currently running on. If you are not running on Opus, halt and instruct the owner: "Lead must be on Opus. Relaunch this session with `claude --model opus` (or pick Opus in the model switcher) and rerun `/team-feature`." Teammates are pinned to Sonnet via their agent frontmatter; only the lead model is set by the session.
|
|
23
|
-
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.
|
|
24
|
-
2. Confirm Claude Code version is `2.1.32` or later: `claude --version`. If older, halt.
|
|
25
|
-
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`.
|
|
26
|
-
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.
|
|
27
|
-
5. Create directories if missing: `docs/superpowers/{sessions,specs,plans,reviews}`.
|
|
28
|
-
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.
|
|
29
|
-
|
|
30
|
-
## Phase 0 — Stack detection, version pinning, shape decision
|
|
31
|
-
|
|
32
|
-
This phase runs **after** preflight clears (see the next section) and **before** spawning any teammate. It decides which teammates to spawn and pins the Superpowers version so a mid-feature skill update can't corrupt recovery.
|
|
33
|
-
|
|
34
|
-
### 0.1 — Read CLAUDE.md, or detect
|
|
35
|
-
|
|
36
|
-
1. Check whether `CLAUDE.md` exists at the repo root AND contains a fenced `team-superpower` block:
|
|
37
|
-
```bash
|
|
38
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/parse-claudemd.sh extract CLAUDE.md
|
|
39
|
-
```
|
|
40
|
-
- Exit 0: a block was extracted. Parse it. Skip to 0.2.
|
|
41
|
-
- Exit 1 (file missing or no block): run detection.
|
|
42
|
-
|
|
43
|
-
2. Run detection:
|
|
44
|
-
```bash
|
|
45
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/detect-stack.sh "$PWD" > /tmp/team-superpower-detected.yaml
|
|
46
|
-
```
|
|
47
|
-
- 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.**
|
|
48
|
-
- 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."
|
|
49
|
-
- 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.
|
|
16
|
+
## Parsing the launch flags
|
|
50
17
|
|
|
51
|
-
|
|
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:
|
|
52
19
|
|
|
53
|
-
|
|
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.
|
|
54
23
|
|
|
55
|
-
|
|
56
|
-
shape="$(bash ${CLAUDE_PLUGIN_ROOT}/scripts/parse-claudemd.sh shape CLAUDE.md)"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
`$shape` is one of `full-stack` | `be-only` | `fe-only` | `none`. If `none` (the block has `backend: none` AND `frontend: none`), halt and escalate — that combination is non-sensical.
|
|
60
|
-
|
|
61
|
-
### 0.3 — Cross-validate: claimed stack vs. filesystem
|
|
62
|
-
|
|
63
|
-
For every claimed component, verify at least one corresponding source file exists. Example checks:
|
|
64
|
-
|
|
65
|
-
- `backend.language: csharp` → at least one `*.csproj` or `*.sln` exists.
|
|
66
|
-
- `backend.language: node-ts` → `package.json` exists and declares a server dep (`express`, `fastify`, `koa`, `@nestjs/core`, etc.).
|
|
67
|
-
- `frontend.framework: react` → `package.json` declares `react`.
|
|
68
|
-
- `contracts.source_of_truth: openapi` → an OpenAPI file exists at `contracts.openapi_path` if specified.
|
|
69
|
-
|
|
70
|
-
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.
|
|
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:`.
|
|
71
25
|
|
|
72
|
-
|
|
26
|
+
## Your job
|
|
73
27
|
|
|
74
|
-
|
|
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.
|
|
75
29
|
|
|
76
|
-
|
|
77
|
-
mkdir -p docs/superpowers/sessions
|
|
78
|
-
echo "$shape" > docs/superpowers/sessions/<slug>.shape
|
|
79
|
-
git add docs/superpowers/sessions/<slug>.shape
|
|
80
|
-
```
|
|
30
|
+
## Required prechecks (run these first, in order)
|
|
81
31
|
|
|
82
|
-
|
|
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.
|
|
83
39
|
|
|
84
|
-
|
|
40
|
+
## Lead behavior (v5 — single-team lifecycle)
|
|
85
41
|
|
|
86
|
-
|
|
87
|
-
|---------------|--------------------|
|
|
88
|
-
| `full-stack` | designer, planner, software-architect, security-engineer, backend-developer, frontend-developer, qa-engineer, reviewer (**8 total**) |
|
|
89
|
-
| `be-only` | designer, planner, software-architect, security-engineer, backend-developer, qa-engineer, reviewer (**7 total**) |
|
|
90
|
-
| `fe-only` | designer, planner, software-architect, security-engineer, frontend-developer, qa-engineer, reviewer (**7 total**) |
|
|
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:`.
|
|
91
43
|
|
|
92
|
-
|
|
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.
|
|
93
45
|
|
|
94
|
-
|
|
46
|
+
In team mode the orchestrator runs the single-team lifecycle (spec §3.1):
|
|
95
47
|
|
|
96
|
-
|
|
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.
|
|
97
59
|
|
|
98
|
-
|
|
60
|
+
There is **no architect standby**. Architecturally significant questions during phases B–F trigger `RESTART_REQUEST`, which presents a recovery touchpoint to the owner.
|
|
99
61
|
|
|
100
|
-
|
|
62
|
+
## Auto-resume detection (orchestrator runs before mode pick)
|
|
101
63
|
|
|
102
|
-
|
|
103
|
-
superpowers_version: <e.g. 5.0.7>
|
|
104
|
-
plugin_version: <team-superpower plugin version>
|
|
105
|
-
claude_code_version: <e.g. 2.1.32>
|
|
106
|
-
stack_shape: full-stack | be-only | fe-only
|
|
107
|
-
```
|
|
64
|
+
On invocation, before picking mode, scan for in-progress features:
|
|
108
65
|
|
|
109
|
-
|
|
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.
|
|
110
71
|
|
|
111
|
-
|
|
72
|
+
If any candidate matches, present:
|
|
112
73
|
|
|
113
|
-
```bash
|
|
114
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh scan
|
|
115
74
|
```
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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)
|
|
121
84
|
```
|
|
122
85
|
|
|
123
|
-
|
|
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"`.
|
|
124
91
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
| Team config exists for `<slug>` and `liveness: stale` or `unknown` | Tell the owner: "Stale state from a previous run detected." Offer two paths: **(a) Resume** via `/team-feature-resume YYYY-MM-DD-<slug>.md`, or **(b) Cleanup and restart** via `/team-cleanup <slug>` then re-run `/team-feature`. Halt — do NOT auto-decide. |
|
|
130
|
-
| Other slugs have configs but not this one | Note in the checkpoint that other in-flight runs exist; proceed with this slug. |
|
|
131
|
-
|
|
132
|
-
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.
|
|
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.
|
|
133
96
|
|
|
134
|
-
|
|
97
|
+
If multiple candidates: list all, owner picks one or `[0] start fresh`.
|
|
98
|
+
If none: skip to mode pick.
|
|
135
99
|
|
|
136
|
-
|
|
100
|
+
## Modes
|
|
137
101
|
|
|
138
|
-
|
|
139
|
-
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.
|
|
140
|
-
3. Ensure `docs/superpowers/sessions/<slug>.shape` was written in phase 0.4 and is committed.
|
|
141
|
-
4. Write checkpoint updates atomically: write to `<file>.tmp` then `mv -f <file>.tmp <file>`. Half-written checkpoints corrupt recovery.
|
|
102
|
+
### Solo mode (1 touchpoint)
|
|
142
103
|
|
|
143
|
-
|
|
104
|
+
For bug fix, typo, rename, version bump, single-file/≤10-line diff.
|
|
144
105
|
|
|
145
|
-
|
|
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.
|
|
146
107
|
|
|
147
|
-
|
|
108
|
+
### Single-agent mode (1 touchpoint)
|
|
148
109
|
|
|
149
|
-
|
|
150
|
-
TeamCreate({
|
|
151
|
-
team_name: "superpower-<slug>",
|
|
152
|
-
agent_type: "team-lead",
|
|
153
|
-
description: "<one-line owner request, ≤120 chars>"
|
|
154
|
-
})
|
|
155
|
-
```
|
|
110
|
+
For small enhancement, 1–3 files, no architecture impact.
|
|
156
111
|
|
|
157
|
-
|
|
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.
|
|
158
113
|
|
|
159
|
-
|
|
160
|
-
~/.claude/teams/superpower-<slug>/
|
|
161
|
-
├── config.json ← team configuration & members (lead-managed)
|
|
162
|
-
└── inboxes/
|
|
163
|
-
├── team-lead.json ← your inbox (auto-populated as teammates SendMessage you)
|
|
164
|
-
├── designer.json ← created when the designer teammate is spawned
|
|
165
|
-
├── planner.json ← created when the planner is spawned
|
|
166
|
-
└── ... ← one file per teammate name (= the agent's role)
|
|
167
|
-
|
|
168
|
-
~/.claude/tasks/superpower-<slug>/
|
|
169
|
-
└── ... ← shared task list (TaskCreate / TaskUpdate)
|
|
170
|
-
```
|
|
114
|
+
### Team mode (2 touchpoints + finish)
|
|
171
115
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
```json
|
|
175
|
-
{
|
|
176
|
-
"from": "<sender role name>",
|
|
177
|
-
"text": "<message body>",
|
|
178
|
-
"summary": "<5-10 word preview>",
|
|
179
|
-
"timestamp": "<ISO 8601 UTC>",
|
|
180
|
-
"read": false,
|
|
181
|
-
"color": "<UI hint>"
|
|
182
|
-
}
|
|
183
|
-
```
|
|
116
|
+
For feature work spanning ≥2 modules or ≥4 files, or introducing a new component.
|
|
184
117
|
|
|
185
|
-
|
|
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).
|
|
186
119
|
|
|
187
|
-
|
|
120
|
+
#### Heuristic ladder (when `--mode` is not set)
|
|
188
121
|
|
|
189
|
-
|
|
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**.
|
|
190
125
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
team_name: "superpower-<slug>",
|
|
195
|
-
name: "<role>", // e.g. "designer"; becomes the inbox filename (designer.json) and the SendMessage `to` value
|
|
196
|
-
prompt: "<filled Spawn prompt template, see below>"
|
|
197
|
-
})
|
|
198
|
-
```
|
|
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.
|
|
199
129
|
|
|
200
|
-
|
|
130
|
+
#### Team size (team mode only)
|
|
201
131
|
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
- 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.
|
|
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).
|
|
206
135
|
|
|
207
|
-
##
|
|
136
|
+
## SPAWN_REQUEST handling (orchestrator behavior)
|
|
208
137
|
|
|
209
|
-
|
|
138
|
+
When team-leader posts:
|
|
210
139
|
|
|
211
140
|
```
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
Resume: <yes | no> (yes when spawned by /team-feature-resume; pick up at the next pending task)
|
|
217
|
-
|
|
218
|
-
Read first:
|
|
219
|
-
- CLAUDE.md (free-form prose AND the `team-superpower` block)
|
|
220
|
-
- Your role brief: <relative path to plugins/team-superpower/agents/<role>.md>
|
|
221
|
-
- <role-relevant artefact paths — list them all; e.g. design doc, plan, ARCH/SEC reports, QA report>
|
|
222
|
-
|
|
223
|
-
Open escalations:
|
|
224
|
-
<one-line summary per open escalation in the checkpoint, or "(none)">
|
|
225
|
-
|
|
226
|
-
Your task: <one sentence describing the specific phase work the role is being spawned for>
|
|
227
|
-
Mailbox signal expected back: <e.g. DESIGN_APPROVED <path>, PLAN_READY <path>, ARCH_PASSED <path>, BE_DONE <task-id>, etc.>
|
|
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>, ...]
|
|
228
145
|
```
|
|
229
146
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
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.
|
|
235
|
-
|
|
236
|
-
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.
|
|
237
|
-
|
|
238
|
-
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.
|
|
239
|
-
|
|
240
|
-
4. **Implementation (shape-adaptive, parallel where allowed).** Read the approved plan. Create one shared-task-list entry per plan task with the planner's assigned title (`impl:be-*`, `impl:fe-*`, `impl:be-migration-*`, `impl:be-contract-publish-*`), body = full task text including verification, and `depends_on` + `files` + `tests` + `estimated_minutes` + `plan_approved_at` metadata from the plan.
|
|
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:
|
|
241
151
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
- `fe-only`: spawn one `frontend-developer` only. Do NOT spawn `backend-developer`.
|
|
246
|
-
|
|
247
|
-
**Contract publish (full-stack only).** If the planner emitted `impl:be-contract-publish-<slug>` as the first task, the backend-developer claims it first. Do NOT release any `impl:fe-*` task to the frontend-developer until you see `CONTRACT_PUBLISHED <task-id>` in your mailbox. The plan tasks already encode `depends_on: [impl:be-contract-publish-<slug>]` on every FE task, but you enforce the gate at the assignment level too.
|
|
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
|
+
```
|
|
248
155
|
|
|
249
|
-
|
|
156
|
+
4. Replies to team-leader: `SPAWN_DONE wave=<plan-phase>.<wave> agent_ids=[...]`.
|
|
250
157
|
|
|
251
|
-
|
|
158
|
+
Concurrency cap: orchestrator refuses to spawn beyond `limits.max_concurrent_teammates` (default 5). Excess spawns are queued; reply notes `queued: <ids>`.
|
|
252
159
|
|
|
253
|
-
|
|
160
|
+
## RESTART_REQUEST handling (orchestrator behavior)
|
|
254
161
|
|
|
255
|
-
|
|
162
|
+
When team-leader (or qc-engineer) posts `RESTART_REQUEST <reason>`:
|
|
256
163
|
|
|
257
|
-
|
|
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:
|
|
258
166
|
|
|
259
|
-
|
|
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
|
+
```
|
|
260
178
|
|
|
261
|
-
|
|
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.
|
|
262
180
|
|
|
263
|
-
|
|
181
|
+
Recovery touchpoints from RESTART_REQUEST do **not** count against the 3-touchpoint budget.
|
|
264
182
|
|
|
265
|
-
## Phase
|
|
183
|
+
## Phase H — finish-branch and CI gate
|
|
266
184
|
|
|
267
|
-
|
|
185
|
+
After QC pass, team-leader drives the finish-branch decision:
|
|
268
186
|
|
|
269
|
-
|
|
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.
|
|
270
190
|
|
|
271
191
|
### CI-specific menus
|
|
272
192
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
> - **A. Re-poll** — wait another `ci.poll_timeout_minutes` for CI to finish.
|
|
279
|
-
> - **B. Switch to pr_opened** — open a PR; the owner deals with CI on the PR side.
|
|
280
|
-
> - **E. Escalate** — §7 escalation, full reviewer status appended.
|
|
281
|
-
|
|
282
|
-
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.
|
|
283
|
-
|
|
284
|
-
1. Read the mailbox message. Stash `<reason>` and the verbatim git stderr.
|
|
285
|
-
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).
|
|
286
|
-
3. Touch the heartbeat.
|
|
287
|
-
4. Present the 5-option menu below to the owner.
|
|
288
|
-
5. Translate the owner's choice into the next instruction to the reviewer per the table.
|
|
193
|
+
| CI state | Menu |
|
|
194
|
+
|---|---|
|
|
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` |
|
|
289
198
|
|
|
290
199
|
### 5-option merge-failure menu
|
|
291
200
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
> **Merge failed:** `<reason>`. Pick one:
|
|
295
|
-
> - **A. Retry merge** — re-attempt the merge now (you've resolved conflicts externally or upstream has stabilised).
|
|
296
|
-
> - **B. Switch to pr_opened** — open a PR for human merge instead.
|
|
297
|
-
> - **C. Switch to kept** — keep the worktree as-is, you'll handle the merge later.
|
|
298
|
-
> - **D. Switch to discarded** — drop the branch entirely.
|
|
299
|
-
> - **E. Escalate** — pause and surface a §7 escalation with full git output.
|
|
300
|
-
|
|
301
|
-
Translation:
|
|
201
|
+
If merge fails (`conflict` / `non-ff` / `dirty-worktree` / `push-rejected`):
|
|
302
202
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
### Retry cap
|
|
312
|
-
|
|
313
|
-
`merge_retries` is bounded at 3. Before presenting the menu, check the current value:
|
|
314
|
-
|
|
315
|
-
- `merge_retries < 3` → present all five options.
|
|
316
|
-
- `merge_retries == 3` → drop option A. The menu shows B/C/D/E only.
|
|
317
|
-
|
|
318
|
-
The counter is persisted in the checkpoint so `/team-feature-resume` honours it across sessions.
|
|
319
|
-
|
|
320
|
-
### Flow rejoin
|
|
203
|
+
```
|
|
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
|
|
210
|
+
```
|
|
321
211
|
|
|
322
|
-
|
|
212
|
+
Retry cap: 3. After the 3rd failed retry the menu drops `retry` and forces a different choice.
|
|
323
213
|
|
|
324
214
|
## Automatic cleanup (runs after `FINISH_DONE`)
|
|
325
215
|
|
|
326
|
-
|
|
216
|
+
Orchestrator runs cleanup immediately after `FINISH_DONE`:
|
|
327
217
|
|
|
328
218
|
### Step A — Verify safety preconditions
|
|
329
219
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
- Every
|
|
333
|
-
-
|
|
334
|
-
- Phase 7 returned a recognised decision: `merged`, `pr_opened`, `kept`, or `discarded`.
|
|
335
|
-
- The expected git commits exist on the worktree branch. Run `git log --oneline -30` and confirm:
|
|
336
|
-
- A design doc commit under `docs/superpowers/specs/`
|
|
337
|
-
- A plan commit under `docs/superpowers/plans/`
|
|
338
|
-
- An ARCH report commit AND a SEC report commit under `docs/superpowers/reviews/` (phase-3 gate)
|
|
339
|
-
- 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)
|
|
340
|
-
- A QA report commit under `docs/superpowers/reviews/` (phase-5 gate)
|
|
341
|
-
- A code-review report commit under `docs/superpowers/reviews/`
|
|
342
|
-
- 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.
|
|
343
224
|
|
|
344
|
-
If any
|
|
225
|
+
If any precondition fails, halt with the failed item and leave platform state intact for `/team-cleanup`.
|
|
345
226
|
|
|
346
227
|
### Step B — Shut down teammates gracefully
|
|
347
228
|
|
|
348
|
-
For each
|
|
349
|
-
|
|
350
|
-
1. Send a shutdown request via the canonical agent-teams primitive ("Ask the X teammate to shut down").
|
|
351
|
-
2. Wait for graceful exit.
|
|
352
|
-
3. If a teammate rejects shutdown, surface the rejection reason to the owner via the §7 template and halt cleanup.
|
|
353
|
-
|
|
354
|
-
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.
|
|
355
230
|
|
|
356
231
|
### Step C — Run the canonical team cleanup
|
|
357
232
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh scan <slug>
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Expected after the runtime cleanup:
|
|
365
|
-
|
|
366
|
-
- `team_config_state: absent`
|
|
367
|
-
- `task_list_state: absent`
|
|
368
|
-
- `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>/`).
|
|
369
234
|
|
|
370
235
|
### Step D — Manual sweep (only if Step C left residue)
|
|
371
236
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
```bash
|
|
375
|
-
bash ${CLAUDE_PLUGIN_ROOT}/scripts/team-state.sh cleanup <slug> --force
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
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`.
|
|
379
238
|
|
|
380
239
|
### Step D.5 — Worktree removal (on successful merge only)
|
|
381
240
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
**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).
|
|
385
242
|
|
|
386
|
-
|
|
387
|
-
2. Step A precondition check passed.
|
|
388
|
-
3. Step B teammate shutdown was clean.
|
|
389
|
-
4. The post-Step-C (or post-Step-D) scan shows `team_config_state: absent`, `task_list_state: absent`, `tmux_state: absent`.
|
|
390
|
-
5. The checkpoint has a non-empty `**Worktree:**` field.
|
|
391
|
-
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.
|
|
392
|
-
|
|
393
|
-
If any condition fails, record `worktree: removal-skipped:<reason>` in the Closing block (Step E) where `<reason>` is one of:
|
|
394
|
-
|
|
395
|
-
- `not-merged-decision` — finish decision was `pr_opened`, `kept`, or `discarded`.
|
|
396
|
-
- `team-cleanup-incomplete` — Step C/D left platform state present.
|
|
397
|
-
- `no-worktree-recorded` — checkpoint has no `**Worktree:**` line.
|
|
398
|
-
- `reused-existing-worktree` — `**Worktree origin:** reused`; the owner pre-existed the worktree and keeps it.
|
|
399
|
-
|
|
400
|
-
**Procedure** (only when all trigger conditions pass):
|
|
401
|
-
|
|
402
|
-
1. Read the worktree path from the checkpoint's `**Worktree:**` line. Call it `WT_PATH`.
|
|
403
|
-
2. `cd` to the repo root (the **main** worktree, NOT `WT_PATH`). `git worktree remove` refuses when the current directory is inside the target.
|
|
404
|
-
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.
|
|
405
|
-
4. Touch the heartbeat.
|
|
406
|
-
5. Run `git worktree remove "$WT_PATH"` (non-forced).
|
|
407
|
-
6. On success → record `worktree: removed` in the Closing block. Touch heartbeat. Proceed to Step E.
|
|
408
|
-
7. On non-zero exit → enter the **4-option remove-failure menu** below.
|
|
409
|
-
|
|
410
|
-
**Branch handling:** `git worktree remove` does NOT delete the branch. The feature branch survives this step. Branch deletion is left to the owner.
|
|
411
|
-
|
|
412
|
-
### 4-option remove-failure menu
|
|
413
|
-
|
|
414
|
-
Triggered when `git worktree remove "$WT_PATH"` exits non-zero. Common causes: untracked files, locked worktree, in-progress git operation, owner pre-seeded files.
|
|
415
|
-
|
|
416
|
-
Present verbatim:
|
|
417
|
-
|
|
418
|
-
> **Could not remove worktree** `<WT_PATH>`. Git said: `<stderr>`. Pick one:
|
|
419
|
-
> - **A. Show files + retry** — list what's blocking, then retry the remove.
|
|
420
|
-
> - **B. Force remove** — discard uncommitted work in `<WT_PATH>` and remove. (Confirmation required.)
|
|
421
|
-
> - **C. Keep worktree** — leave it on disk; you'll remove it manually later.
|
|
422
|
-
> - **D. Escalate** — pause and surface a §7 escalation with the verbatim stderr.
|
|
423
|
-
|
|
424
|
-
Translation:
|
|
425
|
-
|
|
426
|
-
| Choice | Action | Closing-block record |
|
|
427
|
-
|---|---|---|
|
|
428
|
-
| **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. |
|
|
429
|
-
| **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>, ...]` |
|
|
430
|
-
| **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>` |
|
|
431
|
-
| **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>` |
|
|
432
|
-
|
|
433
|
-
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`.
|
|
434
244
|
|
|
435
245
|
### Step E — Final checkpoint commit
|
|
436
246
|
|
|
437
|
-
Append
|
|
438
|
-
|
|
439
|
-
```markdown
|
|
440
|
-
## Closing
|
|
441
|
-
- finished at: <ISO datetime>
|
|
442
|
-
- decision: <merged|pr_opened|kept|discarded>
|
|
443
|
-
- cleanup: complete
|
|
444
|
-
- worktree: <removed | already-absent | removal-skipped:<reason> | removed (after manual fix) | force-removed | kept-by-owner | escalated>
|
|
445
|
-
- 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)
|
|
446
|
-
- merge_retries: K # only when K > 0; matches the final value of the mid-phase counter
|
|
447
|
-
- dropped_files: [<path>, ...] # only when state == force-removed
|
|
448
|
-
```
|
|
247
|
+
Append `## Closing` block to the checkpoint:
|
|
449
248
|
|
|
450
|
-
|
|
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
|
+
```
|
|
451
258
|
|
|
452
|
-
|
|
259
|
+
Commit the checkpoint.
|
|
453
260
|
|
|
454
261
|
### Step F — If anything failed
|
|
455
262
|
|
|
456
|
-
|
|
263
|
+
Halt with the failure mode. The owner runs `/team-cleanup <slug>` from a fresh session.
|
|
457
264
|
|
|
458
265
|
## Within-phase stall watchdog
|
|
459
266
|
|
|
460
|
-
|
|
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.
|
|
461
268
|
|
|
462
|
-
|
|
463
|
-
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):
|
|
464
|
-
- Send a ping to the teammate's mailbox: `STATUS_CHECK <slug> — no activity for <N> minutes; reply with current status or progress note.`
|
|
465
|
-
- Start a second watchdog window of the same length.
|
|
466
|
-
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.
|
|
269
|
+
## Owner touchpoints (the ONLY allowed pings to the owner)
|
|
467
270
|
|
|
468
|
-
|
|
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).
|
|
469
275
|
|
|
470
|
-
|
|
276
|
+
Single-agent mode (1):
|
|
277
|
+
1. **Combined spec + plan approval**.
|
|
471
278
|
|
|
472
|
-
|
|
279
|
+
Solo mode (1):
|
|
280
|
+
1. **Diff preview + verification step**.
|
|
473
281
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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.
|
|
477
287
|
|
|
478
|
-
|
|
288
|
+
Anything else that reaches the owner MUST use the §7 escalation template in `assets/ESCALATION.md`.
|
|
479
289
|
|
|
480
290
|
## Checkpointing
|
|
481
291
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
```markdown
|
|
485
|
-
---
|
|
486
|
-
slug: <slug>
|
|
487
|
-
started: <ISO datetime>
|
|
488
|
-
superpowers_version: <e.g. 5.0.7>
|
|
489
|
-
plugin_version: <team-superpower plugin version>
|
|
490
|
-
claude_code_version: <e.g. 2.1.32>
|
|
491
|
-
stack_shape: full-stack | be-only | fe-only
|
|
492
|
-
---
|
|
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`.
|
|
493
293
|
|
|
494
|
-
|
|
495
|
-
**Started:** <ISO datetime>
|
|
496
|
-
**Last update:** <ISO datetime>
|
|
497
|
-
**Team:** superpower-<slug>
|
|
498
|
-
**Worktree:** <path>
|
|
499
|
-
**Worktree origin:** created | reused # `reused` means the owner launched `/team-feature` from inside a linked worktree; Step D.5 skips removal in that case
|
|
500
|
-
|
|
501
|
-
## Phases
|
|
502
|
-
- [x] design → docs/superpowers/specs/YYYY-MM-DD-<slug>-design.md
|
|
503
|
-
- [x] worktree → <branch>
|
|
504
|
-
- [x] plan → docs/superpowers/plans/YYYY-MM-DD-<slug>-plan.md (approved <datetime>)
|
|
505
|
-
- [x] pre_impl_review → arch + sec PASSED
|
|
506
|
-
- [ ] implementation (M/N tasks complete)
|
|
507
|
-
- [ ] qa
|
|
508
|
-
- [ ] review
|
|
509
|
-
- [ ] 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.
|
|
510
|
-
|
|
511
|
-
## Teammates
|
|
512
|
-
(list reflects stack_shape — omit the implementer that doesn't exist for be-only / fe-only)
|
|
513
|
-
- designer (agent-id: ...) — idle
|
|
514
|
-
- planner (agent-id: ...) — idle
|
|
515
|
-
- software-architect (agent-id: ...) — idle
|
|
516
|
-
- security-engineer (agent-id: ...) — idle
|
|
517
|
-
- backend-developer (agent-id: ...) — active on task impl:be-<name> # full-stack | be-only
|
|
518
|
-
- frontend-developer (agent-id: ...) — idle # full-stack | fe-only
|
|
519
|
-
- qa-engineer (agent-id: ...) — idle
|
|
520
|
-
- reviewer (agent-id: ...) — idle
|
|
294
|
+
Body sections:
|
|
521
295
|
|
|
296
|
+
```
|
|
297
|
+
## Phases — checklist with file paths to artefacts
|
|
298
|
+
## Teammates — role / agent id / current task or idle
|
|
522
299
|
## Open escalations
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
##
|
|
526
|
-
(appended after each phase; one entry per non-owner decision)
|
|
527
|
-
- <ISO ts> <role> [class=<tactical|cross-role|architectural>]: <one-line decision> (peer: <role|none>, evidence: <link to mailbox msg | n/a>)
|
|
528
|
-
|
|
529
|
-
## Resume protocol
|
|
530
|
-
1. Owner runs /team-feature-resume with this filename.
|
|
531
|
-
2. Lead respawns teammates using same role definitions.
|
|
532
|
-
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
|
|
533
303
|
```
|
|
534
304
|
|
|
305
|
+
The orchestrator commits this file after every phase transition. If the orchestrator crashes, the feature lives in this file.
|
|
306
|
+
|
|
535
307
|
## Hard rules
|
|
536
308
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
- **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.
|
|
547
|
-
- **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`.
|
|
548
|
-
- **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.
|
|
549
|
-
- **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.
|
|
550
|
-
|
|
551
|
-
## Hard rules (v2 additions)
|
|
552
|
-
|
|
553
|
-
- **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.
|
|
554
|
-
- **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.
|
|
555
|
-
- **Never** release an `impl:fe-*` task before `CONTRACT_PUBLISHED` arrives (full-stack with `contracts.source_of_truth != none`).
|
|
556
|
-
- **Never** release a second `impl:be-migration-*` task while one is `in_progress`. The hook is a backstop; you are the primary control.
|
|
557
|
-
- **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).
|
|
558
|
-
- **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.
|
|
559
|
-
- **Never** improvise a spawn prompt. Use the **Spawn prompt template** verbatim — leave fields as `n/a` rather than omitting them.
|
|
560
|
-
- **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.
|
|
561
|
-
- **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.
|
|
562
|
-
- **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.
|
|
563
|
-
- **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.
|
|
564
|
-
|
|
565
|
-
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.
|