oh-my-claude-sisyphus 3.5.6 → 3.5.8

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 (79) hide show
  1. package/README.md +58 -343
  2. package/commands/omc-setup.md +51 -0
  3. package/dist/__tests__/analytics/tokscale-adapter.test.d.ts +2 -0
  4. package/dist/__tests__/analytics/tokscale-adapter.test.d.ts.map +1 -0
  5. package/dist/__tests__/analytics/tokscale-adapter.test.js +79 -0
  6. package/dist/__tests__/analytics/tokscale-adapter.test.js.map +1 -0
  7. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
  8. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
  9. package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
  10. package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
  11. package/dist/__tests__/hooks/learner/bridge.test.d.ts +11 -0
  12. package/dist/__tests__/hooks/learner/bridge.test.d.ts.map +1 -0
  13. package/dist/__tests__/hooks/learner/bridge.test.js +199 -0
  14. package/dist/__tests__/hooks/learner/bridge.test.js.map +1 -0
  15. package/dist/__tests__/installer.test.js +1 -1
  16. package/dist/analytics/cost-estimator.d.ts +14 -0
  17. package/dist/analytics/cost-estimator.d.ts.map +1 -1
  18. package/dist/analytics/cost-estimator.js +65 -0
  19. package/dist/analytics/cost-estimator.js.map +1 -1
  20. package/dist/analytics/index.d.ts +1 -0
  21. package/dist/analytics/index.d.ts.map +1 -1
  22. package/dist/analytics/index.js +4 -0
  23. package/dist/analytics/index.js.map +1 -1
  24. package/dist/analytics/query-engine.d.ts +3 -0
  25. package/dist/analytics/query-engine.d.ts.map +1 -1
  26. package/dist/analytics/query-engine.js +87 -0
  27. package/dist/analytics/query-engine.js.map +1 -1
  28. package/dist/analytics/token-tracker.d.ts +3 -0
  29. package/dist/analytics/token-tracker.d.ts.map +1 -1
  30. package/dist/analytics/token-tracker.js +89 -0
  31. package/dist/analytics/token-tracker.js.map +1 -1
  32. package/dist/analytics/tokscale-adapter.d.ts +71 -0
  33. package/dist/analytics/tokscale-adapter.d.ts.map +1 -0
  34. package/dist/analytics/tokscale-adapter.js +223 -0
  35. package/dist/analytics/tokscale-adapter.js.map +1 -0
  36. package/dist/analytics/types.d.ts +17 -0
  37. package/dist/analytics/types.d.ts.map +1 -1
  38. package/dist/analytics/types.js +5 -0
  39. package/dist/analytics/types.js.map +1 -1
  40. package/dist/cli/analytics.js +35 -0
  41. package/dist/cli/analytics.js.map +1 -1
  42. package/dist/cli/commands/agents.d.ts.map +1 -1
  43. package/dist/cli/commands/agents.js +4 -2
  44. package/dist/cli/commands/agents.js.map +1 -1
  45. package/dist/cli/commands/stats.d.ts.map +1 -1
  46. package/dist/cli/commands/stats.js +6 -1
  47. package/dist/cli/commands/stats.js.map +1 -1
  48. package/dist/cli/index.js +95 -35
  49. package/dist/cli/index.js.map +1 -1
  50. package/dist/cli/utils/tokscale-launcher.d.ts +18 -0
  51. package/dist/cli/utils/tokscale-launcher.d.ts.map +1 -0
  52. package/dist/cli/utils/tokscale-launcher.js +64 -0
  53. package/dist/cli/utils/tokscale-launcher.js.map +1 -0
  54. package/dist/features/auto-update.js +5 -5
  55. package/dist/features/auto-update.js.map +1 -1
  56. package/dist/hooks/learner/bridge.d.ts +71 -0
  57. package/dist/hooks/learner/bridge.d.ts.map +1 -0
  58. package/dist/hooks/learner/bridge.js +426 -0
  59. package/dist/hooks/learner/bridge.js.map +1 -0
  60. package/dist/hooks/skill-bridge.cjs +349 -0
  61. package/dist/hud/types.d.ts +6 -2
  62. package/dist/hud/types.d.ts.map +1 -1
  63. package/dist/hud/types.js.map +1 -1
  64. package/dist/hud/usage-api.d.ts.map +1 -1
  65. package/dist/hud/usage-api.js +13 -1
  66. package/dist/hud/usage-api.js.map +1 -1
  67. package/dist/installer/index.d.ts +1 -1
  68. package/dist/installer/index.js +1 -1
  69. package/docs/ARCHITECTURE.md +80 -397
  70. package/docs/FEATURES.md +396 -1981
  71. package/docs/MIGRATION.md +4 -4
  72. package/docs/REFERENCE.md +545 -0
  73. package/docs/SYNC-SYSTEM.md +6 -6
  74. package/package.json +5 -2
  75. package/scripts/build-skill-bridge.mjs +32 -0
  76. package/scripts/skill-injector.mjs +77 -26
  77. package/scripts/sync-metadata.ts +2 -2
  78. package/skills/omc-setup/SKILL.md +51 -0
  79. package/docs/FULL-README.md +0 -1001
package/docs/FEATURES.md CHANGED
@@ -1,6 +1,6 @@
1
- # oh-my-claudecode Features Reference
1
+ # Developer API Reference
2
2
 
3
- > Developer documentation for v3.2 features integrated from oh-my-opencode.
3
+ > Internal API documentation for oh-my-claudecode developers and contributors.
4
4
 
5
5
  ## Table of Contents
