specweave 1.0.235 → 1.0.239
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/README.md +89 -193
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js +176 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts +36 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.js +115 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js +56 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts +68 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.js +102 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts +64 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js +162 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.d.ts +50 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.js +107 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts +53 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.js +138 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts +40 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.js +50 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts +30 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.js +75 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts +94 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.js +232 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.d.ts +50 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.js +114 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts +53 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.js +109 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts +21 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +161 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts +46 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js +99 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts +43 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.js +153 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.js.map +1 -0
- package/dist/plugins/specweave-github/lib/index.d.ts +1 -4
- package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/index.js +1 -4
- package/dist/plugins/specweave-github/lib/index.js.map +1 -1
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +7 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js +15 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts +10 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js +36 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts +25 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js +57 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts +7 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.js +17 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.js.map +1 -0
- package/dist/src/cli/commands/auto.d.ts.map +1 -1
- package/dist/src/cli/commands/auto.js +1 -2
- package/dist/src/cli/commands/auto.js.map +1 -1
- package/dist/src/cli/commands/cancel-auto.js +1 -2
- package/dist/src/cli/commands/cancel-auto.js.map +1 -1
- package/dist/src/cli/commands/living-docs.js +2 -2
- package/dist/src/cli/commands/living-docs.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +1 -2
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/core/config/types.d.ts +8 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +3 -0
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +72 -0
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +6 -0
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/package.json +2 -2
- package/plugins/specweave/hooks/hooks.json +2 -2
- package/plugins/specweave/hooks/startup-health-check.sh +1 -1
- package/plugins/specweave/hooks/stop-auto-v5.sh +166 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +10 -0
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +21 -1
- package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -1
- package/plugins/specweave/skills/auto/SKILL.md +71 -251
- package/plugins/specweave/skills/team-build/SKILL.md +370 -0
- package/plugins/specweave/skills/team-merge/SKILL.md +123 -0
- package/plugins/specweave/skills/team-orchestrate/SKILL.md +800 -0
- package/plugins/specweave/skills/team-status/SKILL.md +89 -0
- package/plugins/specweave-github/MULTI-PROJECT-SYNC-ARCHITECTURE.md +94 -8
- package/plugins/specweave-github/commands/sync.md +17 -3
- package/plugins/specweave-github/hooks/github-ac-sync-handler.sh +255 -0
- package/plugins/specweave-github/hooks/github-auto-create-handler.sh +455 -0
- package/plugins/specweave-github/lib/github-ac-comment-poster.js +150 -0
- package/plugins/specweave-github/lib/github-ac-comment-poster.ts +245 -0
- package/plugins/specweave-github/lib/github-batch-sync.js +93 -0
- package/plugins/specweave-github/lib/github-batch-sync.ts +152 -0
- package/plugins/specweave-github/lib/github-board-resolver-v2.js +47 -0
- package/plugins/specweave-github/lib/github-board-resolver-v2.ts +73 -0
- package/plugins/specweave-github/lib/github-conflict-resolver.js +90 -0
- package/plugins/specweave-github/lib/github-conflict-resolver.ts +154 -0
- package/plugins/specweave-github/lib/github-cross-repo-sync.js +168 -0
- package/plugins/specweave-github/lib/github-cross-repo-sync.ts +252 -0
- package/plugins/specweave-github/lib/github-field-sync.js +116 -0
- package/plugins/specweave-github/lib/github-field-sync.ts +165 -0
- package/plugins/specweave-github/lib/github-graphql-client.js +129 -0
- package/plugins/specweave-github/lib/github-graphql-client.ts +181 -0
- package/plugins/specweave-github/lib/github-issue-body-generator.js +30 -0
- package/plugins/specweave-github/lib/github-issue-body-generator.ts +76 -0
- package/plugins/specweave-github/lib/github-issue-body-parser.js +55 -0
- package/plugins/specweave-github/lib/github-issue-body-parser.ts +92 -0
- package/plugins/specweave-github/lib/github-pull-sync.js +185 -0
- package/plugins/specweave-github/lib/github-pull-sync.ts +343 -0
- package/plugins/specweave-github/lib/github-push-sync.js +119 -0
- package/plugins/specweave-github/lib/github-push-sync.ts +174 -0
- package/plugins/specweave-github/lib/github-rate-limiter.js +96 -0
- package/plugins/specweave-github/lib/github-rate-limiter.ts +143 -0
- package/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +117 -0
- package/plugins/specweave-github/lib/github-spec-frontmatter-updater.ts +180 -0
- package/plugins/specweave-github/lib/github-sync-orchestrator.js +84 -0
- package/plugins/specweave-github/lib/github-sync-orchestrator.ts +156 -0
- package/plugins/specweave-github/lib/github-us-auto-closer.js +134 -0
- package/plugins/specweave-github/lib/github-us-auto-closer.ts +226 -0
- package/plugins/specweave-github/lib/index.js +1 -7
- package/plugins/specweave-github/lib/index.ts +1 -4
- package/plugins/specweave-github/skills/github-sync/SKILL.md +76 -4
- package/plugins/specweave-testing/commands/e2e-setup.md +18 -0
- package/plugins/specweave-testing/commands/ui-automate.md +2 -0
- package/plugins/specweave-testing/commands/ui-inspect.md +8 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +6 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.js +14 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.ts +24 -0
- package/plugins/specweave-testing/lib/playwright-cli-detector.js +33 -0
- package/plugins/specweave-testing/lib/playwright-cli-detector.ts +48 -0
- package/plugins/specweave-testing/lib/playwright-cli-runner.js +58 -0
- package/plugins/specweave-testing/lib/playwright-cli-runner.ts +80 -0
- package/plugins/specweave-testing/lib/playwright-routing.js +16 -0
- package/plugins/specweave-testing/lib/playwright-routing.ts +38 -0
- package/plugins/specweave-testing/skills/e2e-testing/SKILL.md +38 -0
- package/src/templates/CLAUDE.md.template +7 -0
- package/src/templates/config.json.template +9 -1
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/subtask-sync.js +0 -147
- package/dist/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
- package/dist/plugins/specweave-github/lib/task-parser.d.ts +0 -37
- package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/task-parser.js +0 -211
- package/dist/plugins/specweave-github/lib/task-parser.js.map +0 -1
- package/dist/plugins/specweave-github/lib/task-sync.d.ts +0 -56
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/task-sync.js +0 -375
- package/dist/plugins/specweave-github/lib/task-sync.js.map +0 -1
- package/plugins/specweave/hooks/validate-completion-conditions.sh +0 -474
- package/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
- package/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
- package/plugins/specweave-github/lib/subtask-sync.js +0 -154
- package/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
- package/plugins/specweave-github/lib/subtask-sync.ts +0 -225
- package/plugins/specweave-github/lib/task-parser.d.js +0 -0
- package/plugins/specweave-github/lib/task-parser.d.ts +0 -37
- package/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
- package/plugins/specweave-github/lib/task-parser.js +0 -195
- package/plugins/specweave-github/lib/task-parser.js.map +0 -1
- package/plugins/specweave-github/lib/task-parser.ts +0 -246
- package/plugins/specweave-github/lib/task-sync.d.js +0 -0
- package/plugins/specweave-github/lib/task-sync.d.ts +0 -51
- package/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
- package/plugins/specweave-github/lib/task-sync.js +0 -415
- package/plugins/specweave-github/lib/task-sync.js.map +0 -1
- package/plugins/specweave-github/lib/task-sync.ts +0 -451
- package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +0 -496
- /package/plugins/specweave/hooks/{stop-auto.sh → _archive/stop-auto-v4-legacy.sh} +0 -0
- /package/plugins/{specweave-github/lib/subtask-sync.d.js → specweave-testing/lib/playwright-ci-defaults.d.js} +0 -0
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Orchestrate multi-agent parallel development using Claude Code Agent Teams or subagent fallback. Spawns domain-specialized agents (frontend, backend, database, testing, security, DevOps, mobile, ML) with contract-first coordination. Activates for: team setup, parallel agents, multi-repo work, orchestrate agents, team orchestrate, agent teams.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Team Orchestrate
|
|
6
|
+
|
|
7
|
+
**Plan and launch parallel development agents across domains using Claude Code's native Agent Teams or subagent fallback.**
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/sw:team-orchestrate "<feature description>" [OPTIONS]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
| Option | Description | Default |
|
|
18
|
+
|--------|-------------|---------|
|
|
19
|
+
| `--dry-run` | Show proposed agent plan without launching | false |
|
|
20
|
+
| `--domains` | Override domain detection (e.g., `--domains frontend,backend,testing`) | auto-detect |
|
|
21
|
+
| `--max-agents` | Maximum number of concurrent agents | 6 |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. Mode Detection
|
|
26
|
+
|
|
27
|
+
Before spawning agents, detect the available orchestration mode.
|
|
28
|
+
|
|
29
|
+
### Step 1a: Check for Native Agent Teams
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Check if native Agent Teams is enabled
|
|
33
|
+
if [[ -n "$CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS" ]]; then
|
|
34
|
+
MODE="native-agent-teams"
|
|
35
|
+
else
|
|
36
|
+
MODE="subagent-fallback"
|
|
37
|
+
fi
|
|
38
|
+
echo "Orchestration mode: $MODE"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 1b: Detect Terminal Environment (Native Agent Teams only)
|
|
42
|
+
|
|
43
|
+
When `MODE == "native-agent-teams"`, detect the terminal multiplexer:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Detect terminal environment
|
|
47
|
+
if [[ -n "$TMUX" ]]; then
|
|
48
|
+
TERMINAL="tmux"
|
|
49
|
+
elif [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
|
50
|
+
TERMINAL="iterm2"
|
|
51
|
+
else
|
|
52
|
+
TERMINAL="in-process"
|
|
53
|
+
fi
|
|
54
|
+
echo "Terminal: $TERMINAL"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| Terminal | Detection | Navigation | Notes |
|
|
58
|
+
|----------|-----------|------------|-------|
|
|
59
|
+
| **tmux** | `$TMUX` env var set | `Ctrl+B` + arrow keys | Best for SSH/remote |
|
|
60
|
+
| **iTerm2** | `$TERM_PROGRAM == iTerm.app` | `it2` CLI + Python API | macOS native |
|
|
61
|
+
| **In-process** | Default fallback | `Shift+Up` / `Shift+Down` | No terminal setup required |
|
|
62
|
+
|
|
63
|
+
### Step 1c: Terminal Setup (if needed)
|
|
64
|
+
|
|
65
|
+
**tmux** (if not installed):
|
|
66
|
+
```bash
|
|
67
|
+
# macOS
|
|
68
|
+
brew install tmux
|
|
69
|
+
|
|
70
|
+
# Linux (Debian/Ubuntu)
|
|
71
|
+
sudo apt install tmux
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**iTerm2** (macOS only):
|
|
75
|
+
```bash
|
|
76
|
+
# Enable Python API in iTerm2 preferences
|
|
77
|
+
# Then use it2 CLI for tab/split control
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**In-process** (default fallback):
|
|
81
|
+
- No setup required
|
|
82
|
+
- Agents run as background tasks within the Claude Code process
|
|
83
|
+
- Navigate with `Shift+Up` / `Shift+Down`
|
|
84
|
+
|
|
85
|
+
### Step 1d: settings.json Configuration (Native Agent Teams)
|
|
86
|
+
|
|
87
|
+
Ensure Agent Teams is enabled in Claude Code settings:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"env": {
|
|
92
|
+
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Place this in `.claude/settings.json` (project-level) or `~/.claude/settings.json` (global).
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 2. Domain-to-Skill Mapping
|
|
102
|
+
|
|
103
|
+
Analyze the feature request and map affected domains to SpecWeave skills.
|
|
104
|
+
|
|
105
|
+
| Domain | Primary Skill | Additional Skills | When to Use |
|
|
106
|
+
|--------|--------------|-------------------|-------------|
|
|
107
|
+
| **Frontend** | `sw-frontend:frontend-architect` | `sw-frontend:nextjs`, `sw-frontend:frontend-design` | UI components, pages, client-side state |
|
|
108
|
+
| **Backend** | `sw:architect` | `sw-infra:devops` | API endpoints, services, business logic |
|
|
109
|
+
| **Database** | `sw:architect` | | Schema design, migrations, seed data |
|
|
110
|
+
| **Shared/Types** | `sw:architect` | `sw:tech-lead` | TypeScript interfaces, shared constants, API contracts |
|
|
111
|
+
| **Testing** | `sw-testing:qa-engineer` | `sw-testing:e2e-testing`, `sw-testing:unit-testing` | Test strategy, E2E suites, integration tests |
|
|
112
|
+
| **Security** | `sw:security` | `sw:security-patterns` | Auth, authorization, threat modeling, OWASP |
|
|
113
|
+
| **DevOps** | `sw-infra:devops` | `sw-k8s:deployment-generate`, `sw-infra:observability` | CI/CD, Docker, K8s, monitoring |
|
|
114
|
+
| **Mobile** | `sw-mobile:mobile-architect` | `sw-mobile:screen-generate`, `sw-mobile:react-native-expert` | Native/cross-platform mobile apps |
|
|
115
|
+
| **ML** | `sw-ml:ml-engineer` | `sw-ml:pipeline`, `sw-ml:deploy` | Model training, inference pipelines, deployment |
|
|
116
|
+
|
|
117
|
+
### Auto-Detection Signals
|
|
118
|
+
|
|
119
|
+
The orchestrator infers domains from the feature description and codebase structure (e.g., `src/components/` signals Frontend, `prisma/` signals Database, `src/api/` signals Backend, `tests/` signals Testing, auth-related keywords signal Security, Docker/K8s/CI files signal DevOps, React Native/Flutter signal Mobile, model/pipeline keywords signal ML).
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 3. Contract-First Spawning Protocol
|
|
124
|
+
|
|
125
|
+
Agents are NOT all spawned simultaneously. The orchestrator follows a two-phase dependency protocol to prevent integration conflicts.
|
|
126
|
+
|
|
127
|
+
### Contract Artifacts
|
|
128
|
+
|
|
129
|
+
| Artifact | Location | Producer | Consumers |
|
|
130
|
+
|----------|----------|----------|-----------|
|
|
131
|
+
| TypeScript interfaces | `src/types/` or `src/shared/types/` | Shared/Types agent | Frontend, Backend, Testing |
|
|
132
|
+
| Prisma schema | `prisma/schema.prisma` | Database agent | Backend, Testing |
|
|
133
|
+
| OpenAPI spec | `openapi.yaml` or `src/api/openapi.yaml` | Backend agent | Frontend, Testing |
|
|
134
|
+
| GraphQL schema | `schema.graphql` | Backend agent | Frontend, Mobile |
|
|
135
|
+
| API route types | `src/api/types/` | Backend agent | Frontend |
|
|
136
|
+
|
|
137
|
+
### Phase 1: Upstream Agents (Contracts First)
|
|
138
|
+
|
|
139
|
+
**Contract chain order**: shared/types → database → backend → frontend (upstream before downstream).
|
|
140
|
+
|
|
141
|
+
Spawn agents that produce shared contracts. These MUST complete before downstream agents begin.
|
|
142
|
+
|
|
143
|
+
**Upstream agents** (spawn first, wait for completion):
|
|
144
|
+
- **Shared/Types agent** -- produces TypeScript interfaces, enums, constants
|
|
145
|
+
- **Database agent** -- produces Prisma schema, migration files, seed data
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Phase 1: Upstream
|
|
149
|
+
├── Shared/Types Agent → produces interfaces, enums
|
|
150
|
+
└── Database Agent → produces schema, migrations
|
|
151
|
+
|
|
152
|
+
[WAIT for Phase 1 completion]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Completion signal**: Each upstream agent writes a contract-ready message (see Communication Protocol below).
|
|
156
|
+
|
|
157
|
+
### Phase 2: Downstream Agents (Consume Contracts)
|
|
158
|
+
|
|
159
|
+
Once upstream contracts are established, spawn downstream agents in parallel.
|
|
160
|
+
|
|
161
|
+
**Downstream agents** (spawn in parallel after Phase 1):
|
|
162
|
+
- **Backend agent** -- consumes types and schema, produces API endpoints
|
|
163
|
+
- **Frontend agent** -- consumes types and API contracts, produces UI
|
|
164
|
+
- **Testing agent** -- consumes all contracts, produces test suites
|
|
165
|
+
- **Security agent** -- consumes all code, produces security hardening
|
|
166
|
+
- **DevOps agent** -- consumes all code, produces deployment config
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Phase 2: Downstream (parallel)
|
|
170
|
+
├── Backend Agent (reads types + schema)
|
|
171
|
+
├── Frontend Agent (reads types + API spec)
|
|
172
|
+
├── Testing Agent (reads all contracts)
|
|
173
|
+
├── Security Agent (reads all code)
|
|
174
|
+
└── DevOps Agent (reads all code)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### No-Dependency Case
|
|
178
|
+
|
|
179
|
+
If the feature has no cross-domain dependencies (e.g., purely frontend work with no new types), skip Phase 1 and spawn all agents in parallel immediately.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Example: independent domains
|
|
183
|
+
# If domains are [frontend, testing] with no shared types needed:
|
|
184
|
+
# → Spawn both in parallel (no Phase 1 needed)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Spawn Decision Logic
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Analyze domains
|
|
191
|
+
│
|
|
192
|
+
├── Any upstream domains (shared/types, database)?
|
|
193
|
+
│ YES → Phase 1: spawn upstream, wait for contracts
|
|
194
|
+
│ Phase 2: spawn downstream in parallel
|
|
195
|
+
│ NO → Spawn all agents in parallel (no dependency)
|
|
196
|
+
│
|
|
197
|
+
└── Single domain?
|
|
198
|
+
YES → Spawn single agent, no orchestration needed
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 4. Agent Spawn Prompt Templates
|
|
204
|
+
|
|
205
|
+
Each agent receives a detailed prompt that includes its skill invocations, file ownership, and workflow instructions.
|
|
206
|
+
|
|
207
|
+
### 4a. Frontend Agent
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
You are the FRONTEND agent for increment [INCREMENT_ID].
|
|
211
|
+
|
|
212
|
+
SKILLS TO INVOKE:
|
|
213
|
+
Skill({ skill: "sw-frontend:frontend-architect" })
|
|
214
|
+
Skill({ skill: "sw-frontend:nextjs" }) // if Next.js project
|
|
215
|
+
Skill({ skill: "sw-frontend:frontend-design" }) // for design system work
|
|
216
|
+
|
|
217
|
+
FILE OWNERSHIP (WRITE access):
|
|
218
|
+
src/components/**
|
|
219
|
+
src/pages/**
|
|
220
|
+
src/hooks/**
|
|
221
|
+
src/styles/**
|
|
222
|
+
src/app/** // Next.js app router
|
|
223
|
+
src/stores/** // Client state (zustand, redux, etc.)
|
|
224
|
+
public/**
|
|
225
|
+
|
|
226
|
+
READ ACCESS: Any file in the repository (especially src/types/, src/shared/, openapi.yaml)
|
|
227
|
+
|
|
228
|
+
WORKFLOW:
|
|
229
|
+
1. Read the increment spec: .specweave/increments/[ID]/spec.md
|
|
230
|
+
2. Read the tasks assigned to you in: .specweave/increments/[ID]/tasks.md
|
|
231
|
+
3. Wait for contract artifacts if Phase 1 is active:
|
|
232
|
+
- Read src/types/ for shared interfaces
|
|
233
|
+
- Read openapi.yaml for API endpoints (if backend produces one)
|
|
234
|
+
4. Execute tasks: /sw:do or /sw:auto
|
|
235
|
+
5. Run quality gate: /sw:grill
|
|
236
|
+
6. Signal completion (see Communication Protocol)
|
|
237
|
+
|
|
238
|
+
RULES:
|
|
239
|
+
- WRITE only to files you own (listed above)
|
|
240
|
+
- READ any file for context
|
|
241
|
+
- Follow existing code conventions (check .eslintrc, .prettierrc, tsconfig.json)
|
|
242
|
+
- Run linter and type-check before signaling completion
|
|
243
|
+
- All new components must have corresponding test files
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 4b. Backend Agent
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
You are the BACKEND agent for increment [INCREMENT_ID].
|
|
250
|
+
|
|
251
|
+
SKILLS TO INVOKE:
|
|
252
|
+
Skill({ skill: "sw:architect" })
|
|
253
|
+
Skill({ skill: "sw-infra:devops" }) // if deployment config needed
|
|
254
|
+
|
|
255
|
+
FILE OWNERSHIP (WRITE access):
|
|
256
|
+
src/api/**
|
|
257
|
+
src/services/**
|
|
258
|
+
src/middleware/**
|
|
259
|
+
src/routes/**
|
|
260
|
+
src/controllers/**
|
|
261
|
+
src/utils/server/**
|
|
262
|
+
prisma/seed.ts // seed data only (schema owned by DB agent)
|
|
263
|
+
|
|
264
|
+
READ ACCESS: Any file in the repository (especially prisma/schema.prisma, src/types/)
|
|
265
|
+
|
|
266
|
+
WORKFLOW:
|
|
267
|
+
1. Read the increment spec: .specweave/increments/[ID]/spec.md
|
|
268
|
+
2. Read the tasks assigned to you in: .specweave/increments/[ID]/tasks.md
|
|
269
|
+
3. Wait for contract artifacts if Phase 1 is active:
|
|
270
|
+
- Read prisma/schema.prisma for database schema
|
|
271
|
+
- Read src/types/ for shared interfaces
|
|
272
|
+
4. Execute tasks: /sw:do or /sw:auto
|
|
273
|
+
5. Generate or update OpenAPI spec if API routes change
|
|
274
|
+
6. Run quality gate: /sw:grill
|
|
275
|
+
7. Signal completion (see Communication Protocol)
|
|
276
|
+
|
|
277
|
+
RULES:
|
|
278
|
+
- WRITE only to files you own (listed above)
|
|
279
|
+
- READ any file for context
|
|
280
|
+
- Every new API endpoint must have request/response validation
|
|
281
|
+
- Error handling must follow project conventions
|
|
282
|
+
- All services must have unit tests
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 4c. Database Agent
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
You are the DATABASE agent for increment [INCREMENT_ID].
|
|
289
|
+
|
|
290
|
+
SKILLS TO INVOKE:
|
|
291
|
+
Skill({ skill: "sw:architect" })
|
|
292
|
+
|
|
293
|
+
FILE OWNERSHIP (WRITE access):
|
|
294
|
+
prisma/schema.prisma
|
|
295
|
+
prisma/migrations/**
|
|
296
|
+
src/db/**
|
|
297
|
+
src/repositories/**
|
|
298
|
+
scripts/db/**
|
|
299
|
+
seeds/**
|
|
300
|
+
|
|
301
|
+
READ ACCESS: Any file in the repository
|
|
302
|
+
|
|
303
|
+
WORKFLOW:
|
|
304
|
+
1. Read the increment spec: .specweave/increments/[ID]/spec.md
|
|
305
|
+
2. Read the tasks assigned to you in: .specweave/increments/[ID]/tasks.md
|
|
306
|
+
3. Design database schema changes
|
|
307
|
+
4. Generate Prisma migration: npx prisma migrate dev --name <migration-name>
|
|
308
|
+
5. Write seed data if needed
|
|
309
|
+
6. Execute tasks: /sw:do or /sw:auto
|
|
310
|
+
7. Run quality gate: /sw:grill
|
|
311
|
+
8. Signal CONTRACT_READY with schema details (see Communication Protocol)
|
|
312
|
+
9. Signal completion
|
|
313
|
+
|
|
314
|
+
RULES:
|
|
315
|
+
- WRITE only to files you own (listed above)
|
|
316
|
+
- READ any file for context
|
|
317
|
+
- Always create migrations (never modify schema without migration)
|
|
318
|
+
- Seed data must be idempotent
|
|
319
|
+
- Schema changes must be backward-compatible when possible
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### 4d. Testing Agent
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
You are the TESTING agent for increment [INCREMENT_ID].
|
|
326
|
+
|
|
327
|
+
SKILLS TO INVOKE:
|
|
328
|
+
Skill({ skill: "sw-testing:qa-engineer" })
|
|
329
|
+
Skill({ skill: "sw-testing:e2e-testing" }) // for E2E test suites
|
|
330
|
+
Skill({ skill: "sw-testing:unit-testing" }) // for unit test coverage
|
|
331
|
+
|
|
332
|
+
FILE OWNERSHIP (WRITE access):
|
|
333
|
+
tests/**
|
|
334
|
+
__tests__/**
|
|
335
|
+
src/**/*.test.ts
|
|
336
|
+
src/**/*.test.tsx
|
|
337
|
+
src/**/*.spec.ts
|
|
338
|
+
e2e/**
|
|
339
|
+
playwright.config.ts // if Playwright
|
|
340
|
+
cypress.config.ts // if Cypress
|
|
341
|
+
test-utils/**
|
|
342
|
+
fixtures/**
|
|
343
|
+
|
|
344
|
+
READ ACCESS: Any file in the repository
|
|
345
|
+
|
|
346
|
+
WORKFLOW:
|
|
347
|
+
1. Read the increment spec: .specweave/increments/[ID]/spec.md
|
|
348
|
+
2. Read the tasks assigned to you in: .specweave/increments/[ID]/tasks.md
|
|
349
|
+
3. Wait for ALL other agents to produce initial code
|
|
350
|
+
4. Write unit tests for new services/components
|
|
351
|
+
5. Write integration tests for API endpoints
|
|
352
|
+
6. Write E2E tests for user journeys
|
|
353
|
+
7. Execute tasks: /sw:do or /sw:auto
|
|
354
|
+
8. Run full test suite and report results
|
|
355
|
+
9. Run quality gate: /sw:grill
|
|
356
|
+
10. Signal completion
|
|
357
|
+
|
|
358
|
+
RULES:
|
|
359
|
+
- WRITE only to test files (listed above)
|
|
360
|
+
- READ any file for context
|
|
361
|
+
- Tests must cover all acceptance criteria from spec.md
|
|
362
|
+
- Follow existing test patterns and utilities
|
|
363
|
+
- E2E tests must include accessibility checks when applicable
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 4e. Security Agent
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
You are the SECURITY agent for increment [INCREMENT_ID].
|
|
370
|
+
|
|
371
|
+
SKILLS TO INVOKE:
|
|
372
|
+
Skill({ skill: "sw:security" })
|
|
373
|
+
Skill({ skill: "sw:security-patterns" })
|
|
374
|
+
|
|
375
|
+
FILE OWNERSHIP (WRITE access):
|
|
376
|
+
src/auth/**
|
|
377
|
+
src/middleware/auth*
|
|
378
|
+
src/middleware/security*
|
|
379
|
+
src/utils/crypto/**
|
|
380
|
+
src/utils/validation/**
|
|
381
|
+
security/**
|
|
382
|
+
.env.example // document required secrets (never .env itself)
|
|
383
|
+
|
|
384
|
+
READ ACCESS: Any file in the repository
|
|
385
|
+
|
|
386
|
+
WORKFLOW:
|
|
387
|
+
1. Read the increment spec: .specweave/increments/[ID]/spec.md
|
|
388
|
+
2. Read the tasks assigned to you in: .specweave/increments/[ID]/tasks.md
|
|
389
|
+
3. Audit code produced by other agents for security issues
|
|
390
|
+
4. Implement auth/authz middleware if needed
|
|
391
|
+
5. Add input validation and sanitization
|
|
392
|
+
6. Execute tasks: /sw:do or /sw:auto
|
|
393
|
+
7. Run security audit tools (npm audit, dependency check)
|
|
394
|
+
8. Run quality gate: /sw:grill
|
|
395
|
+
9. Signal completion with security findings summary
|
|
396
|
+
|
|
397
|
+
RULES:
|
|
398
|
+
- WRITE only to files you own (listed above)
|
|
399
|
+
- READ any file for context and audit
|
|
400
|
+
- NEVER commit secrets, credentials, or API keys
|
|
401
|
+
- All user input must be validated and sanitized
|
|
402
|
+
- Follow OWASP Top 10 guidelines
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## 5. File Ownership
|
|
408
|
+
|
|
409
|
+
Each agent has exclusive WRITE access to specific file patterns. This prevents merge conflicts.
|
|
410
|
+
|
|
411
|
+
### Ownership Map
|
|
412
|
+
|
|
413
|
+
| Domain | WRITE Patterns | Notes |
|
|
414
|
+
|--------|---------------|-------|
|
|
415
|
+
| **Frontend** | `src/components/**`, `src/pages/**`, `src/hooks/**`, `src/styles/**`, `src/app/**`, `src/stores/**`, `public/**` | UI layer |
|
|
416
|
+
| **Backend** | `src/api/**`, `src/services/**`, `src/middleware/**`, `src/routes/**`, `src/controllers/**` | API layer |
|
|
417
|
+
| **Database** | `prisma/**`, `src/db/**`, `src/repositories/**`, `seeds/**`, `scripts/db/**` | Data layer |
|
|
418
|
+
| **Shared/Types** | `src/types/**`, `src/shared/**`, `src/constants/**`, `src/utils/shared/**` | Contracts |
|
|
419
|
+
| **Testing** | `tests/**`, `__tests__/**`, `e2e/**`, `**/*.test.ts`, `**/*.test.tsx`, `**/*.spec.ts`, `test-utils/**`, `fixtures/**` | All test files |
|
|
420
|
+
| **Security** | `src/auth/**`, `src/middleware/auth*`, `src/middleware/security*`, `src/utils/crypto/**`, `src/utils/validation/**`, `security/**` | Auth and security |
|
|
421
|
+
| **DevOps** | `.github/**`, `docker/**`, `Dockerfile*`, `docker-compose*`, `k8s/**`, `terraform/**`, `.gitlab-ci.yml`, `Makefile` | Infrastructure |
|
|
422
|
+
| **Mobile** | `src/screens/**`, `src/navigation/**`, `ios/**`, `android/**`, `src/native/**` | Mobile app |
|
|
423
|
+
| **ML** | `models/**`, `notebooks/**`, `src/ml/**`, `src/pipelines/**`, `data/**` | Machine learning |
|
|
424
|
+
|
|
425
|
+
### Ownership Rules
|
|
426
|
+
|
|
427
|
+
1. **WRITE only to files you own** -- agents must not modify files outside their ownership patterns
|
|
428
|
+
2. **READ any file** -- all agents have unrestricted read access for context
|
|
429
|
+
3. **Shared files require coordination** -- if two domains need to modify the same file (e.g., `package.json`), the orchestrator assigns a primary owner and others request changes via messages
|
|
430
|
+
4. **New files** -- agents can create new files ONLY within their ownership patterns
|
|
431
|
+
5. **Conflict detection** -- the orchestrator checks for ownership overlap before spawning and resolves ambiguity upfront
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## 6. Communication Protocol
|
|
436
|
+
|
|
437
|
+
Agents must communicate contract readiness, blocking issues, and completion status.
|
|
438
|
+
|
|
439
|
+
### Mode A: Native Agent Teams (SendMessage)
|
|
440
|
+
|
|
441
|
+
When `MODE == "native-agent-teams"`, agents use the `SendMessage` tool for peer-to-peer communication.
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
// Upstream agent signals contract is ready
|
|
445
|
+
SendMessage({
|
|
446
|
+
type: "message",
|
|
447
|
+
recipient: "team-lead",
|
|
448
|
+
content: "CONTRACT_READY: TypeScript interfaces written to src/types/checkout.ts. Exports: CheckoutItem, CartSummary, PaymentIntent.",
|
|
449
|
+
summary: "Shared types contract ready"
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
// Agent reports a blocking issue
|
|
453
|
+
SendMessage({
|
|
454
|
+
type: "message",
|
|
455
|
+
recipient: "team-lead",
|
|
456
|
+
content: "BLOCKING_ISSUE: Cannot implement payment webhook -- Stripe webhook secret not found in .env. Need STRIPE_WEBHOOK_SECRET to proceed.",
|
|
457
|
+
summary: "Blocked on missing Stripe secret"
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// Agent signals completion
|
|
461
|
+
SendMessage({
|
|
462
|
+
type: "message",
|
|
463
|
+
recipient: "team-lead",
|
|
464
|
+
content: "COMPLETION: All 8 tasks done. Tests passing (24/24). /sw:grill passed. Frontend increment ready for merge.",
|
|
465
|
+
summary: "Frontend agent completed all tasks"
|
|
466
|
+
});
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
**Message Types:**
|
|
470
|
+
|
|
471
|
+
| Type | Prefix | Purpose | Sender | Receiver |
|
|
472
|
+
|------|--------|---------|--------|----------|
|
|
473
|
+
| `CONTRACT_READY` | `CONTRACT_READY:` | Upstream contract is published | Upstream agent | Team lead (broadcasts to downstream) |
|
|
474
|
+
| `BLOCKING_ISSUE` | `BLOCKING_ISSUE:` | Agent is stuck, needs help | Any agent | Team lead |
|
|
475
|
+
| `COMPLETION` | `COMPLETION:` | Agent finished all tasks | Any agent | Team lead |
|
|
476
|
+
|
|
477
|
+
### Mode B: Subagent Fallback (File-Based)
|
|
478
|
+
|
|
479
|
+
When `MODE == "subagent-fallback"`, agents communicate via files in `.specweave/state/parallel/messages/`.
|
|
480
|
+
|
|
481
|
+
**Message file format**: `{timestamp}-{sender}-{type}.json`
|
|
482
|
+
|
|
483
|
+
```json
|
|
484
|
+
{
|
|
485
|
+
"timestamp": "2026-02-09T14:30:00Z",
|
|
486
|
+
"sender": "database-agent",
|
|
487
|
+
"type": "CONTRACT_READY",
|
|
488
|
+
"content": "Prisma schema updated with Checkout, CartItem, PaymentRecord models. Migration 20260209_add_checkout created.",
|
|
489
|
+
"artifacts": ["prisma/schema.prisma", "prisma/migrations/20260209_add_checkout/"]
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"timestamp": "2026-02-09T15:10:00Z",
|
|
496
|
+
"sender": "frontend-agent",
|
|
497
|
+
"type": "BLOCKING_ISSUE",
|
|
498
|
+
"content": "OpenAPI spec not found at openapi.yaml. Backend agent has not published API contract yet.",
|
|
499
|
+
"blockedOn": "backend-agent"
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
"timestamp": "2026-02-09T16:45:00Z",
|
|
506
|
+
"sender": "backend-agent",
|
|
507
|
+
"type": "COMPLETION",
|
|
508
|
+
"content": "All 6 tasks complete. 18 tests passing. API endpoints: POST /checkout, GET /orders, POST /payments/webhook.",
|
|
509
|
+
"incrementId": "0194-checkout-backend"
|
|
510
|
+
}
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**File-based state tracking directory structure:**
|
|
514
|
+
|
|
515
|
+
```
|
|
516
|
+
.specweave/state/parallel/
|
|
517
|
+
├── session.json # Session metadata
|
|
518
|
+
├── messages/
|
|
519
|
+
│ ├── 1707489000-database-CONTRACT_READY.json
|
|
520
|
+
│ ├── 1707492600-frontend-BLOCKING_ISSUE.json
|
|
521
|
+
│ └── 1707497100-backend-COMPLETION.json
|
|
522
|
+
└── agents/
|
|
523
|
+
├── frontend.json # Agent status
|
|
524
|
+
├── backend.json
|
|
525
|
+
└── database.json
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## 7. Spawning Agents
|
|
531
|
+
|
|
532
|
+
### Native Agent Teams Mode
|
|
533
|
+
|
|
534
|
+
When Agent Teams is available, use the `Teammate` and `Task` tools with team coordination.
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
// Step 1: Create the team
|
|
538
|
+
Teammate({
|
|
539
|
+
operation: "spawnTeam",
|
|
540
|
+
team_name: "feature-checkout",
|
|
541
|
+
description: "Building checkout flow across frontend, backend, and database"
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// Step 2: Spawn upstream agents (Phase 1)
|
|
545
|
+
Task({
|
|
546
|
+
team_name: "feature-checkout",
|
|
547
|
+
name: "database-agent",
|
|
548
|
+
subagent_type: "general-purpose",
|
|
549
|
+
prompt: `[DATABASE AGENT PROMPT - see template in Section 4c]`,
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
Task({
|
|
553
|
+
team_name: "feature-checkout",
|
|
554
|
+
name: "shared-types-agent",
|
|
555
|
+
subagent_type: "general-purpose",
|
|
556
|
+
prompt: `[SHARED/TYPES AGENT PROMPT]`,
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
// Step 3: Wait for Phase 1 CONTRACT_READY messages
|
|
560
|
+
// Messages are delivered automatically via SendMessage
|
|
561
|
+
|
|
562
|
+
// Step 4: Spawn downstream agents (Phase 2)
|
|
563
|
+
Task({
|
|
564
|
+
team_name: "feature-checkout",
|
|
565
|
+
name: "backend-agent",
|
|
566
|
+
subagent_type: "general-purpose",
|
|
567
|
+
prompt: `[BACKEND AGENT PROMPT - see template in Section 4b]`,
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
Task({
|
|
571
|
+
team_name: "feature-checkout",
|
|
572
|
+
name: "frontend-agent",
|
|
573
|
+
subagent_type: "general-purpose",
|
|
574
|
+
prompt: `[FRONTEND AGENT PROMPT - see template in Section 4a]`,
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
Task({
|
|
578
|
+
team_name: "feature-checkout",
|
|
579
|
+
name: "testing-agent",
|
|
580
|
+
subagent_type: "general-purpose",
|
|
581
|
+
prompt: `[TESTING AGENT PROMPT - see template in Section 4d]`,
|
|
582
|
+
});
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Subagent Fallback Mode
|
|
586
|
+
|
|
587
|
+
When Agent Teams is NOT available, use the Task tool with background execution.
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
// Spawn agents as background subagents
|
|
591
|
+
// Phase 1: upstream
|
|
592
|
+
Task({
|
|
593
|
+
subagent_type: "general-purpose",
|
|
594
|
+
prompt: `[DATABASE AGENT PROMPT]`,
|
|
595
|
+
run_in_background: true,
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
Task({
|
|
599
|
+
subagent_type: "general-purpose",
|
|
600
|
+
prompt: `[SHARED/TYPES AGENT PROMPT]`,
|
|
601
|
+
run_in_background: true,
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
// Poll for Phase 1 completion by checking file-based messages
|
|
605
|
+
// Wait until CONTRACT_READY messages appear in .specweave/state/parallel/messages/
|
|
606
|
+
|
|
607
|
+
// Phase 2: downstream
|
|
608
|
+
Task({
|
|
609
|
+
subagent_type: "general-purpose",
|
|
610
|
+
prompt: `[BACKEND AGENT PROMPT]`,
|
|
611
|
+
run_in_background: true,
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
Task({
|
|
615
|
+
subagent_type: "general-purpose",
|
|
616
|
+
prompt: `[FRONTEND AGENT PROMPT]`,
|
|
617
|
+
run_in_background: true,
|
|
618
|
+
});
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
**File-based state tracking**: Each agent writes its status to `.specweave/state/parallel/agents/{domain}.json` (fields: `domain`, `incrementId`, `status`, `tasksCompleted`, `tasksTotal`, `lastUpdate`, `fileOwnership`). The orchestrator polls these files to track progress and determine when phases complete.
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## 8. Quality Gates
|
|
626
|
+
|
|
627
|
+
Every agent MUST run quality validation before signaling completion.
|
|
628
|
+
|
|
629
|
+
### Per-Agent Quality Gate
|
|
630
|
+
|
|
631
|
+
Each agent runs `/sw:grill` as the final step before marking its work complete:
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
Agent Workflow:
|
|
635
|
+
1. Execute all assigned tasks → /sw:do or /sw:auto
|
|
636
|
+
2. Run tests for owned code
|
|
637
|
+
3. Run linter/type-check for owned code
|
|
638
|
+
4. Run /sw:grill
|
|
639
|
+
5. If /sw:grill passes → signal COMPLETION
|
|
640
|
+
6. If /sw:grill fails → fix issues, repeat from step 2
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### Orchestrator Quality Gate
|
|
644
|
+
|
|
645
|
+
After all agents complete, the orchestrator (team lead) runs a final validation:
|
|
646
|
+
|
|
647
|
+
```
|
|
648
|
+
Orchestrator Final Check:
|
|
649
|
+
1. All agents signaled COMPLETION
|
|
650
|
+
2. No unresolved BLOCKING_ISSUE messages
|
|
651
|
+
3. Run full test suite (all domains combined)
|
|
652
|
+
4. Run /sw:grill on the combined increment
|
|
653
|
+
5. If all pass → /sw:team-merge
|
|
654
|
+
6. If failures → identify owning agent, request fix
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Grill Checklist per Domain
|
|
658
|
+
|
|
659
|
+
| Domain | Grill Checks |
|
|
660
|
+
|--------|-------------|
|
|
661
|
+
| Frontend | Components render, no console errors, accessibility, responsive |
|
|
662
|
+
| Backend | API endpoints return correct status codes, validation works, error handling |
|
|
663
|
+
| Database | Migrations apply cleanly, seed data loads, rollback works |
|
|
664
|
+
| Testing | All tests pass, coverage threshold met, no flaky tests |
|
|
665
|
+
| Security | No exposed secrets, input validation, auth working |
|
|
666
|
+
| DevOps | Docker builds, CI passes, deployment config valid |
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
## 9. Workflow Summary
|
|
671
|
+
|
|
672
|
+
### Full Orchestration Flow
|
|
673
|
+
|
|
674
|
+
```
|
|
675
|
+
/sw:team-orchestrate "Build checkout flow"
|
|
676
|
+
│
|
|
677
|
+
├── Step 1: Detect mode (native Agent Teams vs subagent fallback)
|
|
678
|
+
├── Step 2: Analyze feature → identify domains
|
|
679
|
+
├── Step 3: Create per-domain increments
|
|
680
|
+
├── Step 4: Contract-first spawning
|
|
681
|
+
│ ├── Phase 1: Spawn shared + database → wait for CONTRACT_READY
|
|
682
|
+
│ └── Phase 2: Spawn backend + frontend + testing (parallel)
|
|
683
|
+
├── Step 5: Monitor progress (/sw:team-status)
|
|
684
|
+
├── Step 6: Quality gates (each agent runs /sw:grill)
|
|
685
|
+
└── Step 7: Merge and close (/sw:team-merge)
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### --dry-run Output
|
|
689
|
+
|
|
690
|
+
When `--dry-run` is specified, display the proposed plan without executing:
|
|
691
|
+
|
|
692
|
+
```
|
|
693
|
+
Team Orchestration Plan (DRY RUN)
|
|
694
|
+
==================================================
|
|
695
|
+
Feature: Build checkout flow | Mode: native-agent-teams (tmux) | Domains: 4
|
|
696
|
+
|
|
697
|
+
Phase 1 (upstream):
|
|
698
|
+
1. shared-types → sw:architect, sw:tech-lead | Increment: 0200-checkout-shared
|
|
699
|
+
2. database → sw:architect | Increment: 0201-checkout-database
|
|
700
|
+
|
|
701
|
+
Phase 2 (downstream, parallel):
|
|
702
|
+
3. backend → sw:architect, sw-infra:devops | Increment: 0202-checkout-backend
|
|
703
|
+
4. frontend → sw-frontend:frontend-architect | Increment: 0203-checkout-frontend
|
|
704
|
+
|
|
705
|
+
Max agents: 4 (2 sequential + 2 parallel)
|
|
706
|
+
To execute, run without --dry-run.
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## 10. Session State
|
|
712
|
+
|
|
713
|
+
The orchestrator records the team session to `.specweave/state/parallel/session.json`:
|
|
714
|
+
|
|
715
|
+
```json
|
|
716
|
+
{
|
|
717
|
+
"sessionId": "team-20260209-abc123",
|
|
718
|
+
"feature": "Build checkout flow",
|
|
719
|
+
"mode": "native-agent-teams",
|
|
720
|
+
"terminal": "tmux",
|
|
721
|
+
"startedAt": "2026-02-09T14:00:00Z",
|
|
722
|
+
"phases": {
|
|
723
|
+
"phase1": { "status": "completed", "agents": ["shared-types", "database"] },
|
|
724
|
+
"phase2": { "status": "in-progress", "agents": ["backend", "frontend", "testing"] }
|
|
725
|
+
},
|
|
726
|
+
"agents": [
|
|
727
|
+
{ "name": "shared-types", "domain": "shared", "incrementId": "0200-checkout-shared", "status": "completed", "fileOwnership": ["src/types/**", "src/shared/**"] },
|
|
728
|
+
{ "name": "database", "domain": "database", "incrementId": "0201-checkout-database", "status": "completed", "fileOwnership": ["prisma/**", "src/db/**"] },
|
|
729
|
+
{ "name": "backend", "domain": "backend", "incrementId": "0202-checkout-backend", "status": "running", "fileOwnership": ["src/api/**", "src/services/**"] },
|
|
730
|
+
{ "name": "frontend", "domain": "frontend", "incrementId": "0203-checkout-frontend", "status": "running", "fileOwnership": ["src/components/**", "src/pages/**"] },
|
|
731
|
+
{ "name": "testing", "domain": "testing", "incrementId": "0204-checkout-testing", "status": "running", "fileOwnership": ["tests/**", "e2e/**"] }
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## 11. Troubleshooting
|
|
739
|
+
|
|
740
|
+
| Issue | Cause | Fix |
|
|
741
|
+
|-------|-------|-----|
|
|
742
|
+
| **tmux panes hang/freeze** | Pane buffer overflow or stuck process | `tmux kill-pane -t <pane>` then re-spawn the agent; or `tmux kill-session -t <session>` to reset all |
|
|
743
|
+
| **Agent not spawning** | Missing terminal multiplexer or Agent Teams not enabled | Check `echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`; install tmux if needed; fall back to subagent mode |
|
|
744
|
+
| **Agents editing same files** | Overlapping file ownership patterns | Review ownership map in session.json; reassign conflicting files to a single owner; use `--dry-run` to validate before launch |
|
|
745
|
+
| **Token cost too high** | Too many agents or overly large prompts | Reduce `--max-agents`; use `--domains` to limit scope; split feature into smaller increments |
|
|
746
|
+
| **Agent completes but lead does not notice** | Message delivery missed (subagent mode) | Check `.specweave/state/parallel/messages/` for COMPLETION files; in native mode, messages are auto-delivered |
|
|
747
|
+
| **Contract agent takes too long** | Large schema or complex type system | Set a timeout in the agent prompt; if stuck >15 min, check agent output and consider splitting the contract work |
|
|
748
|
+
| **Phase 2 starts before Phase 1 finishes** | Race condition in subagent fallback mode | Verify CONTRACT_READY messages exist before spawning downstream; add explicit polling loop with sleep |
|
|
749
|
+
| **Session state file corrupted** | Concurrent writes from multiple agents | Use atomic file writes (write to temp, rename); or let only the orchestrator write session.json |
|
|
750
|
+
| **Agent fails mid-task** | Build error, test failure, or dependency issue | Check agent logs; fix the issue in the agent's owned files; restart the agent with `/sw:auto` on its increment |
|
|
751
|
+
| **Cannot find team session** | Session file deleted or wrong path | Check `.specweave/state/parallel/session.json`; verify the team name matches; use `/sw:team-status` to inspect |
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
## 12. Examples
|
|
756
|
+
|
|
757
|
+
### Example 1: Full-Stack Feature
|
|
758
|
+
|
|
759
|
+
```
|
|
760
|
+
User: /sw:team-orchestrate "Build user authentication with login, signup, password reset, and OAuth"
|
|
761
|
+
|
|
762
|
+
Orchestrator detects domains: shared/types, database, backend, frontend, testing, security
|
|
763
|
+
Creates 6 increments.
|
|
764
|
+
|
|
765
|
+
Phase 1:
|
|
766
|
+
- shared-types agent: Auth types (User, Session, AuthToken interfaces)
|
|
767
|
+
- database agent: User table, Session table, Prisma migrations
|
|
768
|
+
|
|
769
|
+
Phase 2 (after contracts ready):
|
|
770
|
+
- backend agent: /api/auth/login, /api/auth/signup, /api/auth/reset, OAuth flow
|
|
771
|
+
- frontend agent: LoginForm, SignupForm, ResetPasswordForm, OAuthButton
|
|
772
|
+
- testing agent: Unit tests, E2E login flow, E2E signup flow
|
|
773
|
+
- security agent: Password hashing, JWT validation, rate limiting, CSRF
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Example 2: Frontend-Only (No Dependencies)
|
|
777
|
+
|
|
778
|
+
```
|
|
779
|
+
User: /sw:team-orchestrate "Redesign dashboard" --domains frontend,testing
|
|
780
|
+
→ No upstream dependencies. Both agents spawn in parallel immediately.
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### Example 3: Dry Run
|
|
784
|
+
|
|
785
|
+
```
|
|
786
|
+
User: /sw:team-orchestrate "Add payment processing" --dry-run
|
|
787
|
+
→ Shows plan with domains, phases, file ownership. No agents spawned.
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## Related Skills
|
|
793
|
+
|
|
794
|
+
| Skill | Purpose |
|
|
795
|
+
|-------|---------|
|
|
796
|
+
| `/sw:team-status` | Show progress of all agents in the current team session |
|
|
797
|
+
| `/sw:team-merge` | Merge completed agent work in dependency order |
|
|
798
|
+
| `/sw:auto` | Autonomous execution (single-agent mode) |
|
|
799
|
+
| `/sw:architect` | System architecture and ADRs |
|
|
800
|
+
| `/sw:grill` | Quality validation gate |
|