viepilot 3.7.3 → 3.9.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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [3.9.0] - 2026-05-24
13
+
14
+ ### Changed
15
+ - ENH-099: skills/vp-auto/SKILL.md — Claude Code adapter tool section expanded with 8 new
16
+ tools: Monitor, CronCreate/Delete/List, EnterWorktree/ExitWorktree, LSP, PushNotification,
17
+ EnterPlanMode/ExitPlanMode (sourced from official tools-reference, May 2026)
18
+ - ENH-099: workflows/autonomous.md — TodoWrite deprecated references replaced with
19
+ TaskCreate/TaskList (disabled since Claude Code v2.1.142); Monitor quality-gate pattern
20
+ and PushNotification phase-complete notification added
21
+ - ENH-099: docs/dev/agents.md — full 28-event hooks inventory table added; Agent Teams
22
+ experimental section (TeamCreate, TeamDelete, SendMessage) documented
23
+
24
+ ---
25
+
26
+ ## [3.8.0] - 2026-05-24
27
+
28
+ ### Added
29
+ - ENH-098: vp-brainstorm Stakeholder Generation Gate — AI infers domain-appropriate stakeholders
30
+ at end of session, creates `.claude/agents/{project-slug}-{role}.md` agent files (haiku-4-5, Read-only)
31
+ - ENH-098: vp-crystallize Step 1G Stakeholder Review Gate — parallel fan-out of all project
32
+ stakeholder agents, gap analysis synthesis (Gaps/Risks/Suggestions), enriches PROJECT-CONTEXT.md
33
+ before ROADMAP generation; skippable with `--no-stakeholders`
34
+ - `templates/stakeholder-agent.md` — canonical template for generated stakeholder agent files
35
+
36
+ ---
37
+
12
38
  ## [3.7.3] - 2026-05-23
13
39
 
14
40
  ### Documentation
package/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  **Autonomous Vibe Coding Framework / Bộ khung phát triển tự động có kiểm soát**
4
4
 
