Command Palette

Search for a command to run...

UnylyUnyly
Browse all

Auto Codex

FreeNot checked

Get the best of both worlds. Token-efficient autonomous coding pipeline for Claude Code. Codex plans, Opus reviews, Sonnet swarm implements, optional metric opt

GitHubEmbed

About

Get the best of both worlds. Token-efficient autonomous coding pipeline for Claude Code. Codex plans, Opus reviews, Sonnet swarm implements, optional metric optimization (inspired by karpathy/autoresearch).

README

auto-codex pipeline banner

auto-codex

Four autonomous coding pipelines for Claude Code.
Pick a lane by how much you want Codex involved, from fully Codex-driven to Claude-only, plus a 19-phase lane for building whole projects from a spec.

MIT License Python 3.8+ Claude Code Plugin Codex MCP optional One opt-in fallback, never silent

Live visual tour →


Why this exists

Long autonomous Claude sessions burn tokens fast. This plugin exists to spread the work across models that are good at different parts of it: planning, adversarial review, parallel implementation. That beats asking one Claude session to do all of it and grade its own homework.

Codex (via the Codex MCP server, billed to your existing ChatGPT account) is one option for offloading planning and building. It isn't required. The plugin ships four lanes so you can choose how much of that work you want to hand to Codex versus keep in Claude:

/auto-codex          research → plan-codex → codex hard gate → swarm → verify → [optimize] → complete
/makeitso             research → plan → review → swarm → verify → [optimize] → complete
/makeitso-codex       research → plan-codex → codex hard gate → codex build → verify → [optimize] → complete
/makeitso-project     19 gated phases (see below)

Four lanes, pick one

Lane Planner Builder Reviewers Phases Needs Codex Best for
/auto-codex Codex Sonnet swarm Opus (plan) → Codex (hard gate) → Opus (code) 6 + optional optimize Yes The original pipeline. Default choice if you already have Codex.
/makeitso Claude (you) Claude subagent swarm Fresh Claude subagent (plan) → fresh Claude subagent (hard gate) → Claude subagent (code) 6 + optional optimize No No Codex account, or you'd rather stay in one model family.
/makeitso-codex Codex Codex Opus once (plan) → Codex (hard gate) → Claude subagent once (diff) 6 + optional optimize Yes Minimizes Claude token spend, since almost everything runs on Codex.
/makeitso-project Claude (you) Claude subagent swarm Fresh subagent at every gate, plus a dedicated red-team pass 19 No Building a whole project from a spec: requirements, traceability, gap analysis, red-team, cleanup, deploy.

Every lane shares the same underlying engine (scripts/) and the same anti-fallback discipline: one correct approach per plan step, hard-gated reviews, no silent degradation.

The lane map

flowchart TD
    Start(["Pick a lane"]) --> AC["/auto-codex<br/>research → plan-codex → codex gate → swarm → verify → [optimize] → complete"]
    Start --> MI["/makeitso<br/>research → plan → review → swarm → verify → [optimize] → complete"]
    Start --> MC["/makeitso-codex<br/>research → plan-codex → codex gate → codex build → verify → [optimize] → complete"]
    Start --> MP["/makeitso-project<br/>19 phases: research → requirements → plan → traceability → review → swarm → integration-check → write-tests → test-traceability → verify → gap-analysis loop → red-team → fix-redteam → [optimize] → re-verify → cleanup → deploy → complete"]
    AC --> Done(["Task complete → next task or done"])
    MI --> Done
    MC --> Done
    MP --> Done

Cross-check flow on the Codex lanes: Codex plans → Opus interrogates → Codex verifies resolution → builder implements → reviewer checks. Every handoff has a hard gate; nothing advances until the gate passes. The Claude-only lanes (/makeitso, /makeitso-project) run the same shape of gate with fresh Claude subagents standing in for Codex and Opus.

Prerequisites

  • Claude Code (this is a Claude Code plugin)
  • Python 3.8+ · git (almost certainly already installed)

Codex is optional. Two of the four lanes use it, two don't:

Codex required Lanes
Yes /auto-codex, /makeitso-codex
No /makeitso, /makeitso-project

