@automagik/genie 4.260405.4 → 4.260405.6

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 (124) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.genie/agents/metrics-updater/runs.jsonl +1 -0
  3. package/.genie/agents/metrics-updater/state.json +1 -1
  4. package/.genie/wishes/agent-flexibility-guide/WISH.md +155 -0
  5. package/.genie/wishes/auto-orchestrate/WISH.md +232 -0
  6. package/.genie/wishes/daily-metrics-agent/WISH.md +360 -0
  7. package/.genie/wishes/docs-overhaul/WISH.md +238 -0
  8. package/.genie/wishes/docs-readme-review/AUDIT-REPORT.md +227 -0
  9. package/.genie/wishes/docs-readme-review/WISH.md +175 -0
  10. package/.genie/wishes/dx-800-closeout/WISH.md +160 -0
  11. package/.genie/wishes/feature-matrix-page/WISH.md +97 -0
  12. package/.genie/wishes/fire-and-forget/WISH.md +282 -0
  13. package/.genie/wishes/fix-agent-join-delay/WISH.md +92 -0
  14. package/.genie/wishes/fix-cli-polish/WISH.md +197 -0
  15. package/.genie/wishes/fix-depends-parser/WISH.md +89 -0
  16. package/.genie/wishes/fix-dispatch-initial-prompt/WISH.md +67 -0
  17. package/.genie/wishes/fix-first-run/WISH.md +98 -0
  18. package/.genie/wishes/fix-genie-v4-stability/WISH.md +224 -0
  19. package/.genie/wishes/fix-metrics-agent/WISH.md +97 -0
  20. package/.genie/wishes/fix-native-inbox/WISH.md +93 -0
  21. package/.genie/wishes/fix-omni-bridge-hardening/WISH.md +87 -0
  22. package/.genie/wishes/fix-release-blockers/WISH.md +184 -0
  23. package/.genie/wishes/fix-session-continue-fallback/WISH.md +215 -0
  24. package/.genie/wishes/fix-session-hook-channel/WISH.md +141 -0
  25. package/.genie/wishes/fix-session-uuid-resume/WISH.md +164 -0
  26. package/.genie/wishes/fix-short-name-resolver/WISH.md +86 -0
  27. package/.genie/wishes/fix-task-project/WISH.md +93 -0
  28. package/.genie/wishes/fix-team-lead-exit/WISH.md +112 -0
  29. package/.genie/wishes/fix-team-lead-polling/WISH.md +62 -0
  30. package/.genie/wishes/fix-test-safety/WISH.md +151 -0
  31. package/.genie/wishes/fix-tmux-dual-statusbar/WISH.md +162 -0
  32. package/.genie/wishes/fix-tmux-session-explosion/WISH.md +116 -0
  33. package/.genie/wishes/fix-trust-prompt/WISH.md +159 -0
  34. package/.genie/wishes/genie-base-skill/WISH.md +138 -0
  35. package/.genie/wishes/genie-boards-workflows/WISH.md +345 -0
  36. package/.genie/wishes/genie-dx-polish/WISH.md +197 -0
  37. package/.genie/wishes/genie-export-import/WISH.md +291 -0
  38. package/.genie/wishes/genie-final-polish/WISH.md +206 -0
  39. package/.genie/wishes/genie-hacks-community-docs/WISH.md +195 -0
  40. package/.genie/wishes/genie-hardening/WISH.md +241 -0
  41. package/.genie/wishes/genie-item-registry/WISH.md +341 -0
  42. package/.genie/wishes/genie-observability/WISH.md +203 -0
  43. package/.genie/wishes/genie-omni-marriage/WISH.md +322 -0
  44. package/.genie/wishes/genie-orchestration-fix/WISH.md +236 -0
  45. package/.genie/wishes/genie-resume/WISH.md +273 -0
  46. package/.genie/wishes/genie-scheduler/WISH.md +243 -0
  47. package/.genie/wishes/genie-stats-command/WISH.md +148 -0
  48. package/.genie/wishes/genie-task-tables/WISH.md +97 -0
  49. package/.genie/wishes/genie-workflow-engine/WISH.md +60 -0
  50. package/.genie/wishes/hook-only-first-install/WISH.md +108 -0
  51. package/.genie/wishes/inbox-driven-sessions/WISH.md +254 -0
  52. package/.genie/wishes/messaging-refresh/WISH.md +215 -0
  53. package/.genie/wishes/multi-agent-session-isolation/WISH.md +156 -0
  54. package/.genie/wishes/omni-session-isolation/WISH.md +125 -0
  55. package/.genie/wishes/parallel-execution/WISH.md +220 -0
  56. package/.genie/wishes/pg-state-migration/WISH.md +134 -0
  57. package/.genie/wishes/pg-total-migration/WISH.md +329 -0
  58. package/.genie/wishes/pgserve-embed/WISH.md +229 -0
  59. package/.genie/wishes/qa-dev-to-main/WISH.md +232 -0
  60. package/.genie/wishes/readme-v4-agent-first/WISH.md +378 -0
  61. package/.genie/wishes/resilient-messaging/WISH.md +198 -0
  62. package/.genie/wishes/resilient-resume/WISH.md +86 -0
  63. package/.genie/wishes/session-auto-create/WISH.md +34 -0
  64. package/.genie/wishes/session-continue-by-name/WISH.md +222 -0
  65. package/.genie/wishes/skills-v4-upgrade/WISH.md +266 -0
  66. package/.genie/wishes/stable-release-fixes/WISH.md +211 -0
  67. package/.genie/wishes/task-auto-close-on-merge/WISH.md +79 -0
  68. package/.genie/wishes/task-external-linking/WISH.md +72 -0
  69. package/.genie/wishes/task-lifecycle-foundation/WISH.md +1066 -0
  70. package/.genie/wishes/task-projects/WISH.md +235 -0
  71. package/.genie/wishes/team-lead-minimal/WISH.md +124 -0
  72. package/.genie/wishes/test-pg-ram-isolation/TRACE.md +66 -0
  73. package/.genie/wishes/test-pg-ram-isolation/WISH.md +225 -0
  74. package/.genie/wishes/test-schema-isolation/WISH.md +147 -0
  75. package/.genie/wishes/tmux-split-tabbar/WISH.md +255 -0
  76. package/.genie/wishes/tmux-tui/WISH.md +186 -0
  77. package/.genie/wishes/transcript-docs/WISH.md +137 -0
  78. package/.genie/wishes/unified-executor-layer/AUDIT.md +322 -0
  79. package/.genie/wishes/unified-executor-layer/WISH.md +782 -0
  80. package/.genie/wishes/unified-omni-bridge/INTEGRATION-FROM-OMNI.md +212 -0
  81. package/.genie/wishes/unified-omni-bridge/WISH.md +416 -0
  82. package/.genie/wishes/unique-leader-names/WISH.md +349 -0
  83. package/.genie/wishes/v3-fixes-release/WISH.md +219 -0
  84. package/.genie/wishes/v4-critical-fixes/WISH.md +197 -0
  85. package/.genie/wishes/voice-personality-pass/WISH.md +143 -0
  86. package/.genie/wishes/work-fire-forget/WISH.md +160 -0
  87. package/.genie/wishes/workflow-engine-runtime/WISH.md +310 -0
  88. package/.genie/wishes/worktree-out-of-repo/WISH.md +139 -0
  89. package/README.md +1 -1
  90. package/dist/genie.js +58 -89
  91. package/knip.json +6 -4
  92. package/package.json +1 -1
  93. package/plugins/genie/.claude-plugin/plugin.json +1 -1
  94. package/plugins/genie/package.json +1 -1
  95. package/src/db/migrations/026_executors_omni_metadata_index.sql +11 -0
  96. package/src/genie.ts +2 -1
  97. package/src/lib/__tests__/executor-config.test.ts +67 -0
  98. package/src/lib/audit-events.ts +64 -0
  99. package/src/lib/executor-config.ts +40 -0
  100. package/src/lib/executor-registry.test.ts +35 -0
  101. package/src/lib/executor-registry.ts +45 -5
  102. package/src/lib/safe-pg-call.ts +23 -0
  103. package/src/lib/test-db.ts +31 -0
  104. package/src/lib/tmux-alive.test.ts +59 -1
  105. package/src/lib/tmux.ts +17 -3
  106. package/src/services/__tests__/omni-bridge.test.ts +706 -0
  107. package/src/services/__tests__/omni-turn.test.ts +105 -0
  108. package/src/services/executor.ts +12 -42
  109. package/src/services/executors/__tests__/_sdk-mocks.ts +127 -0
  110. package/src/services/executors/__tests__/claude-sdk-resume.test.ts +410 -0
  111. package/src/services/executors/__tests__/claude-sdk.test.ts +204 -59
  112. package/src/services/executors/__tests__/sdk-session-capture.test.ts +313 -0
  113. package/src/services/executors/claude-code.ts +95 -154
  114. package/src/services/executors/claude-sdk.ts +285 -71
  115. package/src/services/executors/sdk-session-capture.ts +116 -0
  116. package/src/services/omni-bridge.ts +345 -19
  117. package/src/services/omni-turn.ts +52 -0
  118. package/src/term-commands/agent/list.ts +2 -1
  119. package/src/term-commands/agents.ts +18 -2
  120. package/src/term-commands/exec/index.ts +9 -3
  121. package/src/term-commands/omni.ts +38 -20
  122. package/src/term-commands/sessions.ts +17 -4
  123. package/src/types/genie-config.ts +2 -0
  124. package/src/services/omni-reply.ts +0 -70
