viepilot 2.50.1 → 3.7.3

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +214 -0
  2. package/README.md +17 -17
  3. package/bin/viepilot.cjs +1 -0
  4. package/bin/vp-tools.cjs +123 -1
  5. package/docs/brainstorm/session-2026-05-22.md +472 -0
  6. package/docs/dev/agents.md +51 -41
  7. package/docs/dev/architecture.md +26 -0
  8. package/docs/skills-reference.md +96 -0
  9. package/lib/adapter-context.cjs +294 -0
  10. package/lib/adapters/antigravity.cjs +8 -2
  11. package/lib/adapters/claude-code.cjs +4 -0
  12. package/lib/audit/browser-runner.cjs +102 -0
  13. package/lib/intake/adapters/browser.cjs +58 -0
  14. package/lib/intake/adapters/excel-m365.cjs +54 -6
  15. package/lib/intake/auto-intake.cjs +194 -0
  16. package/lib/intake/classifier.cjs +22 -4
  17. package/lib/intake/manifest.cjs +81 -0
  18. package/lib/intake/triage-ux.cjs +10 -2
  19. package/lib/intake/validator.cjs +97 -0
  20. package/lib/intake/writeback.cjs +169 -3
  21. package/lib/request/url-enricher.cjs +69 -0
  22. package/lib/viepilot-install.cjs +15 -0
  23. package/package.json +1 -1
  24. package/skills/vp-audit/SKILL.md +99 -3
  25. package/skills/vp-auto/SKILL.md +54 -4
  26. package/skills/vp-brainstorm/SKILL.md +69 -3
  27. package/skills/vp-crystallize/SKILL.md +52 -3
  28. package/skills/vp-debug/SKILL.md +52 -3
  29. package/skills/vp-design/SKILL.md +52 -3
  30. package/skills/vp-docs/SKILL.md +52 -3
  31. package/skills/vp-evolve/SKILL.md +52 -3
  32. package/skills/vp-info/SKILL.md +52 -3
  33. package/skills/vp-intake/SKILL.md +306 -7
  34. package/skills/vp-pause/SKILL.md +52 -3
  35. package/skills/vp-persona/SKILL.md +52 -3
  36. package/skills/vp-proposal/SKILL.md +52 -3
  37. package/skills/vp-request/SKILL.md +72 -3
  38. package/skills/vp-resume/SKILL.md +52 -3
  39. package/skills/vp-rollback/SKILL.md +52 -3
  40. package/skills/vp-skills/SKILL.md +52 -3
  41. package/skills/vp-status/SKILL.md +52 -3
  42. package/skills/vp-task/SKILL.md +52 -3
  43. package/skills/vp-ui-components/SKILL.md +52 -3
  44. package/skills/vp-update/SKILL.md +52 -3
  45. package/workflows/autonomous.md +268 -18
  46. package/workflows/brainstorm.md +222 -7
  47. package/workflows/crystallize.md +124 -6
  48. package/workflows/design.md +62 -1
  49. package/workflows/request.md +54 -8
