Merge branch 'dev' into fix/typos

This commit is contained in:
luojiyin
2026-01-22 10:51:45 +08:00
71 changed files with 3973 additions and 1723 deletions
+4 -8
View File
@@ -2,21 +2,19 @@
## OVERVIEW
10 AI agents for multi-model orchestration. Sisyphus (primary), oracle, librarian, explore, frontend, document-writer, multimodal-looker, Prometheus, Metis, Momus.
8 AI agents for multi-model orchestration. Sisyphus (primary), oracle, librarian, explore, multimodal-looker, Prometheus, Metis, Momus.
## STRUCTURE
```
agents/
├── orchestrator-sisyphus.ts # Orchestrator (1531 lines) - 7-phase delegation
├── sisyphus.ts # Main prompt (640 lines)
├── atlas.ts # Orchestrator (1383 lines) - 7-phase delegation
├── sisyphus.ts # Main prompt (615 lines)
├── sisyphus-junior.ts # Delegated task executor
├── sisyphus-prompt-builder.ts # Dynamic prompt generation
├── dynamic-agent-prompt-builder.ts # Dynamic prompt generation
├── oracle.ts # Strategic advisor (GPT-5.2)
├── librarian.ts # Multi-repo research (GLM-4.7-free)
├── explore.ts # Fast grep (Grok Code)
├── frontend-ui-ux-engineer.ts # UI specialist (Gemini 3 Pro)
├── document-writer.ts # Technical writer (Gemini 3 Flash)
├── multimodal-looker.ts # Media analyzer (Gemini 3 Flash)
├── prometheus-prompt.ts # Planning (1196 lines) - interview mode
├── metis.ts # Plan consultant - pre-planning analysis
@@ -34,8 +32,6 @@ agents/
| oracle | openai/gpt-5.2 | 0.1 | Read-only consultation, debugging |
| librarian | opencode/glm-4.7-free | 0.1 | Docs, GitHub search, OSS examples |
| explore | opencode/grok-code | 0.1 | Fast contextual grep |
| frontend-ui-ux-engineer | google/gemini-3-pro-preview | 0.7 | UI generation, visual design |
| document-writer | google/gemini-3-flash | 0.3 | Technical documentation |
| multimodal-looker | google/gemini-3-flash | 0.1 | PDF/image analysis |
| Prometheus | anthropic/claude-opus-4-5 | 0.1 | Strategic planning, interview mode |
| Metis | anthropic/claude-sonnet-4-5 | 0.1 | Pre-planning gap analysis |
@@ -1,6 +1,7 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import type { AgentPromptMetadata } from "./types"
import type { AvailableAgent, AvailableSkill } from "./sisyphus-prompt-builder"
import type { AvailableAgent, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder"
import { buildCategorySkillsDelegationGuide } from "./dynamic-agent-prompt-builder"
import type { CategoryConfig } from "../config/schema"
import { DEFAULT_CATEGORIES, CATEGORY_DESCRIPTIONS } from "../tools/delegate-task/constants"
import { createAgentToolRestrictions } from "../shared/permission-compat"
@@ -23,15 +24,7 @@ function buildAgentSelectionSection(agents: AvailableAgent[]): string {
if (agents.length === 0) {
return `##### Option B: Use AGENT directly (for specialized experts)
| Agent | Best For |
|-------|----------|
| \`oracle\` | Read-only consultation. High-IQ debugging, architecture design |
| \`explore\` | Codebase exploration, pattern finding |
| \`librarian\` | External docs, GitHub examples, OSS reference |
| \`frontend-ui-ux-engineer\` | Visual design, UI implementation |
| \`document-writer\` | README, API docs, guides |
| \`git-master\` | Git commits (ALWAYS use for commits) |
| \`debugging-master\` | Complex debugging sessions |`
No agents available.`
}
const rows = agents.map((a) => {
@@ -43,9 +36,7 @@ function buildAgentSelectionSection(agents: AvailableAgent[]): string {
| Agent | Best For |
|-------|----------|
${rows.join("\n")}
| \`git-master\` | Git commits (ALWAYS use for commits) |
| \`debugging-master\` | Complex debugging sessions |`
${rows.join("\n")}`
}
function buildCategorySection(userCategories?: Record<string, CategoryConfig>): string {
@@ -65,8 +56,7 @@ Categories spawn \`Sisyphus-Junior-{category}\` with optimized settings:
${categoryRows.join("\n")}
\`\`\`typescript
delegate_task(category="visual-engineering", prompt="...") // UI/frontend work
delegate_task(category="ultrabrain", prompt="...") // Backend/strategic work
delegate_task(category="[category-name]", skills=[...], prompt="...")
\`\`\``
}
@@ -89,44 +79,42 @@ function buildSkillsSection(skills: AvailableSkill[]): string {
|-------|-------------|
${skillRows.join("\n")}
**When to include skills:**
- Task matches a skill's domain (e.g., \`frontend-ui-ux\` for UI work, \`playwright\` for browser automation)
- Multiple skills can be combined
**MANDATORY: Evaluate ALL skills for relevance to your task.**
Read each skill's description and ask: "Does this skill's domain overlap with my task?"
- If YES: INCLUDE in skills=[...]
- If NO: You MUST justify why in your pre-delegation declaration
**Usage:**
\`\`\`typescript
delegate_task(category="visual-engineering", skills=["frontend-ui-ux"], prompt="...")
delegate_task(category="general", skills=["playwright"], prompt="...") // Browser testing
delegate_task(category="visual-engineering", skills=["frontend-ui-ux", "playwright"], prompt="...") // UI with browser testing
delegate_task(category="[category]", skills=["skill-1", "skill-2"], prompt="...")
\`\`\`
**IMPORTANT:**
- Skills are OPTIONAL - only include if task clearly benefits from specialized guidance
- Skills get prepended to the subagent's prompt, providing domain-specific instructions
- If no appropriate skill exists, omit the \`skills\` parameter entirely`
- Subagents are STATELESS - they don't know what skills exist unless you include them
- Missing a relevant skill = suboptimal output quality`
}
function buildDecisionMatrix(agents: AvailableAgent[], userCategories?: Record<string, CategoryConfig>): string {
const allCategories = { ...DEFAULT_CATEGORIES, ...userCategories }
const hasVisual = "visual-engineering" in allCategories
const hasStrategic = "ultrabrain" in allCategories
const rows: string[] = []
if (hasVisual) rows.push("| Implement frontend feature | `category=\"visual-engineering\"` |")
if (hasStrategic) rows.push("| Implement backend feature | `category=\"ultrabrain\"` |")
const agentNames = agents.map((a) => a.name)
if (agentNames.includes("oracle")) rows.push("| Code review / architecture | `agent=\"oracle\"` |")
if (agentNames.includes("explore")) rows.push("| Find code in codebase | `agent=\"explore\"` |")
if (agentNames.includes("librarian")) rows.push("| Look up library docs | `agent=\"librarian\"` |")
rows.push("| Git commit | `agent=\"git-master\"` |")
rows.push("| Debug complex issue | `agent=\"debugging-master\"` |")
const categoryRows = Object.entries(allCategories).map(([name]) => {
const desc = CATEGORY_DESCRIPTIONS[name] ?? "General tasks"
return `| ${desc} | \`category="${name}", skills=[...]\` |`
})
const agentRows = agents.map((a) => {
const shortDesc = a.description.split(".")[0] || a.description
return `| ${shortDesc} | \`agent="${a.name}"\` |`
})
return `##### Decision Matrix
| Task Type | Use |
|-----------|-----|
${rows.join("\n")}
| Task Domain | Use |
|-------------|-----|
${categoryRows.join("\n")}
${agentRows.join("\n")}
**NEVER provide both category AND agent - they are mutually exclusive.**`
}
@@ -147,7 +135,7 @@ You are "Sisyphus" - Powerful AI Agent with orchestration capabilities from OhMy
- Follows user instructions. NEVER START IMPLEMENTING, UNLESS USER WANTS YOU TO IMPLEMENT SOMETHING EXPLICITLY.
- KEEP IN MIND: YOUR TODO CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TODO CONTINUATION]), BUT IF NOT USER REQUESTED YOU TO WORK, NEVER START WORK.
**Operating Mode**: You NEVER work alone when specialists are available. Frontend work delegate. Deep research parallel background agents (async subagents). Complex architecture consult Oracle.
**Operating Mode**: You NEVER work alone when specialists are available. Specialized work = delegate via category+skills. Deep research = parallel background agents. Complex architecture = consult agents.
</Role>
@@ -318,51 +306,6 @@ STOP searching when:
2. Mark current task \`in_progress\` before starting
3. Mark \`completed\` as soon as done (don't batch) - OBSESSIVELY TRACK YOUR WORK USING TODO TOOLS
### Frontend Files: Decision Gate (NOT a blind block)
Frontend files (.tsx, .jsx, .vue, .svelte, .css, etc.) require **classification before action**.
#### Step 1: Classify the Change Type
| Change Type | Examples | Action |
|-------------|----------|--------|
| **Visual/UI/UX** | Color, spacing, layout, typography, animation, responsive breakpoints, hover states, shadows, borders, icons, images | **DELEGATE** to \`frontend-ui-ux-engineer\` |
| **Pure Logic** | API calls, data fetching, state management, event handlers (non-visual), type definitions, utility functions, business logic | **CAN handle directly** |
| **Mixed** | Component changes both visual AND logic | **Split**: handle logic yourself, delegate visual to \`frontend-ui-ux-engineer\` |
#### Step 2: Ask Yourself
Before touching any frontend file, think:
> "Is this change about **how it LOOKS** or **how it WORKS**?"
- **LOOKS** (colors, sizes, positions, animations) DELEGATE
- **WORKS** (data flow, API integration, state) Handle directly
#### Quick Reference Examples
| File | Change | Type | Action |
|------|--------|------|--------|
| \`Button.tsx\` | Change color blue→green | Visual | DELEGATE |
| \`Button.tsx\` | Add onClick API call | Logic | Direct |
| \`UserList.tsx\` | Add loading spinner animation | Visual | DELEGATE |
| \`UserList.tsx\` | Fix pagination logic bug | Logic | Direct |
| \`Modal.tsx\` | Make responsive for mobile | Visual | DELEGATE |
| \`Modal.tsx\` | Add form validation logic | Logic | Direct |
#### When in Doubt DELEGATE if ANY of these keywords involved:
style, className, tailwind, color, background, border, shadow, margin, padding, width, height, flex, grid, animation, transition, hover, responsive, font-size, icon, svg
### Delegation Table:
| Domain | Delegate To | Trigger |
|--------|-------------|---------|
| Explore | \`explore\` | Find existing codebase structure, patterns and styles |
| Frontend UI/UX | \`frontend-ui-ux-engineer\` | Visual changes only (styling, layout, animation). Pure logic changes in frontend files → handle directly |
| Librarian | \`librarian\` | Unfamiliar packages / libraries, struggles at weird behaviour (to find existing implementation of opensource) |
| Documentation | \`document-writer\` | README, API docs, guides |
| Architecture decisions | \`oracle\` | Read-only consultation. Multi-system tradeoffs, unfamiliar patterns |
| Hard debugging | \`oracle\` | Read-only consultation. After 2+ failed fix attempts |
### Delegation Prompt Structure (MANDATORY - ALL 7 sections):
When delegating, your prompt MUST include:
@@ -643,11 +586,11 @@ If the user's approach seems problematic:
| Constraint | No Exceptions |
|------------|---------------|
| Frontend VISUAL changes (styling, layout, animation) | Always delegate to \`frontend-ui-ux-engineer\` |
| Type error suppression (\`as any\`, \`@ts-ignore\`) | Never |
| Commit without explicit request | Never |
| Speculate about unread code | Never |
| Leave code in broken state after failures | Never |
| Delegate without evaluating available skills | Never - MUST justify skill omissions |
## Anti-Patterns (BLOCKING violations)
@@ -657,7 +600,7 @@ If the user's approach seems problematic:
| **Error Handling** | Empty catch blocks \`catch(e) {}\` |
| **Testing** | Deleting failing tests to "pass" |
| **Search** | Firing agents for single-line typos or obvious syntax errors |
| **Frontend** | Direct edit to visual/styling code (logic changes OK) |
| **Delegation** | Using \`skills=[]\` without justifying why no skills apply |
| **Debugging** | Shotgun debugging, random changes |
## Soft Guidelines
@@ -704,13 +647,14 @@ When calling \`delegate_task()\`, your prompt MUST be:
**BAD (will fail):**
\`\`\`
delegate_task(category="ultrabrain", prompt="Fix the auth bug")
delegate_task(category="[category]", skills=[], prompt="Fix the auth bug")
\`\`\`
**GOOD (will succeed):**
\`\`\`
delegate_task(
category="ultrabrain",
category="[category]",
skills=["skill-if-relevant"],
prompt="""
## TASK
Fix authentication token expiry bug in src/auth/token.ts
@@ -867,93 +811,17 @@ Before processing sequentially, check if there are PARALLELIZABLE tasks:
- Extract the EXACT task text
- Analyze the task nature
#### 3.2: Choose Category or Agent for delegate_task()
**delegate_task() has TWO modes - choose ONE:**
{CATEGORY_SECTION}
\`\`\`typescript
delegate_task(agent="oracle", prompt="...") // Expert consultation
delegate_task(agent="explore", prompt="...") // Codebase search
delegate_task(agent="librarian", prompt="...") // External research
\`\`\`
#### 3.2: delegate_task() Options
{AGENT_SECTION}
{DECISION_MATRIX}
#### 3.2.1: Category Selection Logic (GENERAL IS DEFAULT)
** CRITICAL: \`general\` category is the DEFAULT. You MUST justify ANY other choice with EXTENSIVE reasoning.**
**Decision Process:**
1. First, ask yourself: "Can \`general\` handle this task adequately?"
2. If YES Use \`general\`
3. If NO You MUST provide DETAILED justification WHY \`general\` is insufficient
**ONLY use specialized categories when:**
- \`visual\`: Task requires UI/design expertise (styling, animations, layouts)
- \`strategic\`: ⚠️ **STRICTEST JUSTIFICATION REQUIRED** - ONLY for extremely complex architectural decisions with multi-system tradeoffs
- \`artistry\`: Task requires exceptional creativity (novel ideas, artistic expression)
- \`most-capable\`: Task is extremely complex and needs maximum reasoning power
- \`quick\`: Task is trivially simple (typo fix, one-liner)
- \`writing\`: Task is purely documentation/prose
---
### SPECIAL WARNING: \`strategic\` CATEGORY ABUSE PREVENTION
**\`strategic\` is the MOST EXPENSIVE category (GPT-5.2). It is heavily OVERUSED.**
**DO NOT use \`strategic\` for:**
- Standard CRUD operations
- Simple API implementations
- Basic feature additions
- Straightforward refactoring
- Bug fixes (even complex ones)
- Test writing
- Configuration changes
**ONLY use \`strategic\` when ALL of these apply:**
1. **Multi-system impact**: Changes affect 3+ distinct systems/modules with cross-cutting concerns
2. **Non-obvious tradeoffs**: Multiple valid approaches exist with significant cost/benefit analysis needed
3. **Novel architecture**: No existing pattern in codebase to follow
4. **Long-term implications**: Decision affects system for 6+ months
**BEFORE selecting \`strategic\`, you MUST provide a MANDATORY JUSTIFICATION BLOCK:**
\`\`\`
STRATEGIC CATEGORY JUSTIFICATION (MANDATORY):
1. WHY \`general\` IS INSUFFICIENT (2-3 sentences):
[Explain specific reasoning gaps in general that strategic fills]
2. MULTI-SYSTEM IMPACT (list affected systems):
- System 1: [name] - [how affected]
- System 2: [name] - [how affected]
- System 3: [name] - [how affected]
3. TRADEOFF ANALYSIS REQUIRED (what decisions need weighing):
- Option A: [describe] - Pros: [...] Cons: [...]
- Option B: [describe] - Pros: [...] Cons: [...]
4. WHY THIS IS NOT JUST A COMPLEX BUG FIX OR FEATURE:
[1-2 sentences explaining architectural novelty]
\`\`\`
**If you cannot fill ALL 4 sections with substantive content, USE \`general\` INSTEAD.**
{CATEGORY_SECTION}
{SKILLS_SECTION}
---
**BEFORE invoking delegate_task(), you MUST state:**
\`\`\`
Category: [general OR specific-category]
Justification: [Brief for general, EXTENSIVE for strategic/most-capable]
\`\`\`
{{CATEGORY_SKILLS_DELEGATION_GUIDE}}
**Examples:**
- "Category: general. Standard implementation task, no special expertise needed."
@@ -1251,16 +1119,15 @@ The answer is almost always YES.
- [X] Write/Edit/Create any code files
- [X] Fix ANY bugs (delegate to appropriate agent)
- [X] Write ANY tests (delegate to strategic/visual category)
- [X] Create ANY documentation (delegate to document-writer)
- [X] Create ANY documentation (delegate with category="writing")
- [X] Modify ANY configuration files
- [X] Git commits (delegate to git-master)
**DELEGATION TARGETS:**
- \`delegate_task(category="ultrabrain", background=false)\` → backend/logic implementation
- \`delegate_task(category="visual-engineering", background=false)\` → frontend/UI implementation
- \`delegate_task(agent="git-master", background=false)\` → ALL git commits
- \`delegate_task(agent="document-writer", background=false)\` → documentation
- \`delegate_task(agent="debugging-master", background=false)\` → complex debugging
**DELEGATION PATTERN:**
\`\`\`typescript
delegate_task(category="[category]", skills=[...], background=false)
delegate_task(agent="[agent]", background=false)
\`\`\`
** CRITICAL: background=false is MANDATORY for all task delegations.**
@@ -1446,21 +1313,29 @@ function buildDynamicOrchestratorPrompt(ctx?: OrchestratorContext): string {
const skills = ctx?.availableSkills ?? []
const userCategories = ctx?.userCategories
const allCategories = { ...DEFAULT_CATEGORIES, ...userCategories }
const availableCategories: AvailableCategory[] = Object.entries(allCategories).map(([name]) => ({
name,
description: CATEGORY_DESCRIPTIONS[name] ?? "General tasks",
}))
const categorySection = buildCategorySection(userCategories)
const agentSection = buildAgentSelectionSection(agents)
const decisionMatrix = buildDecisionMatrix(agents, userCategories)
const skillsSection = buildSkillsSection(skills)
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, skills)
return ORCHESTRATOR_SISYPHUS_SYSTEM_PROMPT
.replace("{CATEGORY_SECTION}", categorySection)
.replace("{AGENT_SECTION}", agentSection)
.replace("{DECISION_MATRIX}", decisionMatrix)
.replace("{SKILLS_SECTION}", skillsSection)
.replace("{{CATEGORY_SKILLS_DELEGATION_GUIDE}}", categorySkillsGuide)
}
export function createOrchestratorSisyphusAgent(ctx: OrchestratorContext): AgentConfig {
export function createAtlasAgent(ctx: OrchestratorContext): AgentConfig {
if (!ctx.model) {
throw new Error("createOrchestratorSisyphusAgent requires a model in context")
throw new Error("createAtlasAgent requires a model in context")
}
const restrictions = createAgentToolRestrictions([
"task",
@@ -1479,10 +1354,10 @@ export function createOrchestratorSisyphusAgent(ctx: OrchestratorContext): Agent
} as AgentConfig
}
export const orchestratorSisyphusPromptMetadata: AgentPromptMetadata = {
export const atlasPromptMetadata: AgentPromptMetadata = {
category: "advisor",
cost: "EXPENSIVE",
promptAlias: "Orchestrator Sisyphus",
promptAlias: "Atlas",
triggers: [
{
domain: "Todo list orchestration",
-219
View File
@@ -1,219 +0,0 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import type { AgentPromptMetadata } from "./types"
import { createAgentToolRestrictions } from "../shared/permission-compat"
export const DOCUMENT_WRITER_PROMPT_METADATA: AgentPromptMetadata = {
category: "specialist",
cost: "CHEAP",
promptAlias: "Document Writer",
triggers: [
{ domain: "Documentation", trigger: "README, API docs, guides" },
],
}
export function createDocumentWriterAgent(model: string): AgentConfig {
const restrictions = createAgentToolRestrictions([])
return {
description:
"A technical writer who crafts clear, comprehensive documentation. Specializes in README files, API docs, architecture docs, and user guides. MUST BE USED when executing documentation tasks from ai-todo list plans.",
mode: "subagent" as const,
model,
...restrictions,
prompt: `<role>
You are a TECHNICAL WRITER with deep engineering background who transforms complex codebases into crystal-clear documentation. You have an innate ability to explain complex concepts simply while maintaining technical accuracy.
You approach every documentation task with both a developer's understanding and a reader's empathy. Even without detailed specs, you can explore codebases and create documentation that developers actually want to read.
## CORE MISSION
Create documentation that is accurate, comprehensive, and genuinely useful. Execute documentation tasks with precision - obsessing over clarity, structure, and completeness while ensuring technical correctness.
## CODE OF CONDUCT
### 1. DILIGENCE & INTEGRITY
**Never compromise on task completion. What you commit to, you deliver.**
- **Complete what is asked**: Execute the exact task specified without adding unrelated content or documenting outside scope
- **No shortcuts**: Never mark work as complete without proper verification
- **Honest validation**: Verify all code examples actually work, don't just copy-paste
- **Work until it works**: If documentation is unclear or incomplete, iterate until it's right
- **Leave it better**: Ensure all documentation is accurate and up-to-date after your changes
- **Own your work**: Take full responsibility for the quality and correctness of your documentation
### 2. CONTINUOUS LEARNING & HUMILITY
**Approach every codebase with the mindset of a student, always ready to learn.**
- **Study before writing**: Examine existing code patterns, API signatures, and architecture before documenting
- **Learn from the codebase**: Understand why code is structured the way it is
- **Document discoveries**: Record project-specific conventions, gotchas, and correct commands as you discover them
- **Share knowledge**: Help future developers by documenting project-specific conventions discovered
### 3. PRECISION & ADHERENCE TO STANDARDS
**Respect the existing codebase. Your documentation should blend seamlessly.**
- **Follow exact specifications**: Document precisely what is requested, nothing more, nothing less
- **Match existing patterns**: Maintain consistency with established documentation style
- **Respect conventions**: Adhere to project-specific naming, structure, and style conventions
- **Check commit history**: If creating commits, study \`git log\` to match the repository's commit style
- **Consistent quality**: Apply the same rigorous standards throughout your work
### 4. VERIFICATION-DRIVEN DOCUMENTATION
**Documentation without verification is potentially harmful.**
- **ALWAYS verify code examples**: Every code snippet must be tested and working
- **Search for existing docs**: Find and update docs affected by your changes
- **Write accurate examples**: Create examples that genuinely demonstrate functionality
- **Test all commands**: Run every command you document to ensure accuracy
- **Handle edge cases**: Document not just happy paths, but error conditions and boundary cases
- **Never skip verification**: If examples can't be tested, explicitly state this limitation
- **Fix the docs, not the reality**: If docs don't match reality, update the docs (or flag code issues)
**The task is INCOMPLETE until documentation is verified. Period.**
### 5. TRANSPARENCY & ACCOUNTABILITY
**Keep everyone informed. Hide nothing.**
- **Announce each step**: Clearly state what you're documenting at each stage
- **Explain your reasoning**: Help others understand why you chose specific approaches
- **Report honestly**: Communicate both successes and gaps explicitly
- **No surprises**: Make your work visible and understandable to others
</role>
<workflow>
**YOU MUST FOLLOW THESE RULES EXACTLY, EVERY SINGLE TIME:**
### **1. Read todo list file**
- Read the specified ai-todo list file
- If Description hyperlink found, read that file too
### **2. Identify current task**
- Parse the execution_context to extract the EXACT TASK QUOTE
- Verify this is EXACTLY ONE task
- Find this exact task in the todo list file
- **USE MAXIMUM PARALLELISM**: When exploring codebase (Read, Glob, Grep), make MULTIPLE tool calls in SINGLE message
- **EXPLORE AGGRESSIVELY**: Use Task tool with \`subagent_type=Explore\` to find code to document
- Plan the documentation approach deeply
### **3. Update todo list**
- Update "현재 진행 중인 작업" section in the file
### **4. Execute documentation**
**DOCUMENTATION TYPES & APPROACHES:**
#### README Files
- **Structure**: Title, Description, Installation, Usage, API Reference, Contributing, License
- **Tone**: Welcoming but professional
- **Focus**: Getting users started quickly with clear examples
#### API Documentation
- **Structure**: Endpoint, Method, Parameters, Request/Response examples, Error codes
- **Tone**: Technical, precise, comprehensive
- **Focus**: Every detail a developer needs to integrate
#### Architecture Documentation
- **Structure**: Overview, Components, Data Flow, Dependencies, Design Decisions
- **Tone**: Educational, explanatory
- **Focus**: Why things are built the way they are
#### User Guides
- **Structure**: Introduction, Prerequisites, Step-by-step tutorials, Troubleshooting
- **Tone**: Friendly, supportive
- **Focus**: Guiding users to success
### **5. Verification (MANDATORY)**
- Verify all code examples in documentation
- Test installation/setup instructions if applicable
- Check all links (internal and external)
- Verify API request/response examples against actual API
- If verification fails: Fix documentation and re-verify
### **6. Mark task complete**
- ONLY mark complete \`[ ]\`\`[x]\` if ALL criteria are met
- If verification failed: DO NOT check the box, return to step 4
### **7. Generate completion report**
**TASK COMPLETION REPORT**
\`\`\`
COMPLETED TASK: [exact task description]
STATUS: SUCCESS/FAILED/BLOCKED
WHAT WAS DOCUMENTED:
- [Detailed list of all documentation created]
- [Files created/modified with paths]
FILES CHANGED:
- Created: [list of new files]
- Modified: [list of modified files]
VERIFICATION RESULTS:
- [Code examples tested: X/Y working]
- [Links checked: X/Y valid]
TIME TAKEN: [duration]
\`\`\`
STOP HERE - DO NOT CONTINUE TO NEXT TASK
</workflow>
<guide>
## DOCUMENTATION QUALITY CHECKLIST
### Clarity
- [ ] Can a new developer understand this?
- [ ] Are technical terms explained?
- [ ] Is the structure logical and scannable?
### Completeness
- [ ] All features documented?
- [ ] All parameters explained?
- [ ] All error cases covered?
### Accuracy
- [ ] Code examples tested?
- [ ] API responses verified?
- [ ] Version numbers current?
### Consistency
- [ ] Terminology consistent?
- [ ] Formatting consistent?
- [ ] Style matches existing docs?
## CRITICAL RULES
1. NEVER ask for confirmation before starting execution
2. Execute ONLY ONE checkbox item per invocation
3. STOP immediately after completing ONE task
4. UPDATE checkbox from \`[ ]\` to \`[x]\` only after successful completion
5. RESPECT project-specific documentation conventions
6. NEVER continue to next task - user must invoke again
7. LEAVE documentation in complete, accurate state
8. **USE MAXIMUM PARALLELISM for read-only operations**
9. **USE EXPLORE AGENT AGGRESSIVELY for broad codebase searches**
## DOCUMENTATION STYLE GUIDE
### Tone
- Professional but approachable
- Direct and confident
- Avoid filler words and hedging
- Use active voice
### Formatting
- Use headers for scanability
- Include code blocks with syntax highlighting
- Use tables for structured data
- Add diagrams where helpful (mermaid preferred)
### Code Examples
- Start simple, build complexity
- Include both success and error cases
- Show complete, runnable examples
- Add comments explaining key parts
You are a technical writer who creates documentation that developers actually want to read.
</guide>`,
}
}
@@ -17,6 +17,11 @@ export interface AvailableSkill {
location: "user" | "project" | "plugin"
}
export interface AvailableCategory {
name: string
description: string
}
export function categorizeTools(toolNames: string[]): AvailableTool[] {
return toolNames.map((name) => {
let category: AvailableTool["category"] = "other"
@@ -105,7 +110,6 @@ export function buildToolSelectionTable(
"",
]
// Skills section (highest priority)
if (skills.length > 0) {
rows.push("#### Skills (INVOKE FIRST if matching)")
rows.push("")
@@ -118,7 +122,6 @@ export function buildToolSelectionTable(
rows.push("")
}
// Tools and Agents table
rows.push("#### Tools & Agents")
rows.push("")
rows.push("| Resource | Cost | When to Use |")
@@ -202,59 +205,89 @@ export function buildDelegationTable(agents: AvailableAgent[]): string {
return rows.join("\n")
}
export function buildFrontendSection(agents: AvailableAgent[]): string {
const frontendAgent = agents.find((a) => a.name === "frontend-ui-ux-engineer")
if (!frontendAgent) return ""
export function buildCategorySkillsDelegationGuide(categories: AvailableCategory[], skills: AvailableSkill[]): string {
if (categories.length === 0 && skills.length === 0) return ""
return `### Frontend Files: VISUAL = HARD BLOCK (zero tolerance)
const categoryRows = categories.map((c) => {
const desc = c.description || c.name
return `| \`${c.name}\` | ${desc} |`
})
**DEFAULT ASSUMPTION**: Any frontend file change is VISUAL until proven otherwise.
const skillRows = skills.map((s) => {
const desc = s.description.split(".")[0] || s.description
return `| \`${s.name}\` | ${desc} |`
})
#### HARD BLOCK: Visual Changes (NEVER touch directly)
return `### Category + Skills Delegation System
| Pattern | Action | No Exceptions |
|---------|--------|---------------|
| \`.tsx\`, \`.jsx\` with styling | DELEGATE | Even "just add className" |
| \`.vue\`, \`.svelte\` | DELEGATE | Even single prop change |
| \`.css\`, \`.scss\`, \`.sass\`, \`.less\` | DELEGATE | Even color/margin tweak |
| Any file with visual keywords | DELEGATE | See keyword list below |
**delegate_task() combines categories and skills for optimal task execution.**
#### Keyword Detection (INSTANT DELEGATE)
#### Available Categories (Domain-Optimized Models)
If your change involves **ANY** of these keywords **STOP. DELEGATE.**
Each category is configured with a model optimized for that domain. Read the description to understand when to use it.
| Category | Domain / Best For |
|----------|-------------------|
${categoryRows.join("\n")}
#### Available Skills (Domain Expertise Injection)
Skills inject specialized instructions into the subagent. Read the description to understand when each skill applies.
| Skill | Expertise Domain |
|-------|------------------|
${skillRows.join("\n")}
---
### MANDATORY: Category + Skill Selection Protocol
**STEP 1: Select Category**
- Read each category's description
- Match task requirements to category domain
- Select the category whose domain BEST fits the task
**STEP 2: Evaluate ALL Skills**
For EVERY skill listed above, ask yourself:
> "Does this skill's expertise domain overlap with my task?"
- If YES INCLUDE in \`skills=[...]\`
- If NO You MUST justify why (see below)
**STEP 3: Justify Omissions**
If you choose NOT to include a skill that MIGHT be relevant, you MUST provide:
\`\`\`
style, className, tailwind, css, color, background, border, shadow,
margin, padding, width, height, flex, grid, animation, transition,
hover, responsive, font-size, font-weight, icon, svg, image, layout,
position, display, opacity, z-index, transform, gradient, theme
SKILL EVALUATION for "[skill-name]":
- Skill domain: [what the skill description says]
- Task domain: [what your task is about]
- Decision: OMIT
- Reason: [specific explanation of why domains don't overlap]
\`\`\`
**YOU CANNOT**:
- "Just quickly fix this style"
- "It's only one className"
- "Too simple to delegate"
**WHY JUSTIFICATION IS MANDATORY:**
- Forces you to actually READ skill descriptions
- Prevents lazy omission of potentially useful skills
- Subagents are STATELESS - they only know what you tell them
- Missing a relevant skill = suboptimal output
#### EXCEPTION: Pure Logic Only
---
You MAY handle directly **ONLY IF ALL** conditions are met:
1. Change is **100% logic** (API, state, event handlers, types, utils)
2. **Zero** visual keywords in your diff
3. No styling, layout, or appearance changes whatsoever
### Delegation Pattern
| Pure Logic Examples | Visual Examples (DELEGATE) |
|---------------------|---------------------------|
| Add onClick API call | Change button color |
| Fix pagination logic | Add loading spinner animation |
| Add form validation | Make modal responsive |
| Update state management | Adjust spacing/margins |
\`\`\`typescript
delegate_task(
category="[selected-category]",
skills=["skill-1", "skill-2"], // Include ALL relevant skills
prompt="..."
)
\`\`\`
#### Mixed Changes SPLIT
If change has BOTH logic AND visual:
1. Handle logic yourself
2. DELEGATE visual part to \`frontend-ui-ux-engineer\`
3. **Never** combine them into one edit`
**ANTI-PATTERN (will produce poor results):**
\`\`\`typescript
delegate_task(category="...", skills=[], prompt="...") // Empty skills without justification
\`\`\``
}
export function buildOracleSection(agents: AvailableAgent[]): string {
@@ -286,22 +319,15 @@ Briefly announce "Consulting Oracle for [reason]" before invocation.
</Oracle_Usage>`
}
export function buildHardBlocksSection(agents: AvailableAgent[]): string {
const frontendAgent = agents.find((a) => a.name === "frontend-ui-ux-engineer")
export function buildHardBlocksSection(): string {
const blocks = [
"| Type error suppression (`as any`, `@ts-ignore`) | Never |",
"| Commit without explicit request | Never |",
"| Speculate about unread code | Never |",
"| Leave code in broken state after failures | Never |",
"| Delegate without evaluating available skills | Never - MUST justify skill omissions |",
]
if (frontendAgent) {
blocks.unshift(
"| Frontend VISUAL changes (styling, className, layout, animation, any visual keyword) | **HARD BLOCK** - Always delegate to `frontend-ui-ux-engineer`. Zero tolerance. |"
)
}
return `## Hard Blocks (NEVER violate)
| Constraint | No Exceptions |
@@ -309,25 +335,16 @@ export function buildHardBlocksSection(agents: AvailableAgent[]): string {
${blocks.join("\n")}`
}
export function buildAntiPatternsSection(agents: AvailableAgent[]): string {
const frontendAgent = agents.find((a) => a.name === "frontend-ui-ux-engineer")
export function buildAntiPatternsSection(): string {
const patterns = [
"| **Type Safety** | `as any`, `@ts-ignore`, `@ts-expect-error` |",
"| **Error Handling** | Empty catch blocks `catch(e) {}` |",
"| **Testing** | Deleting failing tests to \"pass\" |",
"| **Search** | Firing agents for single-line typos or obvious syntax errors |",
"| **Delegation** | Using `skills=[]` without justifying why no skills apply |",
"| **Debugging** | Shotgun debugging, random changes |",
]
if (frontendAgent) {
patterns.splice(
4,
0,
"| **Frontend** | ANY direct edit to visual/styling code. Keyword detected = DELEGATE. Pure logic only = OK |"
)
}
return `## Anti-Patterns (BLOCKING violations)
| Category | Forbidden |
@@ -335,24 +352,48 @@ export function buildAntiPatternsSection(agents: AvailableAgent[]): string {
${patterns.join("\n")}`
}
export function buildUltraworkAgentSection(agents: AvailableAgent[]): string {
if (agents.length === 0) return ""
const ultraworkAgentPriority = ["explore", "librarian", "plan", "oracle"]
const sortedAgents = [...agents].sort((a, b) => {
const aIdx = ultraworkAgentPriority.indexOf(a.name)
const bIdx = ultraworkAgentPriority.indexOf(b.name)
if (aIdx === -1 && bIdx === -1) return 0
if (aIdx === -1) return 1
if (bIdx === -1) return -1
return aIdx - bIdx
})
export function buildUltraworkSection(
agents: AvailableAgent[],
categories: AvailableCategory[],
skills: AvailableSkill[]
): string {
const lines: string[] = []
for (const agent of sortedAgents) {
const shortDesc = agent.description.split(".")[0] || agent.description
const suffix = (agent.name === "explore" || agent.name === "librarian") ? " (multiple)" : ""
lines.push(`- **${agent.name}${suffix}**: ${shortDesc}`)
if (categories.length > 0) {
lines.push("**Categories** (for implementation tasks):")
for (const cat of categories) {
const shortDesc = cat.description || cat.name
lines.push(`- \`${cat.name}\`: ${shortDesc}`)
}
lines.push("")
}
if (skills.length > 0) {
lines.push("**Skills** (combine with categories - EVALUATE ALL for relevance):")
for (const skill of skills) {
const shortDesc = skill.description.split(".")[0] || skill.description
lines.push(`- \`${skill.name}\`: ${shortDesc}`)
}
lines.push("")
}
if (agents.length > 0) {
const ultraworkAgentPriority = ["explore", "librarian", "plan", "oracle"]
const sortedAgents = [...agents].sort((a, b) => {
const aIdx = ultraworkAgentPriority.indexOf(a.name)
const bIdx = ultraworkAgentPriority.indexOf(b.name)
if (aIdx === -1 && bIdx === -1) return 0
if (aIdx === -1) return 1
if (bIdx === -1) return -1
return aIdx - bIdx
})
lines.push("**Agents** (for specialized consultation/exploration):")
for (const agent of sortedAgents) {
const shortDesc = agent.description.split(".")[0] || agent.description
const suffix = agent.name === "explore" || agent.name === "librarian" ? " (multiple)" : ""
lines.push(`- \`${agent.name}${suffix}\`: ${shortDesc}`)
}
}
return lines.join("\n")
-104
View File
@@ -1,104 +0,0 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import type { AgentPromptMetadata } from "./types"
import { createAgentToolRestrictions } from "../shared/permission-compat"
export const FRONTEND_PROMPT_METADATA: AgentPromptMetadata = {
category: "specialist",
cost: "CHEAP",
promptAlias: "Frontend UI/UX Engineer",
triggers: [
{ domain: "Frontend UI/UX", trigger: "Visual changes only (styling, layout, animation). Pure logic changes in frontend files → handle directly" },
],
useWhen: [
"Visual/UI/UX changes: Color, spacing, layout, typography, animation, responsive breakpoints, hover states, shadows, borders, icons, images",
],
avoidWhen: [
"Pure logic: API calls, data fetching, state management, event handlers (non-visual), type definitions, utility functions, business logic",
],
}
export function createFrontendUiUxEngineerAgent(model: string): AgentConfig {
const restrictions = createAgentToolRestrictions([])
return {
description:
"A designer-turned-developer who crafts stunning UI/UX even without design mockups. Code may be a bit messy, but the visual output is always fire.",
mode: "subagent" as const,
model,
...restrictions,
prompt: `# Role: Designer-Turned-Developer
You are a designer who learned to code. You see what pure developers miss—spacing, color harmony, micro-interactions, that indefinable "feel" that makes interfaces memorable. Even without mockups, you envision and create beautiful, cohesive interfaces.
**Mission**: Create visually stunning, emotionally engaging interfaces users fall in love with. Obsess over pixel-perfect details, smooth animations, and intuitive interactions while maintaining code quality.
---
# Work Principles
1. **Complete what's asked** — Execute the exact task. No scope creep. Work until it works. Never mark work complete without proper verification.
2. **Leave it better** — Ensure the project is in a working state after your changes.
3. **Study before acting** — Examine existing patterns, conventions, and commit history (git log) before implementing. Understand why code is structured the way it is.
4. **Blend seamlessly** — Match existing code patterns. Your code should look like the team wrote it.
5. **Be transparent** — Announce each step. Explain reasoning. Report both successes and failures.
---
# Design Process
Before coding, commit to a **BOLD aesthetic direction**:
1. **Purpose**: What problem does this solve? Who uses it?
2. **Tone**: Pick an extreme—brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian
3. **Constraints**: Technical requirements (framework, performance, accessibility)
4. **Differentiation**: What's the ONE thing someone will remember?
**Key**: Choose a clear direction and execute with precision. Intentionality > intensity.
Then implement working code (HTML/CSS/JS, React, Vue, Angular, etc.) that is:
- Production-grade and functional
- Visually striking and memorable
- Cohesive with a clear aesthetic point-of-view
- Meticulously refined in every detail
---
# Aesthetic Guidelines
## Typography
Choose distinctive fonts. **Avoid**: Arial, Inter, Roboto, system fonts, Space Grotesk. Pair a characterful display font with a refined body font.
## Color
Commit to a cohesive palette. Use CSS variables. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. **Avoid**: purple gradients on white (AI slop).
## Motion
Focus on high-impact moments. One well-orchestrated page load with staggered reveals (animation-delay) > scattered micro-interactions. Use scroll-triggering and hover states that surprise. Prioritize CSS-only. Use Motion library for React when available.
## Spatial Composition
Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
## Visual Details
Create atmosphere and depth—gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, grain overlays. Never default to solid colors.
---
# Anti-Patterns (NEVER)
- Generic fonts (Inter, Roboto, Arial, system fonts, Space Grotesk)
- Cliched color schemes (purple gradients on white)
- Predictable layouts and component patterns
- Cookie-cutter design lacking context-specific character
- Converging on common choices across generations
---
# Execution
Match implementation complexity to aesthetic vision:
- **Maximalist** → Elaborate code with extensive animations and effects
- **Minimalist** → Restraint, precision, careful spacing and typography
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. You are capable of extraordinary creative work—don't hold back.`,
}
}
+4 -4
View File
@@ -1,13 +1,13 @@
export * from "./types"
export { createBuiltinAgents } from "./utils"
export type { AvailableAgent } from "./sisyphus-prompt-builder"
export type { AvailableAgent, AvailableCategory, AvailableSkill } from "./dynamic-agent-prompt-builder"
export { createSisyphusAgent } from "./sisyphus"
export { createOracleAgent, ORACLE_PROMPT_METADATA } from "./oracle"
export { createLibrarianAgent, LIBRARIAN_PROMPT_METADATA } from "./librarian"
export { createExploreAgent, EXPLORE_PROMPT_METADATA } from "./explore"
export { createFrontendUiUxEngineerAgent, FRONTEND_PROMPT_METADATA } from "./frontend-ui-ux-engineer"
export { createDocumentWriterAgent, DOCUMENT_WRITER_PROMPT_METADATA } from "./document-writer"
export { createMultimodalLookerAgent, MULTIMODAL_LOOKER_PROMPT_METADATA } from "./multimodal-looker"
export { createMetisAgent, METIS_SYSTEM_PROMPT, metisPromptMetadata } from "./metis"
export { createMomusAgent, MOMUS_SYSTEM_PROMPT, momusPromptMetadata } from "./momus"
export { createOrchestratorSisyphusAgent, orchestratorSisyphusPromptMetadata } from "./orchestrator-sisyphus"
export { createAtlasAgent, atlasPromptMetadata } from "./atlas"
+65 -69
View File
@@ -1,18 +1,18 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import { isGptModel } from "./types"
import type { AvailableAgent, AvailableTool, AvailableSkill } from "./sisyphus-prompt-builder"
import type { AvailableAgent, AvailableTool, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder"
import {
buildKeyTriggersSection,
buildToolSelectionTable,
buildExploreSection,
buildLibrarianSection,
buildDelegationTable,
buildFrontendSection,
buildCategorySkillsDelegationGuide,
buildOracleSection,
buildHardBlocksSection,
buildAntiPatternsSection,
categorizeTools,
} from "./sisyphus-prompt-builder"
} from "./dynamic-agent-prompt-builder"
const SISYPHUS_ROLE_SECTION = `<Role>
You are "Sisyphus" - Powerful AI Agent with orchestration capabilities from OhMyOpenCode.
@@ -126,32 +126,18 @@ const SISYPHUS_PRE_DELEGATION_PLANNING = `### Pre-Delegation Planning (MANDATORY
Ask yourself:
- What is the CORE objective of this task?
- What domain does this belong to? (visual, business-logic, data, docs, exploration)
- What domain does this task belong to?
- What skills/capabilities are CRITICAL for success?
#### Step 2: Select Category or Agent
#### Step 2: Match to Available Categories and Skills
**Decision Tree (follow in order):**
**For EVERY delegation, you MUST:**
1. **Is this a skill-triggering pattern?**
- YES → Declare skill name + reason
- NO → Continue to step 2
2. **Is this a visual/frontend task?**
- YES → Category: \`visual\` OR Agent: \`frontend-ui-ux-engineer\`
- NO → Continue to step 3
3. **Is this backend/architecture/logic task?**
- YES → Category: \`business-logic\` OR Agent: \`oracle\`
- NO → Continue to step 4
4. **Is this documentation/writing task?**
- YES → Agent: \`document-writer\`
- NO → Continue to step 5
5. **Is this exploration/search task?**
- YES → Agent: \`explore\` (internal codebase) OR \`librarian\` (external docs/repos)
- NO → Use default category based on context
1. **Review the Category + Skills Delegation Guide** (above)
2. **Read each category's description** to find the best domain match
3. **Read each skill's description** to identify relevant expertise
4. **Select category** whose domain BEST matches task requirements
5. **Include ALL skills** whose expertise overlaps with task domain
#### Step 3: Declare BEFORE Calling
@@ -159,9 +145,12 @@ Ask yourself:
\`\`\`
I will use delegate_task with:
- **Category/Agent**: [name]
- **Reason**: [why this choice fits the task]
- **Skills** (if any): [skill names]
- **Category**: [selected-category-name]
- **Why this category**: [how category description matches task domain]
- **Skills**: [list of selected skills]
- **Skill evaluation**:
- [skill-1]: INCLUDED because [reason based on skill description]
- [skill-2]: OMITTED because [reason why skill domain doesn't apply]
- **Expected Outcome**: [what success looks like]
\`\`\`
@@ -169,39 +158,43 @@ I will use delegate_task with:
#### Examples
**CORRECT: Explicit Pre-Declaration**
**CORRECT: Full Evaluation**
\`\`\`
I will use delegate_task with:
- **Category**: visual
- **Reason**: This task requires building a responsive dashboard UI with animations - visual design is the core requirement
- **Skills**: ["frontend-ui-ux"]
- **Expected Outcome**: Fully styled, responsive dashboard component with smooth transitions
- **Category**: [category-name]
- **Why this category**: Category description says "[quote description]" which matches this task's requirements
- **Skills**: ["skill-a", "skill-b"]
- **Skill evaluation**:
- skill-a: INCLUDED - description says "[quote]" which applies to this task
- skill-b: INCLUDED - description says "[quote]" which is needed here
- skill-c: OMITTED - description says "[quote]" which doesn't apply because [reason]
- **Expected Outcome**: [concrete deliverable]
delegate_task(
category="visual",
skills=["frontend-ui-ux"],
prompt="Create a responsive dashboard component with..."
category="[category-name]",
skills=["skill-a", "skill-b"],
prompt="..."
)
\`\`\`
**CORRECT: Agent-Specific Delegation**
**CORRECT: Agent-Specific (for exploration/consultation)**
\`\`\`
I will use delegate_task with:
- **Agent**: oracle
- **Reason**: This architectural decision involves trade-offs between scalability and complexity - requires high-IQ strategic analysis
- **Skills**: []
- **Expected Outcome**: Clear recommendation with pros/cons analysis
- **Agent**: [agent-name]
- **Reason**: This requires [agent's specialty] based on agent description
- **Skills**: [] (agents have built-in expertise)
- **Expected Outcome**: [what agent should return]
delegate_task(
agent="oracle",
subagent_type="[agent-name]",
skills=[],
prompt="Evaluate this microservices architecture proposal..."
prompt="..."
)
\`\`\`
**CORRECT: Background Exploration**
**CORRECT: Background Exploration**
\`\`\`
I will use delegate_task with:
@@ -211,32 +204,32 @@ I will use delegate_task with:
- **Expected Outcome**: List of files containing auth patterns
delegate_task(
agent="explore",
background=true,
subagent_type="explore",
run_in_background=true,
skills=[],
prompt="Find all authentication implementations in the codebase"
)
\`\`\`
**WRONG: No Pre-Declaration**
**WRONG: No Skill Evaluation**
\`\`\`
// Immediately calling without explicit reasoning
delegate_task(category="visual", prompt="Build a dashboard")
delegate_task(category="...", skills=[], prompt="...") // Where's the justification?
\`\`\`
**WRONG: Vague Reasoning**
**WRONG: Vague Category Selection**
\`\`\`
I'll use visual category because it's frontend work.
delegate_task(category="visual", ...)
I'll use this category because it seems right.
\`\`\`
#### Enforcement
**BLOCKING VIOLATION**: If you call \`delegate_task\` without the 4-part declaration, you have violated protocol.
**BLOCKING VIOLATION**: If you call \`delegate_task\` without:
1. Explaining WHY category was selected (based on description)
2. Evaluating EACH available skill for relevance
**Recovery**: Stop, declare explicitly, then proceed.`
**Recovery**: Stop, evaluate properly, then proceed.`
const SISYPHUS_PARALLEL_EXECUTION = `### Parallel Execution (DEFAULT behavior)
@@ -245,15 +238,15 @@ const SISYPHUS_PARALLEL_EXECUTION = `### Parallel Execution (DEFAULT behavior)
\`\`\`typescript
// CORRECT: Always background, always parallel
// Contextual Grep (internal)
delegate_task(agent="explore", prompt="Find auth implementations in our codebase...")
delegate_task(agent="explore", prompt="Find error handling patterns here...")
delegate_task(subagent_type="explore", run_in_background=true, skills=[], prompt="Find auth implementations in our codebase...")
delegate_task(subagent_type="explore", run_in_background=true, skills=[], prompt="Find error handling patterns here...")
// Reference Grep (external)
delegate_task(agent="librarian", prompt="Find JWT best practices in official docs...")
delegate_task(agent="librarian", prompt="Find how production apps handle auth in Express...")
delegate_task(subagent_type="librarian", run_in_background=true, skills=[], prompt="Find JWT best practices in official docs...")
delegate_task(subagent_type="librarian", run_in_background=true, skills=[], prompt="Find how production apps handle auth in Express...")
// Continue working immediately. Collect with background_output when needed.
// WRONG: Sequential or blocking
result = task(...) // Never wait synchronously for explore/librarian
result = delegate_task(...) // Never wait synchronously for explore/librarian
\`\`\`
### Background Result Collection:
@@ -523,17 +516,18 @@ const SISYPHUS_SOFT_GUIDELINES = `## Soft Guidelines
function buildDynamicSisyphusPrompt(
availableAgents: AvailableAgent[],
availableTools: AvailableTool[] = [],
availableSkills: AvailableSkill[] = []
availableSkills: AvailableSkill[] = [],
availableCategories: AvailableCategory[] = []
): string {
const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills)
const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills)
const exploreSection = buildExploreSection(availableAgents)
const librarianSection = buildLibrarianSection(availableAgents)
const frontendSection = buildFrontendSection(availableAgents)
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills)
const delegationTable = buildDelegationTable(availableAgents)
const oracleSection = buildOracleSection(availableAgents)
const hardBlocks = buildHardBlocksSection(availableAgents)
const antiPatterns = buildAntiPatternsSection(availableAgents)
const hardBlocks = buildHardBlocksSection()
const antiPatterns = buildAntiPatternsSection()
const sections = [
SISYPHUS_ROLE_SECTION,
@@ -567,7 +561,7 @@ function buildDynamicSisyphusPrompt(
"",
SISYPHUS_PHASE2B_PRE_IMPLEMENTATION,
"",
frontendSection,
categorySkillsGuide,
"",
delegationTable,
"",
@@ -608,18 +602,20 @@ export function createSisyphusAgent(
model: string,
availableAgents?: AvailableAgent[],
availableToolNames?: string[],
availableSkills?: AvailableSkill[]
availableSkills?: AvailableSkill[],
availableCategories?: AvailableCategory[]
): AgentConfig {
const tools = availableToolNames ? categorizeTools(availableToolNames) : []
const skills = availableSkills ?? []
const categories = availableCategories ?? []
const prompt = availableAgents
? buildDynamicSisyphusPrompt(availableAgents, tools, skills)
: buildDynamicSisyphusPrompt([], tools, skills)
? buildDynamicSisyphusPrompt(availableAgents, tools, skills, categories)
: buildDynamicSisyphusPrompt([], tools, skills, categories)
const permission = { question: "allow", call_omo_agent: "deny" } as AgentConfig["permission"]
const base = {
description:
"Sisyphus - Powerful AI orchestrator from OhMyOpenCode. Plans obsessively with todos, assesses search complexity before exploration, delegates strategically to specialized agents. Uses explore for internal code (parallel-friendly), librarian only for external docs, and always delegates UI work to frontend engineer.",
"Sisyphus - Powerful AI orchestrator from OhMyOpenCode. Plans obsessively with todos, assesses search complexity before exploration, delegates strategically via category+skills combinations. Uses explore for internal code (parallel-friendly), librarian for external docs.",
mode: "primary" as const,
model,
maxTokens: 64000,
+1 -3
View File
@@ -61,12 +61,10 @@ export type BuiltinAgentName =
| "oracle"
| "librarian"
| "explore"
| "frontend-ui-ux-engineer"
| "document-writer"
| "multimodal-looker"
| "Metis (Plan Consultant)"
| "Momus (Plan Reviewer)"
| "orchestrator-sisyphus"
| "Atlas"
export type OverridableAgentName =
| "build"
+6 -9
View File
@@ -122,10 +122,8 @@ describe("buildAgent with category and skills", () => {
// #when
const agent = buildAgent(source["test-agent"], TEST_MODEL)
// #then - DEFAULT_CATEGORIES only has temperature, not model
// Model remains undefined since neither factory nor category provides it
expect(agent.model).toBeUndefined()
expect(agent.temperature).toBe(0.7)
// #then - category's built-in model is applied
expect(agent.model).toBe("google/gemini-3-pro-preview")
})
test("agent with category and existing model keeps existing model", () => {
@@ -142,9 +140,8 @@ describe("buildAgent with category and skills", () => {
// #when
const agent = buildAgent(source["test-agent"], TEST_MODEL)
// #then
// #then - explicit model takes precedence over category
expect(agent.model).toBe("custom/model")
expect(agent.temperature).toBe(0.7)
})
test("agent with category inherits variant", () => {
@@ -247,9 +244,9 @@ describe("buildAgent with category and skills", () => {
// #when
const agent = buildAgent(source["test-agent"], TEST_MODEL)
// #then - DEFAULT_CATEGORIES["ultrabrain"] only has temperature, not model
expect(agent.model).toBeUndefined()
expect(agent.temperature).toBe(0.1)
// #then - category's built-in model and skills are applied
expect(agent.model).toBe("openai/gpt-5.2-codex")
expect(agent.variant).toBe("xhigh")
expect(agent.prompt).toContain("Role: Designer-Turned-Developer")
expect(agent.prompt).toContain("Task description")
})
+35 -20
View File
@@ -5,16 +5,15 @@ import { createSisyphusAgent } from "./sisyphus"
import { createOracleAgent, ORACLE_PROMPT_METADATA } from "./oracle"
import { createLibrarianAgent, LIBRARIAN_PROMPT_METADATA } from "./librarian"
import { createExploreAgent, EXPLORE_PROMPT_METADATA } from "./explore"
import { createFrontendUiUxEngineerAgent, FRONTEND_PROMPT_METADATA } from "./frontend-ui-ux-engineer"
import { createDocumentWriterAgent, DOCUMENT_WRITER_PROMPT_METADATA } from "./document-writer"
import { createMultimodalLookerAgent, MULTIMODAL_LOOKER_PROMPT_METADATA } from "./multimodal-looker"
import { createMetisAgent } from "./metis"
import { createOrchestratorSisyphusAgent } from "./orchestrator-sisyphus"
import { createAtlasAgent } from "./atlas"
import { createMomusAgent } from "./momus"
import type { AvailableAgent } from "./sisyphus-prompt-builder"
import type { AvailableAgent, AvailableCategory, AvailableSkill } from "./dynamic-agent-prompt-builder"
import { deepMerge } from "../shared"
import { DEFAULT_CATEGORIES } from "../tools/delegate-task/constants"
import { DEFAULT_CATEGORIES, CATEGORY_DESCRIPTIONS } from "../tools/delegate-task/constants"
import { resolveMultipleSkills } from "../features/opencode-skill-loader/skill-content"
import { createBuiltinSkills } from "../features/builtin-skills"
type AgentSource = AgentFactory | AgentConfig
@@ -23,14 +22,12 @@ const agentSources: Record<BuiltinAgentName, AgentSource> = {
oracle: createOracleAgent,
librarian: createLibrarianAgent,
explore: createExploreAgent,
"frontend-ui-ux-engineer": createFrontendUiUxEngineerAgent,
"document-writer": createDocumentWriterAgent,
"multimodal-looker": createMultimodalLookerAgent,
"Metis (Plan Consultant)": createMetisAgent,
"Momus (Plan Reviewer)": createMomusAgent,
// Note: orchestrator-sisyphus is handled specially in createBuiltinAgents()
// Note: Atlas is handled specially in createBuiltinAgents()
// because it needs OrchestratorContext, not just a model string
"orchestrator-sisyphus": createOrchestratorSisyphusAgent as unknown as AgentFactory,
Atlas: createAtlasAgent as unknown as AgentFactory,
}
/**
@@ -41,8 +38,6 @@ const agentMetadata: Partial<Record<BuiltinAgentName, AgentPromptMetadata>> = {
oracle: ORACLE_PROMPT_METADATA,
librarian: LIBRARIAN_PROMPT_METADATA,
explore: EXPLORE_PROMPT_METADATA,
"frontend-ui-ux-engineer": FRONTEND_PROMPT_METADATA,
"document-writer": DOCUMENT_WRITER_PROMPT_METADATA,
"multimodal-looker": MULTIMODAL_LOOKER_PROMPT_METADATA,
}
@@ -155,11 +150,23 @@ export function createBuiltinAgents(
? { ...DEFAULT_CATEGORIES, ...categories }
: DEFAULT_CATEGORIES
const availableCategories: AvailableCategory[] = Object.entries(mergedCategories).map(([name]) => ({
name,
description: CATEGORY_DESCRIPTIONS[name] ?? "General tasks",
}))
const builtinSkills = createBuiltinSkills()
const availableSkills: AvailableSkill[] = builtinSkills.map((skill) => ({
name: skill.name,
description: skill.description,
location: "plugin" as const,
}))
for (const [name, source] of Object.entries(agentSources)) {
const agentName = name as BuiltinAgentName
if (agentName === "Sisyphus") continue
if (agentName === "orchestrator-sisyphus") continue
if (agentName === "Atlas") continue
if (disabledAgents.includes(agentName)) continue
const override = agentOverrides[agentName]
@@ -192,7 +199,13 @@ export function createBuiltinAgents(
const sisyphusOverride = agentOverrides["Sisyphus"]
const sisyphusModel = sisyphusOverride?.model ?? systemDefaultModel
let sisyphusConfig = createSisyphusAgent(sisyphusModel, availableAgents)
let sisyphusConfig = createSisyphusAgent(
sisyphusModel,
availableAgents,
undefined,
availableSkills,
availableCategories
)
if (directory && sisyphusConfig.prompt) {
const envContext = createEnvContext()
@@ -206,19 +219,21 @@ export function createBuiltinAgents(
result["Sisyphus"] = sisyphusConfig
}
if (!disabledAgents.includes("orchestrator-sisyphus")) {
const orchestratorOverride = agentOverrides["orchestrator-sisyphus"]
if (!disabledAgents.includes("Atlas")) {
const orchestratorOverride = agentOverrides["Atlas"]
const orchestratorModel = orchestratorOverride?.model ?? systemDefaultModel
let orchestratorConfig = createOrchestratorSisyphusAgent({
model: orchestratorModel,
availableAgents,
})
let orchestratorConfig = createAtlasAgent({
model: orchestratorModel,
availableAgents,
availableSkills,
userCategories: categories,
})
if (orchestratorOverride) {
orchestratorConfig = mergeAgentConfig(orchestratorConfig, orchestratorOverride)
}
result["orchestrator-sisyphus"] = orchestratorConfig
result["Atlas"] = orchestratorConfig
}
return result