If you want either Codex lane:

  • Codex CLI: npm install -g @openai/codex (one-time)
  • Codex auth: codex login (uses your existing ChatGPT/Codex account)

No Codex account, or don't want to install one? Start with /makeitso: same pipeline shape, Claude runs every phase itself, nothing else to install.

Install

In any Claude Code session:

/plugin marketplace add neonplants/auto-codex
/plugin install auto-codex@auto-codex-marketplace

Restart Claude Code (or run /plugin reload). The plugin's plugin.json automatically registers the Codex MCP server so mcp__codex__codex is available in your sessions. You only need it running if you use one of the two Codex lanes.

Quick start

/auto-codex          # Codex plans, Sonnet swarm builds (needs Codex)
/makeitso             # Claude does every phase itself (no Codex needed)
/makeitso-codex       # Codex plans and builds, Claude reads twice (needs Codex)
/makeitso-project     # 19-phase build from a spec (no Codex needed)

Not sure which one? Check the lane table above. If you're not sure and don't have Codex installed, /makeitso is the safe default.

Each command is smart-default: running it with no argument inspects state and does the right thing.

  • No session yet → drafts a scope of work in tmp/scope_of_work.md (from your git log, README, any STATE.md / tasks.md), asks Claude to fill in real prioritized tasks, shows you the scope, waits for your explicit approval, then commits and starts executing. (/makeitso-project asks "What are we building?" instead of drafting a scope, since it's built for a single spec-based project, not a task queue.)
  • Scope draft exists from before → asks whether to use, edit, or regenerate it.
  • Session already active → fetches the next action and resumes the autonomous loop.

Subcommand shape differs slightly by lane. Here's what each one actually supports:

Subcommand /auto-codex /makeitso /makeitso-codex /makeitso-project
(no argument) smart-detect: status, draft, or resume show status show status start a new project, or resume an active one
start n/a (smart-detect handles it) begin a new session begin a new session n/a (use no argument)
status pipeline status pipeline status pipeline status pipeline state
stop pause, no files modified pause, no files modified pause, no files modified pause
resume continue after stop continue after stop continue after stop n/a (use no argument)
kill teardown, preserve data teardown, preserve data teardown, preserve data teardown, preserve data
doctor verbose environment check n/a n/a (Codex check runs automatically before start) n/a

How /auto-codex orchestrates models

ModelStageWhy this model
Codex (latest, currently gpt-5.5) Primary planner · Final integrity gate · Optimize loop Fast, structured, billed to your ChatGPT account, so it saves Claude tokens. The plugin doesn't pin a version, so you automatically get whatever Codex defaults to.
Opus Adversarial plan review · Post-swarm code review Strongest reviewer. Finds edge cases. Mandatory before code lands.
Sonnet Parallel implementation (up to 6 subagents) Fast, parallelizable. One atomic task per agent.

The other three lanes route reviewers by the same principles: task classification, cross-family reviewer routing (whoever builds is never who reviews), a hard ask-gate before ever escalating to your most expensive model, and orchestrator economy for delegating the phase loop off an expensive driver model. Each lane's command file (commands/makeitso.md, commands/makeitso-codex.md, commands/makeitso-project.md) documents its routing rules in full. Start there if you want the exact reviewer for a given blast radius.

The optimize loop (the killer feature)

Inspired by karpathy/autoresearch, Andrej Karpathy's autonomous experiment loop where an agent edits a single training script, runs a time-boxed eval, and keeps or reverts the change. We wired the same pattern as the final phase of every lane in this plugin.

How it works: if your plan declares an ## Optimization Target block, the pipeline runs the optimize loop (Codex-driven on the Codex lanes, same engine on the Claude-only lanes). Each cycle: read the target file, propose ONE change, run your eval, parse the metric, keep the change if the metric improved (git commit), revert if not. Repeat.

Plan block format:

file: path/to/single/file.py
eval: command that prints metric_name=value
metric: name_of_metric
direction: higher|lower
cycles: 30
constraints: what prevents gaming the eval

Results land in tmp/optimize_results.tsv (one row per cycle: timestamp, commit hash, metric value, status, description, duration).

What makes this different from "ask Claude to optimize my code":

Feature What it does
Single-file constraint Only one file can be touched per cycle. Forces focus, blocks scope creep, makes git revert trivial.
History-aware prompts The loop sees the last 15 experiments and what happened to each. Stops repeating losing ideas.
Real evaluation, not vibes The metric is whatever your eval script prints: Sharpe ratio, val loss, throughput, render time, anything measurable.
Auto keep/revert via git No human approves each change. Metric improved? Commit stays. Didn't? Reverted.
Auto-abort on 3 fails A misconfigured eval or a broken CLI can't burn your whole night.

What people optimize: trading strategies (Sharpe, drawdown), model training (val loss, perplexity), GPU kernels (throughput, memory bandwidth), template engines (render time, bundle size), tabular ML (cross-val score, AUC). If you can print metric=value, this loop can hill-climb it.

Requirements: project must be a git repo (loop uses commit/revert), eval must print the metric, plan for ~3.5 hours at 30 cycles × ~7 min/cycle, write your eval so it can't be gamed.

Fallback behavior

This plugin has exactly one declared fallback, and it is never automatic.

  • /auto-codex and /makeitso-codex both require Codex. Before either one starts or resumes autonomous work, it runs a definitive availability check: is the CLI present, authenticated, and is the Codex MCP server actually reachable.
  • If that check fails, the command stops, prints exactly what's missing and how to fix it (install the CLI, run codex login, or whatever the check names), and offers /makeitso by name: same pipeline shape, Claude does the planning and building itself, no Codex required.
  • It does not switch lanes for you. You get an explicit choice: fix Codex and retry, or knowingly run /makeitso instead. Nothing runs silently in a lane you didn't ask for.

Separately from that one lane-level fallback, every lane also enforces an anti-fallback code quality rule: no silent except: pass, no default-to-success, one correct approach per plan step. That rule is about the code the pipelines produce, not about which lane runs; see the details below.

Commands shipped with this plugin

  • /auto-codex: the original 6-phase lane. Codex plans, a Sonnet swarm implements, Codex is the final gate. (subcommands: status/stop/resume/kill/doctor)
  • /makeitso: Claude-only lane, no Codex required. Same phase shape, with task-classification and ask-gated escalation rules built in. (subcommands: status/start/stop/resume/kill)
  • /makeitso-codex: Codex plans and builds; Claude reads the plan once and the diff once. Offers /makeitso if Codex isn't available. (subcommands: status/start/stop/resume/kill)
  • /makeitso-project: 19-phase full-rigor pipeline for building a whole project from a spec: requirements, traceability, gap analysis, red-team, cleanup, deploy. (subcommands: status/stop/kill; no argument handles start/resume)
  • /plan-codex: standalone planning mode (Codex drafts, Opus reviews). Called internally by /auto-codex and /makeitso-codex.
  • /swarm: standalone parallel implementation. Called internally by /auto-codex, /makeitso, and /makeitso-project. Requires a reviewed plan gate.

You can run /plan-codex and /swarm on their own without an autonomous lane if you just want one phase.

Working directory layout (tmp/ and the session state files)

The plugin uses your project's tmp/ directory as its working area, shared across all four lanes:

File Purpose
tmp/scope_of_work.md the draft scope (deleted after commit; not used by /makeitso-project)
tmp/research.md research findings for the current task
tmp/plan.md implementation plan
tmp/plan_reviews.json advisory review findings
tmp/plan_gate.json gate flag set after review
tmp/adversary_route.json task classification + reviewer routing + escalation approval, per task
tmp/verify_metrics.json, tmp/verify_report.md output of scripts/run_verify.py, the shared real build/typecheck/test step
tmp/optimize_results.tsv optimization loop results (if optimize ran)
tmp/optimize_session.json optimization session state
tmp/logs/optimize.log optimization loop console output
tmp/.auto_codex_doctor_cache.json doctor cache (1 hour TTL, codex-mtime-keyed)

autonomous_session.json (project root) is the single source of truth for /auto-codex, /makeitso, and /makeitso-codex sessions: active flag, approval policy, branch, task list, current task ID, rotation count, per-task phase and review status. Atomically written via tmp-rename.

/makeitso-project only uses tmp/project_pipeline.json instead (run ID, current phase, phases completed, gap round, artifacts) plus its own phase artifacts: tmp/requirements_checklist.md, tmp/traceability_matrix.md, tmp/integration_report.md, tmp/test_manifest.md, tmp/test_traceability_matrix.md, tmp/gap_report_round_N.md, tmp/redteam_report.md, tmp/verify_report_post_optimize.md.

The plugin clears research.md, plan.md, plan_reviews.json, and plan_gate.json between tasks to prevent contamination. The optimize files are preserved across tasks. Add tmp/ to your .gitignore.

Troubleshooting

codex CLI not found: Run npm install -g @openai/codex. After install, you may need to add ~/.npm-global/bin to your PATH (or wherever npm-global installs binaries). This only matters for /auto-codex and /makeitso-codex; /makeitso and /makeitso-project don't touch Codex at all.

codex --version works but mcp__codex__codex not available: Reload the plugin (/plugin reload) or restart Claude Code. The MCP server is launched on session start.

A Codex lane tells you Codex isn't available: That's the fallback gate working as designed (see Fallback behavior above). It'll name exactly what's missing. Fix it and retry, or switch to /makeitso.

tmp/research.md missing or too small: The agent didn't write enough content (50-char minimum). Either the agent skipped research, or crashed mid-write. Run <lane> resume to retry.

Pipeline stuck in a review phase: The hard gate didn't get marked. Run the gate manually then mark-reviewed --verdict approved, or use --verdict override if you've already done equivalent review yourself.

Want to manually inspect state: Open autonomous_session.json (or tmp/project_pipeline.json for /makeitso-project). Plain JSON.

Plugin scripts erroring on import: Run /auto-codex doctor for the full report (works even if you're using a different lane; it checks the shared environment).

Doctor cache feels stuck: Delete tmp/.auto_codex_doctor_cache.json to force a fresh full check.

Anti-fallback policy

Every lane is built around the rule: one correct approach per step, never silent fallbacks. Plans containing "if X fails, try Y" are rejected by every reviewer. Swarms are instructed to fail loud rather than except: pass. The optimize loop catches only specific expected exceptions (OSError, subprocess.SubprocessError, RuntimeError) and auto-aborts after 3 consecutive failures rather than spinning. The shared run_verify.py step exits non-zero and says so plainly if it can't determine how to test your project. It never passes by default.

This is opinionated and intentional: it surfaces bugs early instead of letting them rot behind degraded behavior. If you genuinely need a fallback in your own code, agents are told to annotate it explicitly so reviewers can verify the intent.

This is a separate rule from the one described in Fallback behavior above, which is about lane selection, not code quality.

Sandboxed testing (don't touch your live setup)

Use --bare --plugin-dir to test in a session that doesn't touch your global Claude Code config:

mkdir -p /tmp/auto-codex-fresh-test && cd /tmp/auto-codex-fresh-test
git init -q && git commit --allow-empty -q -m baseline
claude --bare --plugin-dir /path/to/auto-codex
  • --bare skips hooks, auto-memory, and CLAUDE.md auto-discovery, to simulate a fresh user install
  • --plugin-dir loads the plugin for this session only; nothing is written to your global plugin registry
  • When you exit the session, everything disappears. Your live setup is untouched.

Then inside that session: /auto-codex doctor then whichever lane you want to try.

License

MIT · vanilla Claude Code plugin · no telemetry

from github.com/neonplants/auto-codex

Installing Auto Codex

This server has no published package — it is built from source. Open the repository and follow its README.

▸ github.com/neonplants/auto-codex

FAQ

Is Auto Codex MCP free?

Yes, Auto Codex MCP is free — one-click install via Unyly at no cost.

Does Auto Codex need an API key?

No, Auto Codex runs without API keys or environment variables.

Is Auto Codex hosted or self-hosted?

Self-hosted: the server runs locally on your machine via the install command above.

How do I install Auto Codex in Claude Desktop, Claude Code or Cursor?

Open Auto Codex on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.

Related MCPs

Compare Auto Codex with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All development MCPs