diff --git a/src/hooks/keyword-detector/constants.ts b/src/hooks/keyword-detector/constants.ts index 07623992..e207adee 100644 --- a/src/hooks/keyword-detector/constants.ts +++ b/src/hooks/keyword-detector/constants.ts @@ -49,7 +49,81 @@ You ARE the planner. Your job: create bulletproof work plans. - External library APIs and constraints - Similar implementations in OSS (via librarian) -**NEVER plan blind. Context first, plan second.**` +**NEVER plan blind. Context first, plan second.** + +--- + +## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST + +**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.** + +When you finalize a plan, you MUST structure it for maximum parallel execution: + +### 1. Parallel Execution Waves (REQUIRED) + +Analyze task dependencies and group independent tasks into parallel waves: + +\`\`\` +Wave 1 (Start Immediately - No Dependencies): +├── Task 1: [description] → category: X, skills: [a, b] +└── Task 4: [description] → category: Y, skills: [c] + +Wave 2 (After Wave 1 Completes): +├── Task 2: [depends: 1] → category: X, skills: [a] +├── Task 3: [depends: 1] → category: Z, skills: [d] +└── Task 5: [depends: 4] → category: Y, skills: [c] + +Wave 3 (After Wave 2 Completes): +└── Task 6: [depends: 2, 3] → category: X, skills: [a, b] + +Critical Path: Task 1 → Task 2 → Task 6 +Estimated Parallel Speedup: ~40% faster than sequential +\`\`\` + +### 2. Dependency Matrix (REQUIRED) + +| Task | Depends On | Blocks | Can Parallelize With | +|------|------------|--------|---------------------| +| 1 | None | 2, 3 | 4 | +| 2 | 1 | 6 | 3, 5 | +| 3 | 1 | 6 | 2, 5 | +| 4 | None | 5 | 1 | +| 5 | 4 | None | 2, 3 | +| 6 | 2, 3 | None | None (final) | + +### 3. TODO List Structure (REQUIRED) + +Each TODO item MUST include: + +\`\`\`markdown +- [ ] N. [Task Title] + + **What to do**: [Clear steps] + + **Dependencies**: [Task numbers this depends on] | None + **Blocks**: [Task numbers that depend on this] + **Parallel Group**: Wave N (with Tasks X, Y) + + **Recommended Agent Profile**: + - **Category**: \`[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]\` + - **Skills**: [\`skill-1\`, \`skill-2\`] + + **Acceptance Criteria**: [Verifiable conditions] +\`\`\` + +### 4. Agent Dispatch Summary (REQUIRED) + +| Wave | Tasks | Dispatch Command | +|------|-------|------------------| +| 1 | 1, 4 | \`delegate_task(category="...", load_skills=[...], run_in_background=true)\` × 2 | +| 2 | 2, 3, 5 | \`delegate_task(...)\` × 3 after Wave 1 completes | +| 3 | 6 | \`delegate_task(...)\` final integration | + +**WHY PARALLEL TASK GRAPH IS MANDATORY:** +- Orchestrator (Sisyphus) executes tasks in parallel waves +- Independent tasks run simultaneously via background agents +- Proper dependency tracking prevents race conditions +- Category + skills ensure optimal model routing per task` /** * Determines if the agent is a planner-type agent. @@ -166,52 +240,52 @@ 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. -## MANDATORY: PROMETHEUS AGENT INVOCATION (NON-NEGOTIABLE) +## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE) -**YOU MUST ALWAYS INVOKE PROMETHEUS (THE PLANNER) FOR ANY NON-TRIVIAL TASK.** +**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.** | Condition | Action | |-----------|--------| -| Task has 2+ steps | MUST call Prometheus | -| Task scope unclear | MUST call Prometheus | -| Implementation required | MUST call Prometheus | -| Architecture decision needed | MUST call Prometheus | +| 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="prometheus", prompt="") +delegate_task(subagent_type="plan", prompt="") \`\`\` -**WHY PROMETHEUS IS MANDATORY:** -- Prometheus analyzes dependencies and parallel execution opportunities -- Prometheus recommends CATEGORY + SKILLS for each task (in TL;DR + per-task) -- Prometheus ensures nothing is missed with structured work plans +**WHY PLAN AGENT IS MANDATORY:** +- Plan agent analyzes dependencies and parallel execution opportunities +- Plan agent outputs a **parallel task graph** with waves and dependencies +- Plan agent provides structured TODO list with category + skills per task - YOU are an orchestrator, NOT an implementer -### SESSION CONTINUITY WITH PROMETHEUS (CRITICAL) +### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL) -**Prometheus returns a session_id. USE IT for follow-up interactions.** +**Plan agent returns a session_id. USE IT for follow-up interactions.** | Scenario | Action | |----------|--------| -| Prometheus asks clarifying questions | \`delegate_task(session_id="{returned_session_id}", prompt="")\` | +| Plan agent asks clarifying questions | \`delegate_task(session_id="{returned_session_id}", prompt="")\` | | Need to refine the plan | \`delegate_task(session_id="{returned_session_id}", prompt="Please adjust: ")\` | | Plan needs more detail | \`delegate_task(session_id="{returned_session_id}", prompt="Add more detail to Task N")\` | **WHY SESSION_ID IS CRITICAL:** -- Prometheus retains FULL conversation context +- Plan agent retains FULL conversation context - No repeated exploration or context gathering - Saves 70%+ tokens on follow-ups - Maintains interview continuity until plan is finalized \`\`\` // WRONG: Starting fresh loses all context -delegate_task(subagent_type="prometheus", prompt="Here's more info...") +delegate_task(subagent_type="plan", prompt="Here's more info...") // CORRECT: Resume preserves everything delegate_task(session_id="ses_abc123", prompt="Here's my answer to your question: ...") \`\`\` -**FAILURE TO CALL PROMETHEUS = INCOMPLETE WORK.** +**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.** --- @@ -223,7 +297,7 @@ delegate_task(session_id="ses_abc123", prompt="Here's my answer to your question |-----------|--------|-----| | 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 | +| Planning | delegate_task(subagent_type="plan") | Parallel task graph + structured TODO list | | Architecture/Debugging | delegate_task(subagent_type="oracle") | High-IQ reasoning | | Implementation | delegate_task(category="...", load_skills=[...]) | Domain-optimized models | @@ -283,20 +357,20 @@ delegate_task(..., run_in_background=true) // task_id_3 delegate_task(subagent_type="librarian", run_in_background=true, prompt="...") \`\`\` -2. **INVOKE PROMETHEUS** (MANDATORY for non-trivial tasks): +2. **INVOKE PLAN AGENT** (MANDATORY for non-trivial tasks): \`\`\` - result = delegate_task(subagent_type="prometheus", prompt="") + result = delegate_task(subagent_type="plan", prompt="") // STORE the session_id for follow-ups! - prometheus_session_id = result.session_id + plan_session_id = result.session_id \`\`\` -3. **ITERATE WITH PROMETHEUS** (if clarification needed): +3. **ITERATE WITH PLAN AGENT** (if clarification needed): \`\`\` // Use session_id to continue the conversation - delegate_task(session_id=prometheus_session_id, prompt="") + delegate_task(session_id=plan_session_id, prompt="") \`\`\` -4. **EXECUTE VIA DELEGATION** (category + skills from Prometheus's plan): +4. **EXECUTE VIA DELEGATION** (category + skills from plan agent's output): \`\`\` delegate_task(category="...", load_skills=[...], prompt="") \`\`\` @@ -375,9 +449,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) -2. GATHER -> delegate_task(subagent_type="prometheus", prompt="") -3. ITERATE WITH PROMETHEUS (session_id resume) UNTIL PLAN IS FINALIZED -4. WORK BY DELEGATING TO CATEGORY + SKILLS AGENTS (following Prometheus's plan) +2. GATHER -> delegate_task(subagent_type="plan", prompt="") +3. ITERATE WITH PLAN AGENT (session_id resume) UNTIL PLAN IS FINALIZED +4. WORK BY DELEGATING TO CATEGORY + SKILLS AGENTS (following plan agent's parallel task graph) NOW.