@@ -10,7 +10,7 @@
10
10
  "plugins": [
11
11
  {
12
12
  "name": "genie",
13
- "version": "4.260405.4",
13
+ "version": "4.260405.6",
14
14
  "source": "./plugins/genie",
15
15
  "description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
16
16
  }
@@ -17,3 +17,4 @@
17
17
  {"timestamp":"2026-04-02T00:00:00.000Z","duration_ms":15000,"api_calls":0,"tools_generated":0,"errors":["gh CLI not available","GitHub MCP tools not present in session"],"status":"failed","fallback":false,"metrics":null}
18
18
  {"timestamp":"2026-04-03T00:00:00.000Z","duration_ms":3200,"api_calls":0,"tools_generated":0,"errors":["gh CLI not available","GitHub MCP tools not present in session"],"status":"failed","fallback":false,"metrics":null}
19
19
  {"timestamp":"2026-04-04T00:00:00.000Z","duration_ms":30000,"api_calls":0,"tools_generated":0,"errors":["gh CLI not available","GitHub MCP tools not present in session"],"status":"success","fallback":true,"metrics":{"releases_24h":2,"merged_prs_7d":35,"avg_merge_time_h":0.3,"ship_rate_pct":85}}
20
+ {"timestamp":"2026-04-05T12:24:47Z","duration_ms":32000,"api_calls":0,"tools_generated":0,"errors":["gh CLI not available","GitHub MCP tools not present in session"],"status":"success","fallback":true,"metrics":{"releases_24h":2,"merged_prs_7d":35,"avg_merge_time_h":0.3,"ship_rate_pct":85}}
@@ -1,5 +1,5 @@
1
1
  {
2
- "last_run": "2026-04-04T00:00:00.000Z",
2
+ "last_run": "2026-04-05T12:24:47.000Z",
3
3
  "last_run_status": "success",
4
4
  "last_metrics": {
5
5
  "releases_24h": 2,
@@ -0,0 +1,155 @@
1
+ # Wish: Agent Flexibility Guide (Provider Switching + BYOA)
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | **Status** | APPROVED |
6
+ | **Slug** | `agent-flexibility-guide` |
7
+ | **Date** | 2026-03-24 |
8
+
9
+ ## Summary
10
+
11
+ Document how to use Genie with different AI agents. Create a new page showing provider switching patterns, /spawn --provider flag usage, auto-respawn templates, and real multi-provider team examples. Position Genie as provider-agnostic.
12
+
13
+ ## Scope
14
+
15
+ ### IN
16
+ - New page: `genie/concepts/byoa.mdx` — BYOA positioning, examples, agent neutrality
17
+ - Document `/spawn --provider` flag with examples
18
+ - Show provider switching patterns (Claude ↔ Codex ↔ BYOA)
19
+ - Document auto-respawn template system
20
+ - Real examples: multi-provider teams, cost optimization, failover patterns
21
+ - Update `docs.json` to include BYOA concept page
22
+
23
+ ### OUT
24
+ - Automatic failover logic (manual only, documented as patterns)
25
+ - Custom agent implementation guide (separate wish)
26
+ - Testing harness for agent compatibility (out of scope)
27
+
28
+ ## Decisions
29
+
30
+ | Decision | Rationale |
31
+ |----------|-----------|
32
+ | New concept page | BYOA deserves first-class documentation, not buried in skills |
33
+ | `/spawn --provider` examples | Users need to know how to actually use it |
34
+ | Real patterns over theory | Show actual multi-provider teams, cost models |
35
+
36
+ ## Success Criteria
37
+
38
+ - [ ] `genie/concepts/byoa.mdx` created with BYOA positioning
39
+ - [ ] `/spawn --provider` flag documented with 5+ examples
40
+ - [ ] Auto-respawn template system explained
41
+ - [ ] 3 real multi-provider team patterns shown (cost optimization, specialization, failover)
42
+ - [ ] BYOA concept in docs.json navigation
43
+ - [ ] No broken links
44
+ - [ ] Tone: vendor-neutral, empowering
45
+
46
+ ## Execution Strategy
47
+
48
+ ### Wave 1
49
+ | Group | Agent | Description |
50
+ |-------|-------|-------------|
51
+ | 1 | writer | Create BYOA concept page + /spawn --provider docs |
52
+ | 2 | writer | Multi-provider patterns + examples |
53
+
54
+ ### Wave 2
55
+ | Group | Agent | Description |
56
+ |-------|-------|-------------|
57
+ | 3 | reviewer | Validate accuracy, no broken links, tone consistent |
58
+
59
+ ## Execution Groups
60
+
61
+ ### Group 1: BYOA Concept Page
62
+
63
+ **Goal:** Create new page explaining Genie's provider agnosticism.
64
+
65
+ **Deliverables:**
66
+ 1. `genie/concepts/byoa.mdx` with:
67
+ - Definition: BYOA = Bring Your Own Agent
68
+ - Genie doesn't care which agent backs workers
69
+ - List providers: Claude Code, Codex, Gemini CLI, custom
70
+ - `/spawn --provider <provider>` flag usage
71
+ - Auto-respawn template system (if agent goes offline, respawned from saved config)
72
+ - Why it matters: future-proofs, no vendor lock-in
73
+
74
+ **Acceptance Criteria:**
75
+ - [ ] File exists at `/tmp/automagik-docs/genie/concepts/byoa.mdx`
76
+ - [ ] Explains /spawn --provider flag
77
+ - [ ] Lists 5+ provider options
78
+ - [ ] Auto-respawn system documented
79
+ - [ ] No broken links
80
+
81
+ **Validation:**
82
+ ```bash
83
+ grep -q "BYOA\|--provider\|provider" /tmp/automagik-docs/genie/concepts/byoa.mdx
84
+ grep -q "auto-respawn\|template" /tmp/automagik-docs/genie/concepts/byoa.mdx
85
+ ```
86
+
87
+ **depends-on:** none
88
+
89
+ ---
90
+
91
+ ### Group 2: Multi-Provider Patterns
92
+
93
+ **Goal:** Show 3 real patterns for using different agents together.
94
+
95
+ **Deliverables:**
96
+ 1. Three patterns in BYOA page:
97
+ - **Pattern 1: Specialization** — Claude for reasoning, Codex for parsing, BYOA for domain logic
98
+ - **Pattern 2: Cost Optimization** — Use Codex for fast iteration, Claude for final review
99
+ - **Pattern 3: Manual Fallback** — If one provider is down, spawn with another (not automatic)
100
+
101
+ 2. Each pattern includes:
102
+ - Problem statement
103
+ - Solution (how to do it)
104
+ - Code example (`genie spawn --provider <provider>`)
105
+ - Benefit + trade-offs
106
+ - When to use
107
+
108
+ **Acceptance Criteria:**
109
+ - [ ] 3 patterns documented
110
+ - [ ] Each has: problem, solution, code, benefit, when-to-use
111
+ - [ ] Examples are realistic, not aspirational
112
+ - [ ] Code examples show actual --provider flags
113
+
114
+ **Validation:**
115
+ ```bash
116
+ grep -c "Pattern\|Example" /tmp/automagik-docs/genie/concepts/byoa.mdx
117
+ grep "genie spawn.*--provider" /tmp/automagik-docs/genie/concepts/byoa.mdx
118
+ ```
119
+
120
+ **depends-on:** 1
121
+
122
+ ---
123
+
124
+ ### Group 3: Review
125
+
126
+ **Goal:** Validate accuracy and consistency.
127
+
128
+ **Deliverables:**
129
+ 1. Checklist:
130
+ - `/spawn --provider` syntax is accurate (not invented)
131
+ - Patterns are realistic (not aspirational)
132
+ - Links to other doc pages work
133
+ - Tone is neutral (no vendor criticism)
134
+ - Examples use actual provider names
135
+
136
+ **Acceptance Criteria:**
137
+ - [ ] No broken links
138
+ - [ ] Patterns match actual Genie capabilities
139
+ - [ ] Tone is neutral and empowering
140
+
141
+ **Validation:**
142
+ ```bash
143
+ # Check for invented features
144
+ ! grep -q "automatic failover\|auto-failover" /tmp/automagik-docs/genie/concepts/byoa.mdx
145
+ ```
146
+
147
+ **depends-on:** 1, 2
148
+
149
+ ## Files to Create/Modify
150
+
151
+ ```
152
+ /tmp/automagik-docs/genie/concepts/byoa.mdx (create)
153
+ /tmp/automagik-docs/docs.json (add BYOA page to navigation)
154
+ ```
155
+
@@ -0,0 +1,232 @@
1
+ # Wish: genie work <slug> auto-orchestrates full wish execution
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | **Status** | DRAFT |
6
+ | **Slug** | `auto-orchestrate` |
7
+ | **Date** | 2026-03-17 |
8
+
9
+ ## Summary
10
+
11
+ `genie work <slug>` (without agent or group) auto-orchestrates the entire wish — reads the Execution Strategy, spawns all agents per wave in parallel, monitors completion, advances waves, and runs review. Reduces the team-lead to 4 lines: read wish, `genie work <slug>`, create PR, `genie team done`. Closes #631.
12
+
13
+ ## Scope
14
+
15
+ ### IN
16
+ - New `genie work <slug>` command (no agent, no group) that orchestrates the full wish
17
+ - Parses Execution Strategy waves from WISH.md
18
+ - Spawns all agents in a wave as background processes (parallel)
19
+ - Monitors via wish state — marks groups done as workers report completion
20
+ - Advances to next wave when current wave completes
21
+ - Dispatches reviewer after all waves (if `review` group exists in strategy)
22
+ - Returns exit 0 when all groups done, exit 1 on failure
23
+ - Team-lead prompt updated to use `genie work <slug>` as primary dispatch
24
+
25
+ ### OUT
26
+ - Changes to `genie work <agent> <slug>#<group>` (still works for manual dispatch)
27
+ - Changes to wish state machine logic (already works)
28
+ - QA orchestration (team-lead handles that after PR)
29
+ - Retry/fix loops within `genie work` (team-lead handles escalation)
30
+
31
+ ## Decisions
32
+
33
+ | Decision | Rationale |
34
+ |----------|-----------|
35
+ | `genie work <slug>` is a new command signature, not replacing the old one | Backwards compatible. Old `genie work <agent> <slug>#<group>` still works for manual dispatch. |
36
+ | Spawns workers as background tmux panes | Workers run in parallel. `genie work` polls state file for completion, not stdout. |
37
+ | Polls wish state, not worker output | Deterministic — workers call `genie done <slug>#<group>` when complete, state file is source of truth. |
38
+ | 30s poll interval | Fast enough to be responsive, not so fast it thrashes the state file. |
39
+ | Max 30min timeout per wave | Safety valve — if a wave doesn't complete in 30min, exit with error. Team-lead decides what to do. |
40
+ | Review dispatched automatically if Execution Strategy includes a review wave | Convention: last wave with `reviewer` agent triggers review dispatch. |
41
+
42
+ ## Success Criteria
43
+
44
+ - [ ] `genie work <slug>` reads Execution Strategy and spawns Wave 1 agents in parallel
45
+ - [ ] All agents in Wave 1 run simultaneously (visible in `genie ls`)
46
+ - [ ] Wave 2 starts only after all Wave 1 groups are done
47
+ - [ ] `genie work <slug>` exits 0 when all groups done
48
+ - [ ] `genie work <slug>` exits 1 if a wave times out (30min)
49
+ - [ ] `genie work <agent> <slug>#<group>` still works (backwards compatible)
50
+ - [ ] Team-lead prompt uses `genie work <slug>` as primary command
51
+ - [ ] `bun run check` passes
52
+
53
+ ## Execution Groups
54
+
55
+ ### Group 1: Parse Execution Strategy from WISH.md
56
+
57
+ **Goal:** Extract wave definitions from the Execution Strategy section.
58
+
59
+ **Deliverables:**
60
+ 1. Add `parseExecutionStrategy(content: string)` to `src/term-commands/dispatch.ts`:
61
+ - Parses `### Wave N` headings from the Execution Strategy section
62
+ - Extracts the table rows: Group | Agent | Description
63
+ - Returns `Wave[]` where each wave has `{ name: string, groups: { group: string, agent: string }[] }`
64
+ 2. Handle missing Execution Strategy section — fall back to sequential (all groups in one wave, `engineer` as default agent)
65
+
66
+ **Acceptance Criteria:**
67
+ - [ ] Parses wave tables from wish template format
68
+ - [ ] Falls back to sequential if no Execution Strategy section
69
+ - [ ] Returns typed `Wave[]` array
70
+
71
+ **Validation:**
72
+ ```bash
73
+ bun run typecheck && bun run lint
74
+ ```
75
+
76
+ **depends-on:** none
77
+
78
+ ---
79
+
80
+ ### Group 2: Implement genie work <slug> orchestrator
81
+
82
+ **Goal:** The core auto-orchestration loop.
83
+
84
+ **Deliverables:**
85
+ 1. Add `autoOrchestrateCommand(slug: string)` to `src/term-commands/dispatch.ts`:
86
+ - Read WISH.md, parse groups and execution strategy
87
+ - Auto-initialize wish state
88
+ - For each wave in order:
89
+ a. Dispatch all groups in the wave using `Promise.all()` — call `workDispatchCommand(agent, slug#group)` for each group concurrently. `workDispatchCommand` spawns a tmux pane and returns — it does NOT wait for the worker to finish, so `Promise.all` resolves once all panes are created.
90
+ b. Poll `wishState.getState(slug)` every 30s until all groups in the wave show `done`
91
+ c. If 30min elapsed without wave completion, exit 1 with error
92
+ - After all waves complete, exit 0
93
+ 2. Register the new command signature using Commander's optional arg pattern:
94
+ - `genie work <ref> [agent]` — if `agent` is provided AND `ref` contains `#`, it's manual mode (`workDispatchCommand`). If only `ref` (no `#`), it's auto mode (`autoOrchestrateCommand`).
95
+ - This avoids Commander ambiguity — single command, detect mode by args.
96
+
97
+ **Acceptance Criteria:**
98
+ - [ ] `genie work <slug>` spawns all Wave 1 agents concurrently (visible in `genie ls`)
99
+ - [ ] Polls state every 30s, advances waves correctly
100
+ - [ ] Times out after 30min per wave
101
+ - [ ] `genie work <agent> <slug>#<group>` still works unchanged
102
+ - [ ] Exit codes: 0 success, 1 timeout/failure
103
+
104
+ **Validation:**
105
+ ```bash
106
+ bun run typecheck && bun run lint && bun test
107
+ ```
108
+
109
+ **depends-on:** Group 1
110
+
111
+ ---
112
+
113
+ ### Group 3: Engineer reports completion via genie done
114
+
115
+ **Goal:** Workers must call `genie done <slug>#<group>` when they finish, so the orchestrator's state poll detects completion.
116
+
117
+ **Deliverables:**
118
+ 1. Update `plugins/genie/agents/engineer/AGENTS.md` — add instruction: "After completing all deliverables and validation, call `genie done <slug>#<group>` to report completion. The slug and group are in your initial prompt."
119
+ 2. Update the `initialPrompt` in `workDispatchCommand()` to include the `genie done` instruction: "When done, run: `genie done <slug>#<group>`"
120
+ 3. Sync flat copy `plugins/genie/agents/engineer.md`
121
+
122
+ **Acceptance Criteria:**
123
+ - [ ] Engineer prompt mentions `genie done`
124
+ - [ ] initialPrompt includes completion instruction
125
+ - [ ] Flat copy synced
126
+
127
+ **Validation:**
128
+ ```bash
129
+ bun run typecheck && bun run lint
130
+ ```
131
+
132
+ **depends-on:** none
133
+
134
+ ---
135
+
136
+ ### Group 4: Update team-lead prompt
137
+
138
+ **Goal:** Simplify team-lead to use `genie work <slug>`.
139
+
140
+ **Deliverables:**
141
+ 1. Update `plugins/genie/agents/team-lead/AGENTS.md` Phase 2:
142
+ - Primary command: `genie work <slug>` — handles all wave orchestration automatically
143
+ - Fallback: `genie work <agent> <slug>#<group>` for manual dispatch if auto fails
144
+ - `genie spawn` as escape hatch for custom agents
145
+ 2. Sync flat copy `plugins/genie/agents/team-lead.md`
146
+
147
+ **Acceptance Criteria:**
148
+ - [ ] Phase 2 says `genie work <slug>` as the primary command
149
+ - [ ] Manual dispatch documented as fallback
150
+ - [ ] Flat copy synced
151
+
152
+ **Validation:**
153
+ ```bash
154
+ diff plugins/genie/agents/team-lead/AGENTS.md plugins/genie/agents/team-lead.md
155
+ bun run typecheck && bun run lint
156
+ ```
157
+
158
+ **depends-on:** Group 2
159
+
160
+ ---
161
+
162
+ ### Group 5: Validate
163
+
164
+ **Goal:** Full CI pass.
165
+
166
+ **Validation:**
167
+ ```bash
168
+ bun run check
169
+ bun run build
170
+ ```
171
+
172
+ **depends-on:** Group 1, Group 2, Group 3, Group 4
173
+
174
+ ---
175
+
176
+ ## Execution Strategy
177
+
178
+ ### Wave 1 (parallel)
179
+ | Group | Agent | Description |
180
+ |-------|-------|-------------|
181
+ | 1 | engineer | Parse Execution Strategy |
182
+ | 3 | engineer | Engineer reports completion via genie done |
183
+
184
+ ### Wave 2 (after Wave 1)
185
+ | Group | Agent | Description |
186
+ |-------|-------|-------------|
187
+ | 2 | engineer | Auto-orchestration loop |
188
+
189
+ ### Wave 3 (after Wave 2)
190
+ | Group | Agent | Description |
191
+ |-------|-------|-------------|
192
+ | 4 | engineer | Team-lead prompt update |
193
+
194
+ ### Wave 4 (after Wave 3)
195
+ | Group | Agent | Description |
196
+ |-------|-------|-------------|
197
+ | 5 | reviewer | Full validation |
198
+
199
+ ---
200
+
201
+ ## Assumptions / Risks
202
+
203
+ | Risk | Severity | Mitigation |
204
+ |------|----------|------------|
205
+ | Workers don't call `genie done` and state never updates | Medium | 30min timeout exits with error. Team-lead can investigate. |
206
+ | Git conflicts between parallel workers in same worktree | Medium | Wish groups should be scoped to different files. If conflict happens, team-lead resolves. |
207
+ | Command parsing ambiguity between `work <slug>` and `work <agent> <ref>` | Low | Detect by: 1 arg = auto mode, 2 args with `#` = manual mode. |
208
+
209
+ ---
210
+
211
+ ## QA Criteria
212
+
213
+ - [ ] `genie work auto-orchestrate` spawns parallel agents per wave
214
+ - [ ] Waves advance correctly — Wave 2 only after Wave 1 complete
215
+ - [ ] Team-lead uses `genie work <slug>` and it works end-to-end
216
+ - [ ] Manual `genie work engineer slug#1` still works
217
+
218
+ ---
219
+
220
+ ## Review Results
221
+
222
+ _Populated by `/review` after execution completes._
223
+
224
+ ---
225
+
226
+ ## Files to Create/Modify
227
+
228
+ ```
229
+ src/term-commands/dispatch.ts — parseExecutionStrategy(), autoOrchestrateCommand(), command registration, initialPrompt update
230
+ plugins/genie/agents/engineer/AGENTS.md + engineer.md — add genie done completion reporting
231
+ plugins/genie/agents/team-lead/AGENTS.md + team-lead.md — simplified Phase 2
232
+ ```