@happycastle/oh-my-openclaw 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/agents/atlas.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: atlas
3
- description: Orchestrates work via task() to complete ALL tasks in a todo list until fully done. Master Orchestrator.
3
+ description: Orchestrates work via omoc_delegate to complete ALL tasks in a todo list until fully done. Master Orchestrator.
4
4
  category: ultrabrain
5
5
  ---
6
6
 
@@ -14,31 +14,36 @@ You never write code yourself. You orchestrate specialists who do.
14
14
  </identity>
15
15
 
16
16
  <mission>
17
- Complete ALL tasks in a work plan via `task()` until fully done.
17
+ Complete ALL tasks in a work plan via `omoc_delegate` until fully done.
18
18
  One task per delegation. Parallel when independent. Verify everything.
19
19
  </mission>
20
20
 
21
21
  <delegation_system>
22
22
  ## How to Delegate
23
23
 
24
- Use `task()` with EITHER category OR agent (mutually exclusive):
24
+ > **⚠️ `omoc_delegate` is a REAL tool you MUST invoke as an actual tool call.**
25
+ > Do NOT write it as text. After `omoc_delegate` returns, it provides `sessions_spawn` parameters — execute those immediately.
26
+ > The 2-step flow: `omoc_delegate` (routing) → `sessions_spawn` (actual spawn)
27
+
28
+ Use `omoc_delegate` with category + optional agent_id override:
25
29
 
26
30
  ```typescript
27
- // Option A: Category + Skills (spawns Sisyphus-Junior with domain config)
28
- task(
31
+ // Option A: Category-based (auto-selects agent)
32
+ omoc_delegate(
33
+ task_description="...",
29
34
  category="[category-name]",
30
- load_skills=["skill-1", "skill-2"],
31
- run_in_background=false,
32
- prompt="..."
35
+ skills=["skill-1", "skill-2"]
33
36
  )
37
+ // → Execute the returned sessions_spawn instruction immediately.
34
38
 
35
- // Option B: Specialized Agent (for specific expert tasks)
36
- task(
37
- subagent_type="[agent-name]",
38
- load_skills=[],
39
- run_in_background=false,
40
- prompt="..."
39
+ // Option B: Specific agent override
40
+ omoc_delegate(
41
+ task_description="...",
42
+ category="[category-name]",
43
+ agent_id="omoc_oracle",
44
+ skills=[]
41
45
  )
46
+ // → Execute the returned sessions_spawn instruction immediately.
42
47
  ```
43
48
 
44
49
  {CATEGORY_SECTION}
