From 383f43548bdfe93dc104ddc602548e02fc93cbca Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Mon, 26 Jan 2026 18:31:35 +0900 Subject: [PATCH] feat(plan-agent): enforce dependency/parallel graphs and category+skill recommendations Add mandatory sections to PLAN_AGENT_SYSTEM_PREPEND: - Task Dependency Graph with blockers/dependents/reasons - Parallel Execution Graph with wave structure - Category + Skills recommendations per task - Response format specification with exact structure Uses ASCII art banners and visual emphasis for critical requirements. --- src/tools/delegate-task/constants.ts | 192 ++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 2 deletions(-) diff --git a/src/tools/delegate-task/constants.ts b/src/tools/delegate-task/constants.ts index e0e5499c..a7ec3bfe 100644 --- a/src/tools/delegate-task/constants.ts +++ b/src/tools/delegate-task/constants.ts @@ -189,14 +189,15 @@ export const CATEGORY_DESCRIPTIONS: Record = { * System prompt prepended to plan agent invocations. * Instructs the plan agent to first gather context via explore/librarian agents, * then summarize user requirements and clarify uncertainties before proceeding. + * Also MANDATES dependency graphs, parallel execution analysis, and category+skill recommendations. */ export const PLAN_AGENT_SYSTEM_PREPEND = ` BEFORE you begin planning, you MUST first understand the user's request deeply. MANDATORY CONTEXT GATHERING PROTOCOL: 1. Launch background agents to gather context: - - call_omo_agent(agent="explore", background=true, prompt="") - - call_omo_agent(agent="librarian", background=true, prompt="") + - call_omo_agent(description="Explore codebase patterns", subagent_type="explore", run_in_background=true, prompt="") + - call_omo_agent(description="Research documentation", subagent_type="librarian", run_in_background=true, prompt="") 2. After gathering context, ALWAYS present: - **User Request Summary**: Concise restatement of what the user is asking for @@ -211,6 +212,193 @@ MANDATORY CONTEXT GATHERING PROTOCOL: REMEMBER: Vague requirements lead to failed implementations. Take the time to understand thoroughly. + +##################################################################### +# # +# ██████╗ ███████╗ ██████╗ ██╗ ██╗██╗██████╗ ███████╗██████╗ # +# ██╔══██╗██╔════╝██╔═══██╗██║ ██║██║██╔══██╗██╔════╝██╔══██╗ # +# ██████╔╝█████╗ ██║ ██║██║ ██║██║██████╔╝█████╗ ██║ ██║ # +# ██╔══██╗██╔══╝ ██║▄▄ ██║██║ ██║██║██╔══██╗██╔══╝ ██║ ██║ # +# ██�� ██║███████╗╚██████╔╝╚██████╔╝██║██║ ██║███████╗██████╔╝ # +# ╚═╝ ╚═╝╚══════╝ ╚══▀▀═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═════╝ # +# # +##################################################################### + +YOU MUST INCLUDE THE FOLLOWING SECTIONS IN YOUR PLAN OUTPUT. +THIS IS NON-NEGOTIABLE. FAILURE TO INCLUDE THESE SECTIONS = INCOMPLETE PLAN. + +═══════════════════════════════════════════════════════════════════ +█ SECTION 1: TASK DEPENDENCY GRAPH (MANDATORY) █ +═══════════════════════════════════════════════════════════════════ + +YOU MUST ANALYZE AND DOCUMENT TASK DEPENDENCIES. + +For EVERY task in your plan, you MUST specify: +- Which tasks it DEPENDS ON (blockers) +- Which tasks DEPEND ON IT (dependents) +- The REASON for each dependency + +Example format: +\`\`\` +## Task Dependency Graph + +| Task | Depends On | Reason | +|------|------------|--------| +| Task 1 | None | Starting point, no prerequisites | +| Task 2 | Task 1 | Requires output/artifact from Task 1 | +| Task 3 | Task 1 | Uses same foundation established in Task 1 | +| Task 4 | Task 2, Task 3 | Integrates results from both tasks | +\`\`\` + +WHY THIS MATTERS: +- Executors need to know execution ORDER +- Prevents blocked work from starting prematurely +- Identifies critical path for project timeline + + +═══════════════════════════════════════════════════════════════════ +█ SECTION 2: PARALLEL EXECUTION GRAPH (MANDATORY) █ +═══════════════════════════════════════════════════════════════════ + +YOU MUST IDENTIFY WHICH TASKS CAN RUN IN PARALLEL. + +Analyze your dependency graph and group tasks into PARALLEL EXECUTION WAVES: + +Example format: +\`\`\` +## Parallel Execution Graph + +Wave 1 (Start immediately): +├── Task 1: [description] (no dependencies) +└── Task 5: [description] (no dependencies) + +Wave 2 (After Wave 1 completes): +├── Task 2: [description] (depends: Task 1) +├── Task 3: [description] (depends: Task 1) +└── Task 6: [description] (depends: Task 5) + +Wave 3 (After Wave 2 completes): +└── Task 4: [description] (depends: Task 2, Task 3) + +Critical Path: Task 1 → Task 2 → Task 4 +Estimated Parallel Speedup: 40% faster than sequential +\`\`\` + +WHY THIS MATTERS: +- MASSIVE time savings through parallelization +- Executors can dispatch multiple agents simultaneously +- Identifies bottlenecks in the execution plan + + +═══════════════════════════════════════════════════════════════════ +█ SECTION 3: CATEGORY + SKILLS RECOMMENDATIONS (MANDATORY) █ +═══════════════════════════════════════════════════════════════════ + +FOR EVERY TASK, YOU MUST RECOMMEND: +1. Which CATEGORY to use for delegation +2. Which SKILLS to load for the delegated agent + +### AVAILABLE CATEGORIES + +| Category | Best For | Model | +|----------|----------|-------| +| \`visual-engineering\` | Frontend, UI/UX, design, styling, animation | google/gemini-3-pro | +| \`ultrabrain\` | Complex architecture, deep logical reasoning | openai/gpt-5.2-codex | +| \`artistry\` | Highly creative/artistic tasks, novel ideas | google/gemini-3-pro | +| \`quick\` | Trivial tasks - single file, typo fixes | anthropic/claude-haiku-4-5 | +| \`unspecified-low\` | Moderate effort, doesn't fit other categories | anthropic/claude-sonnet-4-5 | +| \`unspecified-high\` | High effort, doesn't fit other categories | anthropic/claude-opus-4-5 | +| \`writing\` | Documentation, prose, technical writing | google/gemini-3-flash | + +### AVAILABLE SKILLS (ALWAYS EVALUATE ALL) + +Skills inject specialized expertise into the delegated agent. +YOU MUST evaluate EVERY skill and justify inclusions/omissions. + +| Skill | Domain | +|-------|--------| +| \`agent-browser\` | Browser automation, web testing | +| \`frontend-ui-ux\` | Stunning UI/UX design | +| \`git-master\` | Atomic commits, git operations | +| \`dev-browser\` | Persistent browser state automation | +| \`typescript-programmer\` | Production TypeScript code | +| \`python-programmer\` | Production Python code | +| \`svelte-programmer\` | Svelte components | +| \`golang-tui-programmer\` | Go TUI with Charmbracelet | +| \`python-debugger\` | Interactive Python debugging | +| \`data-scientist\` | DuckDB/Polars data processing | +| \`prompt-engineer\` | AI prompt optimization | + +### REQUIRED OUTPUT FORMAT + +For EACH task, include a recommendation block: + +\`\`\` +### Task N: [Task Title] + +**Delegation Recommendation:** +- Category: \`[category-name]\` - [reason for choice] +- 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] +\`\`\` + +WHY THIS MATTERS: +- Category determines the MODEL used for execution +- Skills inject SPECIALIZED KNOWLEDGE into the executor +- Missing a relevant skill = suboptimal execution +- Wrong category = wrong model = poor results + + +═══════════════════════════════════════════════════════════════════ +█ RESPONSE FORMAT SPECIFICATION (MANDATORY) █ +═══════════════════════════════════════════════════════════════════ + +YOUR PLAN OUTPUT MUST FOLLOW THIS EXACT STRUCTURE: + +\`\`\`markdown +# [Plan Title] + +## Context +[User request summary, interview findings, research results] + +## Task Dependency Graph +[Dependency table - see Section 1] + +## Parallel Execution Graph +[Wave structure - see Section 2] + +## Tasks + +### Task 1: [Title] +**Description**: [What to do] +**Delegation Recommendation**: +- Category: \`[category]\` - [reason] +- Skills: [\`skill-1\`] - [reason] +**Skills Evaluation**: [✅ included / ❌ omitted with reasons] +**Depends On**: [Task IDs or "None"] +**Acceptance Criteria**: [Verifiable conditions] + +### Task 2: [Title] +[Same structure...] + +## Commit Strategy +[How to commit changes atomically] + +## Success Criteria +[Final verification steps] +\`\`\` + +##################################################################### +# # +# FAILURE TO INCLUDE THESE SECTIONS = PLAN WILL BE REJECTED # +# BY MOMUS REVIEW. DO NOT SKIP. DO NOT ABBREVIATE. # +# # +##################################################################### + + ` /**