5
- [![Version](https://img.shields.io/badge/version-3.7.3-blue.svg)](CHANGELOG.md)
5
+ [![Version](https://img.shields.io/badge/version-3.8.0-blue.svg)](CHANGELOG.md)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
7
  [![Skills](https://img.shields.io/badge/skills-21-purple.svg)](#skills-reference)
8
8
  [![Workflows](https://img.shields.io/badge/workflows-14-orange.svg)](#workflows)
9
- [![Templates](https://img.shields.io/badge/templates-17-cyan.svg)](#templates)
9
+ [![Templates](https://img.shields.io/badge/templates-18-cyan.svg)](#templates)
10
10
  [![Tests](https://img.shields.io/badge/tests-2210%20passing-brightgreen.svg)](tests/)
11
11
  [![GitHub](https://img.shields.io/github/stars/0-CODE/viepilot?style=social)](https://github.com/0-CODE/viepilot)
12
12
 
13
- **Version**: `3.7.3` — tracked in `package.json`, `CHANGELOG.md`, and `.viepilot/TRACKER.md`.
13
+ **Version**: `3.8.0` — tracked in `package.json`, `CHANGELOG.md`, and `.viepilot/TRACKER.md`.
14
14
 
15
15
  ViePilot là bộ skill framework cho phép AI assistant (Claude, GPT, etc.) phát triển dự án một cách **tự động**, **có kiểm soát**, và **có thể khôi phục**. Thiết kế theo các tiêu chuẩn chuyên nghiệp: Semantic Versioning, Conventional Commits, Keep a Changelog.
16
16
 
@@ -31,7 +31,7 @@ Nếu ViePilot giúp ích cho bạn, bạn có thể ủng hộ một ly cafe:
31
31
  | Total LOC | **~94,739+** (`.md`, `.js`, `.cjs`, `.yml`, `.json`, `.sh`; không gồm `node_modules`) |
32
32
  | Skills | **21** |
33
33
  | Workflows | **14** |
34
- | Templates | **17** (Project: 12, Phase: 5) |
34
+ | Templates | **18** (Project: 13, Phase: 5) |
35
35
  | CLI Commands | **18** (`vp-tools` 17 subcommands + `viepilot` installer) |
36
36
  | Tests | **2210** (111 suites: unit + integration + AI compat + README metrics + UI direction + ENH contracts + scope policy + FEAT-009/010/011/012/013/015 + ENH-021~037 routing/language/architect/adapter + BUG-009~013 guards + viepilot-info/update/install/adapters) |
37
37
  | ViePilot phases (local `.viepilot`) | **142** phase cycles — **v3.7.x** ENH-095~097 orchestrator delegation; **v3.0.0** M3.0 Per-Adapter Intelligence; **v2.4.0** FEAT-015 Codex; **v2.0.0** FEAT-013 dynamic adapters; xem `CHANGELOG.md` |
@@ -167,6 +167,7 @@ Tổng thể / Overall: ██████████████████
167
167
  | `CONTRIBUTING.md` | Contribution guidelines |
168
168
  | `CONTRIBUTORS.md` | Attribution list |
169
169
  | `README.md` | Professional README template |
170
+ | `stakeholder-agent.md` | Agent template for stakeholder reviews (generated by vp-brainstorm Step S2) |
170
171
 
171
172
  ### Phase Templates (5)
172
173
 
@@ -139,3 +139,85 @@ describes the exact steps — follow them as a scoped sub-prompt.
139
139
  - File: `agents/{name}-agent.md` (kebab-case, always ends in `-agent`)
140
140
  - Reference: `{name}-agent` (e.g., `tracker-agent`, not `tracker`)
141
141
  - Invocation: `Load agents/{name}-agent.md for full spec.`
142
+
143
+ ## Hook Events Reference (ENH-099)
144
+
145
+ Complete list of 28 hook events supported in Claude Code (as of May 2026).
146
+ Source: [code.claude.com/docs/en/hooks](https://code.claude.com/docs/en/hooks)
147
+
148
+ | Hook | Fires When | Blocking | Key ViePilot Use |
149
+ |------|-----------|---------|-----------------|
150
+ | `SessionStart` | Session begins/resumes | No | Inject context, set env, watch paths |
151
+ | `SessionEnd` | Session terminates | No | Cleanup, logging |
152
+ | `UserPromptSubmit` | User submits prompt | Yes | Block/augment prompts; set session title |
153
+ | `UserPromptExpansion` | Slash command expands | Yes | Audit `/vp-*` invocations |
154
+ | `PreToolUse` | Before any tool executes | Yes | Block destructive commands, log ops |
155
+ | `PostToolUse` | After tool succeeds | No | Validate output, add context |
156
+ | `PostToolUseFailure` | After tool fails | No | Log failures |
157
+ | `PostToolBatch` | After parallel tools resolve | Yes | Validate parallel fan-out batch results |
158
+ | `PermissionRequest` | Permission dialog appears | Yes | Auto-approve known safe patterns |
159
+ | `PermissionDenied` | Tool call denied | No | Signal retry allowed |
160
+ | `Stop` | Claude finishes responding | Yes | Continue autonomous loop without re-prompt |
161
+ | `StopFailure` | Turn ends due to API error | No | Error logging |
162
+ | `Notification` | Claude Code sends notification | No | Desktop notification / terminal bell |
163
+ | `SubagentStart` | Subagent spawned | No | Log agent start, inject context |
164
+ | `SubagentStop` | Subagent finishes | Yes | Block premature stop, collect output |
165
+ | `TaskCreated` | TaskCreate tool used | Yes | Enforce naming conventions |
166
+ | `TaskCompleted` | Task marked complete | Yes | Trigger quality gate automatically |
167
+ | `TeammateIdle` | Agent team teammate idle | Yes | Keep agent alive / assign next task |
168
+ | `CwdChanged` | Working directory changes | No | Reactive env setup (direnv) |
169
+ | `FileChanged` | Watched file changes | No | React to test/code file saves |
170
+ | `ConfigChange` | Config file changes | Yes | Block unexpected config changes |
171
+ | `WorktreeCreate` | Worktree being created | Yes | Custom worktree setup |
172
+ | `WorktreeRemove` | Worktree being removed | No | Cleanup |
173
+ | `PreCompact` | Before context compaction | Yes | Block compaction during critical phase steps |
174
+ | `PostCompact` | After compaction completes | No | Re-inject phase context |
175
+ | `Setup` | `--init-only` / `-p --init` | No | One-time dependency installation |
176
+ | `InstructionsLoaded` | CLAUDE.md / rules loaded | No | Audit logging |
177
+ | `Elicitation` | MCP server requests user input | Yes | Auto-respond to MCP prompts |
178
+
179
+ ### Exit code behavior
180
+ - **Exit 0**: success; JSON output processed
181
+ - **Exit 2**: blocking error; stderr shown, event blocked
182
+ - **Other non-zero**: non-blocking; first line of stderr shown
183
+
184
+ ### Most impactful hooks for ViePilot autonomous runs
185
+ - `TaskCreated` + `TaskCompleted` → hook-driven quality gates (no manual trigger needed)
186
+ - `PreCompact` + `PostCompact` → protect long phases from mid-run context loss
187
+ - `SubagentStart` + `SubagentStop` → trace agent orchestration
188
+ - `Stop` → enables fully autonomous `/vp-auto` without re-prompting
189
+ - `PostToolBatch` → validate parallel fan-out results (ENH-096/097 pattern)
190
+
191
+ ## Agent Teams (Experimental)
192
+
193
+ Agent Teams allow multiple Claude Code sessions to communicate via message passing.
194
+ Requires: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` environment variable.
195
+
196
+ ### Tools
197
+
198
+ | Tool | Description |
199
+ |------|-------------|
200
+ | `TeamCreate` | Create a named team with multiple teammate sessions |
201
+ | `TeamDelete` | Disband team and clean up all teammate processes |
202
+ | `SendMessage` | Send a message to a teammate by name, or resume a stopped subagent |
203
+
204
+ ### Architecture
205
+
206
+ ```
207
+ TeamCreate → defines lead + teammates
208
+ TeamLead → assigns tasks via SendMessage
209
+ Teammates → work independently, respond via SendMessage back to lead
210
+ TeamDelete → cleanup after all work complete
211
+ ```
212
+
213
+ ### ViePilot roadmap
214
+
215
+ Agent Teams represent a future upgrade path for the vp-auto orchestration model (ENH-096/097).
216
+ Currently, vp-auto uses fire-and-forget `Agent` spawning (no back-and-forth). Agent Teams
217
+ would enable:
218
+ - Lead orchestrator assigns tasks AND receives status updates
219
+ - Teammates can ask questions mid-task
220
+ - Better handling of inter-task dependency resolution
221
+
222
+ **Status**: experimental — requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`.
223
+ Not yet used in ViePilot workflows. Tracked via ENH-099.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viepilot",
3
- "version": "3.7.3",
3
+ "version": "3.9.0",
4
4
  "description": "**Autonomous Vibe Coding Framework / Bộ khung phát triển tự động có kiểm soát**",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -67,6 +67,22 @@ Use Claude Code tools: `Bash` (shell), `Read` (file), `Edit` + `Write` (file wri
67
67
  `Agent` (spawn subagent — multi-level nesting supported)
68
68
  Interactive: `AskUserQuestion` (deferred — preload via ToolSearch before first call)
69
69
 
70
+ **Additional tools (ENH-099):**
71
+ - `Monitor` — run command in background, each output line fed back to Claude; use for
72
+ `npm test --watchAll=false`, dev server tail, CI polling mid-conversation
73
+ - `CronCreate` / `CronDelete` / `CronList` — in-session scheduled prompts (survive
74
+ `--resume`); use for periodic quality checks during long autonomous phases
75
+ - `EnterWorktree` / `ExitWorktree` — isolated git worktree per task; auto-cleanup on
76
+ exit if no changes; use for parallel task execution without branch conflicts
77
+ (not available to subagents)
78
+ - `LSP` — code intelligence: type errors after each edit, jump to definition, find
79
+ references; requires code intelligence plugin; replaces post-edit `tsc --noEmit`
80
+ - `PushNotification` — desktop + phone push on phase complete or control-point pause
81
+ (Anthropic infra only; not available on Bedrock/Vertex)
82
+ - `EnterPlanMode` / `ExitPlanMode` — plan gate before implementation: EnterPlanMode
83
+ switches to read-only planning; ExitPlanMode presents plan for approval before any
84
+ file edits are made
85
+
70
86
  ## D. Subagent Spawning
71
87
  Use `Agent` tool for subagent dispatch. For parallel task execution: fan-out with multiple
72
88
  `Agent` calls per cluster (see ADAPTER_CONTEXT.orchestration — claude-code supports parallel: true).
@@ -201,6 +201,7 @@ Optional flags:
201
201
  - `--research` : Enable proactive research suggestions during the session
202
202
  - `--ui` : Enable UI Direction mode (live HTML/CSS direction artifacts + auto-generates `design.md` when design keywords present — ENH-076)
203
203
  - `--domain embedded` : Force-activate Embedded Domain Mode (hardware topology, RTOS, pin map, memory layout, protocol matrix, power budget pages + topic probes)
204
+ - `--no-stakeholders` : Skip stakeholder agent generation at session end
204
205
 
205
206
  ### Reference URL Input (ENH-092)
206
207
 
@@ -279,6 +280,11 @@ Key steps:
279
280
  9. Before completing the session: **step 5 — Project meta intake (FEAT-009)** in `workflows/brainstorm.md` when binding is missing; sequential Q&A + profile-map disambiguation + write global profile + `.viepilot/META.md`
280
281
  10. Save session with structured format (including **`## Project meta intake (FEAT-009)`**, research notes + UI direction references + **`## Phases`**)
281
282
  11. Suggest next action: `/vp-crystallize`
283
+
284
+ **Stakeholder Generation (ENH-098):**
285
+ At session end (scope locked), automatically infers project stakeholders from the domain and
286
+ creates `.claude/agents/{project-slug}-{role}.md` agent files. These are consumed by
287
+ `/vp-crystallize` Step 1G for parallel context review. Skip with `--no-stakeholders`.
282
288
  </process>
283
289
 
284
290
  <success_criteria>
@@ -58,6 +58,9 @@ Silent if command unavailable or errors.
58
58
  - Skill được gọi khi user mention `vp-crystallize`, `/vp-crystallize`, hoặc "crystallize", "setup project"
59
59
  - Treat all user text after the skill mention as `{{VP_ARGS}}`
60
60
 
61
+ **Flags:**
62
+ - `--no-stakeholders` : Skip the Step 1G Stakeholder Review Gate (ENH-098)
63
+
61
64
  ## B. User Prompting
62
65
  Prompt user conversationally with numbered list options.
63
66
 
@@ -434,3 +437,14 @@ and injects skill best practices per task without re-prompting.
434
437
  Install skills: `vp-tools install-skill <source>`
435
438
  Registry: `vp-tools scan-skills`
436
439
  Docs: `docs/user/features/skill-registry.md`
440
+
441
+ ### Step 1F — Cross-Reference Gate
442
+
443
+ Validates coverage matrix when both Architect and UI Direction workspaces are present.
444
+ Warns on Phase 1 features with no architect OR UI coverage (non-blocking).
445
+
446
+ ### Step 1G — Stakeholder Review Gate (ENH-098)
447
+
448
+ After scope lock, spawns `.claude/agents/` stakeholder agents in parallel fan-out,
449
+ collects gap analysis (Gaps/Risks/Suggestions), synthesizes feedback to enrich
450
+ PROJECT-CONTEXT.md before ROADMAP generation. Can be skipped with `--no-stakeholders` flag.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: {{project_slug}}-{{role_slug}}
3
+ description: >
4
+ Stakeholder reviewer for {{PROJECT_NAME}}. Reviews the project context document
5
+ from the perspective of a {{ROLE_TITLE}}. Returns a structured gap analysis
6
+ (Gaps / Risks / Suggestions) to enrich PROJECT-CONTEXT.md.
7
+ model: claude-haiku-4-5
8
+ tools:
9
+ - Read
10
+ ---
11
+
12
+ You are a **{{ROLE_TITLE}}** reviewing the initial project definition for **{{PROJECT_NAME}}**.
13
+
14
+ ## Your Perspective
15
+
16
+ {{ROLE_DESCRIPTION}}
17
+
18
+ ## What You Care About
19
+
20
+ {{ROLE_CONCERNS}}
21
+
22
+ ## Your Task
23
+
24
+ Read the project context file at `.viepilot/PROJECT-CONTEXT.md`.
25
+
26
+ Evaluate it from your professional perspective and return a structured review:
27
+
28
+ ### Gaps
29
+
30
+ List definitions, sections, or decisions that are vague, missing, or contradictory
31
+ from your point of view.
32
+
33
+ *(Maximum 5 items. One sentence each.)*
34
+
35
+ ### Risks
36
+
37
+ List concerns, assumptions, or red flags that could cause problems during execution
38
+ or deployment.
39
+
40
+ *(Maximum 5 items. One sentence each.)*
41
+
42
+ ### Suggestions
43
+
44
+ List specific additions, clarifications, or reframings that would make the project
45
+ context more complete and actionable from your perspective.
46
+
47
+ *(Maximum 5 items. One sentence each.)*
48
+
49
+ ---
50
+
51
+ > Return ONLY the structured review above. Do not summarize the project or ask questions.
@@ -259,7 +259,7 @@ ELSE:
259
259
 
260
260
  **Agent Teams mode** (when `ADAPTER_CONTEXT.orchestration.teams == true` AND pending task count ≥ 8):
261
261
  - Set `TEAMS_MODE = true`
262
- - Activate shared TodoWrite task list for teammate coordination
262
+ - Activate shared TaskCreate/TaskList task list for teammate coordination
263
263
  - Each Agent worker reads from the shared list rather than receiving an explicit task prompt
264
264
 
265
265
  #### 3b-orch: Orchestrator Fan-out (Claude Code only)
@@ -342,7 +342,7 @@ On `QUALITY_GATE: FAIL` or `PARTIAL` → route to control point (retry cluster /
342
342
  On `QUALITY_GATE: PASS` → update PHASE-STATE.md (all cluster tasks → done), update TRACKER.md, continue.
343
343
 
344
344
  **Teams mode** (when `TEAMS_MODE == true`):
345
- - Write all pending task IDs to shared `TodoWrite` list at phase start
345
+ - Write all pending task IDs to shared task list via `TaskCreate` at phase start
346
346
  - Each `Agent(vp-task-executor)` reads next available task from shared list
347
347
  - Prevents duplicate execution when dispatching ≥ 8 tasks concurrently
348
348
 
@@ -689,6 +689,13 @@ quality_gate:
689
689
  - no_lint_errors: true
690
690
  ```
691
691
 
692
+ **Monitor pattern (ENH-099) — long-running verifications:**
693
+ For tests or builds that take minutes, use the `Monitor` tool instead of blocking `Bash`:
694
+ ```
695
+ Monitor: tail -f test-output.log — react when output contains "FAIL" or "Tests: N failed"
696
+ ```
697
+ This keeps the agentic loop active while the background process runs.
698
+
692
699
  #### Test Generation — test-generator-agent (ENH-057, BUG-028 fix)
693
700
 
694
701
  **Trigger**: current task is the last task in the phase AND task.md contains `## Acceptance Criteria`
@@ -845,6 +852,12 @@ Before phase-level verification, run a UI stub check:
845
852
  2. Check phase quality gate
846
853
  3. Write SUMMARY.md using `templates/phase/SUMMARY.md` as base.
847
854
 
855
+ **PushNotification (ENH-099, optional):**
856
+ After phase quality gate passes, send a desktop + phone alert:
857
+ - Message: "Phase {N} — {name} complete ✅ ({tasks} tasks, {tests} tests)"
858
+ - Requires Anthropic-hosted Claude Code (not available on Bedrock/Vertex).
859
+ - Call: `PushNotification` tool with the summary message.
860
+
848
861
  Populate `{{CREATED_FILES}}`, `{{MODIFIED_FILES}}`, `{{DELETED_FILES}}` from git:
849
862
  ```bash
850
863
  # Get ALL individual files changed since phase start tag
@@ -2111,6 +2111,107 @@ git push
2111
2111
  ```
2112
2112
  </step>
2113
2113
 
2114
+ <step name="stakeholder_gate">
2115
+ ## 6B. Stakeholder Generation Gate (ENH-098)
2116
+
2117
+ Executed automatically after scope is locked and summary is written.
2118
+ Skipped if: `--no-stakeholders` flag present in session context, or `config.json → crystallize.stakeholders.enabled: false`.
2119
+
2120
+ ### Step S1: Infer Stakeholders
2121
+
2122
+ From the brainstorm summary, extract:
2123
+ - `domain`: the product domain (web-saas, mobile, api, data, e-commerce, infra, other)
2124
+ - `product_type`: what kind of product (SaaS, marketplace, internal tool, SDK, mobile app, etc.)
2125
+ - `team_size`: from PROJECT-META or persona context (solo/small/medium/large)
2126
+ - `project_slug`: short kebab-case name derived from project title (e.g., "myapp", "invoice-app")
2127
+
2128
+ Determine stakeholder count:
2129
+ - solo + simple domain: 3 stakeholders
2130
+ - medium complexity: 4–5 stakeholders
2131
+ - enterprise / regulated (fintech, health, legal): 6 stakeholders
2132
+
2133
+ Generate stakeholder list based on domain. Examples:
2134
+
2135
+ | Domain | Stakeholders |
2136
+ |--------|--------------|
2137
+ | **web-saas** | cto, product-manager, ux-lead, end-user, business-owner |
2138
+ | **mobile** | product-owner, mobile-developer, end-user, app-store-reviewer |
2139
+ | **api/platform** | platform-engineer, api-consumer, devops-lead, sre |
2140
+ | **e-commerce** | business-owner, customer, marketing-manager, logistics-manager |
2141
+ | **data/ml** | data-scientist, ml-engineer, business-analyst, end-user |
2142
+ | **other** | infer contextually from brainstorm content |
2143
+
2144
+ ### Step S2: Write Agent Files
2145
+
2146
+ For each stakeholder, create a file at `.claude/agents/{project_slug}-{role_slug}.md` using the template from `templates/stakeholder-agent.md`.
2147
+
2148
+ Template structure:
2149
+ ```markdown
2150
+ ---
2151
+ name: {project_slug}-{role_slug}
2152
+ description: Stakeholder reviewer for {PROJECT_NAME}. Reviews project context from the
2153
+ perspective of a {ROLE_TITLE}. Returns gap analysis (Gaps/Risks/Suggestions).
2154
+ model: claude-haiku-4-5
2155
+ tools:
2156
+ - Read
2157
+ ---
2158
+
2159
+ You are a {ROLE_TITLE} reviewing the project definition for **{PROJECT_NAME}**.
2160
+
2161
+ ## Your Perspective
2162
+ {2-3 sentence role description — who you are, what you own, what matters to you}
2163
+
2164
+ ## What You Care About
2165
+ {4-6 bullet points of specific concerns from this role's angle}
2166
+
2167
+ ## Your Task
2168
+ Read `.viepilot/PROJECT-CONTEXT.md`. Return a structured review with three sections:
2169
+
2170
+ ### Gaps
2171
+ (sections/definitions that are vague, missing, or contradictory from your perspective)
2172
+
2173
+ ### Risks
2174
+ (concerns or red flags that could cause execution problems)
2175
+
2176
+ ### Suggestions
2177
+ (specific additions or clarifications to strengthen the context)
2178
+
2179
+ Keep each item to 1 sentence. Maximum 5 items per section.
2180
+ ```
2181
+
2182
+ Substitute variables:
2183
+ - `{{project_slug}}` → kebab-case project identifier
2184
+ - `{{role_slug}}` → kebab-case role identifier
2185
+ - `{{PROJECT_NAME}}` → Full project name
2186
+ - `{{ROLE_TITLE}}` → Human-readable role title
2187
+ - `{{ROLE_DESCRIPTION}}` → 2-3 sentence persona description
2188
+ - `{{ROLE_CONCERNS}}` → 4-6 bullet list of role-specific concerns
2189
+
2190
+ Write each file using the Edit/Write tool. Path is relative to project root (where `.claude/` lives).
2191
+
2192
+ > **Note**: `.claude/agents/` is the project-level agents directory for Claude Code.
2193
+ > For other adapters (Cursor, Codex): skip this step gracefully — agent files won't be created,
2194
+ > and the crystallize Step 1G will detect no agents and skip the review gate.
2195
+
2196
+ ### Step S3: Record in Summary
2197
+
2198
+ Append a `## Stakeholders Generated` section to the brainstorm session summary output:
2199
+
2200
+ ```markdown
2201
+ ## Stakeholders Generated
2202
+
2203
+ The following stakeholder agents have been created in `.claude/agents/`:
2204
+
2205
+ | File | Role | Perspective |
2206
+ |------|------|-------------|
2207
+ | `{project_slug}-cto.md` | CTO | Technical feasibility, stack, security |
2208
+ | `{project_slug}-product-manager.md` | Product Manager | Scope, user stories, priorities |
2209
+ | ... | ... | ... |
2210
+
2211
+ These agents will be called in vp-crystallize Step 1G to review PROJECT-CONTEXT.md.
2212
+ ```
2213
+ </step>
2214
+
2114
2215
  <step name="arch_to_ui_sync">
2115
2216
  ## 6C. Architect → UI Direction Sync (ENH-061)
2116
2217
 
@@ -2205,6 +2205,90 @@ Run when BOTH `architect_read_complete: true` AND `ui_direction_read_complete: t
2205
2205
  **Skip condition**: if only one workspace is present (not both) → silently skip Step 1F (single-workspace is valid).
2206
2206
  </step>
2207
2207
 
2208
+ <step name="stakeholder_review_gate">
2209
+ ---
2210
+
2211
+ ## Step 1G: Stakeholder Review Gate (ENH-098)
2212
+
2213
+ **Trigger**: Runs automatically after Step 1F, before Step 2.
2214
+
2215
+ **Skip conditions**:
2216
+ - `--no-stakeholders` flag passed to `/vp-crystallize`
2217
+ - `config.json → crystallize.stakeholders.enabled: false`
2218
+ - No `.claude/agents/{project-slug}-*.md` files found (gate is silently skipped)
2219
+ - Non-Claude-Code adapter (Cursor, Codex, Copilot): skip gracefully
2220
+
2221
+ ### Step 1G.1 — Discover Stakeholder Agents
2222
+
2223
+ ```bash
2224
+ # Find project stakeholder agents
2225
+ ls .claude/agents/ | grep "^{project_slug}-"
2226
+ ```
2227
+
2228
+ If 0 files found: print notice "No stakeholder agents found — skipping Step 1G. Run `/vp-brainstorm` first to generate stakeholder agents, or use `--no-stakeholders` to suppress."
2229
+ Then continue to Step 2.
2230
+
2231
+ If files found: proceed.
2232
+
2233
+ ### Step 1G.2 — Parallel Stakeholder Review
2234
+
2235
+ Spawn all found stakeholder agents simultaneously (parallel fan-out):
2236
+
2237
+ For each `.claude/agents/{project_slug}-{role_slug}.md`:
2238
+ ```
2239
+ Agent({
2240
+ subagent: "{project_slug}-{role_slug}",
2241
+ prompt: "Read .viepilot/PROJECT-CONTEXT.md. Return your structured review (Gaps/Risks/Suggestions)."
2242
+ })
2243
+ ```
2244
+
2245
+ Collect all results. Each result is a structured document with three sections:
2246
+ - `### Gaps` — missing or vague definitions
2247
+ - `### Risks` — execution concerns from this role's perspective
2248
+ - `### Suggestions` — specific additions to strengthen the context
2249
+
2250
+ ### Step 1G.3 — Synthesis
2251
+
2252
+ After all agents return:
2253
+
2254
+ 1. **Aggregate**: collect all Gaps, Risks, Suggestions across all stakeholders
2255
+ 2. **Deduplicate**: merge identical or near-identical points
2256
+ 3. **Rank**: sort by frequency (raised by ≥2 stakeholders = high priority) and severity
2257
+ 4. **Conflict resolution**: if stakeholders disagree (e.g., CTO wants more tech detail, PM wants less), note both perspectives and use the more conservative approach
2258
+ 5. **Filter**: discard suggestions that are already addressed in PROJECT-CONTEXT.md
2259
+
2260
+ ### Step 1G.4 — Enrich PROJECT-CONTEXT.md
2261
+
2262
+ Apply the top-ranked suggestions to `.viepilot/PROJECT-CONTEXT.md`:
2263
+
2264
+ - Add missing sections (e.g., `## Security Considerations`, `## Success Metrics`)
2265
+ - Expand vague definitions with the suggested specifics
2266
+ - Flag unresolved conflicts as `> ⚠️ Open question: {conflict}` inline
2267
+ - Do NOT remove or replace existing content — only add/clarify
2268
+
2269
+ ### Step 1G.5 — Stakeholder Review Summary Banner
2270
+
2271
+ Display to user:
2272
+
2273
+ ```
2274
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2275
+ STAKEHOLDER REVIEW COMPLETE ✓
2276
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2277
+
2278
+ Stakeholders reviewed: {N}
2279
+ Gaps found: {count} ({high-priority} high priority)
2280
+ Risks flagged: {count}
2281
+ Enrichments applied: {count} additions to PROJECT-CONTEXT.md
2282
+ Open questions: {count} (flagged inline for your review)
2283
+
2284
+ Reviewers: {role_1}, {role_2}, ..., {role_N}
2285
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2286
+ ```
2287
+
2288
+ Then continue to Step 2 (ROADMAP generation).
2289
+
2290
+ </step>
2291
+
2208
2292
  <step name="generate_ai_guide">
2209
2293
  ## Step 2: Generate AI-GUIDE.md
2210
2294