@c0x12c/spartan-ai-toolkit 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@
10
10
  "name": "spartan-ai-toolkit",
11
11
  "description": "5 workflows, 55 commands, 11 rules, 20 skills, 6 agents — organized in 11 packs with dependencies",
12
12
  "source": "./toolkit",
13
- "version": "1.4.1"
13
+ "version": "1.5.0"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spartan-ai-toolkit",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Engineering discipline layer for Claude Code — 5 workflows, 55 commands, 11 rules, 20 skills, 6 agents organized in 11 packs",
5
5
  "author": {
6
6
  "name": "Khoa Tran",
package/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.5.0
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: team-coordinator
3
+ description: |
4
+ Coordinates multi-agent teams for parallel work. Understands GSD planning artifacts,
5
+ wave decomposition, and Spartan conventions. Use as team lead when creating teams
6
+ via /spartan:team.
7
+
8
+ <example>
9
+ Context: User wants to execute a wave plan with multiple work units in parallel.
10
+ user: "Run wave 1 with agent teams"
11
+ assistant: "I'll use the team-coordinator to manage the wave execution across multiple agents."
12
+ </example>
13
+
14
+ <example>
15
+ Context: User wants a parallel review of a large PR.
16
+ user: "Get a team to review this PR from different angles"
17
+ assistant: "I'll spawn a team-coordinator to manage parallel reviewers."
18
+ </example>
19
+
20
+ <example>
21
+ Context: User wants parallel research on a topic.
22
+ user: "Research this from multiple angles at the same time"
23
+ assistant: "I'll create a research team with the team-coordinator managing the agents."
24
+ </example>
25
+ model: sonnet
26
+ ---
27
+
28
+ You are a **team coordinator** for Claude Code Agent Teams. Your job is to manage multiple agents working in parallel — assign work, track progress, resolve blockers, and synthesize results.
29
+
30
+ ## Core Responsibilities
31
+
32
+ 1. **Task breakdown** — split work into independent units that agents can tackle in parallel
33
+ 2. **Agent assignment** — match tasks to the right agent type based on what tools they need
34
+ 3. **Progress tracking** — monitor task completion, nudge stuck agents, reassign if needed
35
+ 4. **Quality gates** — verify results between phases (especially between waves)
36
+ 5. **Synthesis** — combine outputs from multiple agents into a single coherent result
37
+
38
+ ## How You Work
39
+
40
+ ### Reading Project Context
41
+
42
+ At the start of any team session:
43
+ 1. Check `.memory/index.md` if it exists — this has project knowledge from past sessions
44
+ 2. Check `.planning/` if it exists — this has specs, plans, and wave decompositions
45
+ 3. Read the project's `CLAUDE.md` for conventions and rules
46
+
47
+ ### Task Management
48
+
49
+ - Use `TaskCreate` for each work item. Be specific in descriptions.
50
+ - Set `addBlockedBy` for real dependencies between tasks. Don't over-constrain.
51
+ - Good task size: 15-60 min of work, max 3 files, one clear deliverable.
52
+ - Aim for 5-6 tasks per teammate.
53
+
54
+ ### Spawning Teammates
55
+
56
+ Pick the right agent type for each role:
57
+
58
+ | Role | Agent Type | Why |
59
+ |------|-----------|-----|
60
+ | Code implementation | `general-purpose` | Needs Edit/Write/Bash tools |
61
+ | Code review | `phase-reviewer` or `general-purpose` | Needs Read + project rules |
62
+ | Research / exploration | `Explore` | Read-only, fast, focused |
63
+ | Architecture / planning | `Plan` | Read-only, designs solutions |
64
+ | Idea critique | `idea-killer` | Harsh evaluator |
65
+
66
+ ### Communication Protocol
67
+
68
+ - **Messages arrive automatically.** Don't poll or check inbox.
69
+ - **Teammates go idle between turns.** This is normal. Send a message to wake them up.
70
+ - **Use direct messages** (`to: "agent-name"`) for specific agents.
71
+ - **Use broadcast** (`to: "*"`) only when everyone needs the same info. It costs tokens.
72
+ - **Don't send JSON status messages.** Use plain text. Use TaskUpdate for status changes.
73
+
74
+ ### Wave Execution Protocol
75
+
76
+ When executing waves from a GSD plan:
77
+
78
+ 1. **Parse the plan** — identify work units and their wave assignments
79
+ 2. **Execute one wave at a time** — all WUs in a wave can run in parallel
80
+ 3. **Verify between waves** — run tests, check for conflicts
81
+ 4. **Advance only when clean** — don't start Wave N+1 until Wave N passes all checks
82
+
83
+ ```
84
+ Wave 1: spawn agents → work in parallel → all complete → verify tests
85
+ ↓ (tests pass)
86
+ Wave 2: spawn agents → work in parallel → all complete → verify tests
87
+ ↓ (tests pass)
88
+ Wave 3: integration → final verification
89
+ ```
90
+
91
+ ### Conflict Resolution
92
+
93
+ When agents work on overlapping areas:
94
+ - Use `isolation: "worktree"` to give each agent its own repo copy
95
+ - After completion, merge worktree changes one at a time
96
+ - If merge conflicts arise, resolve them yourself or ask the user
97
+
98
+ ## Working Principles
99
+
100
+ - **Bias toward parallel work.** If two tasks don't depend on each other, run them at the same time.
101
+ - **Small teams over big teams.** 2-3 focused agents beat 6 scattered ones.
102
+ - **Fail fast.** If an agent is stuck for more than 2 messages, reassign or handle it yourself.
103
+ - **Don't micromanage.** Give clear specs, let agents work, review results.
104
+ - **Synthesize, don't just collect.** When agents report back, combine their outputs into a single coherent result. Don't dump raw agent outputs on the user.
105
+
106
+ ## Communication Style
107
+
108
+ - Direct and brief. No fluff.
109
+ - Report progress as a table (task, owner, status).
110
+ - Flag blockers immediately — don't wait for the user to ask.
111
+ - When synthesizing results, lead with the conclusion, then supporting details.
@@ -13,6 +13,7 @@
13
13
  | `/spartan:forensics "problem"` | Post-mortem investigation — diagnose failed workflows |
14
14
  | `/spartan:brownfield [svc]` | Map existing codebase; generates CONTEXT-MAP.md |
15
15
  | `/spartan:map-codebase` | Deep codebase analysis and architecture mapping |
16
+ | `/spartan:team [action]` | Agent Teams: `create`, `status`, `wave`, `review`, `research`, `build`, `clean` |
16
17
 
17
18
  ### Office Hours (GSD Discuss Phase)
18
19
  When running `/spartan:phase discuss N`, Claude MUST ask these 3 forcing questions BEFORE gathering requirements:
@@ -90,3 +91,29 @@ Multi-tab: each Claude Code tab handles one WU from the same wave.
90
91
  ```
91
92
 
92
93
  Users never need to type `/gsd:*` commands — the wrappers handle everything.
94
+
95
+ ### Agent Teams (Experimental)
96
+
97
+ **Requires:** `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` env var set to `1`.
98
+
99
+ Agent Teams replace manual multi-tab parallelism with automated multi-agent coordination. Multiple Claude Code sessions share a task list, communicate via messages, and work in parallel.
100
+
101
+ | Command | What it does |
102
+ |---|---|
103
+ | `/spartan:team create` | Create a team with smart defaults for a task |
104
+ | `/spartan:team status` | Show team progress and teammate states |
105
+ | `/spartan:team wave` | Execute a GSD wave plan using Agent Teams |
106
+ | `/spartan:team review` | Quick-spawn: parallel review team (quality + tests + security) |
107
+ | `/spartan:team research` | Quick-spawn: research swarm (breadth + depth + contrarian) |
108
+ | `/spartan:team build` | Quick-spawn: parallel implementation team |
109
+ | `/spartan:team clean` | Shut down teammates and clean up |
110
+
111
+ **How it bridges waves:**
112
+ ```
113
+ Wave plan (.planning/) → /spartan:team wave → Agent Teams
114
+ WU-1, WU-3, WU-5 TeamCreate Teammate per WU
115
+ (was: manual tabs) TaskCreate per WU Worktree isolation
116
+ Spawn agents Auto-advance waves
117
+ ```
118
+
119
+ Teams store state in `~/.claude/teams/` and `~/.claude/tasks/`. Clean up with `/spartan:team clean`.
@@ -241,6 +241,36 @@ Write the first failing test for Task 1. Show it fails.
241
241
 
242
242
  ## Stage 3: Implement
243
243
 
244
+ ### Agent Teams boost (if enabled)
245
+
246
+ ```bash
247
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
248
+ ```
249
+
250
+ **If Agent Teams is enabled AND the plan has 4+ tasks AND the feature is full-stack:**
251
+
252
+ Offer to parallelize implementation with Agent Teams:
253
+ > "This has [N] tasks across backend and frontend. Want me to spin up a build team?
254
+ >
255
+ > I'd go with **A** — parallel tracks save time on full-stack work.
256
+ >
257
+ > - **A) Build team** — one backend agent + one frontend agent, working in parallel (uses more tokens)
258
+ > - **B) Sequential** — I'll do all tasks one by one (cheaper, simpler)"
259
+
260
+ If user picks A:
261
+ 1. Use `TeamCreate` with name `build-{feature-slug}`
262
+ 2. Create tasks from the plan — backend tasks assigned to `backend-dev`, frontend tasks to `frontend-dev`
263
+ 3. Set `addBlockedBy` for frontend tasks that need backend API first
264
+ 4. Spawn two agents with `isolation: "worktree"`:
265
+ - **backend-dev** — gets backend tasks, relevant Kotlin/Micronaut rules
266
+ - **frontend-dev** — gets frontend tasks, relevant React/Next.js rules
267
+ 5. Monitor progress. When both finish, merge worktrees and run full test suite.
268
+ 6. After completion, use `TeamDelete` to clean up.
269
+
270
+ If user picks B (or Agent Teams not enabled), continue with sequential execution below.
271
+
272
+ ### Sequential execution (default)
273
+
244
274
  Execute each task in order:
245
275
 
246
276
  ### For each task:
@@ -76,7 +76,34 @@ Note any issues you find. Fix what you can before calling the reviewer.
76
76
 
77
77
  ---
78
78
 
79
- ## Step 3: Spawn the Reviewer
79
+ ## Step 3: Spawn the Reviewer(s)
80
+
81
+ ### Agent Teams boost (if enabled)
82
+
83
+ ```bash
84
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
85
+ ```
86
+
87
+ **If Agent Teams is enabled AND the diff has 10+ changed files or touches 3+ modules:**
88
+
89
+ Offer to use a review team for parallel review:
90
+ > "This is a big change ([N] files across [N] modules). Want a parallel review team?
91
+ >
92
+ > I'd go with **A** — multiple reviewers catch different things.
93
+ >
94
+ > - **A) Review team** — quality reviewer + test reviewer + security reviewer, all in parallel
95
+ > - **B) Single reviewer** — one phase-reviewer agent (cheaper, faster for small changes)"
96
+
97
+ If user picks A → run `/spartan:team review` internally. Three agents review in parallel:
98
+ 1. **quality-reviewer** — code design, SOLID, clean code, stack conventions
99
+ 2. **test-reviewer** — test coverage, edge cases, test quality
100
+ 3. **security-reviewer** — auth, input validation, data handling
101
+
102
+ After all report back, synthesize findings and continue to Step 4 (Discussion).
103
+
104
+ If user picks B (or Agent Teams not enabled) → use single reviewer below.
105
+
106
+ ### Single reviewer (default)
80
107
 
81
108
  Spawn the `phase-reviewer` agent as a subagent. Give it:
82
109
 
@@ -42,7 +42,26 @@ All documents include **file paths in backticks** so Claude can navigate directl
42
42
 
43
43
  ## Execution
44
44
 
45
- Delegate to GSD's map-codebase workflow:
45
+ ### Agent Teams boost (if enabled)
46
+
47
+ ```bash
48
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
49
+ ```
50
+
51
+ **If Agent Teams is enabled**, use a coordinated mapping team instead of independent subagents:
52
+
53
+ 1. Use `TeamCreate` with name `map-{project-slug}`
54
+ 2. Create 4 tasks — one per domain (tech, architecture, quality, concerns)
55
+ 3. Spawn 4 agents in parallel:
56
+ - **tech-mapper** — STACK.md + INTEGRATIONS.md
57
+ - **arch-mapper** — ARCHITECTURE.md + STRUCTURE.md
58
+ - **quality-mapper** — CONVENTIONS.md + TESTING.md
59
+ - **concerns-mapper** — CONCERNS.md
60
+ 4. Agents can message each other if they find cross-cutting issues (e.g., tech mapper finds a security concern → messages concerns-mapper)
61
+ 5. After all complete, verify 7 documents exist and are non-empty
62
+ 6. Clean up team with `TeamDelete`
63
+
64
+ **If Agent Teams is NOT enabled**, delegate to GSD:
46
65
 
47
66
  **Run this command now:**
48
67
 
@@ -103,6 +103,25 @@ git branch -a | head -20
103
103
 
104
104
  **Goal:** Understand how the pieces fit together. Build a mental model.
105
105
 
106
+ ### Agent Teams boost (if enabled)
107
+
108
+ ```bash
109
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
110
+ ```
111
+
112
+ **If Agent Teams is enabled AND the codebase is large (50+ files or multi-module):**
113
+
114
+ Run a parallel mapping team for faster analysis:
115
+ 1. Use `TeamCreate` with name `onboard-{project-slug}`
116
+ 2. Spawn 2-3 mapper agents in parallel:
117
+ - **stack-mapper** — tech stack, dependencies, build tools
118
+ - **arch-mapper** — architecture patterns, data flow, entry points
119
+ - **quality-mapper** — conventions, test patterns, concerns
120
+ 3. After all report back, synthesize into the architecture overview below
121
+ 4. Clean up team with `TeamDelete`
122
+
123
+ **If Agent Teams is NOT enabled (or codebase is small)**, map manually:
124
+
106
125
  ### Architecture mapping
107
126
 
108
127
  Use the approach from `/spartan:map-codebase` internally:
@@ -61,6 +61,30 @@ If the user has multiple Claude Code tabs available, suggest:
61
61
 
62
62
  Running the planned tasks wave by wave.
63
63
 
64
+ ### Agent Teams boost (if enabled)
65
+
66
+ ```bash
67
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
68
+ ```
69
+
70
+ **If Agent Teams is enabled AND the wave plan has 2+ parallel work units in any wave:**
71
+
72
+ Offer to use Agent Teams for wave execution:
73
+ > "Wave 1 has [N] parallel work units. Want me to use Agent Teams?
74
+ >
75
+ > I'd go with **A** — it automates what you'd do manually across tabs.
76
+ >
77
+ > - **A) Agent Teams** — one agent per WU, worktree isolation, auto-advance between waves
78
+ > - **B) Manual** — I'll execute sequentially, or you open multiple tabs yourself"
79
+
80
+ If user picks A → run `/spartan:team wave` internally. This:
81
+ 1. Creates a team from the wave plan
82
+ 2. Spawns one agent per WU with worktree isolation
83
+ 3. Verifies tests pass between waves
84
+ 4. Auto-advances to the next wave
85
+
86
+ If user picks B (or Agent Teams not enabled) → continue with default execution:
87
+
64
88
  **Run:** `/gsd:execute-phase {{ args[1] | default: "N" }}`
65
89
 
66
90
  During execution:
@@ -75,6 +75,25 @@ Options:
75
75
 
76
76
  **Goal:** Find real data from real sources. Track everything.
77
77
 
78
+ ### Agent Teams boost (if enabled)
79
+
80
+ ```bash
81
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
82
+ ```
83
+
84
+ **If Agent Teams is enabled**, run parallel research agents for faster, broader coverage:
85
+
86
+ 1. Use `TeamCreate` with name `research-{topic-slug}`
87
+ 2. Spawn 2-3 agents based on the source strategy from Stage 1:
88
+ - **breadth-researcher** — runs direct + alternative + adjacent queries, collects 8-15 sources
89
+ - **depth-researcher** — picks the top 3-5 sources from breadth, goes deep on each
90
+ - **contrarian-researcher** (optional) — searches for counterarguments, failures, criticism
91
+ 3. Each agent tracks sources with credibility scores (see format below)
92
+ 4. After all report back, merge source lists and continue to Stage 3 (Analyze)
93
+ 5. Clean up team with `TeamDelete`
94
+
95
+ **If Agent Teams is NOT enabled**, gather sequentially:
96
+
78
97
  ### Search strategy
79
98
  Use the `deep-research` skill. Run multiple search queries — not just one:
80
99
 
@@ -128,6 +128,26 @@ Based on results:
128
128
 
129
129
  ## Stage 3: Dig
130
130
 
131
+ ### Agent Teams boost (if enabled)
132
+
133
+ ```bash
134
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
135
+ ```
136
+
137
+ **If Agent Teams is enabled**, run market research and competitor teardowns in parallel:
138
+
139
+ 1. Use `TeamCreate` with name `research-{idea-slug}`
140
+ 2. Spawn 2-3 agents:
141
+ - **market-researcher** — TAM/SAM/SOM, growth signals, adjacent markets
142
+ - **competitor-analyst** — teardown 3+ competitors, find gaps
143
+ - **contrarian** (optional) — challenge assumptions, find risks
144
+ 3. After all report back, synthesize into a single research doc
145
+ 4. Clean up team with `TeamDelete`
146
+
147
+ Skip to step 11 (synthesis) after team reports back.
148
+
149
+ **If Agent Teams is NOT enabled**, run sequentially:
150
+
131
151
  9. Use the `market-research` skill — TAM/SAM/SOM, growth signals, adjacent markets
132
152
  10. Use the `competitive-teardown` skill — at least 3 competitors, strengths, weaknesses, gaps
133
153
  11. Write synthesis:
@@ -0,0 +1,505 @@
1
+ ---
2
+ name: spartan:team
3
+ description: Manage Claude Code Agent Teams — coordinate multi-agent work with shared tasks, messaging, and parallel execution. Bridges wave-based planning with native agent teams.
4
+ argument-hint: "[create | status | wave | review | research | build | clean]"
5
+ preamble-tier: 3
6
+ ---
7
+
8
+ # Agent Teams: {{ args[0] | default: "create" }}
9
+
10
+ You are managing **Claude Code Agent Teams** — multiple Claude Code sessions working together with shared task lists, direct messaging, and coordinated parallel execution.
11
+
12
+ **What are Agent Teams?** Native Claude Code feature where one session (team lead) coordinates multiple teammate sessions. Each teammate has its own context window, works independently, and communicates via messages. Unlike subagents, teammates can talk to each other directly.
13
+
14
+ ---
15
+
16
+ ## Prerequisites Check (always run first)
17
+
18
+ Before any sub-action, check that Agent Teams is enabled:
19
+
20
+ ```bash
21
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
22
+ ```
23
+
24
+ **If `not_set`**, stop and tell the user:
25
+
26
+ > Agent Teams needs to be enabled first. Add this to your settings:
27
+ >
28
+ > **Option A — settings.json** (in `~/.claude/settings.json` or `.claude/settings.json`):
29
+ > ```json
30
+ > {
31
+ > "env": {
32
+ > "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
33
+ > }
34
+ > }
35
+ > ```
36
+ >
37
+ > **Option B — shell** (temporary, current session only):
38
+ > ```bash
39
+ > export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
40
+ > ```
41
+ >
42
+ > Then run `/spartan:team` again.
43
+
44
+ **If enabled**, proceed to the routed sub-action below.
45
+
46
+ ---
47
+
48
+ ## Route by argument
49
+
50
+ {% if args[0] == "create" or args[0] == nil %}
51
+ ## Create Team
52
+
53
+ Create a new agent team for coordinated parallel work.
54
+
55
+ ### Step 1: Understand the task
56
+
57
+ Ask the user (if not already clear from context):
58
+
59
+ > What's the goal for this team?
60
+ >
61
+ > I'd go with **A** — most tasks fit a small focused team.
62
+ >
63
+ > - **A) Small team (2-3 agents)** — fast coordination, low token cost, good for most tasks
64
+ > - **B) Medium team (4-5 agents)** — parallel research or multi-module builds
65
+ > - **C) Custom** — you tell me the roles
66
+
67
+ ### Step 2: Design the team
68
+
69
+ Based on the task, decide:
70
+ - **Team name** — kebab-case, descriptive (e.g., `auth-refactor`, `api-review`, `market-research`)
71
+ - **Teammate roles** — what each agent does (e.g., "backend-impl", "frontend-impl", "test-writer")
72
+ - **Agent types** — pick the right `subagent_type` for each role:
73
+ - `general-purpose` — for implementation work (has all tools including Edit/Write)
74
+ - `Explore` — for read-only research and codebase exploration
75
+ - `Plan` — for architecture and planning (read-only, no edits)
76
+ - Custom agents from `~/.claude/agents/` — for specialized work (e.g., `phase-reviewer`)
77
+
78
+ ### Step 3: Create the team
79
+
80
+ Use `TeamCreate` with the team name and description:
81
+
82
+ ```
83
+ TeamCreate:
84
+ team_name: "{descriptive-kebab-name}"
85
+ description: "Brief description of what the team is doing"
86
+ ```
87
+
88
+ ### Step 4: Create tasks
89
+
90
+ Use `TaskCreate` for each work item. Set up dependencies with `addBlockedBy` where needed.
91
+
92
+ Good tasks are:
93
+ - **Specific** — "Implement user authentication endpoint" not "do backend work"
94
+ - **Self-contained** — one agent can finish it without waiting on others
95
+ - **Sized right** — 15-60 min of work each. 5-6 tasks per teammate is ideal.
96
+
97
+ ### Step 5: Spawn teammates
98
+
99
+ For each teammate, use the `Agent` tool with `team_name` and `name` parameters:
100
+
101
+ ```
102
+ Agent:
103
+ team_name: "{team-name}"
104
+ name: "{teammate-role}"
105
+ subagent_type: "{agent-type}"
106
+ prompt: |
107
+ You are {role description}.
108
+
109
+ Your tasks are in the shared task list. Check TaskList, claim unassigned
110
+ tasks with TaskUpdate (set owner to your name), and work through them.
111
+
112
+ Context:
113
+ - Project: {brief project context}
114
+ - Your focus: {what this agent should work on}
115
+ - Key files: {relevant file paths}
116
+
117
+ When done with a task, mark it completed and check TaskList for next work.
118
+ Message the team lead if you're blocked or need input.
119
+ ```
120
+
121
+ **Key rules for spawn prompts:**
122
+ - Tell the agent to check `TaskList` and self-claim tasks
123
+ - Give file paths, not inline content (saves context)
124
+ - Reference `.memory/` and `.planning/` if they exist
125
+ - Use `isolation: "worktree"` when agents edit overlapping files
126
+
127
+ ### Step 6: Monitor and coordinate
128
+
129
+ After spawning:
130
+ - Messages from teammates come in automatically — no polling needed
131
+ - Use `SendMessage` to redirect or give feedback
132
+ - Teammates go idle between turns — this is normal, send them a message to wake them up
133
+ - When all tasks are done, proceed to cleanup
134
+
135
+ Tell the user: "Team `{name}` is running with {N} teammates. I'll coordinate and report back as they finish."
136
+
137
+ {% elif args[0] == "status" %}
138
+ ## Team Status
139
+
140
+ Show the current state of the active team.
141
+
142
+ ### Step 1: Find active teams
143
+
144
+ ```bash
145
+ ls -la ~/.claude/teams/ 2>/dev/null || echo "NO_TEAMS_DIR"
146
+ ```
147
+
148
+ If no teams directory or empty, tell user: "No active teams. Run `/spartan:team create` to start one."
149
+
150
+ ### Step 2: Read team config
151
+
152
+ For each team found, read the config:
153
+
154
+ ```bash
155
+ cat ~/.claude/teams/*/config.json 2>/dev/null
156
+ ```
157
+
158
+ ### Step 3: Show task progress
159
+
160
+ Use `TaskList` to show all tasks and their status.
161
+
162
+ Display as a table:
163
+
164
+ ```
165
+ ## Team: {team-name}
166
+ | # | Task | Owner | Status |
167
+ |---|------|-------|--------|
168
+ | 1 | Implement auth endpoint | backend-dev | completed |
169
+ | 2 | Write auth tests | test-writer | in_progress |
170
+ | 3 | Add login page | frontend-dev | pending |
171
+ ```
172
+
173
+ **Summary:** X of Y tasks done. Teammates: {list with idle/active state}.
174
+
175
+ Suggest next actions:
176
+ - All done? → "Run `/spartan:team clean` to shut down"
177
+ - Some stuck? → "I can message {teammate} to check on task #{N}"
178
+ - Need more work? → "I can add more tasks with TaskCreate"
179
+
180
+ {% elif args[0] == "wave" %}
181
+ ## Wave Execution with Agent Teams
182
+
183
+ Execute a GSD wave plan using Agent Teams instead of manual multi-tab work.
184
+
185
+ ### Step 1: Find the wave plan
186
+
187
+ ```bash
188
+ # Look for the current phase plan
189
+ ls .planning/milestones/*/phases/*/PLAN.md 2>/dev/null
190
+ ls .planning/PLAN.md 2>/dev/null
191
+ ```
192
+
193
+ If no plan found:
194
+ > No wave plan found. Run `/spartan:phase plan N` first to create a plan with wave decomposition.
195
+ > Or run `/spartan:team create` to build a team from scratch.
196
+
197
+ If found, read the plan and look for wave structure (sections like "Wave 1", "Wave 2", or work units with dependency info).
198
+
199
+ ### Step 2: Parse waves
200
+
201
+ From the plan, extract:
202
+ - **Work units (WUs)** — each atomic task
203
+ - **Wave assignments** — which WUs can run in parallel (Wave 1), which depend on earlier waves
204
+ - **File paths** — what each WU touches
205
+
206
+ ### Step 3: Create team for current wave
207
+
208
+ Identify which wave to execute (usually the first incomplete one).
209
+
210
+ Use `TeamCreate`:
211
+ ```
212
+ team_name: "{milestone}-wave-{N}"
213
+ description: "Wave {N} execution: {list of WU names}"
214
+ ```
215
+
216
+ ### Step 4: Create tasks from WUs
217
+
218
+ For each WU in the current wave, `TaskCreate` with:
219
+ - Subject from WU name
220
+ - Description from WU spec + acceptance criteria
221
+ - For Wave 2+ WUs, set `addBlockedBy` pointing to Wave 1 task IDs
222
+
223
+ ### Step 5: Spawn one agent per WU
224
+
225
+ Each agent gets:
226
+ - A worktree (`isolation: "worktree"`) for safe parallel edits
227
+ - The WU spec as its prompt
228
+ - References to `.memory/` for project context
229
+ - The specific file paths it should touch
230
+
231
+ ```
232
+ Agent:
233
+ team_name: "{team-name}"
234
+ name: "wu-{N}-{short-slug}"
235
+ subagent_type: "general-purpose"
236
+ isolation: "worktree"
237
+ prompt: |
238
+ You are implementing Work Unit {N}: {WU title}.
239
+
240
+ Spec: {WU description from plan}
241
+ Files to touch: {file list}
242
+ Acceptance criteria: {from plan}
243
+
244
+ Read .memory/index.md for project context.
245
+ Follow TDD: write test first, then implement, then verify.
246
+
247
+ When done, mark your task completed and message the lead.
248
+ ```
249
+
250
+ ### Step 6: Monitor wave completion
251
+
252
+ Wait for all Wave N agents to complete. Between waves:
253
+
254
+ 1. Verify all tests pass:
255
+ ```bash
256
+ # Run the project's test command
257
+ ./gradlew test 2>&1 | tail -20 # or npm test, etc.
258
+ ```
259
+
260
+ 2. If tests pass → advance to Wave N+1 (create new tasks, spawn new agents)
261
+ 3. If tests fail → message the relevant agent to fix, or handle it yourself
262
+
263
+ ### Step 7: Complete
264
+
265
+ After all waves finish:
266
+ - Run full test suite
267
+ - Tell user: "All {N} waves complete. {X} work units done. Tests: {pass/fail}."
268
+ - Suggest: "Run `/spartan:team clean` to shut down, then `/spartan:pr-ready` to ship."
269
+
270
+ {% elif args[0] == "review" %}
271
+ ## Quick Spawn: Review Team
272
+
273
+ Spin up a parallel review team for a PR or set of changes.
274
+
275
+ ### Step 1: Identify what to review
276
+
277
+ Check for a PR number in args, or detect changes:
278
+ ```bash
279
+ git diff --stat main...HEAD 2>/dev/null || git diff --stat HEAD~3..HEAD
280
+ ```
281
+
282
+ ### Step 2: Create review team
283
+
284
+ ```
285
+ TeamCreate:
286
+ team_name: "review-{branch-or-pr}"
287
+ description: "Parallel code review"
288
+ ```
289
+
290
+ ### Step 3: Create review tasks
291
+
292
+ Create 2-3 focused review tasks:
293
+ 1. **Code quality** — design, SOLID, clean code, stack conventions
294
+ 2. **Test coverage** — are tests adequate, edge cases covered, test quality
295
+ 3. **Security** (if applicable) — auth, input validation, data handling
296
+
297
+ ### Step 4: Spawn reviewers
298
+
299
+ Spawn 2-3 agents with appropriate expertise:
300
+
301
+ - **quality-reviewer** — use `phase-reviewer` agent type if available, otherwise `general-purpose`
302
+ - **test-reviewer** — `general-purpose` agent focused on test analysis
303
+ - **security-reviewer** (optional) — `general-purpose` agent focused on security
304
+
305
+ Each reviewer gets:
306
+ - The diff or changed file list
307
+ - Their specific review focus
308
+ - Instructions to report findings in the Gate 3.5 format
309
+
310
+ ### Step 5: Synthesize
311
+
312
+ When all reviewers report back:
313
+ - Combine findings into one review summary
314
+ - Deduplicate overlapping issues
315
+ - Prioritize: HIGH (must fix) → MEDIUM (should fix) → LOW (nice to have)
316
+ - Give verdict: **ACCEPT** or **NEEDS CHANGES**
317
+
318
+ {% elif args[0] == "research" %}
319
+ ## Quick Spawn: Research Team
320
+
321
+ Spin up a research swarm to explore a topic from multiple angles.
322
+
323
+ ### Step 1: Get the topic
324
+
325
+ Use `{{ args[1] }}` if provided, otherwise ask the user what to research.
326
+
327
+ ### Step 2: Create research team
328
+
329
+ ```
330
+ TeamCreate:
331
+ team_name: "research-{topic-slug}"
332
+ description: "Research: {topic}"
333
+ ```
334
+
335
+ ### Step 3: Design research angles
336
+
337
+ Create 2-3 complementary research tasks:
338
+ 1. **Breadth search** — survey the landscape, find key sources, map the space
339
+ 2. **Depth analysis** — go deep on the most promising findings from breadth
340
+ 3. **Contrarian view** (optional) — find counterarguments, risks, things that could go wrong
341
+
342
+ ### Step 4: Spawn researchers
343
+
344
+ - **surveyor** — `Explore` or `general-purpose` with web search focus
345
+ - **analyst** — `general-purpose` for deep analysis
346
+ - **contrarian** — `general-purpose` playing devil's advocate (use `idea-killer` agent if available)
347
+
348
+ Each gets the topic + their angle + instructions to report structured findings.
349
+
350
+ ### Step 5: Synthesize
351
+
352
+ Combine into a structured report:
353
+ - Key findings (agreed across agents)
354
+ - Disagreements (where agents had different conclusions)
355
+ - Recommendations
356
+ - Sources and confidence levels
357
+
358
+ Save to `.planning/research/{topic-slug}.md` if in a project context.
359
+
360
+ {% elif args[0] == "build" %}
361
+ ## Quick Spawn: Build Team
362
+
363
+ Spin up a parallel implementation team for a feature.
364
+
365
+ ### Step 1: Understand the feature
366
+
367
+ Check for existing spec/plan:
368
+ ```bash
369
+ ls .planning/specs/ .planning/PLAN.md 2>/dev/null
370
+ ```
371
+
372
+ If no spec exists, tell user: "No spec found. Run `/spartan:spec` first, or describe the feature and I'll split it into parallel work."
373
+
374
+ ### Step 2: Detect stack and split work
375
+
376
+ ```bash
377
+ ls build.gradle.kts package.json next.config.* 2>/dev/null
378
+ ```
379
+
380
+ Split strategy:
381
+ - **Full-stack** → one backend agent + one frontend agent
382
+ - **Backend only** → split by service boundaries or layers (API + data + tests)
383
+ - **Frontend only** → split by pages/components + tests
384
+
385
+ ### Step 3: Create build team
386
+
387
+ ```
388
+ TeamCreate:
389
+ team_name: "build-{feature-slug}"
390
+ description: "Building: {feature name}"
391
+ ```
392
+
393
+ ### Step 4: Create implementation tasks
394
+
395
+ From the spec/plan, create tasks for each parallel track. Set `addBlockedBy` for tasks that depend on earlier ones (e.g., frontend depends on API being done).
396
+
397
+ ### Step 5: Spawn builders
398
+
399
+ Each builder agent gets:
400
+ - Worktree isolation (`isolation: "worktree"`)
401
+ - Their track's tasks and file paths
402
+ - Instructions to follow TDD
403
+ - References to relevant rules from installed packs
404
+ - `.memory/` context
405
+
406
+ ### Step 6: Integration
407
+
408
+ After parallel tracks complete:
409
+ 1. Merge worktree changes
410
+ 2. Run full test suite
411
+ 3. Fix any integration issues
412
+ 4. Report results to user
413
+
414
+ {% elif args[0] == "clean" %}
415
+ ## Clean Up Team
416
+
417
+ Shut down all teammates and clean up team resources.
418
+
419
+ ### Step 1: Find active teams
420
+
421
+ ```bash
422
+ ls ~/.claude/teams/ 2>/dev/null || echo "NO_TEAMS"
423
+ ```
424
+
425
+ If no teams, tell user: "No active teams to clean up."
426
+
427
+ ### Step 2: Check for active teammates
428
+
429
+ Read team config to find members. For each active teammate, send a shutdown request:
430
+
431
+ ```
432
+ SendMessage:
433
+ to: "{teammate-name}"
434
+ message:
435
+ type: "shutdown_request"
436
+ reason: "Team work complete, shutting down"
437
+ ```
438
+
439
+ Wait for shutdown responses. If a teammate rejects, tell the user why.
440
+
441
+ ### Step 3: Delete team
442
+
443
+ After all teammates are shut down, use `TeamDelete` to clean up:
444
+
445
+ ```
446
+ TeamDelete: {}
447
+ ```
448
+
449
+ This removes:
450
+ - `~/.claude/teams/{team-name}/`
451
+ - `~/.claude/tasks/{team-name}/`
452
+
453
+ ### Step 4: Report
454
+
455
+ Tell user: "Team `{name}` cleaned up. {N} teammates shut down, task list removed."
456
+
457
+ If there were orphaned tmux sessions:
458
+ ```bash
459
+ tmux ls 2>/dev/null | grep -i "{team-name}" || echo "no orphaned sessions"
460
+ ```
461
+
462
+ If found, suggest: `tmux kill-session -t {session-name}`
463
+
464
+ {% else %}
465
+ ## Unknown argument: {{ args[0] }}
466
+
467
+ Available options:
468
+ - `/spartan:team` — Create a new agent team (default)
469
+ - `/spartan:team create` — Create a team with smart defaults
470
+ - `/spartan:team status` — Show team progress and teammate states
471
+ - `/spartan:team wave` — Execute a GSD wave plan using Agent Teams
472
+ - `/spartan:team review` — Quick-spawn: parallel review team
473
+ - `/spartan:team research` — Quick-spawn: research swarm
474
+ - `/spartan:team build` — Quick-spawn: parallel build team
475
+ - `/spartan:team clean` — Shut down teammates and clean up
476
+ {% endif %}
477
+
478
+ ---
479
+
480
+ ## Best Practices (applies to all sub-actions)
481
+
482
+ ### Team Size
483
+ - **2-3 agents** for most tasks. Start small.
484
+ - **4-5 agents** only when work is truly independent (no shared files).
485
+ - More agents = more tokens. Each agent has its own context window.
486
+
487
+ ### Task Design
488
+ - 5-6 tasks per teammate keeps everyone productive.
489
+ - Each task should be 15-60 min of work.
490
+ - Set `addBlockedBy` for real dependencies. Don't block unnecessarily.
491
+
492
+ ### Isolation
493
+ - Use `isolation: "worktree"` when agents might edit the same files.
494
+ - Without worktrees, agents work in the same repo — last write wins.
495
+
496
+ ### Communication
497
+ - Messages are delivered automatically. Don't poll.
498
+ - Teammates go idle between turns — send a message to wake them up.
499
+ - Use `SendMessage` with `to: "*"` sparingly — it costs tokens for every teammate.
500
+
501
+ ### Integration with Spartan Workflow
502
+ - **After team work** → `/spartan:pr-ready` for the full pre-PR checklist
503
+ - **Wave execution** → `/spartan:team wave` replaces manual multi-tab work from GSD v5
504
+ - **Review teams** → works alongside `/spartan:gate-review` for dual-agent reviews
505
+ - **Research teams** → feeds into `/spartan:research` report format
@@ -111,6 +111,11 @@ Route here when the user wants a specific tool, not a full workflow.
111
111
  | "big project", "multi-day", "new milestone" | `/spartan:project new` |
112
112
  | "continue phase", "next phase" | `/spartan:phase` |
113
113
  | "workstreams", "parallel work" | `/spartan:workstreams` |
114
+ | "agent team", "spawn team", "create team", "multi-agent" | `/spartan:team` |
115
+ | "run wave with agents", "execute wave with team" | `/spartan:team wave` |
116
+ | "parallel review", "team review" | `/spartan:team review` |
117
+ | "research swarm", "parallel research" | `/spartan:team research` |
118
+ | "parallel build", "team build" | `/spartan:team build` |
114
119
  | "standup", "what did I do" | `/spartan:daily` |
115
120
 
116
121
  **Product thinking:**
@@ -248,6 +253,8 @@ You don't have to wait for the user to type `/spartan`. When you notice these pa
248
253
  | User is confused about what to do next | "Type `/spartan` and I'll figure out the right workflow." |
249
254
  | User just finished a big feature, no tests mentioned | "Should we add tests? `/spartan:e2e` for browser tests, or unit tests first." |
250
255
  | User has been coding for a while, no review mentioned | "Want a quick review before moving on? `/spartan:review`" |
256
+ | User has a wave plan with 3+ parallel work units | "This wave has parallel tasks — want to use `/spartan:team wave` to run them with Agent Teams?" |
257
+ | User wants multiple things reviewed or researched at once | "I can spin up a team for parallel work — `/spartan:team`" |
251
258
 
252
259
  ### How to suggest
253
260
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c0x12c/spartan-ai-toolkit",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Engineering discipline layer for AI coding agents — commands, rules, skills, agents, and packs for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -191,11 +191,14 @@
191
191
  "gsd-upgrade",
192
192
  "forensics",
193
193
  "brownfield",
194
- "map-codebase"
194
+ "map-codebase",
195
+ "team"
195
196
  ],
196
197
  "rules": [],
197
198
  "skills": [],
198
- "agents": [],
199
+ "agents": [
200
+ "team-coordinator.md"
201
+ ],
199
202
  "claudeSections": [
200
203
  "30-project-mgmt.md"
201
204
  ]
@@ -13,10 +13,12 @@ commands:
13
13
  - forensics
14
14
  - brownfield
15
15
  - map-codebase
16
+ - team
16
17
 
17
18
  rules: []
18
19
  skills: []
19
- agents: []
20
+ agents:
21
+ - team-coordinator.md
20
22
 
21
23
  claude-sections:
22
24
  - 30-project-mgmt.md