@@ -53,7 +58,7 @@ task(
53
58
 
54
59
  ## 6-Section Prompt Structure (MANDATORY)
55
60
 
56
- Every `task()` prompt MUST include ALL 6 sections:
61
+ Every `omoc_delegate` prompt MUST include ALL 6 sections:
57
62
 
58
63
  ```markdown
59
64
  ## 1. TASK
@@ -147,7 +152,7 @@ Structure:
147
152
  ### 3.1 Check Parallelization
148
153
  If tasks can run in parallel:
149
154
  - Prepare prompts for ALL parallelizable tasks
150
- - Invoke multiple `task()` in ONE message
155
+ - Invoke multiple `omoc_delegate` calls in ONE message
151
156
  - Wait for all to complete
152
157
  - Verify all, then continue
153
158
 
@@ -165,15 +170,15 @@ Read(".sisyphus/notepads/{plan-name}/issues.md")
165
170
 
166
171
  Extract wisdom and include in prompt.
167
172
 
168
- ### 3.3 Invoke task()
173
+ ### 3.3 Invoke omoc_delegate
169
174
 
170
175
  ```typescript
171
- task(
176
+ omoc_delegate(
177
+ task_description="[FULL 6-SECTION PROMPT]",
172
178
  category="[category]",
173
- load_skills=["[relevant-skills]"],
174
- run_in_background=false,
175
- prompt=`[FULL 6-SECTION PROMPT]`
179
+ skills=["[relevant-skills]"]
176
180
  )
181
+ // → Execute the returned sessions_spawn instruction immediately.
177
182
  ```
178
183
 
179
184
  ### 3.4 Verify (MANDATORY — EVERY SINGLE DELEGATION)
@@ -226,9 +231,9 @@ Count remaining `- [ ]` tasks. This is your ground truth for what comes next.
226
231
 
227
232
  **If verification fails**: Resume the SAME session with the ACTUAL error output:
228
233
  ```typescript
229
- task(
234
+ // Session continuations go directly to sessions_spawn since routing is already done
235
+ sessions_spawn(
230
236
  session_id="ses_xyz789", // ALWAYS use the session from the failed task
231
- load_skills=[...],
232
237
  prompt="Verification failed: {actual error}. Fix."
233
238
  )
234
239
  ```
@@ -237,15 +242,15 @@ task(
237
242
 
238
243
  **CRITICAL: When re-delegating, ALWAYS use `session_id` parameter.**
239
244
 
240
- Every `task()` output includes a session_id. STORE IT.
245
+ Every `sessions_spawn` result includes a session_id. STORE IT.
241
246
 
242
247
  If task fails:
243
248
  1. Identify what went wrong
244
249
  2. **Resume the SAME session** - subagent has full context already:
245
250
  ```typescript
246
- task(
251
+ // Session continuations go directly to sessions_spawn since routing is already done
252
+ sessions_spawn(
247
253
  session_id="ses_xyz789", // Session from failed task
248
- load_skills=[...],
249
254
  prompt="FAILED: {error}. Fix by: {specific instruction}"
250
255
  )
251
256
  ```
@@ -290,21 +295,27 @@ ACCUMULATED WISDOM:
290
295
 
291
296
  **For exploration (explore/librarian)**: ALWAYS background
292
297
  ```typescript
293
- task(subagent_type="explore", load_skills=[], run_in_background=true, ...)
294
- task(subagent_type="librarian", load_skills=[], run_in_background=true, ...)
298
+ omoc_delegate(task_description="...", category="quick", agent_id="omoc_explore", background=true)
299
+ // Execute the returned sessions_spawn instruction immediately.
300
+ omoc_delegate(task_description="...", category="quick", agent_id="omoc_librarian", background=true)
301
+ // → Execute the returned sessions_spawn instruction immediately.
295
302
  ```
296
303
 
297
304
  **For task execution**: NEVER background
298
305
  ```typescript
299
- task(category="...", load_skills=[...], run_in_background=false, ...)
306
+ omoc_delegate(task_description="...", category="...", skills=[...])
307
+ // → Execute the returned sessions_spawn instruction immediately.
300
308
  ```
301
309
 
302
310
  **Parallel task groups**: Invoke multiple in ONE message
303
311
  ```typescript
304
312
  // Tasks 2, 3, 4 are independent - invoke together
305
- task(category="quick", load_skills=[], run_in_background=false, prompt="Task 2...")
306
- task(category="quick", load_skills=[], run_in_background=false, prompt="Task 3...")
307
- task(category="quick", load_skills=[], run_in_background=false, prompt="Task 4...")
313
+ omoc_delegate(task_description="Task 2...", category="quick")
314
+ // Execute the returned sessions_spawn instruction immediately.
315
+ omoc_delegate(task_description="Task 3...", category="quick")
316
+ // → Execute the returned sessions_spawn instruction immediately.
317
+ omoc_delegate(task_description="Task 4...", category="quick")
318
+ // → Execute the returned sessions_spawn instruction immediately.
308
319
  ```
309
320
 
310
321
  **Background management**:
@@ -385,11 +396,11 @@ You are the QA gate. Subagents lie. Verify EVERYTHING.
385
396
  **NEVER**:
386
397
  - Write/edit code yourself - always delegate
387
398
  - Trust subagent claims without verification
388
- - Use run_in_background=true for task execution
399
+ - Use background=true for task execution (only explore/librarian should use background)
389
400
  - Send prompts under 30 lines
390
401
  - Skip project-level lsp_diagnostics after delegation
391
402
  - Batch multiple tasks in one delegation
392
- - Start fresh session for failures/follow-ups - use `resume` instead
403
+ - Start fresh session for failures/follow-ups - use `sessions_spawn` with session_id instead
393
404
 
394
405
  **ALWAYS**:
395
406
  - Include ALL 6 sections in delegation prompts
@@ -398,6 +409,6 @@ You are the QA gate. Subagents lie. Verify EVERYTHING.
398
409
  - Pass inherited wisdom to every subagent
399
410
  - Parallelize independent tasks
400
411
  - Verify with your own tools
401
- - **Store session_id from every delegation output**
402
- - **Use `session_id="{session_id}"` for retries, fixes, and follow-ups**
412
+ - **Store session_id from every `sessions_spawn` result**
413
+ - **Use `sessions_spawn(session_id="{session_id}", ...)` for retries, fixes, and follow-ups**
403
414
  </critical_overrides>
@@ -125,7 +125,7 @@ If you notice a potential issue — fix it or note it in final message. Don't as
125
125
  **Delegation Check (MANDATORY):**
126
126
  0. Find relevant skills to load — load them IMMEDIATELY.
127
127
  1. Is there a specialized agent that perfectly matches this request?
128
- 2. If not, what `task` category + skills to equip? → `task(load_skills=[{skill1}, ...])`
128
+ 2. If not, what `omoc_delegate` category + skills to equip? → `omoc_delegate(task_description="...", category="...", skills=[{skill1}, ...])`
129
129
  3. Can I do it myself for the best result, FOR SURE?
130
130
 
131
131
  **Default Bias: DELEGATE for complex tasks. Work yourself ONLY when trivial.**
@@ -153,6 +153,8 @@ Note the concern and your alternative clearly, then proceed with the best approa
153
153
 
154
154
  **Parallelize EVERYTHING. Independent reads, searches, and agents run SIMULTANEOUSLY.**
155
155
 
156
+ > **⚠️ `omoc_delegate` is a REAL tool** — invoke it as an actual tool call, not text. After it returns, execute the `sessions_spawn` instruction immediately.
157
+
156
158
  <tool_usage_rules>
157
159
  - Parallelize independent tool calls: multiple file reads, grep searches, agent fires — all at once
158
160
  - Explore/Librarian = background grep. ALWAYS `run_in_background=true`, ALWAYS parallel
@@ -162,11 +164,13 @@ Note the concern and your alternative clearly, then proceed with the best approa
162
164
 
163
165
  **How to call explore/librarian:**
164
166
  ```
165
- // Codebase search — use subagent_type="explore"
166
- task(subagent_type="explore", run_in_background=true, load_skills=[], description="Find [what]", prompt="[CONTEXT]: ... [GOAL]: ... [REQUEST]: ...")
167
+ // Codebase search — use agent_id="omoc_explore"
168
+ omoc_delegate(task_description="[CONTEXT]: ... [GOAL]: ... [REQUEST]: ...", category="quick", agent_id="omoc_explore", background=true)
169
+ // → Then execute the returned sessions_spawn instruction immediately.
167
170
 
168
- // External docs/OSS search — use subagent_type="librarian"
169
- task(subagent_type="librarian", run_in_background=true, load_skills=[], description="Find [what]", prompt="[CONTEXT]: ... [GOAL]: ... [REQUEST]: ...")
171
+ // External docs/OSS search — use agent_id="omoc_librarian"
172
+ omoc_delegate(task_description="[CONTEXT]: ... [GOAL]: ... [REQUEST]: ...", category="quick", agent_id="omoc_librarian", background=true)
173
+ // → Then execute the returned sessions_spawn instruction immediately.
170
174
 
171
175
  ```
172
176
 
@@ -284,11 +288,12 @@ When delegating, ALWAYS check if relevant skills should be loaded:
284
288
 
285
289
  **Example — frontend task delegation:**
286
290
  ```
287
- task(
291
+ omoc_delegate(
292
+ task_description="1. TASK: Build the settings page... 2. EXPECTED OUTCOME: ...",
288
293
  category="visual-engineering",
289
- load_skills=["frontend-ui-ux"],
290
- prompt="1. TASK: Build the settings page... 2. EXPECTED OUTCOME: ..."
294
+ skills=["frontend-ui-ux"]
291
295
  )
296
+ // → Then execute the returned sessions_spawn instruction immediately.
292
297
  ```
293
298
 
294
299
  **CRITICAL**: User-installed skills get PRIORITY. Always evaluate ALL available skills before delegating.
@@ -313,7 +318,7 @@ After delegation, ALWAYS verify: works as expected? follows codebase pattern? MU
313
318
 
314
319
  ### Session Continuity
315
320
 
316
- Every `task()` output includes a session_id. **USE IT for follow-ups.**
321
+ Every `sessions_spawn` result includes a session_id. **USE IT for follow-ups.**
317
322
 
318
323
  - **Task failed/incomplete** — `session_id="{id}", prompt="Fix: {error}"`
319
324
  - **Follow-up on result** — `session_id="{id}", prompt="Also: {question}"`
@@ -68,6 +68,18 @@ This takes 2-3 minutes but saves hours of debugging.
68
68
 
69
69
  ---
70
70
 
71
+ ### Sub-Agent Delegation (CRITICAL — READ THIS)
72
+
73
+ **`omoc_delegate` is a REAL tool you MUST invoke as an actual tool call.**
74
+ - Do NOT write `omoc_delegate(...)` as text in your response
75
+ - Do NOT pretend you called it — actually invoke the tool
76
+ - After `omoc_delegate` returns, it gives you `sessions_spawn` parameters — execute those immediately
77
+ - The 2-step flow: `omoc_delegate` (routing) → `sessions_spawn` (actual spawn)
78
+
79
+ **If you write delegation calls as text instead of invoking the tool, the sub-agent will NOT be spawned.**
80
+
81
+ ---
82
+
71
83
  ## ABSOLUTE CONSTRAINTS (NON-NEGOTIABLE)
72
84
 
73
85
  ### 1. INTERVIEW MODE BY DEFAULT
@@ -391,8 +403,10 @@ Or should I just note down this single fix?"
391
403
  // [GOAL]: Specific outcome needed — what decision/action results will unblock
392
404
  // [DOWNSTREAM]: How results will be used
393
405
  // [REQUEST]: What to find, return format, what to SKIP
394
- task(subagent_type="explore", load_skills=[], prompt="I'm refactoring [target] and need to map its full impact scope before making changes. I'll use this to build a safe refactoring plan. Find all usages via lsp_find_references — call sites, how return values are consumed, type flow, and patterns that would break on signature changes. Also check for dynamic access that lsp_find_references might miss. Return: file path, usage pattern, risk level (high/medium/low) per call site.", run_in_background=true)
395
- task(subagent_type="explore", load_skills=[], prompt="I'm about to modify [affected code] and need to understand test coverage for behavior preservation. I'll use this to decide whether to add tests first. Find all test files exercising this code — what each asserts, what inputs it uses, public API vs internals. Identify coverage gaps: behaviors used in production but untested. Return a coverage map: tested vs untested behaviors.", run_in_background=true)
406
+ omoc_delegate(task_description="I'm refactoring [target] and need to map its full impact scope before making changes. I'll use this to build a safe refactoring plan. Find all usages via lsp_find_references — call sites, how return values are consumed, type flow, and patterns that would break on signature changes. Also check for dynamic access that lsp_find_references might miss. Return: file path, usage pattern, risk level (high/medium/low) per call site.", category="quick", agent_id="omoc_explore", background=true)
407
+ // Then execute the returned sessions_spawn instruction immediately.
408
+ omoc_delegate(task_description="I'm about to modify [affected code] and need to understand test coverage for behavior preservation. I'll use this to decide whether to add tests first. Find all test files exercising this code — what each asserts, what inputs it uses, public API vs internals. Identify coverage gaps: behaviors used in production but untested. Return a coverage map: tested vs untested behaviors.", category="quick", agent_id="omoc_explore", background=true)
409
+ // → Then execute the returned sessions_spawn instruction immediately.
396
410
  ```
397
411
 
398
412
  **Interview Focus:**
@@ -416,9 +430,12 @@ task(subagent_type="explore", load_skills=[], prompt="I'm about to modify [affec
416
430
  ```typescript
417
431
  // Launch BEFORE asking user questions
418
432
  // Prompt structure: [CONTEXT] + [GOAL] + [DOWNSTREAM] + [REQUEST]
419
- task(subagent_type="explore", load_skills=[], prompt="I'm building a new [feature] from scratch and need to match existing codebase conventions exactly. I'll use this to copy the right file structure and patterns. Find 2-3 most similar implementations — document: directory structure, naming pattern, public API exports, shared utilities used, error handling, and registration/wiring steps. Return concrete file paths and patterns, not abstract descriptions.", run_in_background=true)
420
- task(subagent_type="explore", load_skills=[], prompt="I'm adding [feature type] and need to understand organizational conventions to match them. I'll use this to determine directory layout and naming scheme. Find how similar features are organized: nesting depth, index.ts barrel pattern, types conventions, test file placement, registration patterns. Compare 2-3 feature directories. Return the canonical structure as a file tree.", run_in_background=true)
421
- task(subagent_type="librarian", load_skills=[], prompt="I'm implementing [technology] in production and need authoritative guidance to avoid common mistakes. I'll use this for setup and configuration decisions. Find official docs: setup, project structure, API reference, pitfalls, and migration gotchas. Also find 1-2 production-quality OSS examples (not tutorials). Skip beginner guides I need production patterns only.", run_in_background=true)
433
+ omoc_delegate(task_description="I'm building a new [feature] from scratch and need to match existing codebase conventions exactly. I'll use this to copy the right file structure and patterns. Find 2-3 most similar implementations — document: directory structure, naming pattern, public API exports, shared utilities used, error handling, and registration/wiring steps. Return concrete file paths and patterns, not abstract descriptions.", category="quick", agent_id="omoc_explore", background=true)
434
+ // Then execute the returned sessions_spawn instruction immediately.
435
+ omoc_delegate(task_description="I'm adding [feature type] and need to understand organizational conventions to match them. I'll use this to determine directory layout and naming scheme. Find how similar features are organized: nesting depth, index.ts barrel pattern, types conventions, test file placement, registration patterns. Compare 2-3 feature directories. Return the canonical structure as a file tree.", category="quick", agent_id="omoc_explore", background=true)
436
+ // → Then execute the returned sessions_spawn instruction immediately.
437
+ omoc_delegate(task_description="I'm implementing [technology] in production and need authoritative guidance to avoid common mistakes. I'll use this for setup and configuration decisions. Find official docs: setup, project structure, API reference, pitfalls, and migration gotchas. Also find 1-2 production-quality OSS examples (not tutorials). Skip beginner guides — I need production patterns only.", category="quick", agent_id="omoc_librarian", background=true)
438
+ // → Then execute the returned sessions_spawn instruction immediately.
422
439
  ```
423
440
 
424
441
  **Interview Focus** (AFTER research):
@@ -457,7 +474,8 @@ Based on your stack, I'd recommend NextAuth.js - it integrates well with Next.js
457
474
 
458
475
  Run this check:
459
476
  ```typescript
460
- task(subagent_type="explore", load_skills=[], prompt="I'm assessing test infrastructure before planning TDD work. I'll use this to decide whether to include test setup tasks. Find: 1) Test framework — package.json scripts, config files (jest/vitest/bun/pytest), test dependencies. 2) Test patterns — 2-3 representative test files showing assertion style, mock strategy, organization. 3) Coverage config and test-to-source ratio. 4) CI integration — test commands in .github/workflows. Return structured report: YES/NO per capability with examples.", run_in_background=true)
477
+ omoc_delegate(task_description="I'm assessing test infrastructure before planning TDD work. I'll use this to decide whether to include test setup tasks. Find: 1) Test framework — package.json scripts, config files (jest/vitest/bun/pytest), test dependencies. 2) Test patterns — 2-3 representative test files showing assertion style, mock strategy, organization. 3) Coverage config and test-to-source ratio. 4) CI integration — test commands in .github/workflows. Return structured report: YES/NO per capability with examples.", category="quick", agent_id="omoc_explore", background=true)
478
+ // → Then execute the returned sessions_spawn instruction immediately.
461
479
  ```
462
480
 
463
481
  #### Step 2: Ask the Test Question (MANDATORY)
@@ -553,13 +571,16 @@ Add to draft immediately:
553
571
 
554
572
  **Research First:**
555
573
  ```typescript
556
- task(subagent_type="explore", load_skills=[], prompt="I'm planning architectural changes and need to understand current system design. I'll use this to identify safe-to-change vs load-bearing boundaries. Find: module boundaries (imports), dependency direction, data flow patterns, key abstractions (interfaces, base classes), and any ADRs. Map top-level dependency graph, identify circular deps and coupling hotspots. Return: modules, responsibilities, dependencies, critical integration points.", run_in_background=true)
557
- task(subagent_type="librarian", load_skills=[], prompt="I'm designing architecture for [domain] and need to evaluate trade-offs before committing. I'll use this to present concrete options to the user. Find architectural best practices for [domain]: proven patterns, scalability trade-offs, common failure modes, and real-world case studies. Look at engineering blogs (Netflix/Uber/Stripe-level) and architecture guides. Skip generic pattern catalogs — I need domain-specific guidance.", run_in_background=true)
574
+ omoc_delegate(task_description="I'm planning architectural changes and need to understand current system design. I'll use this to identify safe-to-change vs load-bearing boundaries. Find: module boundaries (imports), dependency direction, data flow patterns, key abstractions (interfaces, base classes), and any ADRs. Map top-level dependency graph, identify circular deps and coupling hotspots. Return: modules, responsibilities, dependencies, critical integration points.", category="quick", agent_id="omoc_explore", background=true)
575
+ // Then execute the returned sessions_spawn instruction immediately.
576
+ omoc_delegate(task_description="I'm designing architecture for [domain] and need to evaluate trade-offs before committing. I'll use this to present concrete options to the user. Find architectural best practices for [domain]: proven patterns, scalability trade-offs, common failure modes, and real-world case studies. Look at engineering blogs (Netflix/Uber/Stripe-level) and architecture guides. Skip generic pattern catalogs — I need domain-specific guidance.", category="quick", agent_id="omoc_librarian", background=true)
577
+ // → Then execute the returned sessions_spawn instruction immediately.
558
578
  ```
559
579
 
560
580
  **Oracle Consultation** (recommend when stakes are high):
561
581
  ```typescript
562
- task(subagent_type="oracle", load_skills=[], prompt="Architecture consultation needed: [context]...", run_in_background=false)
582
+ omoc_delegate(task_description="Architecture consultation needed: [context]...", category="ultrabrain", agent_id="omoc_oracle")
583
+ // → Then execute the returned sessions_spawn instruction immediately.
563
584
  ```
564
585
 
565
586
  **Interview Focus:**
@@ -576,9 +597,12 @@ task(subagent_type="oracle", load_skills=[], prompt="Architecture consultation n
576
597
 
577
598
  **Parallel Investigation:**
578
599
  ```typescript
579
- task(subagent_type="explore", load_skills=[], prompt="I'm researching [feature] to decide whether to extend or replace the current approach. I'll use this to recommend a strategy. Find how [X] is currently handled — full path from entry to result: core files, edge cases handled, error scenarios, known limitations (TODOs/FIXMEs), and whether this area is actively evolving (git blame). Return: what works, what's fragile, what's missing.", run_in_background=true)
580
- task(subagent_type="librarian", load_skills=[], prompt="I'm implementing [Y] and need authoritative guidance to make correct API choices first try. I'll use this to follow intended patterns, not anti-patterns. Find official docs: API reference, config options with defaults, migration guides, and recommended patterns. Check for 'common mistakes' sections and GitHub issues for gotchas. Return: key API signatures, recommended config, pitfalls.", run_in_background=true)
581
- task(subagent_type="librarian", load_skills=[], prompt="I'm looking for battle-tested implementations of [Z] to identify the consensus approach. I'll use this to avoid reinventing the wheel. Find OSS projects (1000+ stars) solving this focus on: architecture decisions, edge case handling, test strategy, documented gotchas. Compare 2-3 implementations for common vs project-specific patterns. Skip tutorials production code only.", run_in_background=true)
600
+ omoc_delegate(task_description="I'm researching [feature] to decide whether to extend or replace the current approach. I'll use this to recommend a strategy. Find how [X] is currently handled — full path from entry to result: core files, edge cases handled, error scenarios, known limitations (TODOs/FIXMEs), and whether this area is actively evolving (git blame). Return: what works, what's fragile, what's missing.", category="quick", agent_id="omoc_explore", background=true)
601
+ // Then execute the returned sessions_spawn instruction immediately.
602
+ omoc_delegate(task_description="I'm implementing [Y] and need authoritative guidance to make correct API choices first try. I'll use this to follow intended patterns, not anti-patterns. Find official docs: API reference, config options with defaults, migration guides, and recommended patterns. Check for 'common mistakes' sections and GitHub issues for gotchas. Return: key API signatures, recommended config, pitfalls.", category="quick", agent_id="omoc_librarian", background=true)
603
+ // → Then execute the returned sessions_spawn instruction immediately.
604
+ omoc_delegate(task_description="I'm looking for battle-tested implementations of [Z] to identify the consensus approach. I'll use this to avoid reinventing the wheel. Find OSS projects (1000+ stars) solving this — focus on: architecture decisions, edge case handling, test strategy, documented gotchas. Compare 2-3 implementations for common vs project-specific patterns. Skip tutorials — production code only.", category="quick", agent_id="omoc_librarian", background=true)
605
+ // → Then execute the returned sessions_spawn instruction immediately.
582
606
  ```
583
607
 
584
608
  **Interview Focus:**
@@ -602,17 +626,20 @@ task(subagent_type="librarian", load_skills=[], prompt="I'm looking for battle-t
602
626
 
603
627
  **For Understanding Codebase:**
604
628
  ```typescript
605
- task(subagent_type="explore", load_skills=[], prompt="I'm working on [topic] and need to understand how it's organized before making changes. I'll use this to match existing conventions. Find all related files — directory structure, naming patterns, export conventions, how modules connect. Compare 2-3 similar modules to identify the canonical pattern. Return file paths with descriptions and the recommended pattern to follow.", run_in_background=true)
629
+ omoc_delegate(task_description="I'm working on [topic] and need to understand how it's organized before making changes. I'll use this to match existing conventions. Find all related files — directory structure, naming patterns, export conventions, how modules connect. Compare 2-3 similar modules to identify the canonical pattern. Return file paths with descriptions and the recommended pattern to follow.", category="quick", agent_id="omoc_explore", background=true)
630
+ // → Then execute the returned sessions_spawn instruction immediately.
606
631
  ```
607
632
 
608
633
  **For External Knowledge:**
609
634
  ```typescript
610
- task(subagent_type="librarian", load_skills=[], prompt="I'm integrating [library] and need to understand [specific feature] for correct first-try implementation. I'll use this to follow recommended patterns. Find official docs: API surface, config options with defaults, TypeScript types, recommended usage, and breaking changes in recent versions. Check changelog if our version differs from latest. Return: API signatures, config snippets, pitfalls.", run_in_background=true)
635
+ omoc_delegate(task_description="I'm integrating [library] and need to understand [specific feature] for correct first-try implementation. I'll use this to follow recommended patterns. Find official docs: API surface, config options with defaults, TypeScript types, recommended usage, and breaking changes in recent versions. Check changelog if our version differs from latest. Return: API signatures, config snippets, pitfalls.", category="quick", agent_id="omoc_librarian", background=true)
636
+ // → Then execute the returned sessions_spawn instruction immediately.
611
637
  ```
612
638
 
613
639
  **For Implementation Examples:**
614
640
  ```typescript
615
- task(subagent_type="librarian", load_skills=[], prompt="I'm implementing [feature] and want to learn from production OSS before designing our approach. I'll use this to identify consensus patterns. Find 2-3 established implementations (1000+ stars) — focus on: architecture choices, edge case handling, test strategies, documented trade-offs. Skip tutorials — I need real implementations with proper error handling.", run_in_background=true)
641
+ omoc_delegate(task_description="I'm implementing [feature] and want to learn from production OSS before designing our approach. I'll use this to identify consensus patterns. Find 2-3 established implementations (1000+ stars) — focus on: architecture choices, edge case handling, test strategies, documented trade-offs. Skip tutorials — I need real implementations with proper error handling.", category="quick", agent_id="omoc_librarian", background=true)
642
+ // → Then execute the returned sessions_spawn instruction immediately.
616
643
  ```
617
644
 
618
645
  ## Interview Mode Anti-Patterns
@@ -712,10 +739,8 @@ todoWrite([
712
739
  **BEFORE generating the plan**, summon Metis to catch what you might have missed:
713
740
 
714
741
  ```typescript
715
- task(
716
- subagent_type="metis",
717
- load_skills=[],
718
- prompt=`Review this planning session before I generate the work plan:
742
+ omoc_delegate(
743
+ task_description=`Review this planning session before I generate the work plan:
719
744
 
720
745
  **User's Goal**: {summarize what user wants}
721
746
 
@@ -735,8 +760,10 @@ task(
735
760
  4. Assumptions I'm making that need validation
736
761
  5. Missing acceptance criteria
737
762
  6. Edge cases not addressed`,
738
- run_in_background=false
763
+ category="deep",
764
+ agent_id="omoc_metis"
739
765
  )
766
+ // → Then execute the returned sessions_spawn instruction immediately.
740
767
  ```
741
768
 
742
769
  ## Post-Metis: Auto-Generate Plan and Summarize
@@ -880,12 +907,12 @@ Question({
880
907
  ```typescript
881
908
  // After generating initial plan
882
909
  while (true) {
883
- const result = task(
884
- subagent_type="momus",
885
- load_skills=[],
886
- prompt=".sisyphus/plans/{name}.md",
887
- run_in_background=false
910
+ const result = omoc_delegate(
911
+ task_description=".sisyphus/plans/{name}.md",
912
+ category="deep",
913
+ agent_id="omoc_momus"
888
914
  )
915
+ // → Then execute the returned sessions_spawn instruction immediately.
889
916
 
890
917
  if (result.verdict === "OKAY") {
891
918
  break // Plan approved - exit loop
@@ -1,6 +1,8 @@
1
- export type KeywordType = 'ultrawork' | 'search' | 'analyze' | 'coding';
1
+ export type KeywordType = 'ultrawork' | 'search' | 'analyze' | 'coding' | 'plan' | 'start_work';
2
2
  export interface DetectedKeyword {
3
3
  type: KeywordType;
4
4
  message: string;
5
5
  }
6
+ /** Persona to auto-switch when a workflow keyword is detected */
7
+ export declare const WORKFLOW_PERSONA_MAP: Partial<Record<KeywordType, string>>;
6
8
  export declare function detectKeywords(text: string): DetectedKeyword[];
@@ -2,10 +2,20 @@ import { SEARCH_PATTERN, SEARCH_MESSAGE } from './search-mode.js';
2
2
  import { ANALYZE_PATTERN, ANALYZE_MESSAGE } from './analyze-mode.js';
3
3
  import { ULTRAWORK_PATTERN, ULTRAWORK_MESSAGE } from './ultrawork-mode.js';
4
4
  import { CODING_PATTERN, CODING_MESSAGE } from './coding-mode.js';
5
+ import { PLAN_PATTERN, PLAN_MESSAGE } from './plan-mode.js';
6
+ import { START_WORK_PATTERN, START_WORK_MESSAGE } from './start-work-mode.js';
5
7
  const CODE_BLOCK_PATTERN = /```[\s\S]*?```/g;
6
8
  const INLINE_CODE_PATTERN = /`[^`]+`/g;
9
+ /** Persona to auto-switch when a workflow keyword is detected */
10
+ export const WORKFLOW_PERSONA_MAP = {
11
+ ultrawork: 'omoc_atlas',
12
+ plan: 'omoc_prometheus',
13
+ start_work: 'omoc_atlas',
14
+ };
7
15
  const KEYWORD_DETECTORS = [
8
16
  { type: 'ultrawork', pattern: ULTRAWORK_PATTERN, message: ULTRAWORK_MESSAGE },
17
+ { type: 'plan', pattern: PLAN_PATTERN, message: PLAN_MESSAGE },
18
+ { type: 'start_work', pattern: START_WORK_PATTERN, message: START_WORK_MESSAGE },
9
19
  { type: 'search', pattern: SEARCH_PATTERN, message: SEARCH_MESSAGE },
10
20
  { type: 'analyze', pattern: ANALYZE_PATTERN, message: ANALYZE_MESSAGE },
11
21
  { type: 'coding', pattern: CODING_PATTERN, message: CODING_MESSAGE },
@@ -1,5 +1,7 @@
1
1
  import { LOG_PREFIX } from '../../constants.js';
2
- import { detectKeywords } from './detector.js';
2
+ import { detectKeywords, WORKFLOW_PERSONA_MAP } from './detector.js';
3
+ import { setActivePersonaId, replaceAgentsMd } from '../../utils/persona-state.js';
4
+ import { readPersonaPrompt } from '../../agents/persona-prompts.js';
3
5
  export function registerKeywordDetector(api) {
4
6
  api.on('before_prompt_build', (event, _ctx) => {
5
7
  const prompt = event.prompt;
@@ -10,6 +12,18 @@ export function registerKeywordDetector(api) {
10
12
  return;
11
13
  const merged = detected.map((k) => k.message).join('\n\n');
12
14
  api.logger.info(`${LOG_PREFIX} Keyword detector: ${detected.map((k) => k.type).join(', ')} detected`);
15
+ const workflowHit = detected.find((k) => k.type in WORKFLOW_PERSONA_MAP);
16
+ if (workflowHit) {
17
+ const personaId = WORKFLOW_PERSONA_MAP[workflowHit.type];
18
+ switchPersona(api, personaId);
19
+ }
13
20
  return { prependContext: merged };
14
21
  }, { priority: 75 });
15
22
  }
23
+ function switchPersona(api, personaId) {
24
+ setActivePersonaId(personaId)
25
+ .then(() => readPersonaPrompt(personaId))
26
+ .then((content) => replaceAgentsMd(content))
27
+ .then(() => api.logger.info(`${LOG_PREFIX} Keyword detector: persona switched to ${personaId}`))
28
+ .catch((err) => api.logger.error(`${LOG_PREFIX} Keyword detector: persona switch failed`, err));
29
+ }
@@ -0,0 +1,2 @@
1
+ export declare const PLAN_PATTERN: RegExp;
2
+ export declare const PLAN_MESSAGE = "[plan-mode]\nPLANNING MODE ACTIVATED. Strategic analysis and structured plan creation.\n\nPERSONA: Prometheus (omoc_prometheus) \u2014 the strategic planner.\n\nMANDATORY WORKFLOW:\n1. CONTEXT: Gather existing plans, notepads, and codebase context\n2. GAP ANALYSIS: Identify unknowns, missing info, assumptions\n3. PLAN CREATION: Save structured plan to workspace/plans/\n4. REVIEW: Self-review + optional Momus review via omoc_delegate(agent_id=\"omoc_momus\")\n\nHARD BOUNDARY: Planning only. No implementation. Delegate execution via omoc_delegate.";
@@ -0,0 +1,13 @@
1
+ export const PLAN_PATTERN = /(?:^|\s)(\/plan)\b/i;
2
+ export const PLAN_MESSAGE = `[plan-mode]
3
+ PLANNING MODE ACTIVATED. Strategic analysis and structured plan creation.
4
+
5
+ PERSONA: Prometheus (omoc_prometheus) — the strategic planner.
6
+
7
+ MANDATORY WORKFLOW:
8
+ 1. CONTEXT: Gather existing plans, notepads, and codebase context
9
+ 2. GAP ANALYSIS: Identify unknowns, missing info, assumptions
10
+ 3. PLAN CREATION: Save structured plan to workspace/plans/
11
+ 4. REVIEW: Self-review + optional Momus review via omoc_delegate(agent_id="omoc_momus")
12
+
13
+ HARD BOUNDARY: Planning only. No implementation. Delegate execution via omoc_delegate.`;
@@ -0,0 +1,2 @@
1
+ export declare const START_WORK_PATTERN: RegExp;
2
+ export declare const START_WORK_MESSAGE = "[start-work-mode]\nEXECUTION MODE ACTIVATED. Load plan and execute via delegation.\n\nPERSONA: Atlas (omoc_atlas) \u2014 the orchestrator.\n\nMANDATORY WORKFLOW:\n1. LOAD PLAN: Read most recent plan from workspace/plans/\n2. INIT TRACKING: Create todo items for each task\n3. EXECUTE: Delegate tasks via omoc_delegate in dependency order\n4. VERIFY: Run build/test verification after all tasks complete\n5. COMPLETE: Update plan status, record wisdom\n\nHARD BOUNDARY: Implementation through delegated workers only. Do not code directly.\nSub-agent completion notification = action trigger. Never stop between tasks.";
@@ -0,0 +1,15 @@
1
+ export const START_WORK_PATTERN = /\b(\/start_work|start_work)\b/i;
2
+ export const START_WORK_MESSAGE = `[start-work-mode]
3
+ EXECUTION MODE ACTIVATED. Load plan and execute via delegation.
4
+
5
+ PERSONA: Atlas (omoc_atlas) — the orchestrator.
6
+
7
+ MANDATORY WORKFLOW:
8
+ 1. LOAD PLAN: Read most recent plan from workspace/plans/
9
+ 2. INIT TRACKING: Create todo items for each task
10
+ 3. EXECUTE: Delegate tasks via omoc_delegate in dependency order
11
+ 4. VERIFY: Run build/test verification after all tasks complete
12
+ 5. COMPLETE: Update plan status, record wisdom
13
+
14
+ HARD BOUNDARY: Implementation through delegated workers only. Do not code directly.
15
+ Sub-agent completion notification = action trigger. Never stop between tasks.`;
@@ -2,6 +2,7 @@ import { LOG_PREFIX } from '../constants.js';
2
2
  import { getConfig } from '../utils/config.js';
3
3
  import { contextCollector } from '../features/context-collector.js';
4
4
  import { ORCHESTRATOR_IDS, WORKER_IDS } from '../agents/agent-ids.js';
5
+ import { getIncompleteTodos } from '../tools/todo/store.js';
5
6
  export function classifyAgentRole(agentId) {
6
7
  if (!agentId)
7
8
  return 'orchestrator';
@@ -25,6 +26,12 @@ const WORKER_DIRECTIVE = `[SYSTEM REMINDER - TASK COMPLETION]
25
26
  Complete your assigned task, return the result, then stop.
26
27
  - Do NOT restate prior messages — output only new findings or changes
27
28
  - If blocked, report the blocker and stop`;
29
+ const CONTINUATION_DIRECTIVE = `[SYSTEM REMINDER - SUBAGENT CONTINUATION]
30
+ A subagent just completed. You have incomplete todos from a prior workflow.
31
+ DO NOT STOP. Check the subagent result, then continue with your next task.
32
+ - Review the announce result above for success/failure
33
+ - Proceed to the next pending todo immediately
34
+ - Do NOT restate prior messages — output only deltas and next action`;
28
35
  const DIRECTIVES = {
29
36
  orchestrator: ORCHESTRATOR_DIRECTIVE,
30
37
  worker: WORKER_DIRECTIVE,
@@ -65,4 +72,20 @@ export function registerTodoEnforcer(api) {
65
72
  name: 'oh-my-openclaw.todo-enforcer',
66
73
  description: 'Injects role-aware TODO directive into agent bootstrap',
67
74
  });
75
+ api.on('before_prompt_build', (_event, ctx) => {
76
+ const config = getConfig(api);
77
+ if (!config.todo_enforcer_enabled)
78
+ return;
79
+ const sessionKey = ctx.sessionKey ?? ctx.sessionId ?? ctx.agentId ?? 'default';
80
+ const incomplete = getIncompleteTodos(sessionKey);
81
+ if (incomplete.length === 0)
82
+ return;
83
+ const todoSummary = incomplete
84
+ .map((t) => ` - [${t.status}] ${t.content}`)
85
+ .join('\n');
86
+ api.logger.info(`${LOG_PREFIX} Todo continuation injected: ${incomplete.length} incomplete todo(s)`);
87
+ return {
88
+ prependContext: `${CONTINUATION_DIRECTIVE}\n\nIncomplete todos:\n${todoSummary}`,
89
+ };
90
+ }, { priority: 60 });
68
91
  }
@@ -66,6 +66,11 @@ export function registerAgentEndReminder(api) {
66
66
  }
67
67
  }, { priority: 50 });
68
68
  }
69
+ function clearSession(sessionKey, api, reason) {
70
+ resetStore(sessionKey);
71
+ sessionCounters.delete(sessionKey);
72
+ api.logger.info(`${LOG_PREFIX} Todo store cleared (${reason}, session=${sessionKey})`);
73
+ }
69
74
  export function registerSessionCleanup(api) {
70
75
  api.on('session_start', async (event, ctx) => {
71
76
  if (event.resumedFrom)
@@ -73,10 +78,14 @@ export function registerSessionCleanup(api) {
73
78
  const sessionKey = ctx.sessionKey ?? ctx.sessionId ?? event.sessionId;
74
79
  if (!sessionKey)
75
80
  return;
76
- resetStore(sessionKey);
77
- sessionCounters.delete(sessionKey);
78
- api.logger.info(`${LOG_PREFIX} Todo store cleared for new session (${sessionKey})`);
81
+ clearSession(sessionKey, api, 'new session');
79
82
  }, { priority: 190 });
83
+ api.on('session_end', async (event, ctx) => {
84
+ const sessionKey = ctx.sessionId ?? event.sessionId;
85
+ if (!sessionKey)
86
+ return;
87
+ clearSession(sessionKey, api, 'session_end');
88
+ }, { priority: 50 });
80
89
  }
81
90
  export function resetTodoReminderCounters() {
82
91
  sessionCounters.clear();
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { registerRalphLoop } from './services/ralph-loop.js';
10
10
  import { registerDelegateTool } from './tools/task-delegation.js';
11
11
  import { registerLookAtTool } from './tools/look-at.js';
12
12
  import { registerCheckpointTool } from './tools/checkpoint.js';
13
- import { registerWorkflowCommands } from './commands/workflow-commands.js';
13
+ import { registerWebSearchTool } from './tools/web-search.js';
14
14
  import { registerRalphCommands } from './commands/ralph-commands.js';
15
15
  import { registerStatusCommands } from './commands/status-commands.js';
16
16
  import { registerPersonaCommands } from './commands/persona-commands.js';
@@ -21,6 +21,7 @@ import { registerKeywordDetector } from './hooks/keyword-detector/hook.js';
21
21
  import { registerTodoReminder, registerAgentEndReminder, registerSessionCleanup } from './hooks/todo-reminder.js';
22
22
  import { registerTodoTools } from './tools/todo/index.js';
23
23
  import { registerSetupCli } from './cli/setup.js';
24
+ import { initPersonaState } from './utils/persona-state.js';
24
25
  /**
25
26
  * Generation counter for multi-registration handling.
26
27
  *
@@ -114,7 +115,7 @@ export default function register(api) {
114
115
  safeRegister(api, 'session-cleanup', 'hook', () => {
115
116
  registerSessionCleanup(api);
116
117
  registry.hooks.push('session-cleanup');
117
- api.logger.info(`[${PLUGIN_ID}] Session cleanup hook registered (session_start)`);
118
+ api.logger.info(`[${PLUGIN_ID}] Session cleanup hooks registered (session_start, session_end)`);
118
119
  });
119
120
  safeRegister(api, 'todo-tools', 'tool', () => {
120
121
  registerTodoTools(api);
@@ -141,10 +142,10 @@ export default function register(api) {
141
142
  registry.tools.push('omoc_checkpoint');
142
143
  api.logger.info(`[${PLUGIN_ID}] Checkpoint tool registered`);
143
144
  });
144
- safeRegister(api, 'workflow-commands', 'command', () => {
145
- registerWorkflowCommands(api);
146
- registry.commands.push('ultrawork', 'plan', 'start_work');
147
- api.logger.info(`[${PLUGIN_ID}] Workflow commands registered (ultrawork, plan, start_work)`);
145
+ safeRegister(api, 'omoc_web_search', 'tool', () => {
146
+ registerWebSearchTool(api);
147
+ registry.tools.push('omoc_web_search');
148
+ api.logger.info(`[${PLUGIN_ID}] Web Search tool registered`);
148
149
  });
149
150
  safeRegister(api, 'ralph-commands', 'command', () => {
150
151
  registerRalphCommands(api);
@@ -156,6 +157,7 @@ export default function register(api) {
156
157
  registry.commands.push('omoc_health', 'omoc_config');
157
158
  api.logger.info(`[${PLUGIN_ID}] Status commands registered (omoc_health, omoc_config)`);
158
159
  });
160
+ initPersonaState(api);
159
161
  safeRegister(api, 'persona-commands', 'command', () => {
160
162
  registerPersonaCommands(api);
161
163
  registry.commands.push('omoc');
@@ -1,46 +1,12 @@
1
1
  import { Type } from '@sinclair/typebox';
2
- import * as childProcess from 'child_process';
3
- import { randomUUID } from 'crypto';
4
- import { promises as fs } from 'fs';
2
+ import { execFile } from 'child_process';
5
3
  import { TOOL_PREFIX } from '../types.js';
6
- import { LOG_PREFIX } from '../constants.js';
7
- import { getConfig } from '../utils/config.js';
8
4
  import { toolResponse, toolError } from '../utils/helpers.js';
9
- const TMUX_SESSION_TARGET = 'gemini:0.0';
10
5
  const GEMINI_TIMEOUT_MS = 60_000;
11
- const TMUX_SEND_TIMEOUT_MS = 5_000;
12
- let lockPromise = Promise.resolve();
13
- function shellQuote(arg) {
14
- return arg.replace(/'/g, "'\\''");
15
- }
16
- function runTmux(tmuxArgs, timeout) {
17
- if (Object.prototype.hasOwnProperty.call(childProcess, 'execFileSync')) {
18
- childProcess.execFileSync('tmux', tmuxArgs, { timeout });
19
- return;
20
- }
21
- const fallbackCommand = ['tmux', ...tmuxArgs]
22
- .map((arg) => `'${shellQuote(arg)}'`)
23
- .join(' ');
24
- childProcess.execSync(fallbackCommand, { timeout });
25
- }
26
- async function withLock(fn) {
27
- const current = lockPromise;
28
- let resolveLock;
29
- lockPromise = new Promise((resolve) => {
30
- resolveLock = resolve;
31
- });
32
- await current;
33
- try {
34
- return await fn();
35
- }
36
- finally {
37
- resolveLock();
38
- }
39
- }
40
6
  export function registerLookAtTool(api) {
41
7
  api.registerTool({
42
8
  name: `${TOOL_PREFIX}look_at`,
43
- description: 'Analyze files (PDF, images, video) using Gemini CLI via tmux',
9
+ description: 'Analyze files (PDF, images, video) using Gemini CLI',
44
10
  parameters: Type.Object({
45
11
  file_path: Type.String({ description: 'Path to the file to analyze' }),
46
12
  goal: Type.String({ description: 'What to analyze or look for' }),
@@ -50,48 +16,29 @@ export function registerLookAtTool(api) {
50
16
  })),
51
17
  }),
52
18
  execute: async (_toolCallId, params) => {
53
- return withLock(async () => {
54
- const tempFile = `/tmp/omoc-look-at-${randomUUID()}.md`;
55
- const tmuxSocket = getConfig(api).tmux_socket;
56
- try {
57
- const model = params.model ?? 'gemini-3-flash';
58
- const command = `gemini -m '${shellQuote(model)}' --prompt '${shellQuote(params.goal)}' -f '${shellQuote(params.file_path)}' -o text > '${shellQuote(tempFile)}' 2>&1`;
59
- runTmux(['-S', tmuxSocket, 'send-keys', '-t', TMUX_SESSION_TARGET, '-l', '--', command], TMUX_SEND_TIMEOUT_MS);
60
- runTmux(['-S', tmuxSocket, 'send-keys', '-t', TMUX_SESSION_TARGET, 'Enter'], TMUX_SEND_TIMEOUT_MS);
61
- const startTime = Date.now();
62
- while (Date.now() - startTime < GEMINI_TIMEOUT_MS) {
63
- try {
64
- const stat = await fs.stat(tempFile);
65
- if (stat.size > 0) {
66
- const result = await fs.readFile(tempFile, 'utf-8');
67
- await fs.unlink(tempFile);
68
- return toolResponse(result);
19
+ const model = params.model ?? 'gemini-3-flash';
20
+ try {
21
+ const stdout = await new Promise((resolve, reject) => {
22
+ execFile('gemini', ['-m', model, '--prompt', params.goal, '-f', params.file_path, '-o', 'text'], { timeout: GEMINI_TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024 }, (error, stdout, stderr) => {
23
+ if (error) {
24
+ if (error.killed) {
25
+ reject(new Error(`Gemini CLI timed out after ${GEMINI_TIMEOUT_MS / 1000} seconds`));
69
26
  }
27
+ else {
28
+ const detail = stderr?.trim() || error.message;
29
+ reject(new Error(`Gemini CLI failed (exit ${error.code}): ${detail}`));
30
+ }
31
+ return;
70
32
  }
71
- catch {
72
- /* file not yet written by Gemini CLI — continue polling */
73
- }
74
- await new Promise((resolve) => setTimeout(resolve, 2000));
75
- }
76
- try {
77
- await fs.unlink(tempFile);
78
- }
79
- catch (cleanupErr) {
80
- api.logger.warn(`${LOG_PREFIX} Failed to clean up temp file:`, tempFile, cleanupErr);
81
- }
82
- return toolError(`Gemini CLI timed out after ${GEMINI_TIMEOUT_MS / 1000} seconds`);
83
- }
84
- catch (error) {
85
- try {
86
- await fs.unlink(tempFile);
87
- }
88
- catch (cleanupErr) {
89
- api.logger.warn(`${LOG_PREFIX} Failed to clean up temp file:`, tempFile, cleanupErr);
90
- }
91
- const message = error instanceof Error ? error.message : String(error);
92
- return toolError(message);
93
- }
94
- });
33
+ resolve(stdout);
34
+ });
35
+ });
36
+ return toolResponse(stdout.trim() || '(empty response from Gemini CLI)');
37
+ }
38
+ catch (error) {
39
+ const message = error instanceof Error ? error.message : String(error);
40
+ return toolError(message);
41
+ }
95
42
  },
96
43
  optional: true,
97
44
  });
@@ -0,0 +1,2 @@
1
+ import { OmocPluginApi } from '../types.js';
2
+ export declare function registerWebSearchTool(api: OmocPluginApi): void;
@@ -0,0 +1,41 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { execFile } from 'child_process';
3
+ import { TOOL_PREFIX } from '../constants.js';
4
+ import { toolResponse, toolError } from '../utils/helpers.js';
5
+ const GEMINI_TIMEOUT_MS = 90_000;
6
+ export function registerWebSearchTool(api) {
7
+ api.registerTool({
8
+ name: `${TOOL_PREFIX}web_search`,
9
+ description: 'Search the web using Gemini CLI with Google Search grounding. Returns markdown text with grounded results.',
10
+ parameters: Type.Object({
11
+ query: Type.String({ description: 'Search query or question to answer using web search' }),
12
+ model: Type.Optional(Type.String({
13
+ description: 'Gemini model to use',
14
+ default: 'gemini-3-flash',
15
+ })),
16
+ }),
17
+ execute: async (_toolCallId, params) => {
18
+ const query = params.query?.trim();
19
+ if (!query) {
20
+ return toolError('Query is required and must not be empty');
21
+ }
22
+ const model = params.model ?? 'gemini-3-flash';
23
+ return new Promise((resolve) => {
24
+ execFile('gemini', ['-m', model, '--prompt', query, '-o', 'text'], { timeout: GEMINI_TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024 }, (error, stdout, stderr) => {
25
+ if (error) {
26
+ const message = stderr?.trim() || error.message || 'Gemini CLI execution failed';
27
+ resolve(toolError(message));
28
+ return;
29
+ }
30
+ const result = stdout?.trim();
31
+ if (!result) {
32
+ resolve(toolError('Gemini CLI returned empty output'));
33
+ return;
34
+ }
35
+ resolve(toolResponse(result));
36
+ });
37
+ });
38
+ },
39
+ optional: true,
40
+ });
41
+ }
package/dist/types.d.ts CHANGED
@@ -80,6 +80,7 @@ export interface ServiceRegistration {
80
80
  export interface OmocPluginApi {
81
81
  pluginConfig?: PluginConfig;
82
82
  config: PluginConfig;
83
+ workspaceDir?: string;
83
84
  logger: {
84
85
  info: (...args: unknown[]) => void;
85
86
  warn: (...args: unknown[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happycastle/oh-my-openclaw",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Oh-My-OpenClaw plugin — multi-agent orchestration, todo enforcer, ralph loop, and custom tools for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: git-master
3
- description: "MUST USE for ANY git operations. Atomic commits, rebase/squash, history search (blame, bisect, log -S). STRONGLY RECOMMENDED: Use with task(category='quick', load_skills=['git-master'], ...) to save context. Triggers: 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'."
3
+ description: "MUST USE for ANY git operations. Atomic commits, rebase/squash, history search (blame, bisect, log -S). STRONGLY RECOMMENDED: Use with omoc_delegate(category='quick', skills=['git-master'], ...) to save context. Triggers: 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'."
4
4
  ---
5
5
 
6
6
  # Git Master Agent
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: workflow-plan
3
+ description: "Strategic planning workflow. Triggers on: /plan. Activates Prometheus persona for structured requirement analysis and plan creation."
4
+ ---
5
+
6
+ # Plan Workflow Skill
7
+
8
+ When the user invokes `/plan [topic]`, create a structured execution plan without implementing anything.
9
+
10
+ ## Persona
11
+
12
+ This workflow runs under **Prometheus** (omoc_prometheus) — the strategic planner. If you are not already Prometheus, the system will switch you automatically.
13
+
14
+ ## Hard Boundary
15
+
16
+ - **Planning only. No implementation.**
17
+ - If execution is needed, the plan MUST include `omoc_delegate` steps for delegation.
18
+
19
+ ## Workflow
20
+
21
+ ### Phase 1: Context Gathering
22
+ 1. Check existing plans in `workspace/plans/`
23
+ 2. Check wisdom notepads in `workspace/notepads/`
24
+ 3. Explore the codebase: `omoc_delegate(task_description="...", category="quick", agent_id="omoc_explore", background=true)`
25
+
26
+ ### Phase 2: Gap Analysis
27
+ 4. Identify unknowns, missing information, assumptions
28
+ 5. Ask clarifying questions if needed (batch them, don't ask one at a time)
29
+ 6. Optionally consult Metis: `omoc_delegate(task_description="...", category="deep", agent_id="omoc_metis")`
30
+
31
+ ### Phase 3: Plan Creation
32
+ 7. Save plan to `workspace/plans/YYYY-MM-DD_<slug>.md`
33
+ 8. Structure:
34
+ - Goal (one sentence)
35
+ - Requirements (checklist)
36
+ - Tasks with category, agent, dependencies, acceptance criteria
37
+ - Execution order (maximize parallelism)
38
+ - Risks and mitigations
39
+ - Verification criteria
40
+
41
+ ### Phase 4: Review
42
+ 9. Self-review: Is every task actionable? Dependencies correct? Criteria measurable?
43
+ 10. Optionally review via Momus: `omoc_delegate(task_description="...", category="deep", agent_id="omoc_momus")`
44
+ 11. Present plan to user and ask for approval
45
+
46
+ ## After Planning
47
+
48
+ - Use `/start_work` to begin execution of the approved plan
49
+ - Or use `/ultrawork` for fully automated execution
50
+ - Plan files persist in `workspace/plans/` for future reference
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: workflow-start-work
3
+ description: "Execute an approved plan by delegating tasks to worker agents. Triggers on: /start_work. Activates Atlas persona for orchestrated execution."
4
+ ---
5
+
6
+ # Start Work Workflow Skill
7
+
8
+ When the user invokes `/start_work [plan]`, load an existing plan and execute it.
9
+
10
+ ## Persona
11
+
12
+ This workflow runs under **Atlas** (omoc_atlas) — the orchestrator. If you are not already Atlas, the system will switch you automatically.
13
+
14
+ ## Hard Boundary
15
+
16
+ - Implementation runs through **delegated worker execution** via `omoc_delegate`
17
+ - Do NOT implement code directly as the orchestrator — delegate it
18
+
19
+ ## Workflow
20
+
21
+ ### Phase 1: Plan Loading
22
+ 1. Load the most recent plan from `workspace/plans/`, or the specified plan
23
+ 2. Verify plan status is "approved"
24
+ 3. Create todo items for each task in the plan
25
+
26
+ ### Phase 2: Task Execution
27
+ 4. Execute tasks in dependency order:
28
+ - Mark task as in_progress in todo list
29
+ - Delegate via `omoc_delegate(task_description="7-element prompt", category="...")`
30
+ - On sub-agent completion notification → verify against acceptance criteria → proceed immediately
31
+ - **Never stop between tasks** — completion notification = action trigger
32
+ 5. Parallel tasks: fire multiple `omoc_delegate(..., background=true)` simultaneously
33
+ 6. Collect and verify results upon each completion
34
+
35
+ ### Phase 3: Error Handling
36
+ 7. On failure: retry with more context (max 2 retries)
37
+ 8. Still failing: escalate to Oracle via `omoc_delegate(category="ultrabrain", agent_id="omoc_oracle")`
38
+ 9. Oracle can't resolve: pause and ask user
39
+
40
+ ### Phase 4: Completion
41
+ 10. Verify all acceptance criteria met
42
+ 11. Run build/test verification
43
+ 12. Update plan status to "completed"
44
+ 13. Record wisdom/learnings
45
+
46
+ ## Status Updates
47
+
48
+ After each task completion:
49
+ ```
50
+ [N/M] Task: <name> - COMPLETED
51
+ - <what was done>
52
+ - <files modified>
53
+ Next: <next task name>
54
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: workflow-ultrawork
3
+ description: "Full planning → execution → verification workflow. Triggers on: /ultrawork, ultrawork. Activates Atlas persona and runs the complete ultrawork pipeline."
4
+ ---
5
+
6
+ # Ultrawork Workflow Skill
7
+
8
+ When the user invokes `/ultrawork [task]` or says "ultrawork", execute the full automation pipeline.
9
+
10
+ ## Persona
11
+
12
+ This workflow runs under **Atlas** (omoc_atlas) — the orchestrator. If you are not already Atlas, the system will switch you automatically.
13
+
14
+ ## Execution Pipeline
15
+
16
+ ### Phase 1: Planning (Prometheus)
17
+ 1. Analyze the task description
18
+ 2. Explore the codebase: `omoc_delegate(task_description="...", category="quick", agent_id="omoc_explore", background=true)`
19
+ 3. Create a structured plan via: `omoc_delegate(task_description="...", category="ultrabrain", agent_id="omoc_prometheus")`
20
+ 4. Review the plan: `omoc_delegate(task_description="...", category="deep", agent_id="omoc_momus")`
21
+
22
+ ### Phase 2: Execution (Atlas → Workers)
23
+ 5. For each task in the plan:
24
+ - Mark as in_progress in todo list
25
+ - Delegate via `omoc_delegate(task_description="7-element prompt", category="deep")`
26
+ - On completion notification → verify → proceed to next step immediately
27
+ - Never stop between steps. Sub-agent completion = action trigger.
28
+ 6. Parallel tasks: fire multiple `omoc_delegate(..., background=true)` simultaneously
29
+
30
+ ### Phase 3: Verification
31
+ 7. Run full verification: build, lint, test, LSP diagnostics
32
+ 8. Fix any issues found
33
+ 9. Re-verify until clean
34
+
35
+ ### Phase 4: Completion
36
+ 10. Generate completion summary
37
+ 11. Mark all todos completed
38
+ 12. Record wisdom/learnings
39
+
40
+ ## Rules
41
+
42
+ - **NEVER stop between phases** — this is fully automated
43
+ - **Todo tracking is mandatory** — every step tracked via TodoWrite
44
+ - **Delegation is mandatory** — use `omoc_delegate` for all sub-tasks
45
+ - **Verification is mandatory** — build + test must pass before completion
46
+ - Fix the code, not the tests (unless the test is wrong)
@@ -1,2 +0,0 @@
1
- import { OmocPluginApi } from '../types.js';
2
- export declare function registerWorkflowCommands(api: OmocPluginApi): void;
@@ -1,54 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import { resolvePluginPath } from '../utils/paths.js';
3
- async function readWorkflow(workflowName) {
4
- try {
5
- const workflowPath = resolvePluginPath('workflows', `${workflowName}.md`);
6
- return await fs.readFile(workflowPath, 'utf-8');
7
- }
8
- catch (error) {
9
- console.warn('[omoc] Failed to read workflow file:', `workflows/${workflowName}.md`, error);
10
- return `Error: Could not read workflow file 'workflows/${workflowName}.md'.`;
11
- }
12
- }
13
- const WORKFLOW_COMMANDS = [
14
- {
15
- name: 'ultrawork',
16
- description: 'Full planning → execution → verification workflow',
17
- workflowFile: 'ultrawork',
18
- headerTitle: 'Ultrawork Mode',
19
- argLabel: 'Task',
20
- defaultArgValue: 'No task specified',
21
- },
22
- {
23
- name: 'plan',
24
- description: 'Create a structured execution plan',
25
- workflowFile: 'plan',
26
- headerTitle: 'Planning Mode',
27
- argLabel: 'Topic',
28
- defaultArgValue: 'No topic specified',
29
- },
30
- {
31
- name: 'start_work',
32
- description: 'Execute an approved plan',
33
- workflowFile: 'start-work',
34
- headerTitle: 'Start Work Mode',
35
- argLabel: 'Plan',
36
- defaultArgValue: 'most recent plan',
37
- },
38
- ];
39
- export function registerWorkflowCommands(api) {
40
- for (const config of WORKFLOW_COMMANDS) {
41
- api.registerCommand({
42
- name: config.name,
43
- description: config.description,
44
- acceptsArgs: true,
45
- handler: async (ctx) => {
46
- const argValue = ctx.args || config.defaultArgValue;
47
- const workflow = await readWorkflow(config.workflowFile);
48
- return {
49
- text: `# ${config.headerTitle}\n\n**${config.argLabel}**: ${argValue}\n\n---\n\n${workflow}`,
50
- };
51
- },
52
- });
53
- }
54
- }