How yeachan-heo/oh-my-claudecode works
1. What this repository is
- This is a Claude Code extension/runtime called oh-my-claudecode (OMC).
- It is not a single app; it is a tooling platform that installs into Claude Code as a plugin, exposes a terminal CLI (omc), and injects a large set of hooks, skills, and orchestration runtimes.
2. Primary user-facing surfaces
- Terminal CLI: src/cli, src/index.ts, plus build scripts in scripts/.
- In-session slash skills / prompts: implemented through files in skills/ and hook behavior in src/hooks/.
- Plugin/marketplace install path: metadata under .claude-plugin/, .mcp.json, .clawhip/, and installer logic in src/installer/.
- These are separate entry surfaces but they converge on the same orchestration and state libraries.
3. Core runtime model
- OMC orchestrates work through several modes: team, autopilot, ultrawork, ralph, pipeline, autoresearch, and legacy compatibility paths.
- The README makes Team the canonical mode; in code that is reflected by the dense src/team/ subsystem and the src/hooks/team-* runtime hooks.
- Most flows are event-driven: a Claude Code session emits hook events, OMC transforms them, then routes work to agents, workers, tools, or persistence layers.
4. Team orchestration subsystem
- src/team/ is the largest subsystem and models a staged multi-agent workflow.
- It contains:
- task and stage routing (task-router, stage-router, role-router)
- worker lifecycle and health (worker-bootstrap, worker-health, worker-restart)
- tmux/process integration (tmux-session, tmux-comm, runtime-cli, runtime-v2)
- shared state and coordination (inbox-outbox, dispatch-queue, merge-coordinator, audit-log, activity-log)
- governance and guardrails (governance, permissions, sentinel-gate, model-contract)
- Conceptually this subsystem turns a single task into a staged pipeline of workers with explicit handoff and merge points.
5. Hook layer: the main integration boundary
- src/hooks/ is the main boundary between Claude Code session events and OMC behavior.
- Hooks cover pre/post tool use, session start/end, compaction, prompt prerequisites, permission handling, background notifications, keyword detection, and prompt sanitization.
- Important hook families:
- autopilot / persistent-mode / ralph: long-running execution loops with cancellation, validation, and retry logic.
- project-memory / learner / wiki / notepad: capture, infer, and persist reusable knowledge from sessions.
- **team-* hooks**: manage team-session state, leader nudges, canonical state, and worker lifecycle.
- bridge / openclaw / notification hooks: forward session events to external systems.
- Hooks are where most session-time side effects happen; they generally write artifacts, update state files, or call external tools rather than directly implement business logic.
6. Agent and prompt system
- src/agents/ defines the specialized agent roles and prompt templates used by orchestration modes.
- It includes architect, analyst, designer, executor, planner, critic, tester, writer, scientist, explorer, and tracer-style roles.
- There is a clear separation between:
- agent definitions and prompt sections
- mode-specific prompt generation
- runtime execution
- This matters architecturally because Team/autopilot/Ralph don’t just “run code”; they synthesize role-specific prompts and route them through different execution backends.
7. Tooling layer
- src/tools/ exposes internal tools used by hooks, sessions, and workflows.
- Notable tool groups:
- AST and code analysis (ast-tools, diagnostics, LSP helpers)
- memory/state utilities (memory-tools, state-tools, shared-memory-tools)
- session/history/trace helpers
- Python REPL bridge support
- wiki and skills tooling
- These are the reusable primitives that hooks and orchestration modes call into; they are not end-user features by themselves.
8. MCP and external tool servers
- src/mcp/ is the Model Context Protocol server side.
- It includes standalone server support, tool registries, prompt injection/persistence, job management, and team-server convergence logic.
- The README and tree show both standalone MCP and team-oriented MCP support.
- This is the boundary where OMC exposes capabilities to Claude Code or other clients as structured tools rather than as ad hoc shell commands.
9. Installer and plugin packaging
- src/installer/ is responsible for turning the repo into a usable Claude Code plugin/runtime.
- It manages:
- claude.md / setup template reconciliation
- plugin directory mode
- hook template generation
- MCP registry updates
- version and environment guards
- This subsystem is what bridges source repo state into installed runtime state inside a user’s Claude Code environment.
10. HUD, state, and observability
- src/hud/ renders the status line / live session view described in the README.
- It consumes state from multiple places: session metadata, usage info, git state, prompt timing, team/autopilot state, and background tasks.
- Supporting state libraries live in src/lib/ and src/features/state-manager.
- The architecture here is read-heavy: hooks and runtimes write state, HUD reads and renders it.
11. Notifications and external integrations
- src/notifications/ handles outbound delivery to Slack/Discord/Telegram/webhooks and related formatting/redaction.
- src/openclaw/ and the OpenClaw-related hook paths provide another external integration channel for session events and replies.
- These integrations are event sinks: they receive session lifecycle events, tool-use events, or stop events and turn them into outbound messages.
- In the architecture diagram, these should sit downstream of hooks/session events, not as core orchestration logic.
12. Shared libraries and constraints
- src/lib/, src/utils/, src/shared/, and src/platform/ contain cross-cutting concerns:
- filesystem and path handling
- atomic writes / file locks / shared memory
- prompt truncation and payload limits
- session isolation and security guards
- config loading and plugin-dir resolution
- These libraries form the reliability layer used by most subsystems, especially hooks, installer, team, and HUD.
13. Skills and rules as content, not code
- skills/, templates/, and docs/ are first-class runtime content.
- Skills define reusable task behavior; templates define hook and rules injection; docs describe the supported execution patterns.
- This repository is therefore partly a content distribution system: the runtime loads code, but the behavior is heavily shaped by versioned prompt/skill files.
14. Benchmarks, scripts, and compiled output
- benchmark/, benchmarks/, scripts/, and tests/fixtures/ support validation, regression testing, and benchmark evaluation.
- dist/ is the compiled output tree for the TypeScript source.
- These areas are important for build/release but are not part of the live runtime architecture; they exist to validate and package the platform.
15. Main data flows to draw
- Claude Code session event → hook → state/artifact update → HUD/notification/MCP side effect
- CLI command or slash skill → orchestration runtime → agents/workers/tools → artifacts/state
- Installer/setup command → config files + hook templates + plugin metadata → enabled runtime
- Team mode specifically: task intake → stage/role routing → worker execution (often tmux/CLI-based) → outbox/inbox coordination → merge/verify loop → cleanup
Main entry points: team/index.ts Team core · hooks/index.ts Hook layer · cli/index.ts CLI entry · installer/index.ts Installer
Components 28
Entry points
User-facing commands and installation surfaces
- Main entry · Package entry that wires the runtime together
src/index.ts - CLI entry · Top-level command surface for omc
src/cli/index.ts - Team CLI · Command handlers for team and related runtime commands
src/cli/commands/team.ts - Research CLI · CLI path for guided autoresearch flows
src/cli/autoresearch.ts - Installer · Installs OMC into Claude Code and reconciles runtime files
src/installer/index.ts
Runtime core
Session orchestration and mode execution
- Team core · Canonical staged workflow for task intake, routing, and worker coordination
src/team/index.ts - Routers · Task, stage, and role routing for team execution
src/team/task-router.ts - Workers · Bootstrap, health, restart, and canonicalization for worker processes
src/team/worker-bootstrap.ts - Tmux/runtime · Tmux and CLI-backed execution backends for team sessions
src/team/tmux-session.ts - Coordination · Inbox/outbox, dispatch, merge, audit, and task state coordination
src/team/inbox-outbox.ts - Guardrails · Governance, permissions, model contracts, and sentinel gates
src/team/governance.ts - Hook layer · Main boundary between Claude Code events and OMC behavior
src/hooks/index.ts - Autopilot hooks · Long-running autopilot and persistent-mode loops with validation and cancellation
src/hooks/autopilot/index.ts - Team hooks · Session-time hooks for team state, dispatch, and worker lifecycle
src/hooks/team-pipeline/index.ts - Memory hooks · Project memory, learner, wiki, and notepad capture paths
src/hooks/project-memory/index.ts - Safety hooks · Permission handling, compaction, sanitization, and continuation guards
src/hooks/permission-handler/index.ts - Ralphthon · Ralph-oriented orchestrator and PRD/deep-interview flow
src/ralphthon/orchestrator.ts - Autoresearch · Guided research runtime and intake/setup flow
src/autoresearch/runtime.ts
State layer
Shared persistence, HUD, and reusable libraries
- HUD · Read-only session view over state, git, usage, and mode status
src/hud/index.ts - Shared libs · Cross-cutting filesystem, locks, paths, payload limits, and security helpers
src/lib/paths.ts - Tools · Reusable tools for AST, LSP, memory, wiki, trace, and Python REPL
src/tools/index.ts
Integrations
External protocols, notifications, and bridges
- MCP server · Model Context Protocol tool exposure for Claude Code and external clients
src/mcp/index.ts - Notifications · Slack, Discord, Telegram, webhook, and reply-listener delivery paths
src/notifications/index.ts - OpenClaw · External event routing and signal bridge for session events
src/openclaw/index.ts - Interop · Shared-state and MCP bridge glue between runtimes and external processes
src/interop/mcp-bridge.ts
Content
Skills, prompts, templates, and docs
- Agents · Specialized role prompts for architect, analyst, executor, critic, and others
src/agents/index.ts - Skills · Versioned skill content loaded as task behavior in-session
skills/AGENTS.md - Templates · Hook, rules, and setup templates injected into installed environments
templates/hooks/session-start.mjs
Connections 40
- Main entry → CLI entry: exposes · Main package entry wires the terminal surface
- Main entry → Hook layer: loads · Bootstraps hook behavior for Claude Code sessions
- Main entry → Installer: installs · Prepares plugin/runtime files in the Claude environment
- CLI entry → Team CLI: routes · CLI dispatches team commands
- CLI entry → Research CLI: routes · CLI dispatches guided research commands
- CLI entry → Team core: starts · CLI can launch team runtime sessions
- CLI entry → Autoresearch: starts · CLI can launch guided research runs
- Installer → Templates: writes · Installer materializes hooks and setup templates
- Installer → Skills: enables · Installer reconciles runtime skill content
- Installer → MCP server: registers · Installer updates MCP configuration and registry state
- Hook layer → Autopilot hooks: delegates · Session hooks fan out into mode-specific autopilot behavior
- Hook layer → Team hooks: delegates · Session hooks fan out into team lifecycle handling
- Hook layer → Memory hooks: delegates · Session hooks capture reusable memory and wiki artifacts
- Hook layer → Safety hooks: guards · Session hooks enforce permission and prompt safety rules
- Hook layer → Notifications: emits · Hook events can be forwarded to outbound notification sinks
- Hook layer → OpenClaw: bridges · Hook events can be forwarded to OpenClaw integrations
- Team hooks → Team core: drives · Team hooks update and advance team runtime state
- Team core → Routers: uses · Team runtime resolves task, stage, and role routing
- Team core → Workers: spawns · Team runtime manages worker lifecycle
- Team core → Tmux/runtime: runs on · Team runtime executes through tmux/CLI backends
- Team core → Coordination: coordinates · Team runtime shares inbox/outbox and merge state
- Team core → Guardrails: constrains · Team runtime enforces governance and permissions
- Coordination → MCP server: converges · Team coordination can surface through MCP servers
- Tmux/runtime → Interop: bridges · Process backends communicate through shared bridge glue
- Autopilot hooks → Agents: synthesizes · Autopilot behavior is driven by role prompts and templates
- Team hooks → Agents: synthesizes · Team hooks select agent roles for session work
- Memory hooks → Tools: calls · Memory capture relies on reusable tooling primitives
- Safety hooks → Shared libs: depends on · Guardrails use shared filesystem and security helpers
- HUD → Shared libs: reads · HUD consumes shared state, paths, and safety helpers
- HUD → Team core: displays · HUD reflects team session progress and status
- HUD → Autopilot hooks: displays · HUD reflects autopilot and long-running mode state
- MCP server → Tools: exposes · MCP publishes internal tools as structured capabilities
- MCP server → Team core: serves · MCP has team-oriented server support
- Notifications → Interop: integrates · Outbound delivery shares bridge and session state plumbing
- OpenClaw → Interop: shares · OpenClaw uses shared bridge/state plumbing
- Ralphthon → Autopilot hooks: adapts · Ralph flows reuse the long-running orchestration layer
- Autoresearch → Agents: uses · Guided research synthesizes role-specific prompts
- Autoresearch → Tools: uses · Research flow uses shared tools and utilities
- Skills → Hook layer: consumed by · Skills are surfaced through hook-time runtime behavior
- Templates → Installer: materialized by · Templates are installed into Claude Code runtime state