Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Ultra

Role-based model orchestration for Claude Code. As fluent as a plain Opus session - with better results where it counts.

Claude Code lets every subagent run on a different model. Code-Ultra turns that into a configurable system: six roles - advisor, planner, explorer, implementer, implementer_hard, gate - each independently assignable to a lane (any Claude model, or GPT via the official Codex plugin), steered per project from a config file and /code-ultra:* commands.

The governing principle is fluency first: your session works like a normal Claude Code session - plan, implement, verify, inline by default. Orchestration adds quality at high-leverage moments instead of turning the session into a dispatcher:

Role What it does When it activates
advisor Fresh-eyes second opinion that reads your actual code and diff Commitment boundaries, stuck-twice debugging, pre-ship review
planner Stronger-model critique of plans: ordering, missing steps, premortem Before plan mode, multi-step plans, mid-execution checkpoints
explorer Read-only search agent; returns conclusions, not file dumps Broad codebase sweeps (context hygiene)
implementer Implementation lane Independent parallel chunks; cross-vendor second implementations
implementer_hard Escalation lane After two failed attempts, or judgment-heavy pieces
gate Stop-time pre-ship review Config-gated: off / advisory / blocking

The advisor doubles as a client-side replacement for Claude Code's server-side advisor tool - with an upgrade: the built-in advisor only sees your transcript, while this one runs git diff, greps, and reads files itself.

Install

claude plugin marketplace add InverseAltruism/Code-Ultra
claude plugin install code-ultra@code-ultra

Then in a session:

/code-ultra:doctor        # verify the environment
/code-ultra:config init   # scaffold the per-project config (optional - defaults work)

Codex plugin setup

The OpenAI Codex plugin for Claude Code supplies the GPT lane this pattern routes to. Install it as follows.

  1. Run /plugin marketplace add openai/codex-plugin-cc inside Claude Code.
  2. Type /plugin install codex@openai-codex and then /reload-plugins.
  3. Execute /codex:setup to configure your credentials.
  4. Use commands like /codex:review, /codex:adversarial-review, and /codex:rescue to have GPT-5.6 analyze or fix work handled by Claude.

Code-Ultra routes all codex-lane work through this plugin's runtime (jobs visible in /codex:status, queue respected). Without it, codex roles report unavailable loudly - or fall back to a raw-CLI lane if you set codex_fallback: raw-cli.

How to use

Day one (2 minutes).

/code-ultra:setup     # guided: environment check, profile choice, config scaffold

Or manually: /code-ultra:doctor, then /code-ultra:profile apply <name>, then optionally /code-ultra:config init. Master switch: /code-ultra:off makes Claude Code behave exactly as it did before the plugin was installed (per project - doctrine dormant, gate silent, commands still available); /code-ultra:on re-enables.

Then just work. Your session behaves like a normal Claude Code session - Code-Ultra's doctrine loads automatically when orchestration questions come up, and it stays out of the way for ordinary tasks.

When each role activates:

Moment What happens Triggered by
You ask for a second opinion ("fresh eyes on this", "/code-ultra:advise") Advisor resolves the review scope itself (dirty tree, last commits, or a scope you name) and returns a verdict You, anytime
A big plan is forming ("/code-ultra:plan", or Claude about to enter plan mode) Planner critiques ordering, missing prerequisites, rollback; runs a premortem You or Claude, BEFORE the plan hardens
Big decision ahead (architecture, migration, API shape) Doctrine tells the session to consult the advisor BEFORE committing Claude, at commitment boundaries
Same bug resists N attempts (configurable, default 2) Escalates to the implementer_hard lane with a corrected spec Claude, per the escalation rule
A question needs a big codebase sweep Explorer agent searches and returns conclusions, keeping your context lean Claude, for context hygiene
Risky code where a second model family matters Codex lane implements or adversarially reviews (via the codex plugin) Claude or you (/codex:review)
You stop the session with unreviewed work The gate asks for (advisory) or requires (blocking) a pre-ship review The Stop hook, only if you enabled it

Daily patterns.

  • Vet a plan before committing to it: /code-ultra:plan migrate sessions to Redis: 1) dual-write 2) backfill 3) cutover 4) remove old path
  • Vet a decision before building: /code-ultra:advise should we key the cache by user or by session?
  • Pre-ship check: /code-ultra:advise final review
  • Cross-vendor audit of a risky change: /codex:adversarial-review focus on the concurrency model
  • Codex gotchas: it writes only inside the workspace root (sandbox), and xhigh tasks can outlast a foreground wait - background them
  • Turn the safety net on for a critical session: /code-ultra:gate blocking (and skip-once when you need out)
  • See what's configured right now: /code-ultra:status

Tuning it. Everything routes through the role table - change any cell without touching prompts:

/code-ultra:config set roles.advisor.model opus        # cheaper advisor
/code-ultra:config set roles.implementer.kind codex    # GPT types, Claude judges
/code-ultra:config set roles.explorer.kind off         # never delegate exploration
/code-ultra:config set advise.escalate_after_attempts 3
/code-ultra:config set gate.skip_below_changed_lines 20

And put your project's non-negotiables (testing rules, forbidden paths, mandatory checks) in the doctrine body of .claude/code-ultra.local.md - every delegated spec and routing decision carries them.

Profiles

Three lineups, one command to switch (/code-ultra:profile apply <name>):

role claude-only claude-codex (default) codex-heavy
advisor Fable (xhigh) Fable (xhigh) Fable (xhigh)
planner Fable (xhigh) Fable (xhigh) Fable (xhigh)
explorer Sonnet Sonnet Sonnet
implementer Opus (high) Opus (high) Codex (effort xhigh)
implementer_hard Fable (xhigh) Fable (xhigh) Opus
gate reviewer advisor codex codex
gate mode off off advisory

Profiles fully replace the role map; override any single key afterwards:

/code-ultra:config set roles.explorer.model haiku
/code-ultra:config set roles.implementer.kind codex

Configuration

