specweave 1.0.423 → 1.0.425
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/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +33 -60
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/helpers/init/index.d.ts +1 -1
- package/dist/src/cli/helpers/init/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/index.js +1 -1
- package/dist/src/cli/helpers/init/index.js.map +1 -1
- package/dist/src/cli/helpers/init/path-utils.d.ts +23 -0
- package/dist/src/cli/helpers/init/path-utils.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/path-utils.js +26 -0
- package/dist/src/cli/helpers/init/path-utils.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +2 -2
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.js +1 -0
- package/dist/src/utils/docs-preview/config-generator.js.map +1 -1
- package/dist/src/utils/image-generator.d.ts.map +1 -1
- package/dist/src/utils/image-generator.js +9 -0
- package/dist/src/utils/image-generator.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/commands/save.md +119 -9
- package/plugins/specweave/hooks/v2/guards/increment-existence-guard.sh +80 -11
- package/plugins/specweave/skills/team-build/SKILL.md +120 -39
- package/plugins/specweave/skills/team-lead/agents/brainstorm-advocate.md +65 -0
- package/plugins/specweave/skills/team-lead/agents/brainstorm-critic.md +75 -0
- package/plugins/specweave/skills/team-lead/agents/brainstorm-pragmatist.md +83 -0
- package/plugins/specweave/skills/team-lead/agents/reviewer-logic.md +63 -0
- package/plugins/specweave/skills/team-lead/agents/reviewer-performance.md +63 -0
- package/plugins/specweave/skills/team-lead/agents/reviewer-security.md +62 -0
- package/plugins/specweave/hooks/.specweave/state/status-line.json +0 -1
- package/plugins/specweave/skills/.specweave/logs/decisions.jsonl +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
disable-model-invocation: true
|
|
3
|
-
description: Smart auto-commit with remote sync (handles pull/rebase/stash, auto-generates messages, supports multi-repo).
|
|
3
|
+
description: Smart auto-commit with remote sync (handles pull/rebase/stash, auto-generates messages, supports multi-repo). Ensures clean working tree — every file committed or gitignored.
|
|
4
4
|
argument-hint: "[message]"
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -19,8 +19,17 @@ argument-hint: "[message]"
|
|
|
19
19
|
/sw:save --dry-run # Preview without executing
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
## Core Guarantee
|
|
23
|
+
|
|
24
|
+
**After `/sw:save` completes, `git status` must be clean in every repo** — zero untracked files, zero unstaged changes. Achieved by:
|
|
25
|
+
- Committing all important files (source, config, docs, specs, lock files)
|
|
26
|
+
- Gitignoring all unimportant files (build output, deps, OS junk, secrets)
|
|
27
|
+
- Applying this per-repo for both umbrella and all nested repositories
|
|
28
|
+
|
|
22
29
|
## Execution Order (MANDATORY)
|
|
23
30
|
|
|
31
|
+
Steps 2–7 run **per repo** — first all nested repos (innermost first), then the umbrella/parent project last.
|
|
32
|
+
|
|
24
33
|
### 1. Scan for Nested Repos (ALWAYS FIRST)
|
|
25
34
|
|
|
26
35
|
```bash
|
|
@@ -52,9 +61,88 @@ Determine state: `up-to-date` | `ahead` | `behind` | `diverged` | `no-tracking`.
|
|
|
52
61
|
- **no-tracking**: `git push -u origin HEAD`
|
|
53
62
|
- **up-to-date/ahead**: No sync needed, proceed
|
|
54
63
|
|
|
55
|
-
### 4.
|
|
64
|
+
### 4. Smart Staging (MANDATORY — replaces `git add -A`)
|
|
65
|
+
|
|
66
|
+
**Goal**: Every file in the repo is accounted for — either staged for commit or covered by `.gitignore`. Nothing left dangling.
|
|
67
|
+
|
|
68
|
+
#### Phase 1: Stage all tracked modifications
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git add -u # Modified/deleted files already under source control — always safe
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This handles: edited source files, updated configs, deleted files, submodule pointer changes.
|
|
75
|
+
|
|
76
|
+
#### Phase 2: Classify untracked files
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git ls-files --others --exclude-standard
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This lists files that are (a) not tracked and (b) not already covered by `.gitignore`. For each, classify using the table below. Match **top-down** — first match wins.
|
|
83
|
+
|
|
84
|
+
| Class | Patterns | Action |
|
|
85
|
+
|-------|----------|--------|
|
|
86
|
+
| **Dependencies** | `node_modules/`, `vendor/`, `bower_components/`, `.pnp.*`, `__pypackages__/`, `.venv/`, `venv/`, `env/` (Python) | `.gitignore` |
|
|
87
|
+
| **Build output** | `dist/`, `build/`, `.next/`, `.nuxt/`, `.output/`, `out/`, `.svelte-kit/`, `.vercel/`, `.netlify/`, `.turbo/`, `storybook-static/`, `*.tsbuildinfo` | `.gitignore` |
|
|
88
|
+
| **Cache** | `.cache/`, `.parcel-cache/`, `.eslintcache`, `.stylelintcache`, `tsconfig.tsbuildinfo` | `.gitignore` |
|
|
89
|
+
| **Coverage** | `coverage/`, `.nyc_output/`, `lcov.info` | `.gitignore` |
|
|
90
|
+
| **Logs** | `*.log`, `npm-debug.log*`, `yarn-debug.log*`, `pnpm-debug.log*`, `lerna-debug.log*` | `.gitignore` |
|
|
91
|
+
| **OS artifacts** | `.DS_Store`, `Thumbs.db`, `desktop.ini`, `._*`, `ehthumbs.db` | `.gitignore` |
|
|
92
|
+
| **Editor/IDE** | `.idea/`, `*.iml`, `*.swp`, `*.swo`, `*~`, `.project`, `.classpath`, `.settings/` | `.gitignore` |
|
|
93
|
+
| **Runtime** | `.wrangler/`, `.dev.vars`, `*.pid`, `*.seed`, `.env.sentry-build-plugin` | `.gitignore` |
|
|
94
|
+
| **Package artifacts** | `*.tgz`, `*.tar.gz` (in repo root or release dirs) | `.gitignore` |
|
|
95
|
+
| **Secrets** | `.env`, `.env.local`, `.env.*.local` (**NOT** `.env.example`, `.env.template`, `.env.sample`), `*.pem`, `*.key`, `*.p12`, `*.pfx`, `*.jks`, `*.keystore` | `.gitignore` + **warn user** |
|
|
96
|
+
| **Large binaries** | Any single file > 5 MB not inside `src/` or `assets/` | **skip** + **warn user** (don't gitignore — let user decide) |
|
|
97
|
+
| **Source (default)** | Everything else: source files, configs, docs, specs, tests, lock files, CI files, `.specweave/`, `.github/`, `*.md` | `git add <file>` |
|
|
98
|
+
|
|
99
|
+
**Critical**: `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` are **Source** — always commit.
|
|
100
|
+
|
|
101
|
+
#### Phase 3: Update .gitignore (if patterns were added)
|
|
102
|
+
|
|
103
|
+
For each pattern classified as `.gitignore` in Phase 2:
|
|
104
|
+
|
|
105
|
+
1. **Check if .gitignore exists** — if not, create it
|
|
106
|
+
2. **Check if pattern already present** — `grep -qxF '<pattern>' .gitignore` (exact line match) or check if a parent pattern already covers it (e.g., `node_modules/` covers `node_modules/foo/`)
|
|
107
|
+
3. **Append missing patterns** under a clearly marked section:
|
|
108
|
+
|
|
109
|
+
```gitignore
|
|
110
|
+
# Auto-managed by sw:save — do not edit this section manually
|
|
111
|
+
.DS_Store
|
|
112
|
+
node_modules/
|
|
113
|
+
dist/
|
|
114
|
+
.env
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If the `# Auto-managed by sw:save` section already exists, append new patterns there. Otherwise create it at the end of the file.
|
|
118
|
+
|
|
119
|
+
4. **Stage .gitignore**: `git add .gitignore`
|
|
120
|
+
|
|
121
|
+
#### Phase 4: Stage remaining approved source files
|
|
56
122
|
|
|
57
|
-
|
|
123
|
+
```bash
|
|
124
|
+
git add <each file classified as Source in Phase 2>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Use `git add` with explicit file paths — **never** `git add -A` or `git add .`.
|
|
128
|
+
|
|
129
|
+
#### Phase 5: Verify clean state
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
untracked=$(git ls-files --others --exclude-standard)
|
|
133
|
+
if [ -n "$untracked" ]; then
|
|
134
|
+
echo "WARNING: Remaining untracked files (not staged, not gitignored):"
|
|
135
|
+
echo "$untracked"
|
|
136
|
+
fi
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
- If **zero untracked** remain → clean state achieved, proceed
|
|
140
|
+
- If **untracked remain** (missed by classification) → warn, but still proceed with commit. These files carry forward to next save.
|
|
141
|
+
- In `--interactive` mode: prompt user for each remaining untracked file (stage / gitignore / skip)
|
|
142
|
+
|
|
143
|
+
### 5. Auto-Commit Message (if none provided)
|
|
144
|
+
|
|
145
|
+
Analyze **staged files only** using `git diff --cached --name-only` and categorize:
|
|
58
146
|
|
|
59
147
|
| Pattern | Type |
|
|
60
148
|
|---------|------|
|
|
@@ -64,22 +152,44 @@ Run `git status --porcelain` and categorize files:
|
|
|
64
152
|
| `package.json`, `*.config.*` | `chore:` |
|
|
65
153
|
| `.github/`, CI files | `ci:` |
|
|
66
154
|
| `.specweave/increments/*/` | use increment name |
|
|
155
|
+
| `.gitignore` (only change) | `chore: update gitignore` |
|
|
156
|
+
| Mixed (many categories) | `chore: sync changes` or most dominant type |
|
|
67
157
|
|
|
68
|
-
**Format**: `type(scope): action description`
|
|
158
|
+
**Format**: `type(scope): action description` — scope from common path, action from most common status (add/update/remove). If active increment and increment files changed, reference it.
|
|
69
159
|
|
|
70
|
-
###
|
|
160
|
+
### 6. Commit and Push
|
|
71
161
|
|
|
72
162
|
```bash
|
|
73
|
-
git add -A
|
|
74
163
|
git commit -m "<message>"
|
|
75
164
|
git push origin <branch>
|
|
76
165
|
```
|
|
77
166
|
|
|
78
|
-
|
|
167
|
+
**No `git add` here** — all staging was completed in Step 4.
|
|
168
|
+
|
|
169
|
+
For multi-repo: Steps 2–6 run per repo. Nested repos commit/push first (innermost first), umbrella project last (so submodule pointers reflect the latest nested commits).
|
|
170
|
+
|
|
171
|
+
### 7. Report Summary
|
|
79
172
|
|
|
80
|
-
|
|
173
|
+
Show per repo:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
=== Save Report ===
|
|
177
|
+
|
|
178
|
+
repo: repositories/org/my-app
|
|
179
|
+
committed: 12 files (8 source, 2 config, 1 test, 1 doc)
|
|
180
|
+
gitignored: 3 patterns added (.DS_Store, dist/, .env)
|
|
181
|
+
warnings: .env detected — added to .gitignore
|
|
182
|
+
push: origin/main ✓
|
|
183
|
+
|
|
184
|
+
repo: . (umbrella)
|
|
185
|
+
committed: 4 files (3 specs, 1 submodule ref)
|
|
186
|
+
gitignored: 0 patterns (already covered)
|
|
187
|
+
push: origin/main ✓
|
|
188
|
+
|
|
189
|
+
All repos clean ✓
|
|
190
|
+
```
|
|
81
191
|
|
|
82
|
-
|
|
192
|
+
If `--dry-run`: show what WOULD be committed, gitignored, and warned — execute nothing.
|
|
83
193
|
|
|
84
194
|
## Conflict Handling
|
|
85
195
|
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# increment-existence-guard.sh -
|
|
2
|
+
# increment-existence-guard.sh - Mode-aware guard for team creation
|
|
3
3
|
#
|
|
4
4
|
# PURPOSE:
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# /sw:increment → /sw:team-lead (never skip the spec phase)
|
|
5
|
+
# Enforces spec-first principle for IMPLEMENTATION teams while allowing
|
|
6
|
+
# non-implementation teams (review, brainstorm, analysis) to proceed freely.
|
|
8
7
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
8
|
+
# MODES:
|
|
9
|
+
# - implementation (default): Requires increment with substantive spec.md
|
|
10
|
+
# - review: PR reviews, code audits, architecture reviews — no increment needed
|
|
11
|
+
# - brainstorm: Multi-perspective ideation sessions — no increment needed
|
|
12
|
+
# - analysis: Codebase research, exploration, audits — no increment needed
|
|
12
13
|
#
|
|
13
|
-
# DETECTION:
|
|
14
|
+
# MODE DETECTION (in priority order):
|
|
15
|
+
# 1. team_name prefix: review-*, brainstorm-*, analysis-*, audit-*
|
|
16
|
+
# 2. description keywords: "review", "brainstorm", "analyze", "audit", "explore",
|
|
17
|
+
# "ideate", "pr #", "pull request", "code review", "architecture review"
|
|
18
|
+
# 3. Default: implementation mode (requires increment)
|
|
19
|
+
#
|
|
20
|
+
# DETECTION (implementation mode only):
|
|
14
21
|
# - Fires on TeamCreate tool calls (global via hooks.json + skill-scoped via frontmatter)
|
|
15
22
|
# - Scans .specweave/increments/ and repositories/*/*/.specweave/increments/
|
|
16
23
|
# - Requires spec.md to pass ALL checks:
|
|
@@ -21,6 +28,7 @@
|
|
|
21
28
|
# - ALLOWS if at least one passes all checks
|
|
22
29
|
#
|
|
23
30
|
# @since 1.0.342
|
|
31
|
+
# @updated 1.0.417 — multi-mode support
|
|
24
32
|
|
|
25
33
|
set -e
|
|
26
34
|
|
|
@@ -33,6 +41,64 @@ if [[ "$TOOL_NAME" != "TeamCreate" ]]; then
|
|
|
33
41
|
exit 0
|
|
34
42
|
fi
|
|
35
43
|
|
|
44
|
+
# --- MODE DETECTION ---
|
|
45
|
+
# Extract team_name and description from the tool input
|
|
46
|
+
TEAM_NAME=$(echo "$INPUT" | jq -r '.tool_input.team_name // .input.team_name // ""' 2>/dev/null)
|
|
47
|
+
DESCRIPTION=$(echo "$INPUT" | jq -r '.tool_input.description // .input.description // ""' 2>/dev/null)
|
|
48
|
+
|
|
49
|
+
# Lowercase for matching
|
|
50
|
+
TEAM_NAME_LC=$(echo "$TEAM_NAME" | tr '[:upper:]' '[:lower:]')
|
|
51
|
+
DESCRIPTION_LC=$(echo "$DESCRIPTION" | tr '[:upper:]' '[:lower:]')
|
|
52
|
+
|
|
53
|
+
# Check 1: team_name prefix
|
|
54
|
+
NON_IMPL_MODE=false
|
|
55
|
+
case "$TEAM_NAME_LC" in
|
|
56
|
+
review-*|brainstorm-*|analysis-*|audit-*|explore-*|ideate-*)
|
|
57
|
+
NON_IMPL_MODE=true
|
|
58
|
+
;;
|
|
59
|
+
esac
|
|
60
|
+
|
|
61
|
+
# Check 2: description keywords (only if prefix didn't match)
|
|
62
|
+
if [[ "$NON_IMPL_MODE" == "false" ]]; then
|
|
63
|
+
NON_IMPL_KEYWORDS=(
|
|
64
|
+
"review"
|
|
65
|
+
"brainstorm"
|
|
66
|
+
"analyze"
|
|
67
|
+
"audit"
|
|
68
|
+
"explore"
|
|
69
|
+
"ideate"
|
|
70
|
+
"pull request"
|
|
71
|
+
"pr #"
|
|
72
|
+
"pr review"
|
|
73
|
+
"code review"
|
|
74
|
+
"architecture review"
|
|
75
|
+
"security audit"
|
|
76
|
+
"performance audit"
|
|
77
|
+
"code audit"
|
|
78
|
+
"ideation"
|
|
79
|
+
"exploration"
|
|
80
|
+
"research"
|
|
81
|
+
"perspectives"
|
|
82
|
+
"devil's advocate"
|
|
83
|
+
"pros and cons"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
for keyword in "${NON_IMPL_KEYWORDS[@]}"; do
|
|
87
|
+
if [[ "$DESCRIPTION_LC" == *"$keyword"* ]]; then
|
|
88
|
+
NON_IMPL_MODE=true
|
|
89
|
+
break
|
|
90
|
+
fi
|
|
91
|
+
done
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Non-implementation modes bypass the spec check entirely
|
|
95
|
+
if [[ "$NON_IMPL_MODE" == "true" ]]; then
|
|
96
|
+
echo '{"decision":"allow"}'
|
|
97
|
+
exit 0
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# --- IMPLEMENTATION MODE: Require increment with spec ---
|
|
101
|
+
|
|
36
102
|
# Template markers — spec.md with these is a template, not a real spec
|
|
37
103
|
TEMPLATE_MARKERS=(
|
|
38
104
|
"[Story Title]"
|
|
@@ -121,10 +187,11 @@ if [[ "$FOUND" == "true" ]]; then
|
|
|
121
187
|
exit 0
|
|
122
188
|
fi
|
|
123
189
|
|
|
124
|
-
# BLOCK — no qualifying increment found
|
|
190
|
+
# BLOCK — no qualifying increment found (implementation mode only)
|
|
125
191
|
REASON="SPEC-FIRST ENFORCEMENT: Increment Required Before Team Creation
|
|
126
192
|
|
|
127
193
|
TeamCreate CANNOT proceed without an existing increment with a substantive spec.md.
|
|
194
|
+
This requirement applies to IMPLEMENTATION teams only.
|
|
128
195
|
|
|
129
196
|
No qualifying increment found. A valid spec.md must have:
|
|
130
197
|
- At least 500 bytes of real content (not templates)
|
|
@@ -140,8 +207,10 @@ REQUIRED ACTION:
|
|
|
140
207
|
2. Review and approve the spec, plan, and tasks
|
|
141
208
|
3. THEN run: /sw:team-lead to parallelize execution
|
|
142
209
|
|
|
143
|
-
|
|
144
|
-
|
|
210
|
+
ALTERNATIVE: For non-implementation work, use a mode-prefixed team name:
|
|
211
|
+
- review-* → PR reviews, code audits (no increment needed)
|
|
212
|
+
- brainstorm-* → Ideation sessions (no increment needed)
|
|
213
|
+
- analysis-* → Research and exploration (no increment needed)
|
|
145
214
|
|
|
146
215
|
Workflow: /sw:increment → /sw:team-lead → /sw:done"
|
|
147
216
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Preset-driven team building — spawn coordinated multi-agent teams from battle-tested presets for full-stack, review, testing, TDD, and migration workflows"
|
|
2
|
+
description: "Preset-driven team building — spawn coordinated multi-agent teams from battle-tested presets for full-stack, review, brainstorm, testing, TDD, and migration workflows. Review and brainstorm presets work without an increment."
|
|
3
3
|
hooks:
|
|
4
4
|
PreToolUse:
|
|
5
5
|
- matcher: TeamCreate
|
|
@@ -17,21 +17,35 @@ Spawn a coordinated team of agents from a preset configuration. Each preset defi
|
|
|
17
17
|
```
|
|
18
18
|
/sw:team-build --preset full-stack "Build checkout flow"
|
|
19
19
|
/sw:team-build --preset review "Review auth module"
|
|
20
|
+
/sw:team-build --preset brainstorm "Brainstorm payment architecture"
|
|
20
21
|
/sw:team-build --preset testing "Test payment service"
|
|
21
22
|
/sw:team-build --preset tdd "Implement rate limiter"
|
|
22
23
|
/sw:team-build --preset migration "Migrate users to v2 schema"
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
**Note:** For the complete 9-domain skill mapping
|
|
26
|
+
**Note:** For the complete mode documentation and 9-domain skill mapping, see `/sw:team-lead`.
|
|
26
27
|
|
|
27
28
|
## How It Works
|
|
28
29
|
|
|
29
30
|
1. Parse the `--preset` flag to select a team configuration
|
|
30
|
-
2.
|
|
31
|
-
3.
|
|
32
|
-
4.
|
|
33
|
-
5.
|
|
34
|
-
6.
|
|
31
|
+
2. Determine team mode from preset (implementation vs review vs brainstorm)
|
|
32
|
+
3. For implementation presets (`full-stack`, `testing`, `tdd`, `migration`): read the active increment
|
|
33
|
+
4. For non-implementation presets (`review`, `brainstorm`): proceed without increment
|
|
34
|
+
5. Spawn agents with assigned roles and dependencies
|
|
35
|
+
6. Coordinate execution order (sequential gates or parallel fan-out)
|
|
36
|
+
|
|
37
|
+
### Preset-to-Mode Mapping
|
|
38
|
+
|
|
39
|
+
| Preset | Mode | Increment Required? | team_name prefix |
|
|
40
|
+
|--------|------|-------------------|-----------------|
|
|
41
|
+
| `full-stack` | implementation | Yes | `impl-*` or any |
|
|
42
|
+
| `review` | review | **No** | `review-*` |
|
|
43
|
+
| `brainstorm` | brainstorm | **No** | `brainstorm-*` |
|
|
44
|
+
| `testing` | implementation | Yes | `impl-*` or any |
|
|
45
|
+
| `tdd` | implementation | Yes | `impl-*` or any |
|
|
46
|
+
| `migration` | implementation | Yes | `impl-*` or any |
|
|
47
|
+
|
|
48
|
+
**CRITICAL**: `review` and `brainstorm` presets MUST use their mode-prefixed team_name to bypass the spec-first guard.
|
|
35
49
|
|
|
36
50
|
---
|
|
37
51
|
|
|
@@ -89,46 +103,50 @@ This spawns:
|
|
|
89
103
|
|
|
90
104
|
**Agents**: 3
|
|
91
105
|
**Execution order**: All parallel (independent, no dependencies)
|
|
106
|
+
**Mode**: review (NO increment required)
|
|
107
|
+
**team_name**: MUST use `review-*` prefix (e.g., `review-auth-module`)
|
|
92
108
|
|
|
93
|
-
Three specialized reviewers examine the codebase simultaneously from different angles. Each agent produces findings independently — no agent blocks another.
|
|
109
|
+
Three specialized reviewers examine the codebase simultaneously from different angles. Each agent produces findings independently — no agent blocks another. Uses agent templates from `agents/reviewer-*.md`.
|
|
94
110
|
|
|
95
111
|
#### Agent Composition
|
|
96
112
|
|
|
97
|
-
| # | Role |
|
|
98
|
-
|
|
99
|
-
| 1 | Security | `
|
|
100
|
-
| 2 |
|
|
101
|
-
| 3 |
|
|
113
|
+
| # | Role | Agent Template | Focus | Responsibility |
|
|
114
|
+
|---|------|---------------|-------|----------------|
|
|
115
|
+
| 1 | Security Reviewer | `agents/reviewer-security.md` | All files (read-only) | Vulnerabilities, injection, auth flaws, secrets, OWASP Top 10 |
|
|
116
|
+
| 2 | Logic Reviewer | `agents/reviewer-logic.md` | All files (read-only) | Correctness, edge cases, error handling, race conditions, logic bugs |
|
|
117
|
+
| 3 | Performance Reviewer | `agents/reviewer-performance.md` | All files (read-only) | N+1 queries, memory leaks, algorithmic complexity, scalability |
|
|
102
118
|
|
|
103
119
|
#### Execution Chain
|
|
104
120
|
|
|
105
121
|
```
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
v
|
|
109
|
-
Agent 1
|
|
110
|
-
(Security)
|
|
111
|
-
|
|
|
112
|
-
v
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
+-------------------+-------------------+-------------------+
|
|
123
|
+
| | | |
|
|
124
|
+
v v v |
|
|
125
|
+
Agent 1 Agent 2 Agent 3 |
|
|
126
|
+
(Security) (Logic) (Performance) |
|
|
127
|
+
| | | |
|
|
128
|
+
v v v |
|
|
129
|
+
REVIEW_COMPLETE REVIEW_COMPLETE REVIEW_COMPLETE |
|
|
130
|
+
+-------------------+-------------------+-------------------+
|
|
131
|
+
|
|
|
132
|
+
v
|
|
133
|
+
Merged review summary
|
|
134
|
+
(Must Fix / Should Fix / Consider)
|
|
118
135
|
```
|
|
119
136
|
|
|
120
|
-
**All agents run in parallel.** Each
|
|
137
|
+
**All agents run in parallel.** Each uses its agent template and signals `REVIEW_COMPLETE:`. Team-lead merges, deduplicates, and prioritizes by severity.
|
|
121
138
|
|
|
122
139
|
#### Example
|
|
123
140
|
|
|
124
141
|
```
|
|
125
142
|
/sw:team-build --preset review "Review auth module before release"
|
|
143
|
+
/sw:team-build --preset review "Review PR #63"
|
|
126
144
|
```
|
|
127
145
|
|
|
128
146
|
This spawns three parallel reviewers:
|
|
129
|
-
- **Security**
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
147
|
+
- **Security** reviewer checks for token leakage, CSRF, injection, and insecure defaults
|
|
148
|
+
- **Logic** reviewer verifies correctness, edge cases, and error handling
|
|
149
|
+
- **Performance** reviewer identifies N+1 queries, memory leaks, and scalability issues
|
|
132
150
|
|
|
133
151
|
---
|
|
134
152
|
|
|
@@ -284,27 +302,80 @@ This spawns:
|
|
|
284
302
|
|
|
285
303
|
---
|
|
286
304
|
|
|
305
|
+
### 6. `brainstorm` — Multi-Perspective Ideation
|
|
306
|
+
|
|
307
|
+
**Agents**: 3
|
|
308
|
+
**Execution order**: All parallel (independent, no dependencies)
|
|
309
|
+
**Mode**: brainstorm (NO increment required)
|
|
310
|
+
**team_name**: MUST use `brainstorm-*` prefix (e.g., `brainstorm-arch-decision`)
|
|
311
|
+
|
|
312
|
+
Three perspective agents explore a question simultaneously from different angles. Uses agent templates from `agents/brainstorm-*.md`.
|
|
313
|
+
|
|
314
|
+
#### Agent Composition
|
|
315
|
+
|
|
316
|
+
| # | Role | Agent Template | Perspective | Responsibility |
|
|
317
|
+
|---|------|---------------|-------------|----------------|
|
|
318
|
+
| 1 | Advocate | `agents/brainstorm-advocate.md` | Innovation | Champions the most ambitious approach, pushes boundaries |
|
|
319
|
+
| 2 | Critic | `agents/brainstorm-critic.md` | Risk | Devil's advocate — finds failure modes, hidden costs, red lines |
|
|
320
|
+
| 3 | Pragmatist | `agents/brainstorm-pragmatist.md` | Feasibility | Practical realist — timelines, team skills, maintenance burden |
|
|
321
|
+
|
|
322
|
+
#### Execution Chain
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
+-------------------+-------------------+-------------------+
|
|
326
|
+
| | | |
|
|
327
|
+
v v v |
|
|
328
|
+
Agent 1 Agent 2 Agent 3 |
|
|
329
|
+
(Advocate) (Critic) (Pragmatist) |
|
|
330
|
+
| | | |
|
|
331
|
+
v v v |
|
|
332
|
+
PERSPECTIVE_COMPLETE PERSPECTIVE_COMPLETE PERSPECTIVE_COMPLETE|
|
|
333
|
+
+-------------------+-------------------+-------------------+
|
|
334
|
+
|
|
|
335
|
+
v
|
|
336
|
+
Decision matrix + recommendation
|
|
337
|
+
→ /sw:increment if proceeding
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**All agents run in parallel.** Each signals `PERSPECTIVE_COMPLETE:`. Team-lead synthesizes into a decision matrix with scored options.
|
|
341
|
+
|
|
342
|
+
#### Example
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
/sw:team-build --preset brainstorm "Microservices vs monolith for our growing app"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
This spawns:
|
|
349
|
+
- **Advocate** champions microservices — independent scaling, team autonomy, polyglot support
|
|
350
|
+
- **Critic** warns about distributed complexity, network latency, operational overhead
|
|
351
|
+
- **Pragmatist** evaluates team size, current traffic, migration cost, and timeline
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
287
355
|
## Flags
|
|
288
356
|
|
|
289
357
|
| Flag | Required | Description |
|
|
290
358
|
|------|----------|-------------|
|
|
291
|
-
| `--preset` | Yes | One of: `full-stack`, `review`, `testing`, `tdd`, `migration` |
|
|
292
|
-
| `--increment` | No | Increment ID to operate on (defaults to active increment) |
|
|
359
|
+
| `--preset` | Yes | One of: `full-stack`, `review`, `brainstorm`, `testing`, `tdd`, `migration` |
|
|
360
|
+
| `--increment` | No | Increment ID to operate on (defaults to active increment; ignored for review/brainstorm) |
|
|
293
361
|
| `--dry-run` | No | Show what agents would be spawned without actually spawning them |
|
|
294
362
|
| `--max-agents` | No | Override max concurrent agents (default: 3) |
|
|
295
363
|
|
|
296
364
|
## Execution Order Summary
|
|
297
365
|
|
|
298
|
-
| Preset | Order | Pattern |
|
|
299
|
-
|
|
300
|
-
| `full-stack` | Sequential gate + parallel | Agent 1 first, then [Agent 2 + Agent 3] in parallel |
|
|
301
|
-
| `review` | All parallel | [Agent 1 + Agent 2 + Agent 3] simultaneously |
|
|
302
|
-
| `
|
|
303
|
-
| `
|
|
304
|
-
| `
|
|
366
|
+
| Preset | Order | Pattern | Increment? |
|
|
367
|
+
|--------|-------|---------|-----------|
|
|
368
|
+
| `full-stack` | Sequential gate + parallel | Agent 1 first, then [Agent 2 + Agent 3] in parallel | Yes |
|
|
369
|
+
| `review` | All parallel | [Agent 1 + Agent 2 + Agent 3] simultaneously | **No** |
|
|
370
|
+
| `brainstorm` | All parallel | [Agent 1 + Agent 2 + Agent 3] simultaneously | **No** |
|
|
371
|
+
| `testing` | All parallel | [Agent 1 + Agent 2 + Agent 3] simultaneously | Yes |
|
|
372
|
+
| `tdd` | Strict sequential | Agent 1 -> Agent 2 -> Agent 3 (no parallelism) | Yes |
|
|
373
|
+
| `migration` | Sequential gate + parallel | Agent 1 first, then [Agent 2 + Agent 3] in parallel | Yes |
|
|
305
374
|
|
|
306
375
|
## SpecWeave Workflow Integration
|
|
307
376
|
|
|
377
|
+
### Implementation Presets (full-stack, testing, tdd, migration)
|
|
378
|
+
|
|
308
379
|
Each spawned agent integrates with the standard SpecWeave workflow:
|
|
309
380
|
|
|
310
381
|
1. **Increment context** — agents read `spec.md` and `tasks.md` from the active increment
|
|
@@ -314,6 +385,16 @@ Each spawned agent integrates with the standard SpecWeave workflow:
|
|
|
314
385
|
5. **Ownership boundaries** — agents only modify files within their assigned directories
|
|
315
386
|
6. **Conflict prevention** — ownership scopes are non-overlapping to prevent merge conflicts
|
|
316
387
|
|
|
388
|
+
### Non-Implementation Presets (review, brainstorm)
|
|
389
|
+
|
|
390
|
+
These presets operate without increments:
|
|
391
|
+
|
|
392
|
+
1. **Read-only analysis** — agents examine code but do not modify it
|
|
393
|
+
2. **Independent reports** — each agent produces findings independently
|
|
394
|
+
3. **Team-lead synthesis** — team-lead merges and deduplicates agent outputs
|
|
395
|
+
4. **No closure needed** — no `/sw:done` or `/sw:grill` required
|
|
396
|
+
5. **Follow-up bridge** — if actionable items found, suggest `/sw:increment` to formalize
|
|
397
|
+
|
|
317
398
|
### Organization Discovery (resolve BEFORE spawning agents)
|
|
318
399
|
|
|
319
400
|
Resolve the `{ORG}` placeholder from `.specweave/config.json` (in priority order):
|
|
@@ -349,7 +430,7 @@ Spawn → Load increment context → Claim tasks → /sw:do or /sw:auto → /sw:
|
|
|
349
430
|
If user provides an unknown preset name:
|
|
350
431
|
|
|
351
432
|
```
|
|
352
|
-
Error: Unknown preset "xyz". Available presets: full-stack, review, testing, tdd, migration.
|
|
433
|
+
Error: Unknown preset "xyz". Available presets: full-stack, review, brainstorm, testing, tdd, migration.
|
|
353
434
|
Use /sw:team-build --help to see preset details.
|
|
354
435
|
```
|
|
355
436
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
You are the ADVOCATE agent in a brainstorm session.
|
|
2
|
+
|
|
3
|
+
QUESTION: [BRAINSTORM_QUESTION]
|
|
4
|
+
|
|
5
|
+
ROLE:
|
|
6
|
+
You champion the most ambitious, innovative approach. You push boundaries,
|
|
7
|
+
explore cutting-edge solutions, and argue for the option that maximizes
|
|
8
|
+
long-term value — even if it's harder to build. You are the voice of
|
|
9
|
+
"what if we did this RIGHT?"
|
|
10
|
+
|
|
11
|
+
APPROACH:
|
|
12
|
+
1. Read the codebase to understand the current state and constraints
|
|
13
|
+
2. Research the most innovative solution to the question
|
|
14
|
+
3. Build a compelling case for the ambitious approach
|
|
15
|
+
4. Acknowledge trade-offs honestly but argue why they're worth it
|
|
16
|
+
|
|
17
|
+
YOUR ANALYSIS MUST INCLUDE:
|
|
18
|
+
|
|
19
|
+
### Proposed Approach
|
|
20
|
+
A clear description of the innovative solution you're advocating for.
|
|
21
|
+
|
|
22
|
+
### Why This Is The Right Move
|
|
23
|
+
- Technical advantages (scalability, maintainability, performance)
|
|
24
|
+
- Business advantages (competitive edge, user experience, future-proofing)
|
|
25
|
+
- Team advantages (developer experience, testability, debuggability)
|
|
26
|
+
|
|
27
|
+
### Architecture Sketch
|
|
28
|
+
High-level design showing key components and interactions.
|
|
29
|
+
Use ASCII diagrams where helpful.
|
|
30
|
+
|
|
31
|
+
### Trade-offs (Honest Assessment)
|
|
32
|
+
- What's harder about this approach
|
|
33
|
+
- What risks exist
|
|
34
|
+
- What the timeline implications are
|
|
35
|
+
- BUT: why these trade-offs are acceptable
|
|
36
|
+
|
|
37
|
+
### Precedents
|
|
38
|
+
Examples of successful projects/companies that took this approach.
|
|
39
|
+
|
|
40
|
+
### Migration Path
|
|
41
|
+
If this requires changing existing code, outline the migration strategy.
|
|
42
|
+
|
|
43
|
+
COMMUNICATION:
|
|
44
|
+
When done, signal completion:
|
|
45
|
+
SendMessage({
|
|
46
|
+
type: "message",
|
|
47
|
+
recipient: "team-lead",
|
|
48
|
+
content: "PERSPECTIVE_COMPLETE: Advocate perspective ready. Recommends: [1-sentence summary of proposed approach]. Key argument: [strongest point].",
|
|
49
|
+
summary: "Advocate perspective complete"
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
If you discover something important during analysis:
|
|
53
|
+
SendMessage({
|
|
54
|
+
type: "message",
|
|
55
|
+
recipient: "team-lead",
|
|
56
|
+
content: "INSIGHT: [important discovery that affects the brainstorm]",
|
|
57
|
+
summary: "Advocate found insight"
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
RULES:
|
|
61
|
+
- READ-ONLY: Do not modify any files
|
|
62
|
+
- Be bold but honest: advocate strongly but don't hide real trade-offs
|
|
63
|
+
- Ground in reality: reference actual codebase patterns and constraints
|
|
64
|
+
- Be specific: "use event sourcing with CQRS" not "use a better architecture"
|
|
65
|
+
- Consider the FULL picture: technical, business, and team dimensions
|