diff --git a/src/hooks/keyword-detector/constants.ts b/src/hooks/keyword-detector/constants.ts index 592c002a..e1315ed7 100644 --- a/src/hooks/keyword-detector/constants.ts +++ b/src/hooks/keyword-detector/constants.ts @@ -166,34 +166,110 @@ delegate_task(agent="oracle", prompt="Review my approach: [describe plan]") YOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL. TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST. -## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES (by capability, not by name) -- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS for file patterns, internal implementations, project structure -- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS for API references, examples, external library docs -- **Planning & Strategy**: NEVER plan yourself - ALWAYS spawn the Plan agent for work breakdown - - MUST invoke: \`delegate_task(subagent_type="plan", prompt="")\` - - In your prompt to the Plan agent, ASK it to recommend which CATEGORY + SKILLS / AGENTS to leverage for implementation. - - IF IMPLEMENT TASK, MUST ADD TODO NOW: "Consult Plan agent via delegate_task(subagent_type='plan') for work breakdown with category + skills recommendations" -- **High-IQ Reasoning**: Leverage specialized agents for architecture decisions, code review, strategic planning -- **SPECIAL TASKS COVERED WITH CATEGORY + LOAD_SKILLS**: Delegate to specialized agents with category+skills for design and implementation, as following guide: - - CATEGORY + SKILL GUIDE - - MUST PASS \`load_skills\` FOR REQUIRED_SKILLS. MUST USE \`load_skills\` FOR REQUIRED_SKILLS. - - Simple project setup -> delegate_task(category="unspecified-low", load_skills=[{project-setup-skill}]) - - Super Complex Server Workflow Implementation -> delegate_task(category="ultrabrain", load_skills=["terraform-master"], ...) - - Web Frontend Component Writing -> delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux", "playwright"], ...) +## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE) -## 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. - - **CATEGORY + LOAD_SKILLS** +**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.** -## 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. Spawn Plan agent: \`delegate_task(subagent_type="plan", prompt="")\` to create detailed work breakdown -4. Execute with continuous verification against original requirements +| Condition | Action | +|-----------|--------| +| Task has 2+ steps | MUST call Plan agent | +| Task scope unclear | MUST call Plan agent | +| Implementation required | MUST call Plan agent | +| Architecture decision needed | MUST call Plan agent | + +\`\`\` +delegate_task(subagent_type="plan", prompt="") +\`\`\` + +**WHY THIS IS MANDATORY:** +- Plan agent analyzes dependencies and parallel execution opportunities +- Plan agent recommends CATEGORY + SKILLS for each task +- Plan agent ensures nothing is missed +- YOU are an orchestrator, NOT an implementer + +**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.** + +--- + +## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES + +**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.** + +| Task Type | Action | Why | +|-----------|--------|-----| +| Codebase exploration | delegate_task(subagent_type="explore", run_in_background=true) | Parallel, context-efficient | +| Documentation lookup | delegate_task(subagent_type="librarian", run_in_background=true) | Specialized knowledge | +| Planning | delegate_task(subagent_type="plan") | Structured work breakdown | +| Architecture/Debugging | delegate_task(subagent_type="oracle") | High-IQ reasoning | +| Implementation | delegate_task(category="...", load_skills=[...]) | Domain-optimized models | + +**CATEGORY + SKILL DELEGATION:** +\`\`\` +// Frontend work +delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux"]) + +// Complex logic +delegate_task(category="ultrabrain", load_skills=["typescript-programmer"]) + +// Quick fixes +delegate_task(category="quick", load_skills=["git-master"]) +\`\`\` + +**YOU SHOULD ONLY DO IT YOURSELF WHEN:** +- Task is trivially simple (1-2 lines, obvious change) +- You have ALL context already loaded +- Delegation overhead exceeds task complexity + +**OTHERWISE: DELEGATE. ALWAYS.** + +--- + +## EXECUTION RULES (PARALLELIZATION MANDATORY) + +| Rule | Implementation | +|------|----------------| +| **PARALLEL FIRST** | Fire ALL independent agents simultaneously via delegate_task(run_in_background=true) | +| **NEVER SEQUENTIAL** | If tasks A and B are independent, launch BOTH at once | +| **10+ CONCURRENT** | Use 10+ background agents if needed for comprehensive exploration | +| **COLLECT LATER** | Launch agents -> continue work -> background_output when needed | + +**ANTI-PATTERN (BLOCKING):** +\`\`\` +// WRONG: Sequential, slow +result1 = delegate_task(..., run_in_background=false) // waits +result2 = delegate_task(..., run_in_background=false) // waits again +\`\`\` + +**CORRECT PATTERN:** +\`\`\` +// RIGHT: Parallel, fast +delegate_task(..., run_in_background=true) // task_id_1 +delegate_task(..., run_in_background=true) // task_id_2 +delegate_task(..., run_in_background=true) // task_id_3 +// Continue working, collect with background_output when needed +\`\`\` + +--- + +## WORKFLOW (MANDATORY SEQUENCE) + +1. **GATHER CONTEXT** (parallel background agents): + \`\`\` + delegate_task(subagent_type="explore", run_in_background=true, prompt="...") + delegate_task(subagent_type="librarian", run_in_background=true, prompt="...") + \`\`\` + +2. **INVOKE PLAN AGENT** (MANDATORY for non-trivial tasks): + \`\`\` + delegate_task(subagent_type="plan", prompt="") + \`\`\` + +3. **EXECUTE VIA DELEGATION** (category + skills): + \`\`\` + delegate_task(category="...", load_skills=[...], prompt="") + \`\`\` + +4. **VERIFY** against original requirements ## VERIFICATION GUARANTEE (NON-NEGOTIABLE) diff --git a/src/tools/delegate-task/constants.ts b/src/tools/delegate-task/constants.ts index a7ec3bfe..4d9763ca 100644 --- a/src/tools/delegate-task/constants.ts +++ b/src/tools/delegate-task/constants.ts @@ -341,8 +341,8 @@ For EACH task, include a recommendation block: - Skills: [\`skill-1\`, \`skill-2\`] - [reason each skill is needed] **Skills Evaluation:** -- ✅ \`skill-name\`: Included because [reason] -- ❌ \`other-skill\`: Omitted because [reason domain doesn't overlap] +- INCLUDED \`skill-name\`: [reason] +- OMITTED \`other-skill\`: [reason domain doesn't overlap] \`\`\` WHY THIS MATTERS: