Task Delegation
Relevant source files
The following files were used as context for generating this wiki page:
Task Delegation is a core architectural pattern in OhMyOpenCode where a primary orchestrator (such as Atlas or Sisyphus) offloads specific implementation, research, or specialized tasks to subagents. This system enables complex multi-step workflows by leveraging domain-optimized models and specialized "skills" rather than attempting to solve every problem within a single agent context.
The system is designed to be highly structured, requiring orchestrators to categorize tasks, evaluate necessary expertise, and provide exhaustive prompts to ensure high-quality, verifiable outputs from stateless subagents.
Sources: src/agents/atlas/gpt.ts:16-19, src/agents/sisyphus.ts:133-145, sisyphus-prompt.md:24-30
Delegation Architecture
The delegation system follows a hierarchical model where a "Conductor" (Atlas) or "Orchestrator" (Sisyphus) manages the lifecycle of a task through the delegate_task() API. This API allows for the selection of either a specialized agent type or a category combined with specific skills.
Orchestration Flow
The orchestration logic involves analyzing a work plan, initializing persistent state via a "Notepad" system, and dispatching tasks either sequentially or in parallel based on dependencies.
The diagram shows the lifecycle of task delegation from plan analysis through project-level verification and failure recovery.
Sources: src/agents/atlas/gpt.ts:98-150, src/agents/atlas/default.ts:100-145
Delegation API and Parameters
The primary interface for delegating work is the delegate_task() function. It supports two mutually exclusive modes: Category-based (using domain-optimized models) and Agent-based (using specialized expert agents).
Parameters Table
| Parameter | Type | Description |
|---|---|---|
category | string | Domain name (e.g., visual-engineering, ultrabrain). Mutually exclusive with subagent_type. |
subagent_type | string | Specialized agent name (e.g., explore, librarian). |
load_skills | string[] | Array of expert instructions to inject into the subagent. |
run_in_background | boolean | If true, executes asynchronously. Typically used for exploration. |
prompt | string | The 6-section mandatory instruction block for the task. |
session_id | string | Used to resume a previous agent session for retries or follow-ups. |
Sources: src/agents/atlas/gpt.ts:74-84, src/agents/atlas/default.ts:40-54, src/agents/sisyphus.ts:241-260
Category and Skill System
Delegation is optimized by matching tasks to specific categories (which determine the underlying LLM) and skills (which inject specialized domain instructions).
Available Categories
Categories represent domain-optimized configurations. For example, quick uses lower-tier, faster models like Claude Haiku, while unspecified-high uses top-tier models like Claude Opus.
| Category | Best For | Model Configuration |
|---|---|---|
visual-engineering | Frontend, UI/UX, animations | google/gemini-3-pro |
ultrabrain | Deep logic, architecture | openai/gpt-5.2-codex |
quick | Trivial single-file changes | anthropic/claude-haiku-4-5 |
writing | Documentation, prose | google/gemini-3-flash |
Sources: src/tools/delegate-task/constants.ts:141-150, sisyphus-prompt.md:383-393
Specialized Skills
Skills are expert domains that can be "loaded" into an agent. Common skills include:
playwright: Mandatory for browser-related tasks.frontend-ui-ux: For crafting UI/UX without mockups.git-master: For complex git operations like rebasing or squashing.
Sources: sisyphus-prompt.md:401-405, src/agents/sisyphus.ts:192-197
Mandatory Prompt Structure
Every delegation must include an exhaustive 6-section (or 7-section in some configurations) prompt. Prompts under 30 lines are considered insufficient for stateless subagents.
- TASK: An obsessively specific, atomic goal quoted from the work plan.
- EXPECTED OUTCOME: Concrete deliverables including file paths and verification commands.
- REQUIRED TOOLS: An explicit whitelist of tools (e.g.,
ast-grep,lsp_diagnostics). - MUST DO: Specific implementation requirements and reference file patterns.
- MUST NOT DO: Forbidden actions, such as modifying files out of scope or adding dependencies.
- CONTEXT: Inherited wisdom from the project "Notepad" and dependency information.
Sources: src/agents/atlas/gpt.ts:88-112, src/agents/atlas/default.ts:56-80, sisyphus-prompt.md:465-475
Parallel and Background Execution
The system distinguishes between Exploration and Execution. Exploration tasks (finding files, searching docs) are executed in the background to maximize throughput, while implementation tasks are typically sequential or managed in waves.
The sequence diagram illustrates how exploration agents run asynchronously while the orchestrator prepares or executes implementation tasks.
Sources: src/agents/atlas/gpt.ts:182-196, sisyphus-prompt.md:329-346
Verification and Failure Recovery
Delegation is not considered complete until the orchestrator verifies the subagent's work using local tools.
QA Protocol
The orchestrator must run a 4-step project-level verification after every delegation:
- LSP Diagnostics: Must return zero errors at the project level.
- Build Check:
bun run buildmust have exit code 0. - Test Suite:
bun testmust pass all relevant tests. - Manual Read: The orchestrator reads the modified files to ensure requirements were met.
Sources: src/agents/atlas/gpt.ts:162-171, src/agents/atlas/default.ts:147-167
Session Continuity
If a task fails or verification reveals errors, the orchestrator MUST use the session_id to resume the task. This preserves the subagent's state, preventing redundant file reads and saving up to 70% in token costs.
Sources: src/agents/atlas/default.ts:173-195, src/agents/sisyphus.ts:312-325
Summary
Task Delegation in this project is a disciplined orchestration framework that treats AI agents as stateless specialists. By enforcing strict categorization, mandatory multi-section prompting, and rigorous project-level verification, the system ensures that complex software engineering tasks are decomposed and executed with high precision and maintainable state across different model tiers.