6
6
  1. [Notepad Wisdom System](#notepad-wisdom-system)
@@ -15,2153 +15,568 @@
15
15
 
16
16
  ## Notepad Wisdom System
17
17
 
18
- ### Overview
18
+ Plan-scoped knowledge capture for agents executing tasks. Each plan gets its own notepad directory at `.omc/notepads/{plan-name}/` with four markdown files:
19
19
 
20
- The Notepad Wisdom system provides plan-scoped knowledge capture for agents executing tasks. Each plan gets its own notepad directory at `.omc/notepads/{plan-name}/` with four markdown files for categorizing knowledge:
20
+ - **learnings.md**: Patterns, conventions, successful approaches
21
+ - **decisions.md**: Architectural choices and rationales
22
+ - **issues.md**: Problems and blockers
23
+ - **problems.md**: Technical debt and gotchas
21
24
 
22
- - **learnings.md**: Patterns, conventions, successful approaches discovered during execution
23
- - **decisions.md**: Architectural choices and rationales made during implementation
24
- - **issues.md**: Problems and blockers encountered that may need attention
25
- - **problems.md**: Technical debt, gotchas, or ongoing challenges
25
+ All entries are timestamped automatically.
26
26
 
27
- All entries are timestamped automatically, creating an audit trail of the agent's learning process.
27
+ ### Core Functions
28
28
 
29
- ### API Reference
30
-
31
- #### `initPlanNotepad(planName: string, directory?: string): boolean`
32
-
33
- Initialize notepad directory for a plan. Creates `.omc/notepads/{plan-name}/` with 4 empty markdown files.
34
-
35
- **Parameters:**
36
- - `planName`: Name of the plan (used as directory name)
37
- - `directory`: Project root directory (defaults to `process.cwd()`)
38
-
39
- **Returns:** `true` if successful, `false` on error
40
-
41
- **Example:**
42
29
  ```typescript
43
- import { initPlanNotepad } from '@/features/notepad-wisdom';
44
-
45
- initPlanNotepad('feature-auth-refactor');
46
- // Creates: .omc/notepads/feature-auth-refactor/{learnings,decisions,issues,problems}.md
47
- ```
48
-
49
- ---
50
-
51
- #### `readPlanWisdom(planName: string, directory?: string): PlanWisdom`
52
-
53
- Read all wisdom from a plan's notepad. Returns concatenated wisdom from all 4 categories.
54
-
55
- **Parameters:**
56
- - `planName`: Name of the plan
57
- - `directory`: Project root directory (defaults to `process.cwd()`)
30
+ // Initialize notepad directory
31
+ initPlanNotepad(planName: string, directory?: string): boolean
58
32
 
59
- **Returns:** `PlanWisdom` object with all entries organized by category
33
+ // Add entries
34
+ addLearning(planName: string, content: string, directory?: string): boolean
35
+ addDecision(planName: string, content: string, directory?: string): boolean
36
+ addIssue(planName: string, content: string, directory?: string): boolean
37
+ addProblem(planName: string, content: string, directory?: string): boolean
60
38
 
61
- **Example:**
62
- ```typescript
63
- import { readPlanWisdom } from '@/features/notepad-wisdom';
64
-
65
- const wisdom = readPlanWisdom('feature-auth-refactor');
66
- console.log(wisdom.learnings.length); // Number of learning entries
67
- console.log(wisdom.decisions[0].content); // First decision content
39
+ // Read wisdom
40
+ readPlanWisdom(planName: string, directory?: string): PlanWisdom
41
+ getWisdomSummary(planName: string, directory?: string): string
68
42
  ```
69
43
 
70
- ---
44
+ ### Types
71
45
 
72
- #### `addLearning(planName: string, content: string, directory?: string): boolean`
46
+ ```typescript
47
+ export interface WisdomEntry {
48
+ timestamp: string; // ISO 8601: "YYYY-MM-DD HH:MM:SS"
49
+ content: string;
50
+ }
73
51
 
74
- Add a timestamped learning entry to the plan's notepad.
52
+ export type WisdomCategory = 'learnings' | 'decisions' | 'issues' | 'problems';
75
53
 
76
- **Parameters:**
77
- - `planName`: Name of the plan
78
- - `content`: Learning content to record
79
- - `directory`: Project root directory (defaults to `process.cwd()`)
54
+ export interface PlanWisdom {
55
+ planName: string;
56
+ learnings: WisdomEntry[];
57
+ decisions: WisdomEntry[];
58
+ issues: WisdomEntry[];
59
+ problems: WisdomEntry[];
60
+ }
61
+ ```
80
62
 
81
- **Returns:** `true` if successful, `false` on error
63
+ ### Usage Example
82
64
 
83
- **Example:**
84
65
  ```typescript
85
- import { addLearning } from '@/features/notepad-wisdom';
66
+ import { initPlanNotepad, addLearning, readPlanWisdom } from '@/features/notepad-wisdom';
86
67
 
87
- addLearning(
88
- 'feature-auth-refactor',
89
- 'User authentication follows singleton pattern in src/auth/AuthService.ts'
90
- );
68
+ // Initialize and record
69
+ initPlanNotepad('api-v2-migration');
70
+ addLearning('api-v2-migration', 'API routes use Express Router pattern in src/routes/');
71
+
72
+ // Read back
73
+ const wisdom = readPlanWisdom('api-v2-migration');
74
+ console.log(wisdom.learnings[0].content);
91
75
  ```
92
76
 
93
77
  ---
94
78
 
95
- #### `addDecision(planName: string, content: string, directory?: string): boolean`
79
+ ## Delegation Categories
96
80
 
97
- Add a timestamped decision entry to the plan's notepad.
81
+ Semantic task classification that automatically determines model tier, temperature, and thinking budget.
98
82
 
99
- **Parameters:**
100
- - `planName`: Name of the plan
101
- - `content`: Decision content to record
102
- - `directory`: Project root directory (defaults to `process.cwd()`)
83
+ ### Available Categories
103
84
 
104
- **Returns:** `true` if successful, `false` on error
85
+ | Category | Tier | Temp | Thinking | Use For |
86
+ |----------|------|------|----------|---------|
87
+ | `visual-engineering` | HIGH | 0.7 | high | UI/UX, frontend, design systems |
88
+ | `ultrabrain` | HIGH | 0.3 | max | Complex reasoning, architecture, debugging |
89
+ | `artistry` | MEDIUM | 0.9 | medium | Creative solutions, brainstorming |
90
+ | `quick` | LOW | 0.1 | low | Simple lookups, basic operations |
91
+ | `writing` | MEDIUM | 0.5 | medium | Documentation, technical writing |
92
+ | `unspecified-low` | LOW | 0.1 | low | Default for simple tasks |
93
+ | `unspecified-high` | HIGH | 0.5 | high | Default for complex tasks |
105
94
 
106
- **Example:**
107
- ```typescript
108
- import { addDecision } from '@/features/notepad-wisdom';
95
+ ### Core Functions
109
96
 
110
- addDecision(
111
- 'feature-auth-refactor',
112
- 'Using JWT tokens instead of session cookies to maintain stateless architecture'
113
- );
114
- ```
97
+ ```typescript
98
+ // Resolve category configuration
99
+ resolveCategory(category: DelegationCategory): ResolvedCategory
115
100
 
116
- ---
101
+ // Auto-detect from prompt
102
+ detectCategoryFromPrompt(taskPrompt: string): DelegationCategory | null
117
103
 
118
- #### `addIssue(planName: string, content: string, directory?: string): boolean`
104
+ // Get category with context
105
+ getCategoryForTask(context: CategoryContext): ResolvedCategory
119
106
 
120
- Add a timestamped issue entry to the plan's notepad.
107
+ // Enhance prompt with category guidance
108
+ enhancePromptWithCategory(taskPrompt: string, category: DelegationCategory): string
121
109
 
122
- **Parameters:**
123
- - `planName`: Name of the plan
124
- - `content`: Issue content to record
125
- - `directory`: Project root directory (defaults to `process.cwd()`)
110
+ // Individual accessors
111
+ getCategoryTier(category: DelegationCategory): ComplexityTier
112
+ getCategoryTemperature(category: DelegationCategory): number
113
+ getCategoryThinkingBudget(category: DelegationCategory): ThinkingBudget
114
+ getCategoryThinkingBudgetTokens(category: DelegationCategory): number
115
+ getCategoryPromptAppend(category: DelegationCategory): string
116
+ ```
126
117
 
127
- **Returns:** `true` if successful, `false` on error
118
+ ### Types
128
119
 
129
- **Example:**
130
120
  ```typescript
131
- import { addIssue } from '@/features/notepad-wisdom';
121
+ export type DelegationCategory =
122
+ | 'visual-engineering'
123
+ | 'ultrabrain'
124
+ | 'artistry'
125
+ | 'quick'
126
+ | 'writing'
127
+ | 'unspecified-low'
128
+ | 'unspecified-high';
132
129
 
133
- addIssue(
134
- 'feature-auth-refactor',
135
- 'TypeScript errors in auth middleware - missing type definitions for req.user'
136
- );
137
- ```
130
+ export type ThinkingBudget = 'low' | 'medium' | 'high' | 'max';
138
131
 
139
- ---
132
+ export interface ResolvedCategory {
133
+ category: DelegationCategory;
134
+ tier: ComplexityTier;
135
+ temperature: number;
136
+ thinkingBudget: ThinkingBudget;
137
+ description: string;
138
+ promptAppend?: string;
139
+ }
140
140
 
141
- #### `addProblem(planName: string, content: string, directory?: string): boolean`
141
+ export interface CategoryContext {
142
+ taskPrompt: string;
143
+ agentType?: string;
144
+ explicitCategory?: DelegationCategory;
145
+ explicitTier?: ComplexityTier;
146
+ }
147
+ ```
142
148
 
143
- Add a timestamped problem entry to the plan's notepad.
149
+ ### Usage Example
144
150
 
145
- **Parameters:**
146
- - `planName`: Name of the plan
147
- - `content`: Problem content to record
148
- - `directory`: Project root directory (defaults to `process.cwd()`)
151
+ ```typescript
152
+ import { getCategoryForTask, enhancePromptWithCategory } from '@/features/delegation-categories';
149
153
 
150
- **Returns:** `true` if successful, `false` on error
154
+ const userRequest = 'Debug the race condition in payment processor';
151
155
 
152
- **Example:**
153
- ```typescript
154
- import { addProblem } from '@/features/notepad-wisdom';
156
+ const resolved = getCategoryForTask({ taskPrompt: userRequest });
157
+ // resolved.category === 'ultrabrain'
158
+ // resolved.temperature === 0.3
155
159
 
156
- addProblem(
157
- 'feature-auth-refactor',
158
- 'Legacy password hashing uses MD5 - needs migration strategy for existing users'
159
- );
160
+ const enhancedPrompt = enhancePromptWithCategory(userRequest, resolved.category);
161
+ // Adds: "Think deeply and systematically. Consider all edge cases..."
160
162
  ```
161
163
 
162
164
  ---
163
165
 
164
- #### `getWisdomSummary(planName: string, directory?: string): string`
166
+ ## Directory Diagnostics
167
+
168
+ Project-level TypeScript/JavaScript QA enforcement using dual-strategy approach.
165
169
 
166
- Get a formatted string of all wisdom for a plan. Returns markdown-formatted summary.
170
+ ### Strategies
167
171
 
168
- **Parameters:**
169
- - `planName`: Name of the plan
170
- - `directory`: Project root directory (defaults to `process.cwd()`)
172
+ - **`tsc`**: Fast TypeScript compilation check via `tsc --noEmit`
173
+ - **`lsp`**: File-by-file Language Server Protocol diagnostics
174
+ - **`auto`**: Auto-selects best strategy (default, prefers tsc when available)
171
175
 
172
- **Returns:** Markdown-formatted summary string
176
+ ### API
173
177
 
174
- **Example:**
175
178
  ```typescript
176
- import { getWisdomSummary } from '@/features/notepad-wisdom';
177
-
178
- const summary = getWisdomSummary('feature-auth-refactor');
179
- console.log(summary);
180
- // # Learnings
181
- // - [2026-01-21 10:30:45] User authentication follows singleton pattern...
182
- // # Decisions
183
- // - [2026-01-21 10:35:12] Using JWT tokens instead of session cookies...
179
+ runDirectoryDiagnostics(directory: string, strategy?: DiagnosticsStrategy): Promise<DirectoryDiagnosticResult>
184
180
  ```
185
181
 
186
- ---
187
-
188
182
  ### Types
189
183
 
190
184
  ```typescript
191
- export interface WisdomEntry {
192
- timestamp: string; // ISO 8601 format: "YYYY-MM-DD HH:MM:SS"
193
- content: string; // Entry content
194
- }
195
-
196
- export type WisdomCategory = 'learnings' | 'decisions' | 'issues' | 'problems';
185
+ export type DiagnosticsStrategy = 'tsc' | 'lsp' | 'auto';
197
186
 
198
- export interface PlanWisdom {
199
- planName: string;
200
- learnings: WisdomEntry[];
201
- decisions: WisdomEntry[];
202
- issues: WisdomEntry[];
203
- problems: WisdomEntry[];
187
+ export interface DirectoryDiagnosticResult {
188
+ strategy: 'tsc' | 'lsp';
189
+ success: boolean;
190
+ errorCount: number;
191
+ warningCount: number;
192
+ diagnostics: string;
193
+ summary: string;
204
194
  }
205
195
  ```
206
196
 
207
- ### Examples
208
-
209
- **Example 1: Agent recording learnings during task execution**
210
- ```typescript
211
- import { initPlanNotepad, addLearning, addDecision } from '@/features/notepad-wisdom';
212
-
213
- // Initialize notepad at start of plan
214
- initPlanNotepad('api-v2-migration');
215
-
216
- // Record learnings as you discover patterns
217
- addLearning('api-v2-migration', 'API routes use Express Router pattern in src/routes/');
218
- addLearning('api-v2-migration', 'Validation middleware applied at route level, not controller');
219
-
220
- // Record architectural decisions
221
- addDecision('api-v2-migration', 'Migrating to REST resource pattern with versioned endpoints');
222
- ```
197
+ ### Usage Example
223
198
 
224
- **Example 2: Reading wisdom for context in follow-up tasks**
225
199
  ```typescript
226
- import { readPlanWisdom } from '@/features/notepad-wisdom';
227
-
228
- const wisdom = readPlanWisdom('api-v2-migration');
229
-
230
- // Check what was learned previously
231
- const hasRoutingInfo = wisdom.learnings.some(l =>
232
- l.content.includes('Express Router')
233
- );
200
+ import { runDirectoryDiagnostics } from '@/tools/diagnostics';
234
201
 
235
- // Review past decisions
236
- const migrationDecision = wisdom.decisions.find(d =>
237
- d.content.includes('REST resource pattern')
238
- );
239
- ```
202
+ const result = await runDirectoryDiagnostics(process.cwd());
240
203
 
241
- **Example 3: Generating a wisdom report**
242
- ```typescript
243
- import { getWisdomSummary } from '@/features/notepad-wisdom';
244
- import { writeFileSync } from 'fs';
204
+ if (!result.success) {
205
+ console.error(`Found ${result.errorCount} errors:`);
206
+ console.error(result.diagnostics);
207
+ process.exit(1);
208
+ }
245
209
 
246
- const summary = getWisdomSummary('api-v2-migration');
247
- writeFileSync('migration-report.md', summary);
210
+ console.log('Build quality check passed!');
248
211
  ```
249
212
 
250
213
  ---
251
214
 
252
- ## Delegation Categories
215
+ ## Dynamic Prompt Generation
253
216
 
254
- ### Overview
217
+ Generate orchestrator prompts dynamically from agent metadata. Adding a new agent to `definitions.ts` automatically includes it in generated prompts.
255
218
 
256
- The Delegation Categories system provides semantic task classification that automatically determines optimal model tier, temperature, and thinking budget. Categories enhance prompts with domain-specific guidance while the model-routing system independently selects the appropriate model.
219
+ ### Core Functions
257
220
 
258
- **Available Categories:**
259
- - **visual-engineering**: UI/UX work, frontend, design systems
260
- - **ultrabrain**: Complex reasoning, architecture, deep debugging
261
- - **artistry**: Creative solutions, innovative approaches
262
- - **quick**: Simple lookups, straightforward operations
263
- - **writing**: Documentation, technical writing, content
264
- - **unspecified-low**: Default for simple unclassified tasks
265
- - **unspecified-high**: Default for complex unclassified tasks
221
+ ```typescript
222
+ // Generate full orchestrator prompt
223
+ generateOrchestratorPrompt(agents: AgentConfig[], options?: GeneratorOptions): string
266
224
 
267
- ### API Reference
225
+ // Convert definitions to configs
226
+ convertDefinitionsToConfigs(definitions: Record<string, {...}>): AgentConfig[]
268
227
 
269
- #### `resolveCategory(category: DelegationCategory): ResolvedCategory`
228
+ // Individual section builders
229
+ buildHeader(): string
230
+ buildAgentRegistry(agents: AgentConfig[]): string
231
+ buildTriggerTable(agents: AgentConfig[]): string
232
+ buildToolSelectionSection(agents: AgentConfig[]): string
233
+ buildDelegationMatrix(agents: AgentConfig[]): string
234
+ buildOrchestrationPrinciples(): string
235
+ buildWorkflow(): string
236
+ buildCriticalRules(): string
237
+ buildCompletionChecklist(): string
238
+ ```
270
239
 
271
- Resolve a category to its full configuration including tier, temperature, and thinking budget.
240
+ ### Types
272
241
 
273
- **Parameters:**
274
- - `category`: The category to resolve
242
+ ```typescript
243
+ export interface GeneratorOptions {
244
+ includeAgents?: boolean;
245
+ includeTriggers?: boolean;
246
+ includeTools?: boolean;
247
+ includeDelegationTable?: boolean;
248
+ includePrinciples?: boolean;
249
+ includeWorkflow?: boolean;
250
+ includeRules?: boolean;
251
+ includeChecklist?: boolean;
252
+ }
253
+ ```
275
254
 
276
- **Returns:** Resolved category with full configuration
255
+ ### Usage Example
277
256
 
278
- **Example:**
279
257
  ```typescript
280
- import { resolveCategory } from '@/features/delegation-categories';
258
+ import { getAgentDefinitions } from '@/agents/definitions';
259
+ import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
281
260
 
282
- const config = resolveCategory('ultrabrain');
283
- console.log(config.tier); // 'HIGH'
284
- console.log(config.temperature); // 0.3
285
- console.log(config.thinkingBudget); // 'max'
286
- console.log(config.description); // 'Complex reasoning, architecture...'
261
+ const definitions = getAgentDefinitions();
262
+ const agents = convertDefinitionsToConfigs(definitions);
263
+ const prompt = generateOrchestratorPrompt(agents);
287
264
  ```
288
265
 
289
266
  ---
290
267
 
291
- #### `isValidCategory(category: string): category is DelegationCategory`
292
-
293
- Check if a string is a valid delegation category.
294
-
295
- **Parameters:**
296
- - `category`: String to check
268
+ ## Agent Templates
297
269
 
298
- **Returns:** `true` if valid category
270
+ Standardized prompt structures for common task types.
299
271
 
300
- **Example:**
301
- ```typescript
302
- import { isValidCategory } from '@/features/delegation-categories';
272
+ ### Exploration Template
303
273
 
304
- isValidCategory('ultrabrain'); // true
305
- isValidCategory('invalid-cat'); // false
306
- ```
274
+ For exploration, research, or search tasks.
307
275
 
308
- ---
276
+ **Sections:**
277
+ - **TASK**: What needs to be explored
278
+ - **EXPECTED OUTCOME**: What the orchestrator expects back
279
+ - **CONTEXT**: Background information
280
+ - **MUST DO**: Required actions
281
+ - **MUST NOT DO**: Constraints
282
+ - **REQUIRED SKILLS**: Skills needed
283
+ - **REQUIRED TOOLS**: Tools to use
309
284
 
310
- #### `getAllCategories(): DelegationCategory[]`
285
+ **Location:** `src/agents/templates/exploration-template.md`
311
286
 
312
- Get all available delegation categories.
287
+ ### Implementation Template
313
288
 
314
- **Returns:** Array of all delegation categories
289
+ For code implementation, refactoring, or modification tasks.
315
290
 
316
- **Example:**
317
- ```typescript
318
- import { getAllCategories } from '@/features/delegation-categories';
291
+ **Sections:**
292
+ - **TASK**: Implementation goal
293
+ - **EXPECTED OUTCOME**: Deliverable
294
+ - **CONTEXT**: Project background
295
+ - **MUST DO**: Required actions
296
+ - **MUST NOT DO**: Constraints
297
+ - **REQUIRED SKILLS**: Skills needed
298
+ - **REQUIRED TOOLS**: Tools to use
299
+ - **VERIFICATION CHECKLIST**: Pre-completion checks
319
300
 
320
- const categories = getAllCategories();
321
- // ['visual-engineering', 'ultrabrain', 'artistry', 'quick', 'writing', ...]
322
- ```
301
+ **Location:** `src/agents/templates/implementation-template.md`
323
302
 
324
303
  ---
325
304
 
326
- #### `getCategoryDescription(category: DelegationCategory): string`
327
-
328
- Get human-readable description for a category.
305
+ ## Session Resume
329
306
 
330
- **Parameters:**
331
- - `category`: The category
307
+ Wrapper for resuming background agent sessions with full context.
332
308
 
333
- **Returns:** Description string
309
+ ### API
334
310
 
335
- **Example:**
336
311
  ```typescript
337
- import { getCategoryDescription } from '@/features/delegation-categories';
338
-
339
- const desc = getCategoryDescription('visual-engineering');
340
- // 'UI/visual reasoning, frontend work, design systems'
312
+ resumeSession(input: ResumeSessionInput): ResumeSessionOutput
341
313
  ```
342
314
 
343
- ---
344
-
345
- #### `detectCategoryFromPrompt(taskPrompt: string): DelegationCategory | null`
346
-
347
- Detect category from task prompt using keyword matching. Requires at least 2 keyword matches for confidence.
348
-
349
- **Parameters:**
350
- - `taskPrompt`: The task description
351
-
352
- **Returns:** Best matching category or `null` if no confident match
315
+ ### Types
353
316
 
354
- **Example:**
355
317
  ```typescript
356
- import { detectCategoryFromPrompt } from '@/features/delegation-categories';
357
-
358
- const category = detectCategoryFromPrompt('Design a beautiful dashboard with responsive layout');
359
- console.log(category); // 'visual-engineering'
318
+ export interface ResumeSessionInput {
319
+ sessionId: string;
320
+ }
360
321
 
361
- const category2 = detectCategoryFromPrompt('Debug race condition in payment processor');
362
- console.log(category2); // 'ultrabrain'
322
+ export interface ResumeSessionOutput {
323
+ success: boolean;
324
+ context?: {
325
+ previousPrompt: string;
326
+ toolCallCount: number;
327
+ lastToolUsed?: string;
328
+ lastOutputSummary?: string;
329
+ continuationPrompt: string;
330
+ };
331
+ error?: string;
332
+ }
363
333
  ```
364
334
 
365
- ---
366
-
367
- #### `getCategoryForTask(context: CategoryContext): ResolvedCategory`
335
+ ### Usage Example
368
336
 
369
- Get category for a task with full context. Handles explicit overrides and auto-detection.
370
-
371
- **Parameters:**
372
- - `context`: Category resolution context
337
+ ```typescript
338
+ import { resumeSession } from '@/tools/resume-session';
373
339
 
374
- **Returns:** Resolved category with configuration
340
+ const result = resumeSession({ sessionId: 'ses_abc123' });
375
341
 
376
- **Example:**
377
- ```typescript
378
- import { getCategoryForTask } from '@/features/delegation-categories';
342
+ if (result.success && result.context) {
343
+ console.log(`Resuming session with ${result.context.toolCallCount} prior tool calls`);
379
344
 
380
- // Auto-detect from prompt
381
- const resolved = getCategoryForTask({
382
- taskPrompt: 'Create a responsive navigation component'
383
- });
384
- console.log(resolved.category); // 'visual-engineering'
385
- console.log(resolved.temperature); // 0.7
386
-
387
- // Explicit category override
388
- const resolved2 = getCategoryForTask({
389
- taskPrompt: 'Some task',
390
- explicitCategory: 'ultrabrain'
391
- });
392
- console.log(resolved2.category); // 'ultrabrain'
345
+ // Continue with Task delegation
346
+ Task({
347
+ subagent_type: "oh-my-claudecode:executor",
348
+ model: "sonnet",
349
+ prompt: result.context.continuationPrompt
350
+ });
351
+ }
393
352
  ```
394
353
 
395
354
  ---
396
355
 
397
- #### `getCategoryTier(category: DelegationCategory): ComplexityTier`
356
+ ## Autopilot
398
357
 
399
- Get complexity tier from category (for backward compatibility).
358
+ Autonomous execution from idea to validated working code through a 5-phase development lifecycle.
400
359
 
401
- **Parameters:**
402
- - `category`: Delegation category
360
+ ### 5-Phase Workflow
403
361
 
404
- **Returns:** Complexity tier ('LOW' | 'MEDIUM' | 'HIGH')
362
+ 1. **Expansion** - Analyst + Architect expand idea into requirements and technical spec
363
+ 2. **Planning** - Architect creates execution plan (validated by Critic)
364
+ 3. **Execution** - Ralph + Ultrawork implement plan with parallel tasks
365
+ 4. **QA** - UltraQA ensures build/lint/tests pass through fix cycles
366
+ 5. **Validation** - Specialized architects perform functional, security, and quality reviews
405
367
 
406
- **Example:**
407
- ```typescript
408
- import { getCategoryTier } from '@/features/delegation-categories';
368
+ ### Core Types
409
369
 
410
- const tier = getCategoryTier('ultrabrain'); // 'HIGH'
411
- const tier2 = getCategoryTier('quick'); // 'LOW'
412
- ```
370
+ ```typescript
371
+ export type AutopilotPhase =
372
+ | 'expansion'
373
+ | 'planning'
374
+ | 'execution'
375
+ | 'qa'
376
+ | 'validation'
377
+ | 'complete'
378
+ | 'failed';
413
379
 
414
- ---
380
+ export interface AutopilotState {
381
+ active: boolean;
382
+ phase: AutopilotPhase;
383
+ iteration: number;
384
+ max_iterations: number;
385
+ originalIdea: string;
415
386
 
416
- #### `getCategoryTemperature(category: DelegationCategory): number`
387
+ expansion: AutopilotExpansion;
388
+ planning: AutopilotPlanning;
389
+ execution: AutopilotExecution;
390
+ qa: AutopilotQA;
391
+ validation: AutopilotValidation;
417
392
 
418
- Get temperature setting from category.
393
+ started_at: string;
394
+ completed_at: string | null;
395
+ phase_durations: Record<string, number>;
396
+ total_agents_spawned: number;
397
+ wisdom_entries: number;
398
+ session_id?: string;
399
+ }
419
400
 
420
- **Parameters:**
421
- - `category`: Delegation category
401
+ export interface AutopilotConfig {
402
+ maxIterations?: number; // default: 10
403
+ maxExpansionIterations?: number; // default: 2
404
+ maxArchitectIterations?: number; // default: 5
405
+ maxQaCycles?: number; // default: 5
406
+ maxValidationRounds?: number; // default: 3
407
+ parallelExecutors?: number; // default: 5
408
+ pauseAfterExpansion?: boolean; // default: false
409
+ pauseAfterPlanning?: boolean; // default: false
410
+ skipQa?: boolean; // default: false
411
+ skipValidation?: boolean; // default: false
412
+ autoCommit?: boolean; // default: false
413
+ validationArchitects?: ValidationVerdictType[];
414
+ }
415
+ ```
422
416
 
423
- **Returns:** Temperature value (0-1)
417
+ ### State Management
424
418
 
425
- **Example:**
426
419
  ```typescript
427
- import { getCategoryTemperature } from '@/features/delegation-categories';
428
-
429
- const temp = getCategoryTemperature('visual-engineering'); // 0.7
430
- const temp2 = getCategoryTemperature('ultrabrain'); // 0.3
431
- ```
432
-
433
- ---
420
+ // Initialize session
421
+ initAutopilot(directory: string, idea: string, sessionId?: string, config?: Partial<AutopilotConfig>): AutopilotState
434
422
 
435
- #### `getCategoryThinkingBudget(category: DelegationCategory): ThinkingBudget`
423
+ // Read/write state
424
+ readAutopilotState(directory: string): AutopilotState | null
425
+ writeAutopilotState(directory: string, state: AutopilotState): boolean
426
+ clearAutopilotState(directory: string): boolean
436
427
 
437
- Get thinking budget level from category.
428
+ // Check status
429
+ isAutopilotActive(directory: string): boolean
438
430
 
439
- **Parameters:**
440
- - `category`: Delegation category
431
+ // Phase transitions
432
+ transitionPhase(directory: string, newPhase: AutopilotPhase): AutopilotState | null
433
+ transitionRalphToUltraQA(directory: string, sessionId: string): TransitionResult
434
+ transitionUltraQAToValidation(directory: string): TransitionResult
435
+ transitionToComplete(directory: string): TransitionResult
436
+ transitionToFailed(directory: string, error: string): TransitionResult
441
437
 
442
- **Returns:** Thinking budget level ('low' | 'medium' | 'high' | 'max')
438
+ // Update phase data
439
+ updateExpansion(directory: string, updates: Partial<AutopilotExpansion>): boolean
440
+ updatePlanning(directory: string, updates: Partial<AutopilotPlanning>): boolean
441
+ updateExecution(directory: string, updates: Partial<AutopilotExecution>): boolean
442
+ updateQA(directory: string, updates: Partial<AutopilotQA>): boolean
443
+ updateValidation(directory: string, updates: Partial<AutopilotValidation>): boolean
443
444
 
444
- **Example:**
445
- ```typescript
446
- import { getCategoryThinkingBudget } from '@/features/delegation-categories';
445
+ // Metrics
446
+ incrementAgentCount(directory: string, count?: number): boolean
447
447
 
448
- const budget = getCategoryThinkingBudget('ultrabrain'); // 'max'
449
- const budget2 = getCategoryThinkingBudget('quick'); // 'low'
448
+ // Paths
449
+ getSpecPath(directory: string): string // .omc/autopilot/spec.md
450
+ getPlanPath(directory: string): string // .omc/plans/autopilot-impl.md
450
451
  ```
451
452
 
452
- ---
453
+ ### Prompt Generation
453
454
 
454
- #### `getCategoryThinkingBudgetTokens(category: DelegationCategory): number`
455
+ ```typescript
456
+ // Phase-specific prompts
457
+ getExpansionPrompt(idea: string): string
458
+ getDirectPlanningPrompt(specPath: string): string
459
+ getExecutionPrompt(planPath: string): string
460
+ getQAPrompt(): string
461
+ getValidationPrompt(specPath: string): string
455
462
 
456
- Get thinking budget in approximate tokens.
463
+ // Generic phase prompt
464
+ getPhasePrompt(phase: string, context: object): string
457
465
 
458
- **Parameters:**
459
- - `category`: Delegation category
466
+ // Transition prompts
467
+ getTransitionPrompt(fromPhase: string, toPhase: string): string
468
+ ```
460
469
 
461
- **Returns:** Token budget (1000/5000/10000/32000)
470
+ ### Validation Coordination
462
471
 
463
- **Example:**
464
472
  ```typescript
465
- import { getCategoryThinkingBudgetTokens } from '@/features/delegation-categories';
466
-
467
- const tokens = getCategoryThinkingBudgetTokens('ultrabrain'); // 32000
468
- const tokens2 = getCategoryThinkingBudgetTokens('quick'); // 1000
469
- ```
473
+ export type ValidationVerdictType = 'functional' | 'security' | 'quality';
474
+ export type ValidationVerdict = 'APPROVED' | 'REJECTED' | 'NEEDS_FIX';
470
475
 
471
- ---
476
+ // Record verdicts
477
+ recordValidationVerdict(directory: string, type: ValidationVerdictType, verdict: ValidationVerdict, issues?: string[]): boolean
472
478
 
473
- #### `getCategoryPromptAppend(category: DelegationCategory): string`
479
+ // Get status
480
+ getValidationStatus(directory: string): ValidationCoordinatorResult | null
474
481
 
475
- Get prompt appendix for category. Returns context-specific guidance added to prompts.
482
+ // Control validation rounds
483
+ startValidationRound(directory: string): boolean
484
+ shouldRetryValidation(directory: string, maxRounds?: number): boolean
485
+ getIssuesToFix(directory: string): string[]
476
486
 
477
- **Parameters:**
478
- - `category`: Delegation category
487
+ // Prompts and display
488
+ getValidationSpawnPrompt(specPath: string): string
489
+ formatValidationResults(state: AutopilotState): string
490
+ ```
479
491
 
480
- **Returns:** Prompt appendix or empty string
492
+ ### Summaries
481
493
 
482
- **Example:**
483
494
  ```typescript
484
- import { getCategoryPromptAppend } from '@/features/delegation-categories';
495
+ // Generate summary
496
+ generateSummary(directory: string): AutopilotSummary | null
485
497
 
486
- const append = getCategoryPromptAppend('visual-engineering');
487
- // 'Focus on visual design, user experience, and aesthetic quality...'
498
+ // Format summaries
499
+ formatSummary(summary: AutopilotSummary): string
500
+ formatCompactSummary(state: AutopilotState): string
501
+ formatFailureSummary(state: AutopilotState, error?: string): string
502
+ formatFileList(files: string[], title: string, maxFiles?: number): string
488
503
  ```
489
504
 
490
- ---
505
+ ### Cancellation & Resume
491
506
 
492
- #### `enhancePromptWithCategory(taskPrompt: string, category: DelegationCategory): string`
507
+ ```typescript
508
+ // Cancel and preserve progress
509
+ cancelAutopilot(directory: string): CancelResult
510
+ clearAutopilot(directory: string): CancelResult
493
511
 
494
- Create a delegation prompt with category-specific guidance appended.
512
+ // Resume
513
+ canResumeAutopilot(directory: string): { canResume: boolean; state?: AutopilotState; resumePhase?: string }
514
+ resumeAutopilot(directory: string): { success: boolean; message: string; state?: AutopilotState }
495
515
 
496
- **Parameters:**
497
- - `taskPrompt`: Base task prompt
498
- - `category`: Delegation category
516
+ // Display
517
+ formatCancelMessage(result: CancelResult): string
518
+ ```
499
519
 
500
- **Returns:** Enhanced prompt with category guidance
520
+ ### Usage Example
501
521
 
502
- **Example:**
503
522
  ```typescript
504
- import { enhancePromptWithCategory } from '@/features/delegation-categories';
505
-
506
- const enhanced = enhancePromptWithCategory(
507
- 'Create a dashboard component',
508
- 'visual-engineering'
509
- );
510
- // 'Create a dashboard component\n\nFocus on visual design, user experience...'
511
- ```
512
-
513
- ---
523
+ import {
524
+ initAutopilot,
525
+ getPhasePrompt,
526
+ readAutopilotState,
527
+ transitionRalphToUltraQA,
528
+ getValidationStatus,
529
+ generateSummary,
530
+ formatSummary
531
+ } from '@/hooks/autopilot';
514
532
 
515
- ### Types
533
+ // Initialize session
534
+ const idea = 'Create a REST API for todo management with authentication';
535
+ const state = initAutopilot(process.cwd(), idea, 'ses_abc123');
516
536
 
517
- ```typescript
518
- export type DelegationCategory =
519
- | 'visual-engineering'
520
- | 'ultrabrain'
521
- | 'artistry'
522
- | 'quick'
523
- | 'writing'
524
- | 'unspecified-low'
525
- | 'unspecified-high';
537
+ // Get expansion phase prompt
538
+ const prompt = getPhasePrompt('expansion', { idea });
526
539
 
527
- export type ThinkingBudget = 'low' | 'medium' | 'high' | 'max';
540
+ // Monitor progress
541
+ const currentState = readAutopilotState(process.cwd());
542
+ console.log(`Phase: ${currentState?.phase}`);
543
+ console.log(`Agents spawned: ${currentState?.total_agents_spawned}`);
528
544
 
529
- export interface CategoryConfig {
530
- tier: ComplexityTier; // 'LOW' | 'MEDIUM' | 'HIGH'
531
- temperature: number; // 0-1
532
- thinkingBudget: ThinkingBudget;
533
- promptAppend?: string;
534
- description: string;
545
+ // Transition phases
546
+ if (currentState?.phase === 'execution' && currentState.execution.ralph_completed_at) {
547
+ const result = transitionRalphToUltraQA(process.cwd(), 'ses_abc123');
548
+ if (result.success) {
549
+ console.log('Transitioned to QA phase');
550
+ }
535
551
  }
536
552
 
537
- export interface ResolvedCategory extends CategoryConfig {
538
- category: DelegationCategory;
553
+ // Check validation
554
+ const validationStatus = getValidationStatus(process.cwd());
555
+ if (validationStatus?.allApproved) {
556
+ const summary = generateSummary(process.cwd());
557
+ if (summary) {
558
+ console.log(formatSummary(summary));
559
+ }
539
560
  }
540
-
541
- export interface CategoryContext {
542
- taskPrompt: string;
543
- agentType?: string;
544
- explicitCategory?: DelegationCategory;
545
- explicitTier?: ComplexityTier;
546
- }
547
- ```
548
-
549
- ### Examples
550
-
551
- **Example 1: Auto-detecting category for delegation**
552
- ```typescript
553
- import { getCategoryForTask, enhancePromptWithCategory } from '@/features/delegation-categories';
554
-
555
- const userRequest = 'Debug the race condition in the payment processor';
556
-
557
- const resolved = getCategoryForTask({ taskPrompt: userRequest });
558
- console.log(resolved.category); // 'ultrabrain'
559
- console.log(resolved.tier); // 'HIGH'
560
- console.log(resolved.temperature); // 0.3
561
-
562
- const enhancedPrompt = enhancePromptWithCategory(userRequest, resolved.category);
563
- // Prompt now includes: "Think deeply and systematically. Consider all edge cases..."
564
- ```
565
-
566
- **Example 2: Explicit category override for specific needs**
567
- ```typescript
568
- import { getCategoryForTask } from '@/features/delegation-categories';
569
-
570
- const resolved = getCategoryForTask({
571
- taskPrompt: 'Implement user profile page',
572
- explicitCategory: 'visual-engineering' // Force visual engineering approach
573
- });
574
- ```
575
-
576
- **Example 3: Building custom delegation with category configuration**
577
- ```typescript
578
- import { resolveCategory, getCategoryThinkingBudgetTokens } from '@/features/delegation-categories';
579
-
580
- const config = resolveCategory('artistry');
581
- const tokens = getCategoryThinkingBudgetTokens('artistry');
582
-
583
- const delegationParams = {
584
- tier: config.tier,
585
- temperature: config.temperature,
586
- thinkingBudgetTokens: tokens,
587
- prompt: config.promptAppend
588
- ? `${basePrompt}\n\n${config.promptAppend}`
589
- : basePrompt
590
- };
591
- ```
592
-
593
- ---
594
-
595
- ## Directory Diagnostics
596
-
597
- ### Overview
598
-
599
- Directory Diagnostics provides project-level QA enforcement for TypeScript/JavaScript projects using a dual-strategy approach:
600
-
601
- 1. **Primary Strategy (tsc)**: Fast, comprehensive TypeScript compilation check via `tsc --noEmit`
602
- 2. **Fallback Strategy (LSP)**: File-by-file Language Server Protocol diagnostics when tsc unavailable
603
-
604
- The system automatically selects the best strategy based on project configuration.
605
-
606
- ### API Reference
607
-
608
- #### `runDirectoryDiagnostics(directory: string, strategy?: DiagnosticsStrategy): Promise<DirectoryDiagnosticResult>`
609
-
610
- Run directory-level diagnostics using the best available strategy.
611
-
612
- **Parameters:**
613
- - `directory`: Project directory to check
614
- - `strategy`: Strategy to use - `'tsc'`, `'lsp'`, or `'auto'` (default: `'auto'`)
615
-
616
- **Returns:** Promise resolving to diagnostic results
617
-
618
- **Example:**
619
- ```typescript
620
- import { runDirectoryDiagnostics } from '@/tools/diagnostics';
621
-
622
- const result = await runDirectoryDiagnostics('/path/to/project');
623
-
624
- console.log(result.strategy); // 'tsc' or 'lsp'
625
- console.log(result.success); // true if no errors
626
- console.log(result.errorCount); // Number of errors
627
- console.log(result.warningCount); // Number of warnings
628
- console.log(result.diagnostics); // Formatted diagnostics output
629
- console.log(result.summary); // Human-readable summary
630
- ```
631
-
632
- ---
633
-
634
- ### Types
635
-
636
- ```typescript
637
- export type DiagnosticsStrategy = 'tsc' | 'lsp' | 'auto';
638
-
639
- export interface DirectoryDiagnosticResult {
640
- strategy: 'tsc' | 'lsp'; // Strategy that was used
641
- success: boolean; // true if no errors
642
- errorCount: number;
643
- warningCount: number;
644
- diagnostics: string; // Formatted diagnostic output
645
- summary: string; // Human-readable summary
646
- }
647
-
648
- // Re-exported from sub-modules
649
- export interface TscDiagnostic {
650
- file: string;
651
- line: number;
652
- column: number;
653
- severity: 'error' | 'warning';
654
- code: string;
655
- message: string;
656
- }
657
-
658
- export interface TscResult {
659
- success: boolean;
660
- errorCount: number;
661
- warningCount: number;
662
- diagnostics: TscDiagnostic[];
663
- }
664
-
665
- export interface LspDiagnosticWithFile {
666
- file: string;
667
- diagnostic: Diagnostic; // VS Code LSP Diagnostic type
668
- }
669
-
670
- export interface LspAggregationResult {
671
- success: boolean;
672
- errorCount: number;
673
- warningCount: number;
674
- filesChecked: number;
675
- diagnostics: LspDiagnosticWithFile[];
676
- }
677
- ```
678
-
679
- ### Examples
680
-
681
- **Example 1: Auto-detect best strategy**
682
- ```typescript
683
- import { runDirectoryDiagnostics } from '@/tools/diagnostics';
684
-
685
- const result = await runDirectoryDiagnostics(process.cwd());
686
-
687
- if (result.success) {
688
- console.log('All checks passed!');
689
- } else {
690
- console.error(`Found ${result.errorCount} errors:`);
691
- console.error(result.diagnostics);
692
- }
693
- ```
694
-
695
- **Example 2: Force specific strategy**
696
- ```typescript
697
- import { runDirectoryDiagnostics } from '@/tools/diagnostics';
698
-
699
- // Force tsc even if LSP is available
700
- const result = await runDirectoryDiagnostics(process.cwd(), 'tsc');
701
-
702
- console.log(result.summary);
703
- // 'TypeScript check failed: 3 errors, 1 warnings'
704
- ```
705
-
706
- **Example 3: Integration with CI/CD**
707
- ```typescript
708
- import { runDirectoryDiagnostics } from '@/tools/diagnostics';
709
-
710
- async function ciCheck() {
711
- const result = await runDirectoryDiagnostics(process.cwd(), 'auto');
712
-
713
- if (!result.success) {
714
- console.error(result.diagnostics);
715
- process.exit(1);
716
- }
717
-
718
- console.log('Build quality check passed!');
719
- }
720
- ```
721
-
722
- ---
723
-
724
- ## Dynamic Prompt Generation
725
-
726
- ### Overview
727
-
728
- The Dynamic Prompt Generation system builds orchestrator prompts dynamically from agent metadata. Adding a new agent to `definitions.ts` automatically includes it in generated prompts. This ensures the orchestrator always has up-to-date knowledge of available agents.
729
-
730
- ### Generator API
731
-
732
- #### `generateOrchestratorPrompt(agents: AgentConfig[], options?: GeneratorOptions): string`
733
-
734
- Generate complete orchestrator prompt from agent definitions.
735
-
736
- **Parameters:**
737
- - `agents`: Array of agent configurations
738
- - `options`: Optional configuration for which sections to include
739
-
740
- **Returns:** Generated orchestrator prompt string
741
-
742
- **Example:**
743
- ```typescript
744
- import { getAgentDefinitions } from '@/agents/definitions';
745
- import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
746
-
747
- const definitions = getAgentDefinitions();
748
- const agents = convertDefinitionsToConfigs(definitions);
749
- const prompt = generateOrchestratorPrompt(agents);
750
-
751
- console.log(prompt);
752
- // Full orchestrator prompt with agent registry, triggers, delegation guide, etc.
753
- ```
754
-
755
- ---
756
-
757
- #### `convertDefinitionsToConfigs(definitions: Record<string, {...}>): AgentConfig[]`
758
-
759
- Convert agent definitions record to array of AgentConfig for generation.
760
-
761
- **Parameters:**
762
- - `definitions`: Record of agent definitions from `getAgentDefinitions()`
763
-
764
- **Returns:** Array of AgentConfig suitable for prompt generation
765
-
766
- **Example:**
767
- ```typescript
768
- import { getAgentDefinitions } from '@/agents/definitions';
769
- import { convertDefinitionsToConfigs, generateOrchestratorPrompt } from '@/agents/prompt-generator';
770
-
771
- const definitions = getAgentDefinitions();
772
- const agents = convertDefinitionsToConfigs(definitions);
773
- const prompt = generateOrchestratorPrompt(agents);
774
- ```
775
-
776
- ---
777
-
778
- ### Section Builders
779
-
780
- Individual section builders are exported for custom prompt composition:
781
-
782
- #### `buildHeader(): string`
783
- Build the header section with core orchestrator identity.
784
-
785
- #### `buildAgentRegistry(agents: AgentConfig[]): string`
786
- Build the agent registry section with descriptions.
787
-
788
- #### `buildTriggerTable(agents: AgentConfig[]): string`
789
- Build the trigger table showing when to use each agent.
790
-
791
- #### `buildToolSelectionSection(agents: AgentConfig[]): string`
792
- Build tool selection guidance section.
793
-
794
- #### `buildDelegationMatrix(agents: AgentConfig[]): string`
795
- Build delegation matrix/guide table.
796
-
797
- #### `buildOrchestrationPrinciples(): string`
798
- Build orchestration principles section.
799
-
800
- #### `buildWorkflow(): string`
801
- Build workflow section.
802
-
803
- #### `buildCriticalRules(): string`
804
- Build critical rules section.
805
-
806
- #### `buildCompletionChecklist(): string`
807
- Build completion checklist section.
808
-
809
- ### Types
810
-
811
- ```typescript
812
- export interface GeneratorOptions {
813
- includeAgents?: boolean; // default: true
814
- includeTriggers?: boolean; // default: true
815
- includeTools?: boolean; // default: true
816
- includeDelegationTable?: boolean; // default: true
817
- includePrinciples?: boolean; // default: true
818
- includeWorkflow?: boolean; // default: true
819
- includeRules?: boolean; // default: true
820
- includeChecklist?: boolean; // default: true
821
- }
822
- ```
823
-
824
- ### Examples
825
-
826
- **Example 1: Generate full orchestrator prompt**
827
- ```typescript
828
- import { getAgentDefinitions } from '@/agents/definitions';
829
- import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
830
-
831
- const definitions = getAgentDefinitions();
832
- const agents = convertDefinitionsToConfigs(definitions);
833
- const fullPrompt = generateOrchestratorPrompt(agents);
834
- ```
835
-
836
- **Example 2: Generate partial prompt (agents + triggers only)**
837
- ```typescript
838
- import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
839
- import { getAgentDefinitions } from '@/agents/definitions';
840
-
841
- const agents = convertDefinitionsToConfigs(getAgentDefinitions());
842
- const partialPrompt = generateOrchestratorPrompt(agents, {
843
- includeAgents: true,
844
- includeTriggers: true,
845
- includeTools: false,
846
- includeDelegationTable: false,
847
- includePrinciples: false,
848
- includeWorkflow: false,
849
- includeRules: false,
850
- includeChecklist: false
851
- });
852
- ```
853
-
854
- **Example 3: Custom prompt composition with individual builders**
855
- ```typescript
856
- import {
857
- buildHeader,
858
- buildAgentRegistry,
859
- buildDelegationMatrix
860
- } from '@/agents/prompt-generator';
861
- import { getAgentDefinitions } from '@/agents/definitions';
862
- import { convertDefinitionsToConfigs } from '@/agents/prompt-generator';
863
-
864
- const agents = convertDefinitionsToConfigs(getAgentDefinitions());
865
-
866
- const customPrompt = [
867
- buildHeader(),
868
- '',
869
- buildAgentRegistry(agents),
870
- '',
871
- buildDelegationMatrix(agents),
872
- '',
873
- 'CUSTOM SECTION: Special instructions here'
874
- ].join('\n');
875
- ```
876
-
877
- ---
878
-
879
- ## Agent Templates
880
-
881
- ### Overview
882
-
883
- Agent templates provide standardized prompt structures for common task types. They ensure consistency in agent delegation and make it easier to provide comprehensive context.
884
-
885
- ### Available Templates
886
-
887
- #### Exploration Template (`src/agents/templates/exploration-template.md`)
888
-
889
- Use for exploration, research, or search tasks.
890
-
891
- **Sections:**
892
- - **TASK**: Clear description of what needs to be explored
893
- - **EXPECTED OUTCOME**: What the orchestrator expects back
894
- - **CONTEXT**: Background information to guide exploration
895
- - **MUST DO**: Required actions
896
- - **MUST NOT DO**: Constraints
897
- - **REQUIRED SKILLS**: Skills needed for the task
898
- - **REQUIRED TOOLS**: Tools the agent should use
899
-
900
- **Example Use Case:**
901
- - Finding all implementations of a class
902
- - Researching how a feature is implemented
903
- - Exploring database schema
904
- - Searching for usage patterns
905
-
906
- ---
907
-
908
- #### Implementation Template (`src/agents/templates/implementation-template.md`)
909
-
910
- Use for code implementation, refactoring, or modification tasks.
911
-
912
- **Sections:**
913
- - **TASK**: Clear description of implementation goal
914
- - **EXPECTED OUTCOME**: What should be delivered
915
- - **CONTEXT**: Project background and conventions
916
- - **MUST DO**: Required actions (tests, types, patterns)
917
- - **MUST NOT DO**: Constraints (breaking changes, etc.)
918
- - **REQUIRED SKILLS**: Skills needed
919
- - **REQUIRED TOOLS**: Tools to use
920
- - **VERIFICATION CHECKLIST**: Pre-completion checks
921
-
922
- **Example Use Case:**
923
- - Adding error handling
924
- - Implementing new features
925
- - Refactoring code
926
- - Adding type definitions
927
-
928
- ---
929
-
930
- ### Examples
931
-
932
- **Example 1: Using exploration template**
933
- ```typescript
934
- const explorationTask = `
935
- ## TASK
936
- Find all implementations of the UserService class and how they handle authentication.
937
-
938
- ## EXPECTED OUTCOME
939
- - List of file paths with line numbers
940
- - Summary of authentication patterns found
941
- - Recommendations for consolidation if multiple patterns exist
942
-
943
- ## CONTEXT
944
- - TypeScript monorepo using pnpm workspaces
945
- - Investigating inconsistent authentication behavior
946
- - Focus on src/services and src/auth directories
947
-
948
- ## MUST DO
949
- - Use Grep for content search
950
- - Return structured results with file paths and line numbers
951
- - Highlight any security concerns
952
-
953
- ## MUST NOT DO
954
- - Do not modify any files
955
- - Do not search node_modules
956
- - Do not include test files in primary results
957
- `;
958
- ```
959
-
960
- **Example 2: Using implementation template**
961
- ```typescript
962
- const implementationTask = `
963
- ## TASK
964
- Add rate limiting middleware to all API routes.
965
-
966
- ## EXPECTED OUTCOME
967
- - Rate limiting middleware integrated with tests
968
- - All API routes protected
969
- - Configuration via environment variables
970
-
971
- ## CONTEXT
972
- - Express.js API using TypeScript
973
- - Existing middleware in src/middleware/
974
- - Use express-rate-limit (already installed)
975
- - Apply limits: 100 requests per 15 minutes per IP
976
-
977
- ## MUST DO
978
- - Create middleware in src/middleware/rate-limit.ts
979
- - Add TypeScript types
980
- - Write unit tests
981
- - Add JSDoc documentation
982
- - Update README
983
-
984
- ## MUST NOT DO
985
- - Do not modify existing route handlers
986
- - Do not hard-code rate limit values
987
- - Do not break existing tests
988
- `;
989
- ```
990
-
991
- ---
992
-
993
- ## Session Resume
994
-
995
- ### Overview
996
-
997
- The Session Resume tool provides a wrapper for resuming background agent sessions. Since Claude Code's native Task tool cannot be extended, this tool retrieves session context and builds continuation prompts for delegation.
998
-
999
- ### API Reference
1000
-
1001
- #### `resumeSession(input: ResumeSessionInput): ResumeSessionOutput`
1002
-
1003
- Resume a background agent session and prepare continuation prompt.
1004
-
1005
- **Parameters:**
1006
- - `input.sessionId`: Session ID to resume
1007
-
1008
- **Returns:** Resume context or error
1009
-
1010
- **Example:**
1011
- ```typescript
1012
- import { resumeSession } from '@/tools/resume-session';
1013
-
1014
- const result = resumeSession({ sessionId: 'ses_abc123' });
1015
-
1016
- if (result.success && result.context) {
1017
- console.log(result.context.previousPrompt);
1018
- console.log(result.context.toolCallCount);
1019
- console.log(result.context.continuationPrompt);
1020
-
1021
- // Use continuation prompt in next Task delegation
1022
- Task({
1023
- subagent_type: "oh-my-claudecode:executor",
1024
- model: "sonnet",
1025
- prompt: result.context.continuationPrompt
1026
- });
1027
- } else {
1028
- console.error(result.error);
1029
- }
1030
- ```
1031
-
1032
- ---
1033
-
1034
- ### Types
1035
-
1036
- ```typescript
1037
- export interface ResumeSessionInput {
1038
- sessionId: string; // Session ID to resume
1039
- }
1040
-
1041
- export interface ResumeSessionOutput {
1042
- success: boolean;
1043
- context?: {
1044
- previousPrompt: string; // Original prompt from the session
1045
- toolCallCount: number; // Number of tool calls made so far
1046
- lastToolUsed?: string; // Last tool used (if any)
1047
- lastOutputSummary?: string; // Summary of last output (truncated to 500 chars)
1048
- continuationPrompt: string; // Formatted continuation prompt for next Task
1049
- };
1050
- error?: string; // Error message (if failed)
1051
- }
1052
- ```
1053
-
1054
- ### Examples
1055
-
1056
- **Example 1: Basic session resume**
1057
- ```typescript
1058
- import { resumeSession } from '@/tools/resume-session';
1059
-
1060
- const result = resumeSession({ sessionId: 'ses_abc123' });
1061
-
1062
- if (result.success && result.context) {
1063
- console.log(`Resuming session with ${result.context.toolCallCount} prior tool calls`);
1064
- console.log(`Last used: ${result.context.lastToolUsed}`);
1065
- }
1066
- ```
1067
-
1068
- **Example 2: Resume and continue with Task delegation**
1069
- ```typescript
1070
- import { resumeSession } from '@/tools/resume-session';
1071
-
1072
- async function continueBackgroundWork(sessionId: string) {
1073
- const resume = resumeSession({ sessionId });
1074
-
1075
- if (!resume.success || !resume.context) {
1076
- throw new Error(resume.error || 'Failed to resume session');
1077
- }
1078
-
1079
- // Delegate continuation to same agent type
1080
- const result = await Task({
1081
- subagent_type: "oh-my-claudecode:executor",
1082
- model: "sonnet",
1083
- prompt: resume.context.continuationPrompt
1084
- });
1085
-
1086
- return result;
1087
- }
1088
- ```
1089
-
1090
- **Example 3: Checking session progress before resuming**
1091
- ```typescript
1092
- import { resumeSession } from '@/tools/resume-session';
1093
-
1094
- const result = resumeSession({ sessionId: 'ses_abc123' });
1095
-
1096
- if (result.success && result.context) {
1097
- const { toolCallCount, lastOutputSummary } = result.context;
1098
-
1099
- console.log(`Session has made ${toolCallCount} tool calls`);
1100
- console.log(`Last output: ${lastOutputSummary}`);
1101
-
1102
- // Decide whether to resume or start fresh based on progress
1103
- if (toolCallCount > 50) {
1104
- console.warn('Session may be stuck in a loop - consider starting fresh');
1105
- }
1106
- }
1107
- ```
1108
-
1109
- ---
1110
-
1111
- ## Autopilot
1112
-
1113
- ### Overview
1114
-
1115
- The Autopilot feature provides autonomous execution from an initial idea to fully validated working code. It orchestrates a complete 5-phase development lifecycle with minimal human intervention.
1116
-
1117
- **5-Phase Workflow:**
1118
-
1119
- 1. **Expansion** - Analyst + Architect expand the idea into detailed requirements and technical spec
1120
- 2. **Planning** - Architect creates comprehensive execution plan (validated by Critic)
1121
- 3. **Execution** - Ralph + Ultrawork implement the plan with parallel task execution
1122
- 4. **QA** - UltraQA ensures build/lint/tests pass through automated fix cycles
1123
- 5. **Validation** - Specialized architects perform functional, security, and quality reviews
1124
-
1125
- The system automatically transitions between phases, handles mutual exclusion between conflicting modes (Ralph/UltraQA), and preserves progress for resumption if interrupted.
1126
-
1127
- ### Key Features
1128
-
1129
- - **Zero-prompt planning**: From idea to spec to plan to code automatically
1130
- - **Parallel execution**: Ultrawork spawns multiple executors for independent tasks
1131
- - **Automated QA**: Fix-test cycles until build/lint/tests pass
1132
- - **Multi-architect validation**: Functional, security, and quality review in parallel
1133
- - **Resumable sessions**: Cancel and resume without losing progress
1134
- - **Wisdom capture**: Learning entries automatically recorded in notepad system
1135
-
1136
- ### API Reference
1137
-
1138
- #### Types
1139
-
1140
- ##### `AutopilotPhase`
1141
-
1142
- ```typescript
1143
- export type AutopilotPhase =
1144
- | 'expansion' // Requirements gathering and spec creation
1145
- | 'planning' // Creating detailed execution plan
1146
- | 'execution' // Implementing the plan
1147
- | 'qa' // Quality assurance testing
1148
- | 'validation' // Final verification by architects
1149
- | 'complete' // Successfully completed
1150
- | 'failed'; // Failed to complete
1151
- ```
1152
-
1153
- ##### `AutopilotState`
1154
-
1155
- Complete state for an autopilot session.
1156
-
1157
- ```typescript
1158
- export interface AutopilotState {
1159
- active: boolean; // Whether autopilot is currently active
1160
- phase: AutopilotPhase; // Current phase of execution
1161
- iteration: number; // Current iteration number
1162
- max_iterations: number; // Maximum iterations before giving up
1163
- originalIdea: string; // Original user input
1164
-
1165
- // State for each phase
1166
- expansion: AutopilotExpansion;
1167
- planning: AutopilotPlanning;
1168
- execution: AutopilotExecution;
1169
- qa: AutopilotQA;
1170
- validation: AutopilotValidation;
1171
-
1172
- // Metrics
1173
- started_at: string;
1174
- completed_at: string | null;
1175
- phase_durations: Record<string, number>;
1176
- total_agents_spawned: number;
1177
- wisdom_entries: number;
1178
-
1179
- // Session binding
1180
- session_id?: string;
1181
- }
1182
- ```
1183
-
1184
- ##### `AutopilotConfig`
1185
-
1186
- Configuration options for autopilot behavior.
1187
-
1188
- ```typescript
1189
- export interface AutopilotConfig {
1190
- maxIterations?: number; // Max total iterations (default: 10)
1191
- maxExpansionIterations?: number; // Max expansion iterations (default: 2)
1192
- maxArchitectIterations?: number; // Max planning iterations (default: 5)
1193
- maxQaCycles?: number; // Max QA test-fix cycles (default: 5)
1194
- maxValidationRounds?: number; // Max validation rounds (default: 3)
1195
- parallelExecutors?: number; // Number of parallel executors (default: 5)
1196
- pauseAfterExpansion?: boolean; // Pause for confirmation (default: false)
1197
- pauseAfterPlanning?: boolean; // Pause for confirmation (default: false)
1198
- skipQa?: boolean; // Skip QA phase (default: false)
1199
- skipValidation?: boolean; // Skip validation phase (default: false)
1200
- autoCommit?: boolean; // Auto-commit when complete (default: false)
1201
- validationArchitects?: ValidationVerdictType[]; // Validation types (default: all)
1202
- }
1203
- ```
1204
-
1205
- ##### Phase-Specific State
1206
-
1207
- **AutopilotExpansion**
1208
-
1209
- ```typescript
1210
- export interface AutopilotExpansion {
1211
- analyst_complete: boolean; // Analyst finished requirements
1212
- architect_complete: boolean; // Architect finished technical design
1213
- spec_path: string | null; // Path to generated spec
1214
- requirements_summary: string; // Summary of requirements
1215
- tech_stack: string[]; // Identified technology stack
1216
- }
1217
- ```
1218
-
1219
- **AutopilotPlanning**
1220
-
1221
- ```typescript
1222
- export interface AutopilotPlanning {
1223
- plan_path: string | null; // Path to execution plan
1224
- architect_iterations: number; // Number of architect iterations
1225
- approved: boolean; // Whether Critic approved the plan
1226
- }
1227
- ```
1228
-
1229
- **AutopilotExecution**
1230
-
1231
- ```typescript
1232
- export interface AutopilotExecution {
1233
- ralph_iterations: number; // Number of ralph persistence iterations
1234
- ultrawork_active: boolean; // Whether ultrawork is active
1235
- tasks_completed: number; // Tasks completed from plan
1236
- tasks_total: number; // Total tasks in plan
1237
- files_created: string[]; // Files created during execution
1238
- files_modified: string[]; // Files modified during execution
1239
- ralph_completed_at?: string; // Timestamp when ralph completed
1240
- }
1241
- ```
1242
-
1243
- **AutopilotQA**
1244
-
1245
- ```typescript
1246
- export interface AutopilotQA {
1247
- ultraqa_cycles: number; // Number of test-fix cycles
1248
- build_status: QAStatus; // Build status (pending/passing/failing)
1249
- lint_status: QAStatus; // Lint status
1250
- test_status: QAStatus | 'skipped'; // Test status
1251
- qa_completed_at?: string; // Timestamp when QA completed
1252
- }
1253
- ```
1254
-
1255
- **AutopilotValidation**
1256
-
1257
- ```typescript
1258
- export interface AutopilotValidation {
1259
- architects_spawned: number; // Number of validation architects spawned
1260
- verdicts: ValidationResult[]; // List of validation verdicts
1261
- all_approved: boolean; // Whether all validations approved
1262
- validation_rounds: number; // Number of validation rounds performed
1263
- }
1264
- ```
1265
-
1266
- ##### Validation Types
1267
-
1268
- ```typescript
1269
- export type ValidationVerdictType = 'functional' | 'security' | 'quality';
1270
-
1271
- export type ValidationVerdict = 'APPROVED' | 'REJECTED' | 'NEEDS_FIX';
1272
-
1273
- export interface ValidationResult {
1274
- type: ValidationVerdictType;
1275
- verdict: ValidationVerdict;
1276
- issues?: string[];
1277
- }
1278
- ```
1279
-
1280
- ---
1281
-
1282
- #### State Management
1283
-
1284
- ##### `initAutopilot(directory: string, idea: string, sessionId?: string, config?: Partial<AutopilotConfig>): AutopilotState`
1285
-
1286
- Initialize a new autopilot session.
1287
-
1288
- **Parameters:**
1289
- - `directory`: Project directory
1290
- - `idea`: Original user idea/request
1291
- - `sessionId`: Optional session ID for binding
1292
- - `config`: Optional configuration overrides
1293
-
1294
- **Returns:** Initialized autopilot state
1295
-
1296
- **Example:**
1297
- ```typescript
1298
- import { initAutopilot } from '@/hooks/autopilot';
1299
-
1300
- const state = initAutopilot(
1301
- process.cwd(),
1302
- 'Create a REST API for user management',
1303
- 'ses_abc123',
1304
- { maxQaCycles: 3, parallelExecutors: 3 }
1305
- );
1306
- ```
1307
-
1308
- ---
1309
-
1310
- ##### `readAutopilotState(directory: string): AutopilotState | null`
1311
-
1312
- Read current autopilot state from disk.
1313
-
1314
- **Returns:** Current state or `null` if no session exists
1315
-
1316
- **Example:**
1317
- ```typescript
1318
- import { readAutopilotState } from '@/hooks/autopilot';
1319
-
1320
- const state = readAutopilotState(process.cwd());
1321
- if (state) {
1322
- console.log(`Current phase: ${state.phase}`);
1323
- console.log(`Files created: ${state.execution.files_created.length}`);
1324
- }
1325
- ```
1326
-
1327
- ---
1328
-
1329
- ##### `writeAutopilotState(directory: string, state: AutopilotState): boolean`
1330
-
1331
- Write autopilot state to disk.
1332
-
1333
- **Returns:** `true` if successful
1334
-
1335
- ---
1336
-
1337
- ##### `clearAutopilotState(directory: string): boolean`
1338
-
1339
- Clear autopilot state file.
1340
-
1341
- **Returns:** `true` if successful
1342
-
1343
- ---
1344
-
1345
- ##### `isAutopilotActive(directory: string): boolean`
1346
-
1347
- Check if autopilot is currently active.
1348
-
1349
- **Example:**
1350
- ```typescript
1351
- import { isAutopilotActive } from '@/hooks/autopilot';
1352
-
1353
- if (isAutopilotActive(process.cwd())) {
1354
- console.log('Autopilot is running');
1355
- }
1356
- ```
1357
-
1358
- ---
1359
-
1360
- ##### `transitionPhase(directory: string, newPhase: AutopilotPhase): AutopilotState | null`
1361
-
1362
- Transition to a new phase and record duration metrics.
1363
-
1364
- **Returns:** Updated state or `null` on error
1365
-
1366
- **Example:**
1367
- ```typescript
1368
- import { transitionPhase } from '@/hooks/autopilot';
1369
-
1370
- const newState = transitionPhase(process.cwd(), 'execution');
1371
- ```
1372
-
1373
- ---
1374
-
1375
- ##### `updateExpansion(directory: string, updates: Partial<AutopilotExpansion>): boolean`
1376
-
1377
- Update expansion phase data.
1378
-
1379
- **Example:**
1380
- ```typescript
1381
- import { updateExpansion } from '@/hooks/autopilot';
1382
-
1383
- updateExpansion(process.cwd(), {
1384
- analyst_complete: true,
1385
- requirements_summary: 'User auth, CRUD operations, rate limiting'
1386
- });
1387
- ```
1388
-
1389
- ---
1390
-
1391
- ##### `updatePlanning(directory: string, updates: Partial<AutopilotPlanning>): boolean`
1392
-
1393
- Update planning phase data.
1394
-
1395
- ---
1396
-
1397
- ##### `updateExecution(directory: string, updates: Partial<AutopilotExecution>): boolean`
1398
-
1399
- Update execution phase data.
1400
-
1401
- **Example:**
1402
- ```typescript
1403
- import { updateExecution } from '@/hooks/autopilot';
1404
-
1405
- updateExecution(process.cwd(), {
1406
- tasks_completed: 5,
1407
- files_created: ['src/auth.ts', 'src/routes.ts']
1408
- });
1409
- ```
1410
-
1411
- ---
1412
-
1413
- ##### `updateQA(directory: string, updates: Partial<AutopilotQA>): boolean`
1414
-
1415
- Update QA phase data.
1416
-
1417
- ---
1418
-
1419
- ##### `updateValidation(directory: string, updates: Partial<AutopilotValidation>): boolean`
1420
-
1421
- Update validation phase data.
1422
-
1423
- ---
1424
-
1425
- ##### `incrementAgentCount(directory: string, count?: number): boolean`
1426
-
1427
- Increment the total agent spawn counter.
1428
-
1429
- ---
1430
-
1431
- ##### `getSpecPath(directory: string): string`
1432
-
1433
- Get the path where spec will be saved.
1434
-
1435
- **Returns:** `.omc/autopilot/spec.md`
1436
-
1437
- ---
1438
-
1439
- ##### `getPlanPath(directory: string): string`
1440
-
1441
- Get the path where plan will be saved.
1442
-
1443
- **Returns:** `.omc/plans/autopilot-impl.md`
1444
-
1445
- ---
1446
-
1447
- #### Phase Transitions
1448
-
1449
- ##### `transitionRalphToUltraQA(directory: string, sessionId: string): TransitionResult`
1450
-
1451
- Transition from Ralph execution to UltraQA with proper mutual exclusion.
1452
-
1453
- This function handles the critical transition by:
1454
- 1. Preserving Ralph progress
1455
- 2. Cleanly terminating Ralph (and linked Ultrawork)
1456
- 3. Starting UltraQA mode
1457
- 4. Rolling back on failure
1458
-
1459
- **Parameters:**
1460
- - `directory`: Project directory
1461
- - `sessionId`: Session ID for UltraQA binding
1462
-
1463
- **Returns:** Transition result with success status
1464
-
1465
- **Example:**
1466
- ```typescript
1467
- import { transitionRalphToUltraQA } from '@/hooks/autopilot';
1468
-
1469
- const result = transitionRalphToUltraQA(process.cwd(), 'ses_abc123');
1470
- if (result.success) {
1471
- console.log('Successfully transitioned to QA phase');
1472
- } else {
1473
- console.error(result.error);
1474
- }
1475
- ```
1476
-
1477
- ---
1478
-
1479
- ##### `transitionUltraQAToValidation(directory: string): TransitionResult`
1480
-
1481
- Transition from UltraQA to validation phase.
1482
-
1483
- ---
1484
-
1485
- ##### `transitionToComplete(directory: string): TransitionResult`
1486
-
1487
- Transition to complete state.
1488
-
1489
- ---
1490
-
1491
- ##### `transitionToFailed(directory: string, error: string): TransitionResult`
1492
-
1493
- Transition to failed state with error message.
1494
-
1495
- ---
1496
-
1497
- ##### `getTransitionPrompt(fromPhase: string, toPhase: string): string`
1498
-
1499
- Get a prompt explaining the phase transition for Claude to execute.
1500
-
1501
- **Example:**
1502
- ```typescript
1503
- import { getTransitionPrompt } from '@/hooks/autopilot';
1504
-
1505
- const prompt = getTransitionPrompt('execution', 'qa');
1506
- // Returns detailed instructions for Ralph → UltraQA transition
1507
- ```
1508
-
1509
- ---
1510
-
1511
- #### Prompt Generation
1512
-
1513
- ##### `getExpansionPrompt(idea: string): string`
1514
-
1515
- Generate prompt for expansion phase (Analyst + Architect).
1516
-
1517
- **Example:**
1518
- ```typescript
1519
- import { getExpansionPrompt } from '@/hooks/autopilot';
1520
-
1521
- const prompt = getExpansionPrompt('Build a blog platform with CMS');
1522
- // Returns prompt with Task invocations for Analyst and Architect
1523
- ```
1524
-
1525
- ---
1526
-
1527
- ##### `getDirectPlanningPrompt(specPath: string): string`
1528
-
1529
- Generate prompt for planning phase (Architect + Critic).
1530
-
1531
- ---
1532
-
1533
- ##### `getExecutionPrompt(planPath: string): string`
1534
-
1535
- Generate prompt for execution phase (Ralph + Ultrawork).
1536
-
1537
- ---
1538
-
1539
- ##### `getQAPrompt(): string`
1540
-
1541
- Generate prompt for QA phase (UltraQA cycles).
1542
-
1543
- ---
1544
-
1545
- ##### `getValidationPrompt(specPath: string): string`
1546
-
1547
- Generate prompt for validation phase (parallel architect review).
1548
-
1549
- ---
1550
-
1551
- ##### `getPhasePrompt(phase: string, context: object): string`
1552
-
1553
- Get the appropriate prompt for a given phase with context.
1554
-
1555
- **Parameters:**
1556
- - `phase`: Phase name ('expansion', 'planning', etc.)
1557
- - `context`: Context object with `idea`, `specPath`, `planPath`
1558
-
1559
- **Example:**
1560
- ```typescript
1561
- import { getPhasePrompt } from '@/hooks/autopilot';
1562
-
1563
- const prompt = getPhasePrompt('expansion', {
1564
- idea: 'E-commerce checkout flow'
1565
- });
1566
- ```
1567
-
1568
- ---
1569
-
1570
- #### Validation Coordination
1571
-
1572
- ##### `recordValidationVerdict(directory: string, type: ValidationVerdictType, verdict: ValidationVerdict, issues?: string[]): boolean`
1573
-
1574
- Record a validation verdict from an architect.
1575
-
1576
- **Parameters:**
1577
- - `type`: Validation type ('functional', 'security', 'quality')
1578
- - `verdict`: Verdict ('APPROVED', 'REJECTED', 'NEEDS_FIX')
1579
- - `issues`: Optional list of issues found
1580
-
1581
- **Example:**
1582
- ```typescript
1583
- import { recordValidationVerdict } from '@/hooks/autopilot';
1584
-
1585
- recordValidationVerdict(
1586
- process.cwd(),
1587
- 'security',
1588
- 'REJECTED',
1589
- ['SQL injection risk in user input', 'Missing rate limiting']
1590
- );
1591
- ```
1592
-
1593
- ---
1594
-
1595
- ##### `getValidationStatus(directory: string): ValidationCoordinatorResult | null`
1596
-
1597
- Get current validation status and aggregated verdicts.
1598
-
1599
- **Returns:**
1600
- ```typescript
1601
- interface ValidationCoordinatorResult {
1602
- success: boolean; // All verdicts collected
1603
- allApproved: boolean; // All architects approved
1604
- verdicts: ValidationResult[];
1605
- round: number;
1606
- issues: string[]; // Aggregated issues
1607
- }
1608
- ```
1609
-
1610
- **Example:**
1611
- ```typescript
1612
- import { getValidationStatus } from '@/hooks/autopilot';
1613
-
1614
- const status = getValidationStatus(process.cwd());
1615
- if (status?.allApproved) {
1616
- console.log('All validations passed!');
1617
- } else {
1618
- console.log('Issues to fix:', status?.issues);
1619
- }
1620
- ```
1621
-
1622
- ---
1623
-
1624
- ##### `startValidationRound(directory: string): boolean`
1625
-
1626
- Start a new validation round (clears previous verdicts).
1627
-
1628
- ---
1629
-
1630
- ##### `shouldRetryValidation(directory: string, maxRounds?: number): boolean`
1631
-
1632
- Check if validation should retry based on rejections and max rounds.
1633
-
1634
- ---
1635
-
1636
- ##### `getIssuesToFix(directory: string): string[]`
1637
-
1638
- Get all issues from rejected validations.
1639
-
1640
- **Example:**
1641
- ```typescript
1642
- import { getIssuesToFix } from '@/hooks/autopilot';
1643
-
1644
- const issues = getIssuesToFix(process.cwd());
1645
- for (const issue of issues) {
1646
- console.log(issue);
1647
- // [SECURITY] Missing input validation
1648
- // [QUALITY] Test coverage below 80%
1649
- }
1650
- ```
1651
-
1652
- ---
1653
-
1654
- ##### `getValidationSpawnPrompt(specPath: string): string`
1655
-
1656
- Generate prompt for spawning parallel validation architects.
1657
-
1658
- ---
1659
-
1660
- ##### `formatValidationResults(state: AutopilotState): string`
1661
-
1662
- Format validation results for display.
1663
-
1664
- **Example:**
1665
- ```typescript
1666
- import { readAutopilotState, formatValidationResults } from '@/hooks/autopilot';
1667
-
1668
- const state = readAutopilotState(process.cwd());
1669
- if (state) {
1670
- console.log(formatValidationResults(state));
1671
- // ## Validation Results
1672
- // Round: 1
1673
- // ✓ **FUNCTIONAL**: APPROVED
1674
- // ✗ **SECURITY**: REJECTED
1675
- // - SQL injection risk
1676
- // ✓ **QUALITY**: APPROVED
1677
- }
1678
- ```
1679
-
1680
- ---
1681
-
1682
- #### Summary Generation
1683
-
1684
- ##### `generateSummary(directory: string): AutopilotSummary | null`
1685
-
1686
- Generate summary of autopilot run.
1687
-
1688
- **Returns:**
1689
- ```typescript
1690
- interface AutopilotSummary {
1691
- originalIdea: string;
1692
- filesCreated: string[];
1693
- filesModified: string[];
1694
- testsStatus: string;
1695
- duration: number; // Milliseconds
1696
- agentsSpawned: number;
1697
- phasesCompleted: AutopilotPhase[];
1698
- }
1699
- ```
1700
-
1701
- **Example:**
1702
- ```typescript
1703
- import { generateSummary } from '@/hooks/autopilot';
1704
-
1705
- const summary = generateSummary(process.cwd());
1706
- if (summary) {
1707
- console.log(`Completed in ${summary.duration}ms`);
1708
- console.log(`Created ${summary.filesCreated.length} files`);
1709
- console.log(`Used ${summary.agentsSpawned} agents`);
1710
- }
1711
- ```
1712
-
1713
- ---
1714
-
1715
- ##### `formatSummary(summary: AutopilotSummary): string`
1716
-
1717
- Format summary as decorated box for terminal display.
1718
-
1719
- **Example:**
1720
- ```typescript
1721
- import { generateSummary, formatSummary } from '@/hooks/autopilot';
1722
-
1723
- const summary = generateSummary(process.cwd());
1724
- if (summary) {
1725
- console.log(formatSummary(summary));
1726
- // ╭──────────────────────────────────────────────────────╮
1727
- // │ AUTOPILOT COMPLETE │
1728
- // ├──────────────────────────────────────────────────────┤
1729
- // │ Original Idea: REST API for user management │
1730
- // ...
1731
- }
1732
- ```
1733
-
1734
- ---
1735
-
1736
- ##### `formatCompactSummary(state: AutopilotState): string`
1737
-
1738
- Format compact summary for HUD statusline.
1739
-
1740
- **Returns:** `[AUTOPILOT] Phase 3/5: EXECUTION | 12 files`
1741
-
1742
- ---
1743
-
1744
- ##### `formatFailureSummary(state: AutopilotState, error?: string): string`
1745
-
1746
- Format failure summary with error details.
1747
-
1748
- ---
1749
-
1750
- ##### `formatFileList(files: string[], title: string, maxFiles?: number): string`
1751
-
1752
- Format file list for detailed summary.
1753
-
1754
- ---
1755
-
1756
- #### Cancellation
1757
-
1758
- ##### `cancelAutopilot(directory: string): CancelResult`
1759
-
1760
- Cancel autopilot and preserve progress for resume.
1761
-
1762
- **Returns:**
1763
- ```typescript
1764
- interface CancelResult {
1765
- success: boolean;
1766
- message: string;
1767
- preservedState?: AutopilotState;
1768
- }
1769
- ```
1770
-
1771
- **Example:**
1772
- ```typescript
1773
- import { cancelAutopilot } from '@/hooks/autopilot';
1774
-
1775
- const result = cancelAutopilot(process.cwd());
1776
- console.log(result.message);
1777
- // Autopilot cancelled at phase: execution. Progress preserved for resume.
1778
- ```
1779
-
1780
- ---
1781
-
1782
- ##### `clearAutopilot(directory: string): CancelResult`
1783
-
1784
- Fully clear autopilot state (no preserve).
1785
-
1786
- ---
1787
-
1788
- ##### `canResumeAutopilot(directory: string): { canResume: boolean; state?: AutopilotState; resumePhase?: string }`
1789
-
1790
- Check if autopilot can be resumed.
1791
-
1792
- **Example:**
1793
- ```typescript
1794
- import { canResumeAutopilot } from '@/hooks/autopilot';
1795
-
1796
- const { canResume, resumePhase } = canResumeAutopilot(process.cwd());
1797
- if (canResume) {
1798
- console.log(`Can resume from phase: ${resumePhase}`);
1799
- }
1800
- ```
1801
-
1802
- ---
1803
-
1804
- ##### `resumeAutopilot(directory: string): { success: boolean; message: string; state?: AutopilotState }`
1805
-
1806
- Resume a paused autopilot session.
1807
-
1808
- **Example:**
1809
- ```typescript
1810
- import { resumeAutopilot } from '@/hooks/autopilot';
1811
-
1812
- const result = resumeAutopilot(process.cwd());
1813
- if (result.success) {
1814
- console.log(result.message); // Resuming autopilot at phase: execution
1815
- }
1816
- ```
1817
-
1818
- ---
1819
-
1820
- ##### `formatCancelMessage(result: CancelResult): string`
1821
-
1822
- Format cancel result for display.
1823
-
1824
- ---
1825
-
1826
- ### Usage Examples
1827
-
1828
- #### Example 1: Starting an autopilot session
1829
-
1830
- ```typescript
1831
- import {
1832
- initAutopilot,
1833
- getPhasePrompt,
1834
- readAutopilotState
1835
- } from '@/hooks/autopilot';
1836
-
1837
- // Initialize session
1838
- const idea = 'Create a REST API for todo management with authentication';
1839
- const state = initAutopilot(process.cwd(), idea, 'ses_abc123');
1840
-
1841
- // Get the expansion phase prompt
1842
- const prompt = getPhasePrompt('expansion', { idea });
1843
- console.log(prompt);
1844
- // Prompt includes Task invocations for Analyst and Architect
1845
-
1846
- // Monitor progress
1847
- const currentState = readAutopilotState(process.cwd());
1848
- console.log(`Phase: ${currentState?.phase}`);
1849
- console.log(`Agents spawned: ${currentState?.total_agents_spawned}`);
1850
- ```
1851
-
1852
- #### Example 2: Monitoring execution phase
1853
-
1854
- ```typescript
1855
- import {
1856
- readAutopilotState,
1857
- updateExecution
1858
- } from '@/hooks/autopilot';
1859
-
1860
- // Check execution progress
1861
- const state = readAutopilotState(process.cwd());
1862
- if (state?.phase === 'execution') {
1863
- console.log(`Tasks: ${state.execution.tasks_completed}/${state.execution.tasks_total}`);
1864
- console.log(`Ralph iterations: ${state.execution.ralph_iterations}`);
1865
- console.log(`Files created: ${state.execution.files_created.length}`);
1866
- }
1867
-
1868
- // Update execution progress
1869
- updateExecution(process.cwd(), {
1870
- tasks_completed: 8,
1871
- tasks_total: 12,
1872
- files_created: ['src/routes/todo.ts', 'src/models/todo.ts']
1873
- });
1874
- ```
1875
-
1876
- #### Example 3: Handling phase transitions
1877
-
1878
- ```typescript
1879
- import {
1880
- readAutopilotState,
1881
- transitionRalphToUltraQA,
1882
- getTransitionPrompt
1883
- } from '@/hooks/autopilot';
1884
-
1885
- const state = readAutopilotState(process.cwd());
1886
-
1887
- if (state?.phase === 'execution' && state.execution.ralph_completed_at) {
1888
- // Transition from execution to QA
1889
- const result = transitionRalphToUltraQA(process.cwd(), 'ses_abc123');
1890
-
1891
- if (result.success) {
1892
- // Get prompt for Claude to execute QA phase
1893
- const prompt = getTransitionPrompt('execution', 'qa');
1894
- console.log(prompt);
1895
- } else {
1896
- console.error(`Transition failed: ${result.error}`);
1897
- }
1898
- }
1899
- ```
1900
-
1901
- #### Example 4: Validation coordination
1902
-
1903
- ```typescript
1904
- import {
1905
- getValidationStatus,
1906
- shouldRetryValidation,
1907
- getIssuesToFix,
1908
- recordValidationVerdict
1909
- } from '@/hooks/autopilot';
1910
-
1911
- // Record verdicts from architects
1912
- recordValidationVerdict(process.cwd(), 'functional', 'APPROVED');
1913
- recordValidationVerdict(process.cwd(), 'security', 'REJECTED', [
1914
- 'Missing input sanitization',
1915
- 'No rate limiting'
1916
- ]);
1917
- recordValidationVerdict(process.cwd(), 'quality', 'APPROVED');
1918
-
1919
- // Check status
1920
- const status = getValidationStatus(process.cwd());
1921
- if (status?.allApproved) {
1922
- console.log('All validations passed! Ready to complete.');
1923
- } else {
1924
- console.log('Validation failed. Issues to fix:');
1925
- for (const issue of getIssuesToFix(process.cwd())) {
1926
- console.log(` - ${issue}`);
1927
- }
1928
-
1929
- if (shouldRetryValidation(process.cwd())) {
1930
- console.log('Retrying validation after fixes...');
1931
- } else {
1932
- console.log('Max validation rounds reached');
1933
- }
1934
- }
1935
- ```
1936
-
1937
- #### Example 5: Cancellation and resumption
1938
-
1939
- ```typescript
1940
- import {
1941
- cancelAutopilot,
1942
- canResumeAutopilot,
1943
- resumeAutopilot,
1944
- formatCancelMessage
1945
- } from '@/hooks/autopilot';
1946
-
1947
- // Cancel autopilot
1948
- const cancelResult = cancelAutopilot(process.cwd());
1949
- console.log(formatCancelMessage(cancelResult));
1950
- // [AUTOPILOT CANCELLED]
1951
- // Autopilot cancelled at phase: execution. Progress preserved for resume.
1952
- // ...
1953
-
1954
- // Check if can resume
1955
- const { canResume, resumePhase } = canResumeAutopilot(process.cwd());
1956
- if (canResume) {
1957
- console.log(`Session can be resumed from ${resumePhase}`);
1958
-
1959
- // Resume session
1960
- const resumeResult = resumeAutopilot(process.cwd());
1961
- if (resumeResult.success) {
1962
- console.log(resumeResult.message);
1963
- }
1964
- }
1965
- ```
1966
-
1967
- #### Example 6: Complete workflow integration
1968
-
1969
- ```typescript
1970
- import {
1971
- initAutopilot,
1972
- readAutopilotState,
1973
- transitionPhase,
1974
- generateSummary,
1975
- formatSummary
1976
- } from '@/hooks/autopilot';
1977
-
1978
- async function runAutopilot(idea: string, sessionId: string) {
1979
- // Initialize
1980
- const state = initAutopilot(process.cwd(), idea, sessionId);
1981
- console.log(`Autopilot started in phase: ${state.phase}`);
1982
-
1983
- // Monitor progress through phases
1984
- const checkProgress = setInterval(() => {
1985
- const current = readAutopilotState(process.cwd());
1986
- if (!current?.active) {
1987
- clearInterval(checkProgress);
1988
-
1989
- // Generate final summary
1990
- const summary = generateSummary(process.cwd());
1991
- if (summary) {
1992
- console.log(formatSummary(summary));
1993
- }
1994
- } else {
1995
- console.log(`Current phase: ${current.phase}`);
1996
- }
1997
- }, 5000);
1998
- }
1999
- ```
2000
-
2001
- ---
2002
-
2003
- ### Workflow Details
2004
-
2005
- #### Phase 0: Expansion
2006
-
2007
- 1. Spawn Analyst agent to extract requirements
2008
- 2. Spawn Architect agent for technical specification
2009
- 3. Combine into unified spec document
2010
- 4. Save to `.omc/autopilot/spec.md`
2011
- 5. Signal: `EXPANSION_COMPLETE`
2012
-
2013
- #### Phase 1: Planning
2014
-
2015
- 1. Architect reads spec and creates implementation plan
2016
- 2. Critic reviews plan for completeness
2017
- 3. Iterate until Critic approves (max 5 iterations)
2018
- 4. Save to `.omc/plans/autopilot-impl.md`
2019
- 5. Signal: `PLANNING_COMPLETE`
2020
-
2021
- #### Phase 2: Execution
2022
-
2023
- 1. Activate Ralph + Ultrawork modes
2024
- 2. Read plan and identify parallel tasks
2025
- 3. Spawn executor agents (low/medium/high based on complexity)
2026
- 4. Track progress in TODO list
2027
- 5. Signal: `EXECUTION_COMPLETE` when all tasks done
2028
-
2029
- #### Phase 3: QA
2030
-
2031
- 1. **Critical**: Transition from Ralph to UltraQA (mutual exclusion)
2032
- 2. Run build → lint → test
2033
- 3. For each failure: diagnose → fix → re-run
2034
- 4. Repeat until pass or max cycles (5)
2035
- 5. Signal: `QA_COMPLETE`
2036
-
2037
- #### Phase 4: Validation
2038
-
2039
- 1. Spawn 3 parallel architects:
2040
- - Functional: Verify requirements implemented
2041
- - Security: Check for vulnerabilities
2042
- - Quality: Review code quality and tests
2043
- 2. Aggregate verdicts
2044
- 3. If any REJECTED: fix issues and retry (max 3 rounds)
2045
- 4. Signal: `AUTOPILOT_COMPLETE` when all approved
2046
-
2047
- ---
561
+ ```
2048
562
 
2049
563
  ### State Persistence
2050
564
 
2051
- All state is persisted to `.omc/autopilot-state.json`:
2052
-
2053
- ```json
2054
- {
2055
- "active": true,
2056
- "phase": "execution",
2057
- "iteration": 3,
2058
- "max_iterations": 10,
2059
- "originalIdea": "Create REST API...",
2060
- "expansion": {
2061
- "analyst_complete": true,
2062
- "architect_complete": true,
2063
- "spec_path": ".omc/autopilot/spec.md",
2064
- "requirements_summary": "...",
2065
- "tech_stack": ["Node.js", "Express", "TypeScript"]
2066
- },
2067
- "planning": {
2068
- "plan_path": ".omc/plans/autopilot-impl.md",
2069
- "architect_iterations": 2,
2070
- "approved": true
2071
- },
2072
- "execution": {
2073
- "ralph_iterations": 5,
2074
- "ultrawork_active": true,
2075
- "tasks_completed": 8,
2076
- "tasks_total": 12,
2077
- "files_created": ["src/routes.ts", "src/auth.ts"],
2078
- "files_modified": ["package.json"]
2079
- },
2080
- "started_at": "2026-01-21T10:30:00.000Z",
2081
- "total_agents_spawned": 15,
2082
- "session_id": "ses_abc123"
2083
- }
2084
- ```
2085
-
2086
- ---
2087
-
2088
- ## Integration Examples
2089
-
2090
- ### Example 1: Complete agent workflow with wisdom and diagnostics
2091
-
2092
- ```typescript
2093
- import { initPlanNotepad, addLearning, addDecision } from '@/features/notepad-wisdom';
2094
- import { runDirectoryDiagnostics } from '@/tools/diagnostics';
2095
- import { getCategoryForTask } from '@/features/delegation-categories';
2096
-
2097
- async function executeTaskWithContext(planName: string, taskPrompt: string) {
2098
- // Initialize notepad
2099
- initPlanNotepad(planName);
2100
-
2101
- // Determine delegation category
2102
- const category = getCategoryForTask({ taskPrompt });
2103
- console.log(`Using category: ${category.category} (${category.tier})`);
2104
-
2105
- // Record decision
2106
- addDecision(planName, `Using ${category.category} category for task delegation`);
2107
-
2108
- // Execute task (delegate to appropriate agent)
2109
- // ... task execution ...
2110
-
2111
- // Record learnings
2112
- addLearning(planName, 'Successfully implemented feature with proper error handling');
2113
-
2114
- // Verify with diagnostics
2115
- const diagnostics = await runDirectoryDiagnostics(process.cwd());
2116
-
2117
- if (!diagnostics.success) {
2118
- console.error('Diagnostics failed:', diagnostics.summary);
2119
- return false;
2120
- }
2121
-
2122
- console.log('Task completed successfully with clean diagnostics');
2123
- return true;
2124
- }
2125
- ```
2126
-
2127
- ### Example 2: Dynamic orchestrator with auto-generated prompt
2128
-
2129
- ```typescript
2130
- import { getAgentDefinitions } from '@/agents/definitions';
2131
- import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
2132
- import { getCategoryForTask } from '@/features/delegation-categories';
2133
-
2134
- async function createSmartOrchestrator(userRequest: string) {
2135
- // Generate orchestrator prompt
2136
- const definitions = getAgentDefinitions();
2137
- const agents = convertDefinitionsToConfigs(definitions);
2138
- const orchestratorPrompt = generateOrchestratorPrompt(agents);
2139
-
2140
- // Detect task category
2141
- const category = getCategoryForTask({ taskPrompt: userRequest });
2142
-
2143
- // Build enhanced request
2144
- const enhancedRequest = `
2145
- ${orchestratorPrompt}
565
+ All state is persisted to `.omc/autopilot-state.json` and includes:
2146
566
 
2147
- ## USER REQUEST
2148
- ${userRequest}
2149
-
2150
- ## DELEGATION GUIDANCE
2151
- Detected category: ${category.category}
2152
- Recommended tier: ${category.tier}
2153
- Temperature: ${category.temperature}
2154
- `.trim();
2155
-
2156
- return enhancedRequest;
2157
- }
2158
- ```
567
+ - Active status and current phase
568
+ - Original user idea
569
+ - Phase-specific progress (expansion, planning, execution, qa, validation)
570
+ - Files created and modified
571
+ - Agent spawn count and metrics
572
+ - Phase duration tracking
573
+ - Session binding
2159
574
 
2160
575
  ---
2161
576
 
2162
577
  ## See Also
2163
578
 
2164
- - [CHANGELOG.md](../CHANGELOG.md) - Version history and feature additions
2165
- - [ARCHITECTURE.md](./ARCHITECTURE.md) - System architecture overview
2166
- - [MIGRATION.md](./MIGRATION.md) - Migration guide from oh-my-opencode
2167
- - [Agent Definitions](../src/agents/definitions.ts) - Complete agent configuration
579
+ - [CHANGELOG.md](../CHANGELOG.md) - Version history
580
+ - [ARCHITECTURE.md](./ARCHITECTURE.md) - System architecture
581
+ - [MIGRATION.md](./MIGRATION.md) - Migration guide
582
+ - [Agent Definitions](../src/agents/definitions.ts) - Agent configuration