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.
This commit is contained in:
justsisyphus
2026-01-26 18:31:35 +09:00
parent 26b1c67964
commit 383f43548b

View File

@@ -189,14 +189,15 @@ export const CATEGORY_DESCRIPTIONS: Record<string, string> = {
* 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 = `<system>
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="<search for relevant patterns, files, and implementations in the codebase related to user's request>")
- call_omo_agent(agent="librarian", background=true, prompt="<search for external documentation, examples, and best practices related to user's request>")
- call_omo_agent(description="Explore codebase patterns", subagent_type="explore", run_in_background=true, prompt="<search for relevant patterns, files, and implementations in the codebase related to user's request>")
- call_omo_agent(description="Research documentation", subagent_type="librarian", run_in_background=true, prompt="<search for external documentation, examples, and best practices related to user's request>")
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.
</system>
<CRITICAL_REQUIREMENT_DEPENDENCY_PARALLEL_EXECUTION_CATEGORY_SKILLS>
#####################################################################
# #
# ██████╗ ███████╗ ██████╗ ██╗ ██╗██╗██████╗ ███████╗██████╗ #
# ██╔══██╗██╔════╝██╔═══██╗██║ ██║██║██╔══██╗██╔════╝██╔══██╗ #
# ██████╔╝█████╗ ██║ ██║██║ ██║██║██████╔╝█████╗ ██║ ██║ #
# ██╔══██╗██╔══╝ ██║▄▄ ██║██║ ██║██║██╔══██╗██╔══╝ ██║ ██║ #
# ██<E29688><E29688> ██║███████╗╚██████╔╝╚██████╔╝██║██║ ██║███████╗██████╔╝ #
# ╚═╝ ╚═╝╚══════╝ ╚══▀▀═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═════╝ #
# #
#####################################################################
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. #
# #
#####################################################################
</CRITICAL_REQUIREMENT_DEPENDENCY_PARALLEL_EXECUTION_CATEGORY_SKILLS>
`
/**