diff --git a/assets/oh-my-opencode.schema.json b/assets/oh-my-opencode.schema.json index aa68bd73..787c8d3a 100644 --- a/assets/oh-my-opencode.schema.json +++ b/assets/oh-my-opencode.schema.json @@ -2754,6 +2754,9 @@ } } } + }, + "task_system": { + "type": "boolean" } } }, diff --git a/src/hooks/keyword-detector/ultrawork/default.ts b/src/hooks/keyword-detector/ultrawork/default.ts index 6792c1ba..e1f0303a 100644 --- a/src/hooks/keyword-detector/ultrawork/default.ts +++ b/src/hooks/keyword-detector/ultrawork/default.ts @@ -2,9 +2,9 @@ * Default ultrawork message optimized for Claude series models. * * Key characteristics: - * - Optimized for Claude's tendency to be "helpful" by forcing explicit delegation - * - "DELEGATE. ALWAYS." instruction counters Claude's natural inclination to do everything - * - Strong emphasis on parallel agent usage and category+skills delegation + * - Natural tool-like usage of explore/librarian agents (background=true) + * - Parallel execution emphasized - fire agents and continue working + * - Simple workflow: EXPLORES → GATHER → PLAN → DELEGATE */ export const ULTRAWORK_DEFAULT_MESSAGE = ` @@ -46,10 +46,7 @@ export const ULTRAWORK_DEFAULT_MESSAGE = ` \`\`\` delegate_task(subagent_type="explore", load_skills=[], prompt="Find [X] patterns in codebase", run_in_background=true) delegate_task(subagent_type="librarian", load_skills=[], prompt="Find docs/examples for [Y]", run_in_background=true) - -// Hard problem? DON'T struggle alone: -delegate_task(subagent_type="oracle", load_skills=[], run_in_background=false, prompt="...") // conventional: architecture, debugging -delegate_task(category="artistry", load_skills=[], run_in_background=false, prompt="...") // non-conventional: needs different approach +delegate_task(subagent_type="oracle", load_skills=[], prompt="Review my approach: [describe plan]", run_in_background=false) \`\`\` **ONLY AFTER YOU HAVE:** @@ -178,83 +175,18 @@ delegate_task(category="quick", load_skills=["git-master"]) --- -## EXECUTION RULES (PARALLELIZATION) +## EXECUTION RULES +- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each. +- **PARALLEL**: Fire independent agent calls simultaneously via delegate_task(background=true) - NEVER wait sequentially. +- **BACKGROUND FIRST**: Use delegate_task for exploration/research agents (10+ concurrent if needed). +- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done. +- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths. -| Rule | Implementation | -|------|----------------| -| **PARALLEL FIRST** | Fire ALL **truly independent** agents simultaneously via delegate_task(run_in_background=true) | -| **DATA DEPENDENCY CHECK** | If task B requires output FROM task A, B MUST wait for A to complete | -| **10+ CONCURRENT** | Use 10+ background agents if needed for comprehensive exploration | -| **COLLECT BEFORE DEPENDENT** | Collect results with background_output() BEFORE invoking dependent tasks | - -### DEPENDENCY EXCEPTIONS (OVERRIDES PARALLEL FIRST) - -| Agent | Dependency | Must Wait For | -|-------|------------|---------------| -| plan | explore/librarian results | Collect explore outputs FIRST | -| execute | plan output | Finalized work plan | - -**CRITICAL: Plan agent REQUIRES explore results as input. This is a DATA DEPENDENCY, not parallelizable.** - -\`\`\` -// WRONG: Launching plan without explore results -delegate_task(subagent_type="explore", run_in_background=true, prompt="...") -delegate_task(subagent_type="plan", prompt="...") // BAD - no context yet! - -// CORRECT: Collect explore results BEFORE plan -delegate_task(subagent_type="explore", run_in_background=true, prompt="...") // task_id_1 -// ... wait or continue other work ... -context = background_output(task_id="task_id_1") // COLLECT FIRST -delegate_task(subagent_type="plan", prompt="") // NOW plan has context -\`\`\` - ---- - -## WORKFLOW (MANDATORY SEQUENCE - STEPS HAVE DATA DEPENDENCIES) - -**CRITICAL: Steps 1→2→3 have DATA DEPENDENCIES. Each step REQUIRES output from the previous step.** - -\`\`\` -[Step 1: EXPLORE] → output: context - ↓ (data dependency) -[Step 2: COLLECT] → input: task_ids, output: gathered_context - ↓ (data dependency) -[Step 3: PLAN] → input: gathered_context + request -\`\`\` - -1. **GATHER CONTEXT** (parallel background agents): - \`\`\` - task_id_1 = delegate_task(subagent_type="explore", run_in_background=true, prompt="...") - task_id_2 = delegate_task(subagent_type="librarian", run_in_background=true, prompt="...") - \`\`\` - -2. **COLLECT EXPLORE RESULTS** (REQUIRED before step 3): - \`\`\` - // You MUST collect results before invoking plan agent - explore_result = background_output(task_id=task_id_1) - librarian_result = background_output(task_id=task_id_2) - gathered_context = explore_result + librarian_result - \`\`\` - -3. **INVOKE PLAN AGENT** (input: gathered_context from step 2): - \`\`\` - result = delegate_task(subagent_type="plan", prompt=" + ") - // STORE the session_id for follow-ups! - plan_session_id = result.session_id - \`\`\` - -4. **ITERATE WITH PLAN AGENT** (if clarification needed): - \`\`\` - // Use session_id to continue the conversation - delegate_task(session_id=plan_session_id, prompt="") - \`\`\` - -5. **EXECUTE VIA DELEGATION** (category + skills from plan agent's output): - \`\`\` - delegate_task(category="...", load_skills=[...], run_in_background=false, prompt="") - \`\`\` - -6. **VERIFY** against original requirements +## WORKFLOW +1. Analyze the request and identify required capabilities +2. Spawn exploration/librarian agents via delegate_task(background=true) in PARALLEL (10+ if needed) +3. Use Plan agent with gathered context to create detailed work breakdown +4. Execute with continuous verification against original requirements ## VERIFICATION GUARANTEE (NON-NEGOTIABLE) @@ -327,11 +259,9 @@ Write these criteria explicitly. Share with user if scope is non-trivial. THE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT. -1. EXPLORES + LIBRARIANS (background) → get task_ids -2. COLLECT explore results via background_output() → gathered_context -3. INVOKE PLAN with gathered_context: delegate_task(subagent_type="plan", prompt="") -4. ITERATE WITH PLAN AGENT (session_id resume) UNTIL PLAN IS FINALIZED -5. WORK BY DELEGATING TO CATEGORY + SKILLS AGENTS (following plan agent's parallel task graph) +1. EXPLORES + LIBRARIANS +2. GATHER -> PLAN AGENT SPAWN +3. WORK BY DELEGATING TO ANOTHER AGENTS NOW. diff --git a/src/hooks/keyword-detector/ultrawork/gpt5.2.ts b/src/hooks/keyword-detector/ultrawork/gpt5.2.ts index bd894033..a7504077 100644 --- a/src/hooks/keyword-detector/ultrawork/gpt5.2.ts +++ b/src/hooks/keyword-detector/ultrawork/gpt5.2.ts @@ -4,13 +4,12 @@ * Key characteristics (from GPT 5.2 Prompting Guide): * - "Stronger instruction adherence" - follows instructions more literally * - "Conservative grounding bias" - prefers correctness over speed - * - "More deliberate scaffolding" - builds clearer plans by default - * - Explicit decision criteria needed (model won't infer) + * - "Parallelize independent reads to reduce latency" - official guidance * * Design principles: - * - Provide explicit complexity-based decision criteria - * - Use conditional logic, not absolute commands - * - Enable autonomous judgment with clear guidelines + * - Two-track parallel context gathering (Direct tools + Background agents) + * - Fire background agents, then use direct tools while waiting + * - Explicit complexity-based decision criteria */ export const ULTRAWORK_GPT_MESSAGE = ` @@ -81,41 +80,47 @@ Use these when they provide clear value based on the decision framework above: | delegate_task category | Specialized work matching a category | \`delegate_task(category="...", load_skills=[...])\` | -- Prefer tools over internal knowledge for fresh/user-specific data -- Parallelize independent reads (explore, librarian) when gathering context -- After any write/update, briefly restate: What changed, Where, Any follow-up needed +- Prefer tools over internal knowledge for fresh or user-specific data +- Parallelize independent reads (read_file, grep, explore, librarian) to reduce latency +- After any write/update, briefly restate: What changed, Where (path), Follow-up needed -## EXECUTION APPROACH +## EXECUTION PATTERN -### Step 1: Assess Complexity -Before starting, classify the task using the decision framework above. +**Context gathering uses TWO parallel tracks:** -### Step 2: Gather Context (if needed) -For non-trivial tasks, fire explore/librarian in parallel as background: +| Track | Tools | Speed | Purpose | +|-------|-------|-------|---------| +| **Direct** | Grep, Read, LSP, AST-grep | Instant | Quick wins, known locations | +| **Background** | explore, librarian agents | Async | Deep search, external docs | + +**ALWAYS run both tracks in parallel:** \`\`\` -delegate_task(subagent_type="explore", run_in_background=true, prompt="Find patterns for X...") -delegate_task(subagent_type="librarian", run_in_background=true, prompt="Find docs for Y...") -// Continue working - collect results when needed with background_output() +// Fire background agents for deep exploration +delegate_task(subagent_type="explore", load_skills=[], prompt="Find X patterns...", run_in_background=true) +delegate_task(subagent_type="librarian", load_skills=[], prompt="Find docs for Y...", run_in_background=true) + +// WHILE THEY RUN - use direct tools for immediate context +grep(pattern="relevant_pattern", path="src/") +read_file(filePath="known/important/file.ts") + +// Collect background results when ready +deep_context = background_output(task_id=...) + +// Merge ALL findings for comprehensive understanding \`\`\` -### Step 3: Plan (for complex tasks only) -Only invoke plan agent if task has 5+ interdependent steps: -\`\`\` -// Collect context first -context = background_output(task_id=task_id) -// Then plan with context -delegate_task(subagent_type="plan", prompt=" + ") -\`\`\` +**Plan agent (complex tasks only):** +- Only if 5+ interdependent steps +- Invoke AFTER gathering context from both tracks -### Step 4: Execute -- If doing yourself: make surgical, minimal changes matching existing patterns +**Execute:** +- Surgical, minimal changes matching existing patterns - If delegating: provide exhaustive context and success criteria -### Step 5: Verify -- Run \`lsp_diagnostics\` on modified files +**Verify:** +- \`lsp_diagnostics\` on modified files - Run tests if available -- Confirm all success criteria met ## QUALITY STANDARDS