@@ -0,0 +1,472 @@
1
+ # Brainstorm Session — 2026-05-22
2
+ # FEAT-021: ViePilot v3 Per-Adapter Intelligence Refactor
3
+
4
+ workflow_version: 2.51.0
5
+ session_id: 2026-05-22
6
+ topic: v3 Milestone — Per-Adapter Intelligence Refactor
7
+ status: completed
8
+
9
+ ---
10
+
11
+ ## Context
12
+ - **Trigger**: User reported agents not working on Claude Code adapter despite being configured
13
+ - **Root cause confirmed by research**: `cursor_skill_adapter` block in all SKILL.md files uses Cursor-specific tool names (`Shell`, `ReadFile`, `rg`, `ApplyPatch`, `Subagent`) that **do not exist** on Claude Code. These tools are silently ignored, causing entire adapter-specific logic to fail.
14
+ - **Scope**: New Milestone v3 — full adapter abstraction layer refactor
15
+
16
+ ---
17
+
18
+ ## Topic 1: Adapter Research Findings
19
+
20
+ ### Claude Code (Anthropic CLI)
21
+ **Native tools (confirmed):**
22
+ - `Bash` (not `Shell`), `Read` (not `ReadFile`), `Edit`, `MultiEdit`, `Write`
23
+ - `Glob`, `Grep` (not `rg`), `LS`, `NotebookRead`, `NotebookEdit`
24
+ - `WebFetch`, `WebSearch`, `TodoRead`, `TodoWrite`, `ToolSearch`
25
+ - `exit_plan_mode`
26
+ - **Agent/Task tool** — spawn subagents (multi-level nesting supported)
27
+ - **AskUserQuestion** — deferred tool, must be loaded via `ToolSearch` first
28
+
29
+ **Hooks system:** 28 events (PreToolUse, PostToolUse, Stop, SubagentStart, SubagentStop, SessionStart, SessionEnd, TaskCreated, TaskCompleted, UserPromptSubmit, etc.)
30
+ - Handler types: `command`, `http`, `mcp_tool`, `prompt`, `agent`
31
+ - Hooks can: block tool execution, modify tool input, inject context, approve/deny permissions
32
+
33
+ **Skill system:** `.claude/skills/<name>/SKILL.md` or `.claude/commands/<name>.md`
34
+ **Subagents:** `.claude/agents/<name>.md` with full frontmatter config (tools, model, hooks, maxTurns, permissionMode, skills)
35
+ **MCP:** Full support (stdio, http, streamable-http); schemas deferred via ToolSearch
36
+ **Settings:** `~/.claude/settings.json` — hooks, permissions.allow/deny, env, model, permissionMode, mcpServers
37
+
38
+ **Key capability NOT in Cursor:** Multi-level subagent nesting, 28 hook events, dynamic hook context injection
39
+
40
+ ---
41
+
42
+ ### Cursor IDE
43
+ **Native tools (Agent Mode, confirmed from March 2025 system prompt):**
44
+ - `run_terminal_cmd` (not `Shell`)
45
+ - `read_file` (not `ReadFile`)
46
+ - `edit_file`, `delete_file`, `list_dir`, `file_search`
47
+ - `grep_search` (not `rg`)
48
+ - `web_search`, `codebase_search`, `reapply`, `diff_history`, `fetch_rules`
49
+ - **Browser tool** (screenshots, DOM interaction)
50
+
51
+ **Plan Mode only:** `AskQuestion` (interactive structured prompts)
52
+ **Agent Mode:** Text clarification (non-blocking async); no formal `AskQuestion` tool
53
+
54
+ **Rules:** `.cursorrules` (legacy) → `.cursor/rules/*.mdc` (current)
55
+ - STATIC at runtime — agents cannot write rules dynamically
56
+
57
+ **Subagents:** `/multitask` command (v3.2, April 2026) — single-level only, not a callable tool
58
+ **Hooks:** 5 events: beforeShellExecution, beforeMCPExecution, beforeReadFile, afterFileEdit, stop
59
+ **MCP:** Full support, **40-tool hard limit**
60
+ **Skills:** `.cursor/skills/` (project) or `~/.cursor/skills/` (user) — SKILL.md format ✅
61
+
62
+ ---
63
+
64
+ ### Antigravity (Google Gemini CLI successor)
65
+ **Status:** Gemini CLI deprecated June 18, 2026 → replaced by Antigravity CLI (Go-based)
66
+ **Skills:** `.agents/skills/<skill-name>/SKILL.md` (project) or `~/.gemini/antigravity/skills/` (global)
67
+ - LLM-driven discovery (no slash command required) ← different from Claude/Cursor
68
+ - SKILL.md format compatible ✅
69
+
70
+ **Native tools:** Shell/cmd execution, file read/write, MCP integration (plugins), hooks (before tool, after file edit, session start)
71
+ **Interactive:** No formal `AskUserQuestion` confirmed — TUI-based interaction only
72
+ **Subagents:** Async dispatch from TUI
73
+
74
+ ---
75
+
76
+ ### OpenAI Codex CLI
77
+ **Native tools:** `container.exec`/shell (sandboxed), `apply_patch` (file writing), web search, MCP servers, subagents
78
+ **Config:** `~/.codex/config.toml`
79
+ **Interactive:** TUI-based (Tab to queue, Enter to inject) — no formal agent-initiated `AskUserQuestion`
80
+ **Subagents:** Supported for parallel tasks; "Goal mode" for long-running autonomous operation
81
+
82
+ ---
83
+
84
+ ### GitHub Copilot (Custom Agents)
85
+ **Skill format:** `.github/agents/<name>.agent.md` (YAML frontmatter + system prompt)
86
+ **Available tools:** read, edit, editFiles, runCommands, code_search, readfile, find_references, codebase + explore/task built-in agents
87
+ **AskQuestion:** Yes — `askQuestions` tool available in agent mode (NOT in subagents — VS Code issue #293745)
88
+ **Discovery:** User-driven (@agent-name) — no auto-discovery
89
+ **MCP:** Supported in `.agent.md` frontmatter
90
+
91
+ ---
92
+
93
+ ## Topic 2: Root Cause Analysis
94
+
95
+ ### Confirmed Bug: `cursor_skill_adapter` Tool Name Mismatch
96
+
97
+ Current SKILL.md all contain:
98
+ ```xml
99
+ <cursor_skill_adapter>
100
+ ## C. Tool Usage
101
+ Use Cursor tools: `Shell`, `ReadFile`, `Glob`, `rg`, `ApplyPatch`, `WebSearch`, `WebFetch`, `Subagent`
102
+ </cursor_skill_adapter>
103
+ ```
104
+
105
+ **Problem:** Claude Code does NOT have these tools:
106
+ | Cursor tool name | Claude Code equivalent | Status |
107
+ |---|---|---|
108
+ | `Shell` | `Bash` | ❌ Wrong name → silently ignored |
109
+ | `ReadFile` | `Read` | ❌ Wrong name → silently ignored |
110
+ | `rg` | `Grep` | ❌ Wrong name → silently ignored |
111
+ | `ApplyPatch` | `Edit` or `Write` | ❌ Wrong name → silently ignored |
112
+ | `Subagent` | `Agent` (Task tool) | ❌ Wrong name → silently ignored |
113
+ | `WebSearch` | `WebSearch` | ✅ Same |
114
+ | `WebFetch` | `WebFetch` | ✅ Same |
115
+ | `Glob` | `Glob` | ✅ Same |
116
+
117
+ **Result:** When running on Claude Code adapter:
118
+ - All Cursor-specific tool references are silently ignored
119
+ - Adapter-specific execution guidance is lost
120
+ - The SKILL.md's `cursor_skill_adapter` block is rendered but Claude Code can't follow the tool instructions
121
+ - There's ZERO `claude_code_adapter` block equivalent
122
+
123
+ ### Secondary Issues
124
+ 1. **No adapter detection** — vp-tools has no `detect-adapter` command
125
+ 2. **No capability validation** — `vp-tools validate --adapter <id>` doesn't exist
126
+ 3. **Inline compat tables are copy-paste** — every SKILL.md has its own adapter table (fragile, inconsistent)
127
+ 4. **AUQ fallback unclear** — the `ToolSearch` preload step (ENH-059) helps, but the fallback behavior for unsupported adapters is documented but not enforced
128
+ 5. **Antigravity path updated** — new path is `.agents/skills/` not the old `~/.gemini/antigravity/skills/` (though global install still uses the latter)
129
+
130
+ ---
131
+
132
+ ## Topic 3: v3 Architecture Design
133
+
134
+ ### Decision 1: Unified Adapter Block Standard
135
+
136
+ Replace `<cursor_skill_adapter>` with per-adapter blocks in all SKILL.md files:
137
+
138
+ ```xml
139
+ <adapter id="claude-code">
140
+ Tools: Bash, Read, Edit, Write, Glob, Grep, WebFetch, WebSearch, Agent
141
+ Interactive: AskUserQuestion (deferred — preload via ToolSearch before first AUQ call)
142
+ Subagents: Task/Agent tool (multi-level nesting supported)
143
+ Rules: .claude/settings.json permissions + hooks
144
+ Skill path: ~/.claude/skills/ or .claude/skills/
145
+ </adapter>
146
+
147
+ <adapter id="cursor-agent">
148
+ Tools: run_terminal_cmd, read_file, edit_file, grep_search, web_search, codebase_search, list_dir, file_search
149
+ Interactive: Text fallback (AskQuestion Plan Mode only; Agent Mode: async text clarification)
150
+ Subagents: /multitask (single-level only; not a callable tool)
151
+ Rules: .cursor/rules/*.mdc (static — cannot be modified at runtime by agent)
152
+ Skill path: ~/.cursor/skills/ or .cursor/skills/
153
+ </adapter>
154
+
155
+ <adapter id="antigravity">
156
+ Tools: shell, file_read, file_write, MCP tools
157
+ Interactive: Text fallback (TUI-based; no formal AskUserQuestion)
158
+ Subagents: Async TUI dispatch
159
+ Skill path: ~/.gemini/antigravity/skills/ (global) or .agents/skills/ (project)
160
+ Discovery: LLM-driven (automatic, no slash command needed)
161
+ </adapter>
162
+
163
+ <adapter id="codex">
164
+ Tools: container.exec (shell), apply_patch, web_search, MCP tools
165
+ Interactive: Text fallback (TUI Tab/Enter injection)
166
+ Subagents: Supported
167
+ Config: ~/.codex/config.toml
168
+ </adapter>
169
+
170
+ <adapter id="copilot">
171
+ Tools: read, edit, editFiles, runCommands, code_search, find_references
172
+ Interactive: askQuestions (NOT available in subagents — VS Code issue #293745)
173
+ Subagents: Limited
174
+ Skill path: .github/agents/<name>.agent.md
175
+ Discovery: User-driven (@agent-name)
176
+ </adapter>
177
+ ```
178
+
179
+ **Migration:** Replace ALL `<cursor_skill_adapter>` blocks across 21 SKILL.md files with the new 5-block standard.
180
+
181
+ ---
182
+
183
+ ### Decision 2: Adapter Auto-Detection (`vp-tools detect-adapter`)
184
+
185
+ Heuristic detection at session start:
186
+ ```
187
+ 1. Check env: $CURSOR_TRACE → cursor-agent
188
+ 2. Check env: $ANTIGRAVITY_SESSION → antigravity
189
+ 3. Check env: $CODEX_SESSION → codex
190
+ 4. Check running process parent: /usr/local/bin/claude → claude-code
191
+ 5. Check env: $GITHUB_COPILOT_AGENT → copilot
192
+ 6. Fallback: claude-code (most common)
193
+ ```
194
+
195
+ Output: JSON `{ adapter: "claude-code", capabilities: [...], interactive_mode: "AUQ" }`
196
+ Stored in session context for all skills to read.
197
+
198
+ ---
199
+
200
+ ### Decision 3: ADAPTER_CONTEXT Injection (system-level)
201
+
202
+ At every skill start, inject:
203
+ ```
204
+ ADAPTER_CONTEXT = {
205
+ id: "claude-code",
206
+ tools: { shell: "Bash", read: "Read", write: "Write", search: "Grep", patch: "Edit", agent: "Agent" },
207
+ interactive: "AUQ", // AUQ | text | none
208
+ subagent: "multi-level", // multi-level | single-level | none
209
+ hooks: 28,
210
+ mcp: true
211
+ }
212
+ ```
213
+
214
+ Skills read ADAPTER_CONTEXT instead of maintaining their own compat tables.
215
+
216
+ ---
217
+
218
+ ### Decision 4: Capability-Gated Fallback Chain
219
+
220
+ Universal fallback chain for interactive prompts:
221
+ ```
222
+ 1. ADAPTER_CONTEXT.interactive == "AUQ" → call AskUserQuestion (preload via ToolSearch first)
223
+ 2. ADAPTER_CONTEXT.interactive == "text" → show numbered list in plain text
224
+ 3. ADAPTER_CONTEXT.interactive == "none" → proceed with defaults (log decision)
225
+ ```
226
+
227
+ Universal fallback chain for shell execution:
228
+ ```
229
+ 1. claude-code → Bash
230
+ 2. cursor-agent → run_terminal_cmd
231
+ 3. antigravity → shell
232
+ 4. codex → container.exec
233
+ 5. copilot → runCommands
234
+ ```
235
+
236
+ No more per-skill if/else logic.
237
+
238
+ ---
239
+
240
+ ### Decision 5: `vp-tools validate --adapter <id>` Command
241
+
242
+ Validates that the detected adapter can run all ViePilot capabilities:
243
+ - Checks tool availability
244
+ - Checks interactive mode support
245
+ - Warns on limitations (e.g., "Cursor 40-tool MCP limit may conflict with N registered MCP servers")
246
+ - Reports capability gaps
247
+
248
+ ---
249
+
250
+ ## Topic 4: v3 Scope & Phases
251
+
252
+ ### Milestone: v3.0.0 (from v2.51.0)
253
+
254
+ **Phase structure:**
255
+ - **Phase 127** (M): `vp-tools detect-adapter` + ADAPTER_CONTEXT injection + `vp-tools validate`
256
+ - **Phase 128** (L): Replace `cursor_skill_adapter` with 5-block `<adapter>` standard across all 21 SKILL.md files
257
+ - **Phase 129** (L): Update all workflows (brainstorm.md, crystallize.md, autonomous.md, design.md) with adapter-aware execution paths
258
+ - **Phase 130** (M): Claude Code agent.md subagent definitions + hooks upgrade (validate PreToolUse/PostToolUse usage)
259
+ - **Phase 131** (S): Fix Antigravity skill path (`.agents/skills/` project path support) + Gemini CLI deprecation notice
260
+ - **Phase 132** (S): Tests (≥15) + CHANGELOG + version bump → v3.0.0
261
+
262
+ **Estimated total:** ~6 phases, XL scope, ~35 tasks
263
+
264
+ ---
265
+
266
+ ## Topic 5: Key Breaking Changes in v3
267
+
268
+ 1. `cursor_skill_adapter` XML block removed from all SKILL.md — replaced by 5 `<adapter>` blocks
269
+ 2. `vp-tools install --target <adapter>` now validates adapter capability on install
270
+ 3. Hooks upgraded: Claude Code skills can now use PreToolUse/PostToolUse for workflow gates
271
+ 4. Antigravity skill path updated to `.agents/skills/` (project) notation alongside `~/.gemini/antigravity/skills/` (global)
272
+
273
+ ---
274
+
275
+ ---
276
+
277
+ ## Topic 6: Multi-Agent Orchestration for vp-auto
278
+
279
+ ### Problem: vp-auto Runs Everything on Main Agent
280
+
281
+ Current vp-auto executes all tasks sequentially on the main agent thread:
282
+ - Phase loop → task loop → implement → verify → commit → repeat
283
+ - Each implementation turn consumes the full accumulated conversation context
284
+ - By Phase 3-4 the context window is bloated with prior task output, file reads, bash results
285
+ - Independent tasks that could run in parallel are serialized → slow + wasteful
286
+ - No isolation between tasks — a large file read in Task 3 bloats context for Task 7
287
+
288
+ **Symptom**: User described this as "xử lý Autonomous rất vụng về" (clumsy autonomous handling) with "token dư thừa rất nhiều" (excessive token waste).
289
+
290
+ ---
291
+
292
+ ### Claude Code Multi-Agent Architecture
293
+
294
+ #### Orchestrator + Worker Pattern (Agent/Task tool)
295
+
296
+ ```
297
+ Main Agent (Orchestrator)
298
+ ├─ reads phase plan
299
+ ├─ dispatches Task(worker_1) ← fresh context window
300
+ ├─ dispatches Task(worker_2) ← fresh context window (parallel)
301
+ └─ receives only final result from each worker
302
+ ```
303
+
304
+ **Key property:** Each subagent spawned via the `Agent` tool gets a **completely fresh context window**. The parent only receives the worker's final output text — not the worker's intermediate tool calls, file reads, or bash output. This is the token efficiency win.
305
+
306
+ **Fan-out/fan-in for independent tasks:**
307
+ ```
308
+ Orchestrator reads PHASE-STATE.md
309
+ → identifies 3 independent tasks (T1, T2, T3)
310
+ → dispatches Agent(T1), Agent(T2), Agent(T3) in parallel
311
+ → waits for all 3 results
312
+ → writes PHASE-STATE.md with outcomes
313
+ → dispatches next batch
314
+ ```
315
+
316
+ #### Agent Teams (Experimental)
317
+
318
+ Enabled via `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` env var.
319
+
320
+ ```
321
+ Team shared state:
322
+ - Shared task list (TodoRead/TodoWrite visible to ALL teammates)
323
+ - Mailbox per teammate (peer-to-peer messaging)
324
+ - No routing through parent for cross-agent communication
325
+ ```
326
+
327
+ **Pattern:** Teammates claim tasks from shared list, execute independently, report done. Other teammates see completed items and pick next available.
328
+
329
+ **Recommended team size:** 3-5 teammates, 5-6 tasks each. Beyond this, coordination overhead exceeds parallelism gains.
330
+
331
+ **When to use teams vs. single orchestrator:**
332
+ | Scenario | Approach |
333
+ |---|---|
334
+ | Tasks are independent, no shared state | Fan-out Agent tool calls |
335
+ | Tasks share output / ordering matters | Single orchestrator sequential |
336
+ | Many similar tasks (e.g., 21 SKILL.md edits) | Agent Team with shared task list |
337
+ | Heterogeneous phases with mixed dependencies | Orchestrator dispatches mini-teams per cluster |
338
+
339
+ #### `.claude/agents/` Subagent Definitions
340
+
341
+ Subagents can be pre-configured as YAML-frontmatter `.md` files in `.claude/agents/`:
342
+
343
+ ```yaml
344
+ ---
345
+ name: vp-task-executor
346
+ description: Executes a single ViePilot implementation task from task.md contract
347
+ model: claude-haiku-4-5 # cheaper model for routine tasks
348
+ maxTurns: 30
349
+ permissionMode: auto
350
+ tools:
351
+ - Read
352
+ - Edit
353
+ - Write
354
+ - Bash
355
+ - Glob
356
+ - Grep
357
+ disallowedTools:
358
+ - WebSearch
359
+ - WebFetch
360
+ hooks:
361
+ PostToolUse:
362
+ - type: command
363
+ command: "node bin/vp-tools.cjs validate-task-output"
364
+ ---
365
+ System prompt for the task executor subagent...
366
+ ```
367
+
368
+ **Model selection strategy for vp-auto orchestration:**
369
+ - Orchestrator (phase planner, dependency resolver): `claude-sonnet-4-6` (current)
370
+ - Task executors (file edits, bash, tests): `claude-haiku-4-5` (faster, cheaper for routine work)
371
+ - Reviewers / quality gate checkers: `claude-sonnet-4-6` (needs judgment)
372
+
373
+ #### Background Agents
374
+
375
+ - Spawned with `background: true` in agent frontmatter
376
+ - Persist across terminal closes; continue in isolated git worktree
377
+ - Use case: long-running phases (e.g., Phase 128 — 21 SKILL.md files) dispatched as background agent while user continues other work
378
+ - Result surfaced via `vp-tools status` when complete
379
+
380
+ ---
381
+
382
+ ### Orchestration Strategy for vp-auto v3
383
+
384
+ #### Phase Execution Model (Revised)
385
+
386
+ ```
387
+ vp-auto (Orchestrator, main agent)
388
+ 1. Read PHASE-STATE.md → build dependency graph
389
+ 2. Identify runnable task clusters (tasks with no unmet dependencies)
390
+ 3. For each cluster:
391
+ a. Dispatch each task as Agent(worker) in parallel
392
+ b. Worker: reads task.md → implements → commits → reports PASS/FAIL
393
+ c. Orchestrator: receives results → updates PHASE-STATE.md → next cluster
394
+ 4. Phase complete → git tag → next phase
395
+ ```
396
+
397
+ #### Adapter-Specific Orchestration
398
+
399
+ | Adapter | Parallelism model | Notes |
400
+ |---|---|---|
401
+ | Claude Code | Agent/Task tool — true parallel subagents | Fresh context windows; can use Teams for large phases |
402
+ | Cursor | `/multitask` command — single-level dispatch | Not a callable tool; limited to ~3-5 parallel |
403
+ | Antigravity | Async TUI dispatch | Manual; limited control |
404
+ | Codex | Subagents supported | Similar to Claude Code but no Teams |
405
+ | Copilot | Serial only | No parallel dispatch in current .agent.md |
406
+
407
+ #### ADAPTER_CONTEXT Extension for Orchestration
408
+
409
+ ```json
410
+ {
411
+ "id": "claude-code",
412
+ "orchestration": {
413
+ "mode": "agent-tool",
414
+ "parallel": true,
415
+ "teams": true,
416
+ "background": true,
417
+ "model_override": {
418
+ "worker": "claude-haiku-4-5",
419
+ "orchestrator": "claude-sonnet-4-6"
420
+ },
421
+ "max_parallel_tasks": 5
422
+ }
423
+ }
424
+ ```
425
+
426
+ ---
427
+
428
+ ### Decision: vp-auto Orchestration Refactor Scope
429
+
430
+ **Phase 133** (L): vp-auto orchestration refactor
431
+ - Rewrite autonomous.md phase loop to use orchestrator/worker model
432
+ - Define `.claude/agents/vp-task-executor.md` (Haiku model, task impl worker)
433
+ - Define `.claude/agents/vp-phase-planner.md` (dependency resolver)
434
+ - Define `.claude/agents/vp-quality-gate.md` (test runner, output checker)
435
+ - Fan-out dispatch for independent tasks within a cluster
436
+ - Agent Teams pattern for large homogeneous phases (e.g., Phase 128 SKILL.md migration)
437
+ - Adapter fallback: when `ADAPTER_CONTEXT.orchestration.parallel == false` → sequential mode (current behavior preserved)
438
+ - Token budget target: ≥60% reduction vs. current single-agent execution for a typical 7-task phase
439
+
440
+ ---
441
+
442
+ ## Open Questions
443
+ - [ ] Should adapter detection be done in vp-tools CLI or inline in SKILL.md at session start?
444
+ - [ ] Should the `<adapter>` block format be a ViePilot standard or follow an open spec?
445
+ - [ ] How to handle VS Code extension (Claude Code VS Code) — same as claude-code adapter or separate?
446
+ - [x] Should Phase 130 also define `.claude/agents/` YAML-frontmatter subagent definitions for vp-auto parallel task execution? → **YES — moved to Phase 133 dedicated orchestration refactor**
447
+ - [ ] Agent Teams `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` — stable enough for v3 GA? (consider gating behind `vp-tools config set orchestration.teams true`)
448
+ - [ ] Should worker agents use claude-haiku-4-5 by default or let user configure per-phase model?
449
+
450
+ ## ## Phases
451
+ - **Phase 1 (v3 Core):** Adapter detection + context injection + validation + SKILL.md migration + workflow adapter paths + Claude Code agent definitions + Antigravity path fix + orchestration refactor + tests → v3.0.0
452
+ - Phase 127: vp-tools detect-adapter + ADAPTER_CONTEXT + validate command
453
+ - Phase 128: SKILL.md 5-block adapter standard (21 files)
454
+ - Phase 129: Workflow adapter-aware execution paths
455
+ - Phase 130: Claude Code .claude/agents/ definitions + PreToolUse/PostToolUse hooks
456
+ - Phase 131: Antigravity path fix + deprecation handling
457
+ - Phase 132: Tests + CHANGELOG + v3.0.0 bump
458
+ - Phase 133: vp-auto orchestration refactor (orchestrator/worker model, Agent Teams, Haiku workers)
459
+
460
+ **Estimated total:** ~7 phases, XL scope, ~42 tasks
461
+
462
+ ## Project meta intake (FEAT-009)
463
+ Existing profile binding present — skip intake.
464
+
465
+ ---
466
+ ## Research sources
467
+ - Claude Code docs: tools, hooks (28 events), subagents, MCP, skills
468
+ - Claude Code docs: Agent tool / Task tool, Agent Teams (experimental), background agents, `.claude/agents/` frontmatter spec
469
+ - Cursor docs: Agent mode tools (March 2025 system prompt), Plan mode, /multitask (v3.2), Rules, MCP (40-tool limit)
470
+ - Antigravity docs: skill discovery, SKILL.md format, .agents/skills/ path
471
+ - Codex CLI docs: container.exec, apply_patch, MCP support
472
+ - GitHub Copilot docs: .agent.md frontmatter, askQuestions tool (not in subagents — VS Code #293745)
@@ -18,77 +18,84 @@ that run in parallel or in sequence without polluting the calling skill's conver
18
18
 
19
19
  ## Architecture
20
20
 
21
+ Since v3.2.0 (ENH-086), all 9 agents are **native Claude Code agent definitions** installed
22
+ to `~/.claude/agents/` and visible in the `/agents` dialog.
23
+
21
24
  ```
22
- vp-* skill (orchestrator)
25
+ ~/.claude/agents/ ← All 9 agents visible in /agents (v3.2.0+)
23
26
 
24
- ├── tracker-agent ← .viepilot/TRACKER.md read/write
25
- ├── research-agent WebSearch + WebFetch (isolated context)
26
- ├── file-scanner-agent Glob + Grep (repo-wide scanning)
27
- ├── changelog-agent CHANGELOG + version bump (single authority)
28
- ├── test-generator-agent tests/*.test.js generation + run
29
- └── doc-sync-agent ← skills/*/SKILL.md bulk update
27
+ ├── vp-task-executor.md Task implementation worker
28
+ ├── vp-phase-planner.md Phase dependency + cluster planner
29
+ ├── vp-quality-gate.md Verification runner
30
+ ├── tracker-agent.md .viepilot/TRACKER.md read/write
31
+ ├── research-agent.md WebSearch + WebFetch (isolated context)
32
+ ├── file-scanner-agent.md Glob + Grep (repo-wide scanning)
33
+ ├── changelog-agent.md ← CHANGELOG + version bump (single authority)
34
+ ├── test-generator-agent.md ← tests/*.test.js generation + run
35
+ └── doc-sync-agent.md ← skills/*/SKILL.md bulk update
36
+
37
+ ~/.claude/viepilot/agents/ ← Spec files retained for non-CC adapters
38
+ └── (same 6 workflow agents, spec format for Cursor/Codex/Antigravity)
30
39
  ```
31
40
 
32
- Agent definitions live in `agents/` at the repo root. They are installed to
33
- `{viepilotDir}/agents/` alongside workflows and templates.
41
+ Native definitions live in `agents/claude-code/` and spec files in `agents/`.
42
+ Both are installed by `vp-tools install --target claude-code`.
34
43
 
35
44
  ## Agent Catalog
36
45
 
37
46
  ### tracker-agent
38
- **File**: `agents/tracker-agent.md`
47
+ **Files**: `agents/tracker-agent.md` (spec), `agents/claude-code/tracker-agent.md` (native, v3.2.0+)
39
48
  **Purpose**: Read/write TRACKER.md — phase status, task status, decision log, request table.
40
49
  **When to invoke**: vp-auto (task start/complete/phase complete), vp-request (Step 5), vp-evolve (phase creation).
41
- **Claude Code subagent_type**: `general-purpose`
50
+ **Claude Code subagent_type**: `tracker-agent` (native since v3.2.0)
42
51
 
43
52
  ### research-agent
44
- **File**: `agents/research-agent.md`
53
+ **Files**: `agents/research-agent.md` (spec), `agents/claude-code/research-agent.md` (native, v3.2.0+)
45
54
  **Purpose**: WebSearch + WebFetch + summarize for feasibility studies and tech research.
46
55
  **When to invoke**: vp-request (Step 2B — auto-triggered for Feature/platform requests), vp-brainstorm (external validation).
47
- **Claude Code subagent_type**: `general-purpose`
56
+ **Claude Code subagent_type**: `research-agent` (native since v3.2.0; uses claude-sonnet-4-6)
48
57
 
49
58
  ### file-scanner-agent
50
- **File**: `agents/file-scanner-agent.md`
59
+ **Files**: `agents/file-scanner-agent.md` (spec), `agents/claude-code/file-scanner-agent.md` (native, v3.2.0+)
51
60
  **Purpose**: Glob + Grep across repo to find affected files, detect stale refs.
52
- **When to invoke**: vp-audit (Tier 1–4), vp-evolve (impact analysis), vp-rollback (state restore).
53
- **Claude Code subagent_type**: `Explore` (specialized for codebase scanning)
61
+ **When to invoke**: vp-audit (Tier 1+2 scan steps), vp-evolve (impact analysis), vp-rollback (state restore).
62
+ **Claude Code subagent_type**: `file-scanner-agent` (native since v3.2.0)
54
63
 
55
64
  ### changelog-agent
56
- **File**: `agents/changelog-agent.md`
65
+ **Files**: `agents/changelog-agent.md` (spec), `agents/claude-code/changelog-agent.md` (native, v3.2.0+)
57
66
  **Purpose**: Atomically append CHANGELOG entry + bump package.json version.
58
67
  **When to invoke**: vp-auto post-phase (last task), vp-evolve (milestone ship).
59
- **Claude Code subagent_type**: `general-purpose`
68
+ **Claude Code subagent_type**: `changelog-agent` (native since v3.2.0)
60
69
  **Note**: Single authority for version bumps — resolves ENH-053.
61
70
 
62
71
  ### test-generator-agent
63
- **File**: `agents/test-generator-agent.md`
72
+ **Files**: `agents/test-generator-agent.md` (spec), `agents/claude-code/test-generator-agent.md` (native, v3.2.0+)
64
73
  **Purpose**: Generate contract tests from acceptance criteria, run suite, report pass/fail.
65
- **When to invoke**: Last task of each phase (the `N.last` contract-test task pattern).
66
- **Claude Code subagent_type**: `general-purpose`
74
+ **When to invoke**: Last task of each phase triggered by `autonomous.md` when task has `## Acceptance Criteria`.
75
+ **Claude Code subagent_type**: `test-generator-agent` (native since v3.2.0)
67
76
 
68
77
  ### doc-sync-agent
69
- **File**: `agents/doc-sync-agent.md`
78
+ **Files**: `agents/doc-sync-agent.md` (spec), `agents/claude-code/doc-sync-agent.md` (native, v3.2.0+)
70
79
  **Purpose**: Bulk-apply the same change to ≥5 `.md` files (adapter rows, banners, etc.).
71
80
  **When to invoke**: Auto-triggered by autonomous.md when task Paths block has ≥5 identical file types.
72
- **Claude Code subagent_type**: `general-purpose`
81
+ **Claude Code subagent_type**: `doc-sync-agent` (native since v3.2.0)
73
82
 
74
83
  ## Invocation Patterns
75
84
 
76
- ### Claude Code (terminal)
85
+ ### Claude Code (terminal) — v3.2.0+
77
86
 
78
- Use the `Agent` tool with the appropriate `subagent_type`:
87
+ Use the agent's name directly as `subagent_type`:
79
88
 
80
89
  ```js
81
90
  Agent({
82
- subagent_type: "general-purpose", // or "Explore" for file-scanner
83
- description: "{agent-name}: {operation-summary}",
84
- prompt: `
85
- Load agents/{agent-name}.md for the full specification.
86
- Execute operation: {operation}
87
- Inputs: {inputs}
88
- `
91
+ subagent_type: "changelog-agent", // direct native agent type
92
+ description: "Bump to {version} + CHANGELOG",
93
+ prompt: "version: {version}. date: {today}. entries: {entries}."
89
94
  })
90
95
  ```
91
96
 
97
+ No "Load agents/X.md" preamble needed — the system prompt is baked into the native definition.
98
+
92
99
  ### Cursor / Codex / Antigravity
93
100
 
94
101
  Execute the equivalent operation inline in the same session. The agent `.md` file
@@ -98,12 +105,12 @@ describes the exact steps — follow them as a scoped sub-prompt.
98
105
 
99
106
  | Agent | Claude Code | Cursor | Codex | Antigravity |
100
107
  |-------|------------|--------|-------|-------------|
101
- | tracker-agent | Subagent (general-purpose) | Inline | Inline | Inline |
102
- | research-agent | Subagent (general-purpose) | Inline if web available | Inline if web available | Inline if web available |
103
- | file-scanner-agent | Subagent (Explore) | Inline | Inline | Inline |
104
- | changelog-agent | Subagent (general-purpose) | Inline | Inline | Inline |
105
- | test-generator-agent | Subagent (general-purpose) | Inline | Inline | Inline |
106
- | doc-sync-agent | Subagent (general-purpose) | Sequential inline | Sequential inline | Sequential inline |
108
+ | tracker-agent | Native: `tracker-agent` (v3.2.0+) | Inline | Inline | Inline |
109
+ | research-agent | Native: `research-agent` (v3.2.0+) | Inline if web available | Inline if web available | Inline if web available |
110
+ | file-scanner-agent | Native: `file-scanner-agent` (v3.2.0+) | Inline | Inline | Inline |
111
+ | changelog-agent | Native: `changelog-agent` (v3.2.0+) | Inline | Inline | Inline |
112
+ | test-generator-agent | Native: `test-generator-agent` (v3.2.0+) | Inline | Inline | Inline |
113
+ | doc-sync-agent | Native: `doc-sync-agent` (v3.2.0+) | Sequential inline | Sequential inline | Sequential inline |
107
114
 
108
115
  ## Adding a New Agent
109
116
 
@@ -115,12 +122,15 @@ describes the exact steps — follow them as a scoped sub-prompt.
115
122
  - `## Adapter Behavior` (table covering all 4 adapters)
116
123
  - `## Notes`
117
124
 
118
- 2. Add the agent to the delegation table in `workflows/autonomous.md`
125
+ 2. Create `agents/claude-code/{name}-agent.md` with YAML frontmatter (name, description,
126
+ model, tools, disallowedTools) and focused system prompt. Reference `vp-task-executor.md`.
127
+
128
+ 3. Add the agent to the delegation table in `workflows/autonomous.md`
119
129
  under `## Agent Delegation`.
120
130
 
121
- 3. Wire invocation into the relevant workflow steps.
131
+ 4. Wire invocation into the relevant workflow steps using `subagent_type: "{name}-agent"`.
122
132
 
123
- 4. Add to `installSubdirs` in the adapter that should include `agents/`.
133
+ 5. `claudeAgentsSrc: 'agents/claude-code'` already covers all files no install config change needed.
124
134
 
125
135
  5. Write a contract test in `tests/unit/` verifying the file exists and has required sections.
126
136
 
@@ -216,6 +216,32 @@ User Request
216
216
  | No external runtime | Works with any AI assistant |
217
217
  | CommonJS (no ESM) | Maximum Node.js compatibility |
218
218
 
219
+ ## Agent Orchestration Model (ENH-096/097)
220
+
221
+ As of v3.7.2, the vp-auto orchestrator is **read + spawn only**. It never calls Edit, Write, or Bash for any write operation. All work is delegated to specialized subagents:
222
+
223
+ | Agent | Role | Tools Permitted |
224
+ |-------|------|-----------------|
225
+ | vp-auto orchestrator | Read state, spawn workers, gate phase transitions | Read, Bash (read-only git only), Agent |
226
+ | vp-task-executor | All implementation — code, docs, config edits | Read, Edit, Write, MultiEdit, Bash, Glob, Grep, LS |
227
+ | vp-quality-gate | Run verification commands, report PASS/FAIL | Read, Bash, Grep, Glob, LS |
228
+ | vp-phase-planner | Build dependency graph, identify parallel task clusters | Read, Glob, Grep, LS |
229
+ | tracker-agent | Write state files: PHASE-STATE.md, TRACKER.md, HANDOFF.json, ROADMAP.md | Read, Edit, Write |
230
+ | vp-git-agent | Git operations: create-tag, push-branch, push-tags, push-all, git-status | Bash only |
231
+ | changelog-agent | Write CHANGELOG.md entries for features and fixes | Read, Edit, Write |
232
+
233
+ **Result formats:**
234
+ - `TASK_RESULT: PASS | FAIL | PARTIAL` — returned by vp-task-executor and vp-quality-gate
235
+ - `GIT_RESULT: PASS | FAIL | SKIP` — returned by vp-git-agent
236
+
237
+ **Orchestration flow:**
238
+ 1. Orchestrator reads PHASE-STATE.md + task contracts
239
+ 2. Spawns tracker-agent → set tasks `in_progress`
240
+ 3. Spawns vp-task-executor(s) — parallel fan-out for independent tasks
241
+ 4. Spawns vp-quality-gate for each completed task
242
+ 5. On PASS: spawns tracker-agent → mark task done, update HANDOFF.json
243
+ 6. On phase complete: spawns vp-git-agent (tag + push), tracker-agent (ROADMAP update), changelog-agent
244
+
219
245
  ## Extension Points
220
246
 
221
247
  | Point | How to Extend |