{
  "markdown": "# Orchestrator\n\n> Meta-router + prompt generator for Claude Code — the right workflow system, tier, agent, and pattern for any task.\n\nDescribe a task. Orchestrator classifies it, calibrates effort (L1–L4), picks the workflow system (OMC, GSD, ECC, Adversarial Spec, Graphify, MCPs, or direct execution), selects the specialist, wires up context paths, adds safety rails, and outputs a ready-to-paste prompt.\n\n**v4.0** adds Cortex — an always-on meta-router that sits above every workflow system and logs routing decisions for self-learning.\n\n---\n\n## Why this exists\n\nClaude Code has 180+ specialist agents, multiple orchestration frameworks (OMC, GSD, ECC, Adversarial Spec), a graph knowledge layer (Graphify), domain-specific ML models, MCPs (Context7, Exa, Firecrawl, Morph, Figma, Notion, Slack…), design system libraries, and dozens of workflow patterns scattered across repos.\n\nUsing them effectively means knowing which *system* to use, which *tier* of effort to apply, which *agent* to pick, which *pattern* to use, how to *coordinate* multi-agent runs, when to add safety rails, and how to *structure* the prompt so the agent actually delivers.\n\nOrchestrator v4.0 knows all of this so you don't have to. It routes the task, picks the tier, and writes the prompt.\n\n---\n\n## What's new in v4.0 — Cortex\n\nPrior versions (v1–v3) were a single-purpose skill for prompt generation: invoke it on demand, get a prompt back.\n\nv4.0 introduces **Cortex**, a meta-router that sits *above* every workflow system and runs *before* every non-trivial task. It's shipped as an always-on include (`cortex.md`) alongside the on-demand skill (`SKILL.md`). Use both, or either one.\n\n### Six-step routing protocol\n\nBefore starting any non-trivial task, Cortex runs:\n\n1. **Classify** — build / review / plan / research / debug / design / quick fix\n2. **Calibrate** — pick effort tier (L1–L4) using heuristics\n3. **Route** — pick the workflow system from the registry\n4. **Specialise** — pick the pattern + agent(s); fan out to parallel specialists if the task spans ≥2 independent disciplines\n5. **State + Log** — declare the routing line (`OMC > ralplan > Backend Architect @ L3`) and append to the self-learning log\n6. **Skip** — for trivial lookups, no calibration, no state line, no log\n\n### Four effort tiers\n\n| Tier | Name | Model | Thinking | Pattern | Verify |\n|------|------|-------|----------|---------|--------|\n| **L1** | Reflex | haiku / sonnet | none | direct | trust |\n| **L2** | Standard | sonnet | think | autopilot | spot-check |\n| **L3** | Deep | opus | think hard | ralplan | verifier pass |\n| **L4** | Max | opus | ultrathink | ralph / team | full verify loop |\n\nTiers are declared out loud before execution so you can course-correct. Override with `\"go light\"`, `\"be thorough\"`, `\"must be perfect\"`, `\"bump it\"`, or `\"drop it\"`.\n\n### Self-learning loop\n\nEvery route logs to `~/.claude/cortex-log.jsonl` via the shipped `bin/cortex` CLI:\n\n- `/cortex-log` — show last 20 routes with full reasoning trail\n- `/cortex-learn` — detect repeating `(class, system, pattern)` tuples and propose them as Decision Shortcuts (activates at ~20 routes)\n- `/cortex-reroute \"new route\"` — mark the last route as corrected when you disagree with the choice\n\nNo retros, no ceremony. Data-triggered phases fire automatically as the log grows.\n\n### Workflow registry\n\nThe shipped `cortex.md` includes routing tables for:\n\n- **OMC** (ralplan, autopilot, ralph, team, ccg, deep-interview, external-context, self-improve, verify, deep-dive)\n- **GSD** (phase-based project management, context rot prevention, autonomous execution)\n- **Adversarial Spec** (multi-model debate for spec hardening)\n- **ECC** (code review, PR workflows, ralph-loop)\n- **Agency Agents** (180+ specialists across 25+ domains)\n- **Tessl Skills** (framework-specific — React, Next.js, Stripe, Three.js, Python)\n- **Native Claude Code Surface** (channels, teleport, remote control, cloud/desktop schedule, Agent SDK)\n- **Graphify** (knowledge graph layer for cross-content reasoning)\n- **MCP Capabilities** (Context7, Exa, Firecrawl, Morph, Supabase, Slack)\n- **Cloud MCPs** (Figma, Notion, Gmail, Calendar, Canva, Granola, Scholar Gateway, Telegram, GitHub)\n- **Design Systems Library** (58+ real-world DESIGN.md specs)\n- **Chrome DevTools MCP** (visual QA, Lighthouse, a11y)\n- **Domain Models** (optional — pre-trained foundation models for specialised domains)\n\n### 80+ Decision Shortcuts\n\nA single lookup table maps task types to default routes with tier. Examples:\n\n| Task Type | Default Route | Tier |\n|---|---|---|\n| Build feature (backend) | OMC > ralplan > Backend Architect | L3 |\n| Multi-phase project | GSD > `/gsd-new-project` → `/gsd-autonomous` | L3 |\n| Security audit | OMC > ralplan > Security Engineer | L4 |\n| Must be perfect | OMC > ralph | L4 |\n| Multi-domain build (≥2 disciplines) | OMC > /team > parallel specialists → reconciler | L3 |\n| Small surgical fix | OMC > autopilot > Minimal Change Engineer | L1 |\n| Quick bug fix | Direct execution | L1 |\n\nFull table (80+ rows) in `cortex.md`.\n\n### Visual reference\n\nOpen `assets/cortex-flowchart.html` in a browser for a rendered view of the full workflow registry and decision shortcuts.\n\n---\n\n## How it works\n\n### Mode 1 — Meta-router (always-on, via `cortex.md` include)\n\n```\nYou: \"refactor the auth middleware to use the new session store\"\n\nCortex declares:\n  OMC > ralplan > Backend Architect @ L3\n\nThen executes.\n```\n\n```\nYou: \"build a checkout page with Stripe, tracking, and a11y polish\"\n\nCortex declares:\n  OMC > /team > [Frontend Developer ∥ Stripe skill ∥ Accessibility Auditor]\n    → Software Architect reconciler @ L3  [breadth=frontend+payments+a11y]\n\nThen generates parallel prompts + reconciliation step.\n```\n\n### Mode 2 — Prompt generator (on-demand, via skill)\n\n```\nYou: \"I need to build a payment webhook handler — it has to be secure\"\n\nOrchestrator generates:\n\n  — Step 1: Build —\n  Use the Backend Architect agent. ralplan \"Implement the payment webhook handler.\n  Read 'CLAUDE.md' and 'docs/stripe-integration.md'.\n  Save to 'src/webhooks/stripe.ts'\"\n\n  — Step 2: Multi-model review —\n  /ccg \"Review src/webhooks/stripe.ts for correctness, security, and edge cases\"\n\n  — Step 3: Sentinel gate —\n  Use the Security Engineer agent. autopilot: \"Audit src/webhooks/stripe.ts.\n  Check for: signature verification, idempotency, error leakage, missing event types.\n  Block on critical issues, warn on medium. Save to 'reviews/sentinel-audit.md'\"\n```\n\n---\n\n## What's inside\n\n```\norchestrator/\n├── SKILL.md              # on-demand skill (prompt generator)\n├── cortex.md             # always-on meta-router (CLAUDE.md include)\n├── bin/\n│   └── cortex            # Python CLI for self-learning log\n├── assets/\n│   └── cortex-flowchart.html   # visual reference\n├── README.md             # this file\n├── LICENSE               # MIT\n└── skills/               # legacy layout (unchanged from v3)\n```\n\n### 9 Orchestration Patterns\n\nEvery way you can run agents in Claude Code:\n\n| Pattern | What it does | When to use it |\n|---------|-------------|----------------|\n| **ralplan** | Plan → execute → verify loop | **Default for serious work.** Architecture, features, anything that matters. |\n| **autopilot** | One-shot autonomous execution | Well-defined tasks you trust. Quick wins. |\n| **ralph** | Won't stop until verified complete | Must be bulletproof. Security fixes, production deploys. |\n| **team** | N agents working in parallel | Large tasks benefiting from multiple perspectives. |\n| **deep-interview** | Socratic requirements clarification | When you're not sure what you're building yet. |\n| **scripted** | Headless `claude --bare -p` | CI/CD pipelines, cron jobs, automation scripts. |\n| **loop** | Iterative execution with exit conditions | Strategy discovery, monitoring, migrations. |\n| **loop + ralph** | Loop where each iteration is ralph-verified | Long-running AND must be bulletproof per step. |\n| **sentinel** | Separate auditor agent reviews output | Quality gate before shipping. Different agent than the builder. |\n\n### 6 Prompt Generation Rules\n\n1. **Context pointers + output destinations** — every prompt includes `Read '[file]'` and `Save to '[path]'`.\n2. **Pattern selection** — a flat decision map: task type → pattern.\n3. **Agentic engineering principles** — eval-first, 15-minute rule, model routing (haiku/sonnet/opus), skill extraction after corrections.\n4. **Inter-agent memory** — shared state file (`shared/agent-state.md`) namespaced by agent.\n5. **Multi-model review** — `/ask codex` + `/ask gemini` with AGREE/REJECT verification, or `/ccg` for full tri-model.\n6. **Sentinel gate** — different agent audits the build; warn / review / block.\n\n### Loop safety (circuit breakers)\n\nEvery loop prompt includes five exit conditions:\n\n| Trigger | What happens |\n|---------|-------------|\n| **No progress** | Halt after 3 iterations with no git changes or new output |\n| **Repeated errors** | Halt if the same error appears 3+ times |\n| **Output decline** | Halt if output length drops >70% |\n| **Test saturation** | Exit if 3 iterations only run tests, no code changes |\n| **Completion signals** | Exit when 2+ iterations report \"done\" |\n\n### Swarm coordination\n\nTwo multi-agent topologies beyond parallel + reconcile:\n\n| Topology | Structure | Use when |\n|---|---|---|\n| **Hierarchical** | Coordinator delegates to workers | Clear authority, strong dependencies |\n| **Mesh** | Peer-to-peer via shared file | Fault tolerance, collaborative exploration |\n\n---\n\n## Installation\n\n### Recommended (hybrid)\n\n```bash\n# 1. Install as skill\nmkdir -p ~/.claude/skills/orchestrator\ncp SKILL.md ~/.claude/skills/orchestrator/SKILL.md\n\n# 2. Install cortex.md as global include\ncp cortex.md ~/.claude/cortex.md\n\n# 3. Install CLI for self-learning log\nmkdir -p ~/.claude/bin\ncp bin/cortex ~/.claude/bin/cortex\nchmod +x ~/.claude/bin/cortex\n\n# 4. Add the include to your global CLAUDE.md\n#    Append this line to ~/.claude/CLAUDE.md:\n#    @cortex.md\n\n# 5. (Optional) Keep the flowchart handy\ncp assets/cortex-flowchart.html ~/.claude/cortex-flowchart.html\nopen ~/.claude/cortex-flowchart.html\n```\n\nAfter this, Cortex runs on every non-trivial task and the orchestrator skill is available for on-demand prompt generation.\n\n### Skill-only (no meta-router)\n\nIf you want v3-style prompt generation without the always-on router:\n\n```bash\nmkdir -p ~/.claude/skills/orchestrator\ncp SKILL.md ~/.claude/skills/orchestrator/SKILL.md\n```\n\nSkip `cortex.md` entirely.\n\n### Prerequisites\n\nWorks best with:\n\n- [Oh My Claude Code (OMC)](https://github.com/Yeachan-Heo/oh-my-claudecode) — orchestration patterns (ralplan, ralph, autopilot, team, `/learner`, `/ccg`)\n- [Agency Agents](https://github.com/msitarzewski/agency-agents) — 180+ specialist agents at `~/.claude/agents/`\n- [GSD (Get Shit Done)](https://github.com/omniharmonic/gsd) — spec-driven multi-phase development (optional but referenced throughout cortex.md)\n\nWithout these, generated prompts still work as structured Claude Code prompts — you just won't get the orchestration loops or specialist personas.\n\n---\n\n## Personalising `cortex.md`\n\nThe shipped `cortex.md` is generic. Two sections are marked **optional — personal setup** and can be removed or adapted:\n\n- **Obsidian surface** — symlinks to an Obsidian vault for browsing routes and proposals. Delete the section if you don't use Obsidian.\n- **Domain Models (Specialized)** — the example (Kronos — financial forecasting) is a template showing how to register a pre-trained domain model. Remove if not applicable, or replace with your own.\n\nPaths like `<tools-dir>/` and `<design-systems-dir>/` are placeholders — replace with your actual local paths before installing.\n\n---\n\n## Sources\n\nThis skill synthesises patterns from:\n\n| Source | What it contributed |\n|--------|-------------------|\n| [Oh My Claude Code](https://github.com/Yeachan-Heo/oh-my-claudecode) | Orchestration patterns (ralplan, ralph, autopilot, team), `/learner`, `/ccg` |\n| [Agency Agents](https://github.com/msitarzewski/agency-agents) | 180+ specialist agent personas and domain routing |\n| [GSD (Get Shit Done)](https://github.com/omniharmonic/gsd) | Context rot prevention, spec-driven phases, autonomous execution |\n| [Everything Claude Code](https://github.com/affaan-m/everything-claude-code) | Autonomous loops, eval-driven development, agentic engineering, sentinel/auditor pattern |\n| [ralph-claude-code](https://github.com/frankbria/ralph-claude-code) | Circuit breaker safety (3-state model, exit detection, rate limiting) |\n| [Claude Flow](https://github.com/ruvnet/claude-flow) | Swarm coordination topologies (hierarchical, mesh), inter-agent memory patterns |\n| [levnikolaevich/claude-code-skills](https://github.com/levnikolaevich/claude-code-skills) | Multi-model review pipeline (parallel external agents, AGREE/REJECT verification) |\n| [Graphify](https://github.com/safishamsi/graphify) | Knowledge graph layer for cross-content reasoning |\n| [awesome-design-md](https://github.com/VoltAgent/awesome-design-md) | Design system reference library (58+ DESIGN.md specs) |\n\nDesigned to keep evolving — new patterns get merged as they emerge from the community.\n\n---\n\n## Version history\n\n| Version | Date | Changes |\n|---------|------|---------|\n| **v4.0** | 2026-04-17 | **Cortex meta-router.** Always-on routing layer (`cortex.md`), 4-tier effort calibration (L1–L4), self-learning log (`bin/cortex`), visual flowchart (`assets/cortex-flowchart.html`), 80+ decision shortcuts, domain-breadth fan-out rule. Agent count refreshed to 180+. |\n| v3.0 | 2026-03-31 | +6 patterns (loop safety, swarm coordination, inter-agent memory, skill extraction, multi-model review, sentinel gate). Compacted to 253 lines. |\n| v2.0 | 2026-03-31 | Renamed to `orchestrator`. Merged ECC patterns (autonomous loops, agentic engineering). Compressed from 290 → 204 lines. |\n| v1.0 | 2026-03-26 | Initial release as `omc-agency`. 6 patterns, 5 examples, 205 lines. |\n\n---\n\n## Migrating from v3.0 → v4.0\n\nv3.0 users: your existing install keeps working. v4.0 is additive.\n\n**To adopt Cortex (recommended):**\n\n```bash\ncp cortex.md ~/.claude/cortex.md\ncp bin/cortex ~/.claude/bin/cortex && chmod +x ~/.claude/bin/cortex\necho '@cortex.md' >> ~/.claude/CLAUDE.md\n```\n\n**To stay on v3-style prompt generation only:** skip the steps above. Your old `SKILL.md` behaviour is preserved in the new v4 `SKILL.md` as Mode 2.\n\n---\n\n## Licence\n\nMIT\n",
  "bytes": 14461,
  "sha": "6f9e15e7f07bc4f7445725f41c01663b55f32670ee60d1a76b249206cca16e6e",
  "repo_slug": "amitvijapur/orchestrator",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_amitvijapur_orchestrator_orchestrator_d7f3267c/readme"
}