- Add MANDATORY section for delegate_task(subagent_type='plan') at top of ultrawork prompt - Establish 'DELEGATE by default, work yourself only when trivial' principle - Add parallel execution rules with anti-pattern and correct pattern examples - Remove emoji (checkmark/cross) from PLAN_AGENT_SYSTEM_PREPEND - Restructure workflow into clear 4-step sequence
422 lines
17 KiB
TypeScript
422 lines
17 KiB
TypeScript
import type { CategoryConfig } from "../../config/schema"
|
||
|
||
export const VISUAL_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on VISUAL/UI tasks.
|
||
|
||
Design-first mindset:
|
||
- Bold aesthetic choices over safe defaults
|
||
- Unexpected layouts, asymmetry, grid-breaking elements
|
||
- Distinctive typography (avoid: Arial, Inter, Roboto, Space Grotesk)
|
||
- Cohesive color palettes with sharp accents
|
||
- High-impact animations with staggered reveals
|
||
- Atmosphere: gradient meshes, noise textures, layered transparencies
|
||
|
||
AVOID: Generic fonts, purple gradients on white, predictable layouts, cookie-cutter patterns.
|
||
</Category_Context>`
|
||
|
||
export const STRATEGIC_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on BUSINESS LOGIC / ARCHITECTURE tasks.
|
||
|
||
Strategic advisor mindset:
|
||
- Bias toward simplicity: least complex solution that fulfills requirements
|
||
- Leverage existing code/patterns over new components
|
||
- Prioritize developer experience and maintainability
|
||
- One clear recommendation with effort estimate (Quick/Short/Medium/Large)
|
||
- Signal when advanced approach warranted
|
||
|
||
Response format:
|
||
- Bottom line (2-3 sentences)
|
||
- Action plan (numbered steps)
|
||
- Risks and mitigations (if relevant)
|
||
</Category_Context>`
|
||
|
||
export const ARTISTRY_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on HIGHLY CREATIVE / ARTISTIC tasks.
|
||
|
||
Artistic genius mindset:
|
||
- Push far beyond conventional boundaries
|
||
- Explore radical, unconventional directions
|
||
- Surprise and delight: unexpected twists, novel combinations
|
||
- Rich detail and vivid expression
|
||
- Break patterns deliberately when it serves the creative vision
|
||
|
||
Approach:
|
||
- Generate diverse, bold options first
|
||
- Embrace ambiguity and wild experimentation
|
||
- Balance novelty with coherence
|
||
- This is for tasks requiring exceptional creativity
|
||
</Category_Context>`
|
||
|
||
export const QUICK_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on SMALL / QUICK tasks.
|
||
|
||
Efficient execution mindset:
|
||
- Fast, focused, minimal overhead
|
||
- Get to the point immediately
|
||
- No over-engineering
|
||
- Simple solutions for simple problems
|
||
|
||
Approach:
|
||
- Minimal viable implementation
|
||
- Skip unnecessary abstractions
|
||
- Direct and concise
|
||
</Category_Context>
|
||
|
||
<Caller_Warning>
|
||
THIS CATEGORY USES A LESS CAPABLE MODEL (claude-haiku-4-5).
|
||
|
||
The model executing this task has LIMITED reasoning capacity. Your prompt MUST be:
|
||
|
||
**EXHAUSTIVELY EXPLICIT** - Leave NOTHING to interpretation:
|
||
1. MUST DO: List every required action as atomic, numbered steps
|
||
2. MUST NOT DO: Explicitly forbid likely mistakes and deviations
|
||
3. EXPECTED OUTPUT: Describe exact success criteria with concrete examples
|
||
|
||
**WHY THIS MATTERS:**
|
||
- Less capable models WILL deviate without explicit guardrails
|
||
- Vague instructions → unpredictable results
|
||
- Implicit expectations → missed requirements
|
||
|
||
**PROMPT STRUCTURE (MANDATORY):**
|
||
\`\`\`
|
||
TASK: [One-sentence goal]
|
||
|
||
MUST DO:
|
||
1. [Specific action with exact details]
|
||
2. [Another specific action]
|
||
...
|
||
|
||
MUST NOT DO:
|
||
- [Forbidden action + why]
|
||
- [Another forbidden action]
|
||
...
|
||
|
||
EXPECTED OUTPUT:
|
||
- [Exact deliverable description]
|
||
- [Success criteria / verification method]
|
||
\`\`\`
|
||
|
||
If your prompt lacks this structure, REWRITE IT before delegating.
|
||
</Caller_Warning>`
|
||
|
||
export const UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on tasks that don't fit specific categories but require moderate effort.
|
||
|
||
<Selection_Gate>
|
||
BEFORE selecting this category, VERIFY ALL conditions:
|
||
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
||
2. Task requires more than trivial effort but is NOT system-wide
|
||
3. Scope is contained within a few files/modules
|
||
|
||
If task fits ANY other category, DO NOT select unspecified-low.
|
||
This is NOT a default choice - it's for genuinely unclassifiable moderate-effort work.
|
||
</Selection_Gate>
|
||
</Category_Context>
|
||
|
||
<Caller_Warning>
|
||
THIS CATEGORY USES A MID-TIER MODEL (claude-sonnet-4-5).
|
||
|
||
**PROVIDE CLEAR STRUCTURE:**
|
||
1. MUST DO: Enumerate required actions explicitly
|
||
2. MUST NOT DO: State forbidden actions to prevent scope creep
|
||
3. EXPECTED OUTPUT: Define concrete success criteria
|
||
</Caller_Warning>`
|
||
|
||
export const UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on tasks that don't fit specific categories but require substantial effort.
|
||
|
||
<Selection_Gate>
|
||
BEFORE selecting this category, VERIFY ALL conditions:
|
||
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
||
2. Task requires substantial effort across multiple systems/modules
|
||
3. Changes have broad impact or require careful coordination
|
||
4. NOT just "complex" - must be genuinely unclassifiable AND high-effort
|
||
|
||
If task fits ANY other category, DO NOT select unspecified-high.
|
||
If task is unclassifiable but moderate-effort, use unspecified-low instead.
|
||
</Selection_Gate>
|
||
</Category_Context>`
|
||
|
||
export const WRITING_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
||
You are working on WRITING / PROSE tasks.
|
||
|
||
Wordsmith mindset:
|
||
- Clear, flowing prose
|
||
- Appropriate tone and voice
|
||
- Engaging and readable
|
||
- Proper structure and organization
|
||
|
||
Approach:
|
||
- Understand the audience
|
||
- Draft with care
|
||
- Polish for clarity and impact
|
||
- Documentation, READMEs, articles, technical writing
|
||
</Category_Context>`
|
||
|
||
|
||
|
||
export const DEFAULT_CATEGORIES: Record<string, CategoryConfig> = {
|
||
"visual-engineering": { model: "google/gemini-3-pro" },
|
||
ultrabrain: { model: "openai/gpt-5.2-codex", variant: "xhigh" },
|
||
artistry: { model: "google/gemini-3-pro", variant: "max" },
|
||
quick: { model: "anthropic/claude-haiku-4-5" },
|
||
"unspecified-low": { model: "anthropic/claude-sonnet-4-5" },
|
||
"unspecified-high": { model: "anthropic/claude-opus-4-5", variant: "max" },
|
||
writing: { model: "google/gemini-3-flash" },
|
||
}
|
||
|
||
export const CATEGORY_PROMPT_APPENDS: Record<string, string> = {
|
||
"visual-engineering": VISUAL_CATEGORY_PROMPT_APPEND,
|
||
ultrabrain: STRATEGIC_CATEGORY_PROMPT_APPEND,
|
||
artistry: ARTISTRY_CATEGORY_PROMPT_APPEND,
|
||
quick: QUICK_CATEGORY_PROMPT_APPEND,
|
||
"unspecified-low": UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND,
|
||
"unspecified-high": UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND,
|
||
writing: WRITING_CATEGORY_PROMPT_APPEND,
|
||
}
|
||
|
||
export const CATEGORY_DESCRIPTIONS: Record<string, string> = {
|
||
"visual-engineering": "Frontend, UI/UX, design, styling, animation",
|
||
ultrabrain: "Deep logical reasoning, complex architecture decisions requiring extensive analysis",
|
||
artistry: "Highly creative/artistic tasks, novel ideas",
|
||
quick: "Trivial tasks - single file changes, typo fixes, simple modifications",
|
||
"unspecified-low": "Tasks that don't fit other categories, low effort required",
|
||
"unspecified-high": "Tasks that don't fit other categories, high effort required",
|
||
writing: "Documentation, prose, technical writing",
|
||
}
|
||
|
||
/**
|
||
* 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(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
|
||
- **Uncertainties**: List of unclear points, ambiguities, or assumptions you're making
|
||
- **Clarifying Questions**: Specific questions to resolve the uncertainties
|
||
|
||
3. ITERATE until ALL requirements are crystal clear:
|
||
- Do NOT proceed to planning until you have 100% clarity
|
||
- Ask the user to confirm your understanding
|
||
- Resolve every ambiguity before generating the work plan
|
||
|
||
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:**
|
||
- INCLUDED \`skill-name\`: [reason]
|
||
- OMITTED \`other-skill\`: [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>
|
||
|
||
`
|
||
|
||
/**
|
||
* List of agent names that should be treated as plan agents.
|
||
* Case-insensitive matching is used.
|
||
*/
|
||
export const PLAN_AGENT_NAMES = ["plan", "prometheus", "planner"]
|
||
|
||
/**
|
||
* Check if the given agent name is a plan agent.
|
||
* @param agentName - The agent name to check
|
||
* @returns true if the agent is a plan agent
|
||
*/
|
||
export function isPlanAgent(agentName: string | undefined): boolean {
|
||
if (!agentName) return false
|
||
const lowerName = agentName.toLowerCase().trim()
|
||
return PLAN_AGENT_NAMES.some(name => lowerName === name || lowerName.includes(name))
|
||
}
|
||
|
||
|