How oh-my-claudecode orchestrates multi-agent workflows.
oh-my-claudecode enables Claude Code to orchestrate specialized agents through a skill-based routing system. It is built on four interlocking systems: Hooks detect lifecycle events, Skills inject behaviors, Agents execute specialized work, and State tracks progress across context resets.
┌─────────────────────────────────────────────────────────────────────────┐
│ OH-MY-CLAUDECODE │
│ Intelligent Skill Activation │
└─────────────────────────────────────────────────────────────────────────┘
User Input Skill Detection Execution
────────── ─────────────── ─────────
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ "ultrawork │ │ CLAUDE.md │ │ SKILL ACTIVATED │
│ refactor │─────────────▶│ Auto-Routing │──────────▶│ │
│ the API" │ │ │ │ ultrawork + │
└─────────────┘ │ Task Type: │ │ default + │
│ - Implementation│ │ git-master │
│ - Multi-file │ │ │
│ - Parallel OK │ │ ┌─────────────┐ │
│ │ │ │ Parallel │ │
│ Skills: │ │ │ agents │ │
│ - ultrawork ✓ │ │ │ launched │ │
│ - default ✓ │ │ └─────────────┘ │
│ - git-master ✓ │ │ │
└──────────────────┘ │ ┌─────────────┐ │
│ │ Atomic │ │
│ │ commits │ │
│ └─────────────┘ │
└─────────────────┘
The four systems flow in sequence:
User Input --> Hooks (event detection) --> Skills (behavior injection)
--> Agents (task execution) --> State (progress tracking)
OMC provides 19 specialized agents organized into 4 lanes. Each agent is invoked as oh-my-claudecode:<agent-name> and runs on the appropriate model tier.
Covers the full development lifecycle from exploration to verification.
| Agent | Default Model | Role |
|---|---|---|
explore |
haiku | Codebase discovery, file/symbol mapping |
analyst |
opus | Requirements analysis, hidden constraint discovery |
planner |
opus | Task sequencing, execution plan creation |
architect |
opus | System design, interface definition, trade-off analysis |
debugger |
sonnet | Root-cause analysis, build error resolution |
executor |
sonnet | Code implementation, refactoring |
verifier |
sonnet | Completion verification, test adequacy confirmation |
tracer |
sonnet | Evidence-driven causal tracing, competing hypothesis analysis |
Quality gates before handoff. Catches correctness and security issues.
| Agent | Default Model | Role |
|---|---|---|
security-reviewer |
sonnet | Security vulnerabilities, trust boundaries, authn/authz review |
code-reviewer |
opus | Comprehensive code review, API contracts, backward compatibility |
Domain experts called in when needed.
| Agent | Default Model | Role |
|---|---|---|
test-engineer |
sonnet | Test strategy, coverage, flaky-test hardening |
designer |
sonnet | UI/UX architecture, interaction design |
writer |
haiku | Documentation, migration notes |
qa-tester |
sonnet | Interactive CLI/service runtime validation via tmux |
scientist |
sonnet | Data analysis, statistical research |
git-master |
sonnet | Git operations, commits, rebase, history management |
document-specialist |
sonnet | External documentation, API/SDK reference lookup |
code-simplifier |
opus | Code clarity, simplification, maintainability improvement |
Challenges plans and designs made by other agents. A plan passes only when no gaps can be found.
| Agent | Default Model | Role |
|---|---|---|
critic |
opus | Gap analysis of plans and designs, multi-angle review |
OMC uses three model tiers:
| Tier | Model | Characteristics | Cost |
|---|---|---|---|
| LOW | haiku | Fast and inexpensive | Low |
| MEDIUM | sonnet | Balanced performance and cost | Medium |
| HIGH | opus | Highest-quality reasoning | High |
Default assignments by role:
- haiku: Fast lookups and simple tasks (
explore,writer) - sonnet: Code implementation, debugging, testing (
executor,debugger,test-engineer) - opus: Architecture, strategic analysis, review (
architect,planner,critic,code-reviewer)
Work is delegated through the Task tool with intelligent model routing:
Task(
subagent_type="oh-my-claudecode:executor",
model="sonnet",
prompt="Implement feature..."
)Delegate to agents when:
- Multiple files need to change
- Refactoring is required
- Debugging or root-cause analysis is needed
- Code review or security review is needed
- Planning or research is required
Handle directly when:
- Simple file lookups
- Straightforward question answering
- Single-command operations
| Task Type | Recommended Agent | Model |
|---|---|---|
| Quick code lookup | explore |
haiku |
| Feature implementation | executor |
sonnet |
| Complex refactoring | executor (model=opus) |
opus |
| Simple bug fix | debugger |
sonnet |
| Complex debugging | architect |
opus |
| UI component | designer |
sonnet |
| Documentation | writer |
haiku |
| Test strategy | test-engineer |
sonnet |
| Security review | security-reviewer |
sonnet |
| Code review | code-reviewer |
opus |
| Data analysis | scientist |
sonnet |
explore --> analyst --> planner --> critic --> executor --> verifier
(discover) (analyze) (sequence) (review) (implement) (confirm)
| Agent | Does | Does Not |
|---|---|---|
architect |
Code analysis, debugging, verification | Requirements gathering, planning |
analyst |
Find requirements gaps | Code analysis, planning |
planner |
Create task plans | Requirements analysis, plan review |
critic |
Review plan quality | Requirements analysis, code analysis |
Skills are behavior injections that modify how the orchestrator operates. Instead of swapping agents, skills add capabilities on top of existing agents. OMC provides 31 skills total (28 user-invocable + 3 internal/pipeline).
Skills compose in three layers:
┌─────────────────────────────────────────────────────────────┐
│ GUARANTEE LAYER (optional) │
│ ralph: "Cannot stop until verified done" │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ ENHANCEMENT LAYER (0-N skills) │
│ ultrawork (parallel) | git-master (commits) | frontend-ui-ux│
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ EXECUTION LAYER (primary skill) │
│ default (build) | orchestrate (coordinate) | planner (plan) │
└─────────────────────────────────────────────────────────────┘
Formula: [Execution Skill] + [0-N Enhancements] + [Optional Guarantee]
Example:
Task: "ultrawork: refactor API with proper commits"
Active skills: ultrawork + default + git-master
Slash commands:
/oh-my-claudecode:autopilot build me a todo app
/oh-my-claudecode:ralph refactor the auth module
/oh-my-claudecode:team 3:executor "implement fullstack app"Magic keywords — include a keyword in natural language and the skill activates automatically:
autopilot build me a todo app # activates autopilot
ralph: refactor the auth module # activates ralph
ultrawork implement OAuth # activates ultraworkFull autonomous 5-stage pipeline from idea to working code.
- Trigger:
autopilot,build me,I want a
autopilot build me a REST API with authenticationRepeating loop that does not stop until work is verified complete. The verifier agent confirms completion before the loop exits.
- Trigger:
ralph,don't stop,must complete
ralph: refactor the authentication moduleMaximum parallelism — launches multiple agents simultaneously.
- Trigger:
ultrawork,ulw
ultrawork implement user authentication with OAuthCoordinates N Claude agents with a 5-stage pipeline: plan → prd → exec → verify → fix
/oh-my-claudecode:team 3:executor "implement fullstack todo app"Fans out to Codex and Gemini simultaneously; Claude synthesizes the results.
- Trigger:
ccg,claude-codex-gemini
ccg: review this authentication implementationIterative planning: Planner, Architect, and Critic loop until they reach consensus.
- Trigger:
ralplan
ralplan this feature| Skill | Description | Command |
|---|---|---|
cancel |
Cancel active execution mode | /oh-my-claudecode:cancel |
hud |
Status bar configuration | /oh-my-claudecode:hud |
omc-setup |
Initial setup wizard | /oh-my-claudecode:omc-setup |
omc-doctor |
Diagnose installation | /oh-my-claudecode:omc-doctor |
learner |
Extract reusable skills from session | /oh-my-claudecode:learner |
skill |
Manage local skills (list/add/remove) | /oh-my-claudecode:skill |
trace |
Evidence-driven causal tracing | /oh-my-claudecode:trace |
release |
Automated release workflow | /oh-my-claudecode:release |
deepinit |
Generate hierarchical AGENTS.md | /oh-my-claudecode:deepinit |
deep-interview |
Socratic deep interview | /oh-my-claudecode:deep-interview |
sciomc |
Parallel scientist agent orchestration | /oh-my-claudecode:sciomc |
external-context |
Parallel document-specialist research | /oh-my-claudecode:external-context |
ai-slop-cleaner |
Clean AI expression patterns | /oh-my-claudecode:ai-slop-cleaner |
writer-memory |
Memory system for writing projects | /oh-my-claudecode:writer-memory |
| Keyword | Effect |
|---|---|
ultrawork, ulw, uw |
Parallel agent orchestration |
autopilot, build me, I want a, handle it all, end to end, e2e this |
Autonomous execution pipeline |
ralph, don't stop, must complete, until done |
Loop until verified complete |
ccg, claude-codex-gemini |
3-model orchestration |
ralplan |
Consensus-based planning |
deep interview, ouroboros |
Socratic deep interview |
code review, review code |
Comprehensive code review mode |
security review, review security |
Security-focused review mode |
deepsearch, search the codebase, find in codebase |
Codebase search mode |
deepanalyze, deep-analyze |
Deep analysis mode |
ultrathink, think hard, think deeply |
Deep reasoning mode |
tdd, test first, red green |
TDD workflow |
deslop, anti-slop |
AI expression cleanup |
cancelomc, stopomc |
Cancel active execution mode |
Keywords are processed in two places:
| Source | Role | Customizable |
|---|---|---|
config.jsonc magicKeywords |
4 categories (ultrawork, search, analyze, ultrathink) | Yes |
keyword-detector hook |
11+ triggers (autopilot, ralph, ccg, etc.) | No |
The autopilot, ralph, and ccg triggers are hardcoded in the hook and cannot be changed through config.
Hooks are code that reacts to Claude Code lifecycle events. They run automatically when a user submits a prompt, uses a tool, or starts/ends a session. OMC implements agent delegation, keyword detection, and state persistence through this hook system.
Claude Code provides 11 lifecycle events. OMC registers hooks on these events:
| Event | When It Fires | OMC Usage |
|---|---|---|
UserPromptSubmit |
User submits a prompt | Magic keyword detection, skill injection |
SessionStart |
Session begins | Initial setup, project memory load |
PreToolUse |
Before a tool is used | Permission validation, parallel execution hints |
PermissionRequest |
Permission requested | Bash command permission handling |
PostToolUse |
After a tool is used | Result validation, project memory update |
PostToolUseFailure |
After a tool fails | Error recovery handling |
SubagentStart |
Subagent starts | Agent tracking |
SubagentStop |
Subagent stops | Agent tracking, output verification |
PreCompact |
Before context compaction | Preserve critical information, save project memory |
Stop |
Claude is about to stop | Persistent mode enforcement, code simplification |
SessionEnd |
Session ends | Session data cleanup |
Hooks inject additional context to Claude via <system-reminder> tags:
<system-reminder>
hook success: Success
</system-reminder>Injected pattern meanings:
| Pattern | Meaning |
|---|---|
hook success: Success |
Hook ran normally, continue as planned |
hook additional context: ... |
Additional context information, take note |
[MAGIC KEYWORD: ...] |
Magic keyword detected, execute indicated skill |
The boulder never stops |
ralph/ultrawork mode is active |
keyword-detector — fires on UserPromptSubmit. Detects magic keywords in user input and activates the corresponding skill.
persistent-mode — fires on Stop. When a persistent mode (ralph, ultrawork) is active, prevents Claude from stopping until work is verified complete.
pre-compact — fires on PreCompact. Saves critical information to the notepad before the context window is compressed.
subagent-tracker — fires on SubagentStart and SubagentStop. Tracks currently running agents; validates output on stop.
context-guard-stop — fires on Stop. Monitors context usage and warns when approaching the limit.
code-simplifier — fires on Stop. Disabled by default. When enabled, automatically simplifies modified files when Claude stops.
Enable via config:
{
"codeSimplifier": {
"enabled": true,
"extensions": [".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs"],
"maxFiles": 10
}
}OMC hooks are declared in hooks.json. Each hook is a Node.js script with a timeout:
{
"UserPromptSubmit": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "node scripts/keyword-detector.mjs",
"timeout": 5
}
]
}
]
}matcher: Pattern the hook responds to (*matches all input)timeout: Timeout in secondstype: Always"command"(runs an external command)
Disable all hooks:
export DISABLE_OMC=1Skip specific hooks (comma-separated):
export OMC_SKIP_HOOKS="keyword-detector,persistent-mode"OMC stores task progress and project knowledge in the .omc/ directory. The state system preserves critical information even when context compaction resets the context window.
.omc/
├── state/ # Per-mode state files
│ ├── autopilot-state.json # autopilot progress
│ ├── ralph-state.json # ralph loop state
│ ├── team/ # team task state
│ └── sessions/ # per-session state
│ └── {sessionId}/
├── notepad.md # Compaction-resistant memo pad
├── project-memory.json # Project knowledge store
├── plans/ # Execution plans
├── notepads/ # Per-plan knowledge capture
│ └── {plan-name}/
│ ├── learnings.md
│ ├── decisions.md
│ ├── issues.md
│ └── problems.md
├── autopilot/ # autopilot artifacts
│ └── spec.md
├── research/ # Research results
└── logs/ # Execution logs
Global State:
~/.omc/state/{name}.json— user preferences and global config
Legacy locations are auto-migrated on read.
File: .omc/notepad.md
The notepad survives context compaction. Content written to it persists even after the context window is reset.
Notes can be saved using the notepad_write_manual MCP tool or the notepad_write_priority tool for persistent notes.
MCP Tools:
| Tool | Description |
|---|---|
notepad_read |
Read notepad contents |
notepad_write_priority |
Write high-priority memo (permanent retention) |
notepad_write_working |
Write working memo |
notepad_write_manual |
Write manual memo |
notepad_prune |
Clean up old memos |
notepad_stats |
View notepad statistics |
How it works:
- On
PreCompactevent, important information is saved to the notepad - After compaction, notepad contents are re-injected into context
- Agents use the notepad to recover previous context
File: .omc/project-memory.json
Project memory is a persistent store for project-level knowledge. It survives across sessions.
MCP Tools:
| Tool | Description |
|---|---|
project_memory_read |
Read project memory |
project_memory_write |
Overwrite entire project memory |
project_memory_add_note |
Add a note |
project_memory_add_directive |
Add a directive |
Lifecycle integration:
SessionStart: Load project memory and inject into contextPostToolUse: Extract project knowledge from tool results and savePreCompact: Save project memory before context compaction
Path: .omc/state/sessions/{sessionId}/
Stores state isolated per session. Multiple sessions on the same project run simultaneously without state conflicts.
Path: .omc/notepads/{plan-name}/
Stores learnings from each execution plan separately.
| File | Contents |
|---|---|
learnings.md |
Discovered patterns, successful approaches |
decisions.md |
Architecture decisions and rationale |
issues.md |
Problems and blockers |
problems.md |
Technical debt and cautions |
All entries are timestamped automatically.
By default, state is stored in the project's .omc/ directory and is deleted when the worktree is removed.
To preserve state across worktree deletions, set the OMC_STATE_DIR environment variable:
# Add to ~/.bashrc or ~/.zshrc
export OMC_STATE_DIR="$HOME/.claude/omc"State is then stored at ~/.claude/omc/{project-identifier}/. The project identifier is a hash of the Git remote URL, so the same repository shares state across different worktrees.
For critical information, use <remember> tags:
<!-- Retained for 7 days -->
<remember>API endpoint changed to /v2</remember>
<!-- Retained permanently -->
<remember priority>Never access production DB directly</remember>| Tag | Retention |
|---|---|
<remember> |
7 days |
<remember priority> |
Permanent |
The verification module ensures work completion with evidence:
Standard Checks:
- BUILD: Compilation passes
- TEST: All tests pass
- LINT: No linting errors
- FUNCTIONALITY: Feature works as expected
- ARCHITECT: Opus-tier review approval
- TODO: All tasks completed
- ERROR_FREE: No unresolved errors
Evidence must be fresh (within 5 minutes) and include actual command output.
- Complete Reference: See REFERENCE.md
- Internal API: See FEATURES.md
- User Guide: See README.md
- Skills Reference: See CLAUDE.md in your project