Per-project file: .claude/code-ultra.local.md (add .claude/*.local.md to .gitignore); optional committable team defaults in .claude/code-ultra.md. Missing config = built-in defaults, gate off. The frontmatter holds the knobs; everything below it is project doctrine - freeform rules (testing discipline, forbidden paths, mandatory verification commands) that Code-Ultra injects into every routing decision and delegation spec.

---
version: 1
profile: claude-codex
roles:
  advisor: {kind: claude, model: fable}
  planner: {kind: claude, model: fable}
  explorer: {kind: claude, model: sonnet}
  implementer: {kind: claude, model: opus}
  implementer_hard: {kind: claude, model: fable}
  gate: {kind: codex}
gate:
  mode: off                    # off | advisory | blocking
  reviewer: codex              # codex | advisor | both
  skip_below_changed_lines: 5
  max_fires_per_session: 3
  skip_next: false
advise:
  manual_effort: xhigh
  gate_effort: medium
  escalate_after_attempts: 2
codex_fallback: none           # none | raw-cli
---
# Project doctrine
All new features red-first: a failing test exists before the implementation lane runs.

Any role can be disabled with kind: off (e.g. roles.explorer: {kind: off} keeps all exploration inline). A role with kind: claude and no model uses the session model.

Reasoning effort. Hard defaults ship in the agent definitions: advisor, planner, and the escalation implementer run at xhigh; the routine Claude implementer runs at high. Codex lanes take effort from the role table exactly (roles.implementer: {kind: codex, effort: xhigh} - the codex-heavy default). Setting effort on a kind: claude role is advisory: the session states that reasoning depth in the delegation prompt, since Claude Code binds subagent effort in the agent definition, not per invocation. Note: profiles materialize into your config at apply time - after upgrading Code-Ultra, re-run /code-ultra:profile apply <name> (or set keys individually) to pick up new profile defaults.

Commands

Command Does
/code-ultra:status Effective profile, role table, gate state, codex availability
/code-ultra:config show | get <key> | set <key> <value> | init
/code-ultra:profile list | apply <name>
/code-ultra:gate show | off | advisory | blocking | reviewer <r> | skip-once
/code-ultra:advise Consult the advisor now (decision vet or pre-ship review)
/code-ultra:plan Consult the planner on a goal, draft plan, or checkpoint
/code-ultra:doctor Environment diagnosis with fixes
/code-ultra:setup Guided first-time setup (doctor, profile, config)
/code-ultra:on / off Master switch: off = plain Claude Code again, per project

The orchestration doctrine itself is a skill Claude loads automatically when orchestrating; you never invoke it directly.

Shipped agents (invoked by the doctrine or directly via the Agent tool): code-ultra:advisor (Fable, xhigh - verdicts and gate reviews), code-ultra:planner (Fable, xhigh - plan critique), code-ultra:claude-implementer (high - routine lane), code-ultra:claude-implementer-hard (Fable, xhigh - escalation with diagnosis-first contract), code-ultra:codex-cli-fallback (raw-CLI GPT lane, opt-in fallback only).

The gate

A Stop hook that asks for (advisory) or requires (blocking) a pre-ship review before the session stops. It is deliberately fast and transparent: the hook only checks config and state, then instructs the session to run the configured reviewer - you watch the review happen, streamed, in your session. On the next stop, the gate passes. It re-arms only when meaningful new work accumulates after a review.

  • Off by default. Enable per project: /code-ultra:gate advisory or blocking.
  • Escapes (always named in the block message): /code-ultra:gate skip-once, CODE_ULTRA_SKIP_GATE=1, and a per-session fire cap.
  • Trivial diffs (< skip_below_changed_lines) never trigger it.
  • If the codex plugin's own review gate is enabled, Code-Ultra defers - you never get two blocking reviews per stop.
  • Budget note: codex reviews are rate-limited on subscription plans (≈5/hour on Plus). Advisory mode and milestone-driven /codex:review spend that budget better than blocking every stop.

Requirements & caveats

  • Claude Code ≥ 2.1.170; Node 18+ (for the companion scripts).
  • Model access: the defaults pin Fable 5 for advisor/escalation. No Fable on your plan? /code-ultra:config set roles.advisor.model opus (same for implementer_hard) - same pattern, roles shift down one tier.
  • Quiet fallback: if a pinned Claude model isn't available on your account, Claude Code silently falls back to the session model - the pattern degrades quietly rather than erroring. /code-ultra:doctor reminds you; if results feel unremarkable, check your plan.
  • Codex lane requires the official codex plugin (see above) or, as explicit opt-in fallback, the raw Codex CLI.

FAQ

Is this Anthropic's advisor tool? No - that's a server-side API feature (/advisor in Claude Code), and as of mid-2026 it doesn't offer Fable 5 (listed "temporarily unavailable") and has known failure modes with large transcripts and ToolSearch-loaded tools. Code-Ultra's advisor is a plain subagent: client-side, model-configurable, and it reads your code rather than just your transcript.

Why a GPT lane in a Claude plugin? Vendor diversity. Models from one family share blind spots; LLM evaluators also systematically favor their own generations - an independent reviewer from a different lineage catches what same-family review misses. The judgment roles stay Claude; the cross-vendor lane produces or reviews, it doesn't judge the final call.

Why not delegate everything to cheap lanes? Because a single strong session is remarkably efficient, and shattering coherent work across agents costs tokens and coherence. Code-Ultra delegates for context hygiene, parallelism, diversity, and escalation - and otherwise stays out of the way.

License

MIT

About

Code Ultra: model-routing agent pattern for Claude Code (Opus architect, GPT-5.6 Codex lane, Fable review)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages