v0.2.1 · zero-dependency · MIT · Node ≥ 24

The conductor, not another instrument.

apex sits in front of the AI coding agents you already have — ollama · claude · codex · agy · opencode — and routes every goal by your objective: cheapest that can provably do it, most capable, or fastest (learned from your own run history). Now it's one chat in front of a decentralized fleet: the orchestrator decides what each message is, machines across your LAN claim the work, reserve their file areas before writing, and every merge is gated, fenced, and self-healing — conflicts reconcile themselves, never you.

Explore features ↓ vs opencode & others
💬 one chat🧩 9 providers🧪 365 tests📦 0 deps🛰️ distributed fleet🗺️ area reservations↻ self-healing merges⛪ 10 commandments
~/project — apex

↑ live demo — pick the cheapest provider, escalate only if a real gate fails, then keep it true

the idea

One run. The right model. Proof it worked.

Every other tool makes you pick a model up front and pay frontier prices for all of it. apex doesn't.

$ apex --verify "npm test" "fix the failing test" ollamafree · local agyfree-tier claudepaid · only if needed gate ✗ gate ✗ ✅ accepted gate ✓ · tests pass Run on the cheapest provider → run your real success gate → escalate up the cost ladder only when the gate fails. Most tasks finish free; you pay for a frontier model exactly when — and only when — a cheaper one provably couldn't.
new in 0.2.1 · the milestone

Many agents. One repo. Zero conflicts. Guaranteed integrity.

Complex goals decompose into trivial, independent tasks that machines work in parallel and merge back without stepping on each other — on greenfield and existing codebases. The trick isn't merging harder; it's conflict-freedom compiled before anything runs, then enforced while it does.

# a worker's console — every promise is enforced, every step narrated [12:01:04] ⛏ claimed d1a2b3c4 [hard] — add a player-stats page [12:01:05] 🔭 scouting the task's write scope… [12:01:09] 🗺 reserved: src/stats/*, src/routes.js # area lease — other agents now avoid it [12:01:10] ⛓ integrated 1 dependency into this checkout # its contract files are on disk first [12:01:41] ✓ [1] ollama:qwen3-coder:30b (31.2s) · wrote 3 file(s) [12:02:12] ✓ delivered d1a2b3c4 → pushed 09f1bad1 # …and on the machine that dispatched it, seconds later: ✓ integrated — commit 4c1a22e0 · post-integration gate ✓ npm test ⚠ overlap detected: calc.html had earlier work from k1 → ↻ reconcile r36e1ae2 dispatched # no human, ever

Scout + reserve — unknown-scope tasks get a cheap read-only scout that predicts their file area; every task leases its area (refs/apex/reserve/*) before writing, and overlapping leases resolve deterministically with no coordinator. Write-fences — deliveries carry durable scope trailers; out-of-scope changes are quarantined at integration, preserved, and reconciled. Contract-first ordering — interface tasks (types, schemas, stubs) complete first; dependents code against frozen contracts they cannot modify. Repo knowledge — a git-history map of hot files, co-change pairs, and seams teaches the planner where an existing codebase can actually be split. And after every merge: gates re-run, overwrites are detected by blob comparison, and failures auto-dispatch a reconcile task a capable agent claims. Read the architecture →

the live home · watch it work

Type a goal. Watch it get built.

Bare apex opens a live tmux home: a goal-pursuing REPL beside the plan, the run history, and the filesystem changing in real time. Even a free local model writes real files — apex materializes them to disk.

apex repl — type a goal, it pursues it
apex(auto)> build a tiny todo CLI with add/list and a test 📋 project context: .apex/project.md (loaded) → planned 3 subtask(s) via ollama [1] ollama:llama3 scaffold project 1.3s [2] ollama:llama3 implement add/list 2.1s · wrote src/todo.js [3] ollama:llama3 write a test (running… · p=pause, m=switch model) files written → src/todo.js · src/index.js
🎯 todo
1. scaffold project 2. implement add/list 3. write a test (running…)
📊 history
10:58 ollama:llama3 1.3s scaffold 10:59 pursuit 12.0s build todo CLI 11:01 sched reconcile drift
📁 filesystem
?? src/todo.js 2s ?? src/index.js 4s M package.json 9s
every functionality

What apex can do

Each is a real, tested command. Most exploit the fact that apex conducts many agents — things a single-agent tool can't do.

💬One chat, orchestrator decidesNEW

One input on web and CLI. Questions get answered; goals become pursuits — assigned to a free fleet machine when one is online, run locally otherwise. You never pick a mode.

🧭Best brain plans, cheap hands buildNEW

The orchestrator (classify → plan → consolidate) defaults to the most capable brain — Claude Code on opus when installed. Workers stay cheapest-first, chosen by each machine for itself.

🔭Scout + area reservationsNEW

Before writing, tasks reserve their file areas as git refs. Unknown scopes get scouted by a small local model. Two agents can't write the same files — the overlap loses the race and retries.

🚧Write-fences with quarantineNEW

Every delivery is measured against its reserved scope and labeled with durable commit trailers. Out-of-scope changes never integrate silently — they're quarantined, preserved, and reconciled.

Self-healing integrationNEW

After every merge: gates re-run in the integrated tree, overwrites are caught by blob comparison, and any failure auto-dispatches a reconcile task. Keep + reconcile, never revert — and never a human.

📜Contract-first plansNEW

Coupled work starts with an interface task that delivers the contracts (types, schemas, stubs). Dependents code against them, can't modify them, and get them on disk before they run.

🗺️Repo knowledge mapNEW

Hot files, co-change pairs, and seams mined from git history steer decomposition on real codebases: hot files get one serialized register task; boundaries follow the seams.

🛰️Fleet from the browserNEW

Register this machine as a worker in one click, flip the worker on/off with a slider, watch its console live, and see every remote task's plan and execution map — with the worker's name on each step.

⌨️Per-agent tmux consolesNEW

Each CLI agent gets its own persistent session named after it and the project (apex_claude_myapp) — set up and authorize claude/codex/agy right in the web terminal.

💾The conversation survivesNEW

Chat history persists across restarts and is shared between web and CLI — pick up in the browser exactly where the terminal left off. In-flight fleet tasks come back as live cards.

🛠️Any model writes files

Agentic CLIs edit with their own tools; text-only models emit FILE: blocks that apex materializes to disk (path-escape safe). Even ollama builds, doesn't describe.

apex(auto)> write a calculator # → leaves calc.py on disk

🖥️Live tmux home

Bare apex opens a REPL beside live todo, history, and filesystem panes — watch the plan advance and files appear.

$ apex # or: apex dash "target"

♻️Reconciliation loops

Declare a goal; apex checks desired vs actual state and converges on drift via a pursuit. The control-loop pattern, over your codebase.

$ apex reconcile "tests pass" --check "npm test"

Scheduler

Fire pursuits, reconciliations, or tasks on an interval or cron — via an in-process daemon or exported to your OS crontab.

$ apex schedule add --every 10m --reconcile "lint clean"

🧠Project-aware memory

The REPL remembers the conversation and auto-builds a project brief (reuse CLAUDE.md or generate one) that every agent receives — so stateless models stay on-context.

apex(auto)> /brief # what every agent is told

⏯️Live pursuit control

Approve the plan, then pause / step / resume / cancel a running pursuit — in the web UI or the REPL, where you can also switch model or provider mid-run.

apex(auto)> p # pause · m qwen3-coder:30b · r

🔎See the model that's running

Every subtask streams the concrete provider:model that executed it — never a bare provider. In the web UI, provider & model are two linked selects (pick a provider, get its models).

▶ [2] ollama:llama3:latest # 1045ms · wrote 1 file

🎛️Pick provider + model at launch

Launch the REPL and an interactive picker lets you choose the provider, then its model — no more silent default. Enter skips; your pick is saved as the default. Re-run with /setup. In the web UI, every plan step gets its own provider + model selects.

apex(auto)> /setup # choose ollama → qwen3-coder:30b

🎓Learns from its failures

apex mines its own run log for what went wrong — doom loops, rollbacks, rejected reviews, timeouts — and distils durable lessons that get injected into every future prompt. Model-agnostic: a codex failure teaches the next ollama run. Then apex improve patches apex itself, verified and auto-rolled-back.

$ apex advice distill # 8 lessons learned · apex improve to self-patch

The Ten Commandments

Ten named guardrails on every agent apex dispatches: no filesystem destruction, no self-destruction, no privilege escalation, no secret exfiltration, no remote code, no history rewriting, no leaving the workspace, no system tampering, no persistence, no touching its own guardrails. Each one toggleable in settings — and an agent can't toggle them itself (that's #10).

$ apex do "wipe the disk" # ⛔ blocked by commandment #1

🪟Context-window meter

Next to every task: who's working it (concrete provider:model, even when routing is auto) and how much of the model's context window is left — real token counts when the API reports them, estimated otherwise. In the REPL, the tmux TODO pane, and the web UI.

▶ [2] ollama:llama3:latest · ctx 2.1k/8.2k · 74% left

🗺️Animated execution map

The web UI's Pursue tab (now the first tab) renders the run as a live flow diagram — plan → each subtask → outcome. The executing node pulses, its inbound edge flows, and every node carries its provider:model and a context-fill bar.

🧭 plan ✓ #1ollama:llama3 ▶ #2qwen3 · ctx 74% ○ #3 ⏳ outcome

🎚️Selectable routing objectiveNEW

routing = cheapest · best · fastest. Cheapest is the provably-verified default; best starts at the strongest brain; fastest orders providers by your machine's own measured latencies. Escalation walks whichever order you chose.

💸Cost-aware routing

Always routes to the cheapest available provider — free local CLIs first, paid APIs last.

$ apex --provider ollama "write a haiku"

Verified escalation

Run cheap, check an executable gate, escalate only on failure. The cheapest model that passes wins.

$ apex --verify "npm test" "fix the bug"

🧱Composable gates

Repeat --verify — all must pass. Tests and no-secrets and lint.

$ apex --verify "npm test" --verify "gitleaks detect"

💵Dollar budgets

A hard spend cap. Escalation stops when the cap is hit; pursuits end with budget_exhausted.

$ apex --budget 0.50 --verify "npm test" "..."

🔒Enforced local-only

Provable privacy — only free local providers may run; the run records zero external calls.

$ apex --local-only "refactor this module"

🧠Learned router

A bandit over your history routes each task to the provider that wins that kind at lowest cost. Improves with use.

$ apex --learn "write a parser" $ apex db learn

🪶Auto-sized local model

Let a model decide. On ollama, a small model triages each task's difficulty and apex runs it on the smallest local model that fits - a rename goes to a 1B, a real feature to a 30B. Escalation still covers "not good enough".

$ apex pursue "rename two functions" --auto-model # trivial → llama3.2:1b

🛰️Distributed fleet

Point many machines at one repo and they become a fleet. A top model splits a goal into bounded, gated, difficulty-rated tasks; each machine claims and delivers the ones it can run on its own compute. No server - coordination lives in git refs, and claiming is a lock-free atomic ref-create. Conflicts are prevented at plan time (disjoint file boundaries), so results integrate with no merge hell. A working Concord Manifesto.

$ apex fleet plan "add three endpoints with tests" $ apex fleet work # small box grabs trivial tasks, big box the hard ones

👁️Adversarial review

Writer ≠ reviewer: a different model must approve each change before apex accepts it.

$ apex pursue "refactor auth" --review

↩️Auto-rollback

Snapshot before each step; revert any subtask that regresses the gate. The repo can only improve.

$ apex pursue "speed up hot path" --rollback

🏁Race-to-verify swarm

Fan one task to N providers in parallel; the cheapest gate-passer wins. --isolate gives each its own git worktree.

$ apex --race 3 --isolate --verify "npm test" "..."

Parallel worktree swarm

Fan a plan's subtasks out concurrently — each in its own git worktree; winners' diffs merge back onto the base tree.

$ apex pursue "scaffold models + routes + tests" --parallel 3

🔮Spec-first (TDD-as-a-service)

No tests? apex writes the verification gate from your target, then codes against it.

$ apex --spec-first "make divide() handle zero"

🛡️Bounded pursuits

Plan → execute → evaluate, capped on iterations, subtasks, and wallclock. Always reports a concrete stop reason.

$ apex pursue "scaffold a REST API + one test"

🔁Doom-loop guard + ask mode

Halts a pursuit that repeats itself; --ask confirms before any paid provider (fail-closed off-TTY).

$ apex pursue "..." --max-repeats 2 --ask

🧾Signed run receipts

A tamper-evident SHA-256 / HMAC record of a pursuit — the trust artifact for unattended runs.

$ apex receipt <id> $ apex receipt verify receipt.json

🗃️SQLite session store

Materializes the JSONL log into a queryable store via built-in node:sqlite — still zero deps.

$ apex db sync $ apex db providers

Replay & fork

Re-run a past pursuit deterministically — or fork it from any step onto a different provider.

$ apex replay <id> --from 3 --worker claude

📈ROI economics

apex stats shows what you spent and what you saved vs always using a paid model.

$ apex stats # saved $0.40 (100%) by routing

🤖CI bot

A budget-capped, auto-committing pursuit for CI; a workflow template opens a PR with a receipt.

$ apex ci "fix one failing test"

⌨️NL shell commands

Ask a model for a shell command, vet it against safety patterns, confirm, then run.

$ apex do "compress this folder" $ apex explain "tar -xzf x.tgz"

🖥️Web UI + REPL

A local control panel with a real PTY terminal, plus the goal-pursuing REPL.

$ apex serve # 127.0.0.1 by default
new in 0.2 · control plane

Declare a goal. Keep it true.

Reconciliation is the Kubernetes-controller pattern over your codebase: observe actual state, compare to the goal, and converge on drift. Schedule it and apex becomes a standing controller that checks whether other workers achieved the goal — and self-heals when they didn't.

DECLAREgoal + check OBSERVEcheck ↦ exit code · repo EVALUATEmet? gaps? CONVERGEpursuit on drift met ✓ → done, no action on a schedule (--every / --cron / daemon / crontab) → keep checking $ apex schedule add --every 10m --reconcile "tests pass & lint clean" --check "npm test"
under the hood

The bounded pursuit loop

A planner decomposes; workers execute (gated, escalated, files written); the evaluator decides done — within hard caps.

PLANdecompose → subtasks EXECUTEgate · escalate · write files EVALUATEdone? next? loop until: done · no_next · max_iterations · max_subtasks · total_timeout · budget_exhausted · doom_loop every step → .apex/log.jsonl → apex stats · apex db · apex receipt · live tmux home
shipped · parallel swarm

Agent swarm — externalized

Where Kimi K2 bakes orchestration into model weights (opaque, server-side), apex keeps it external, heterogeneous, and auditable — real vendors in isolated git worktrees, winners merged back.

ORCHESTRATOR ollamaworktree #0 agyworktree #1 claudeworktree #2 codexworktree #3 MERGE + VERIFY → receipt
free localfree-tierpaidpaidreal vendors · not clones · provable independence
functionality-wise

apex vs opencode & the others

apex isn't trying to be the best instrument — it's the layer above them. (It runs opencode as a provider.)

Capabilityapexopencodeclaude codeaider
Cost-aware multi-provider routing
Uses other agents as providers
Verified escalation (gate → climb cost)
Hard dollar budgets
Enforced local-only / privacy
Learned router (improves with use)
Adversarial cross-model review
Auto-rollback on gate regression
Parallel race / swarm (isolated worktrees)
Scheduled reconciliation loops
Live dashboard (plan · history · fs)
Signed, tamper-evident receipts
ROI / savings reporting
Doom-loop / runaway guard
SQLite session store
Bounded autonomous loop
MCP client◐ planned
LSP integration○ skip
Zero runtime dependencies

● full   ◐ partial / different shape   ○ none. apex's wedges (escalation, budgets, learned router, receipts, swarm, reconciliation, ROI) are things a single-agent tool architecturally can't do; the table-stakes it lacks (MCP, LSP) are deliberately deferred or skipped.

roadmap

Nine phases all shipped + the control plane

Phases 1–9 are built & tested; 0.2 adds materialization, the live tmux home, and the scheduler + reconciliation control plane. Next: MCP & a Models.dev registry.

phase 1 ✓
Verified escalation
ladder + gate + receipt-trail
phase 2 ✓
Capability policy
local-only · max-cost · budget
phase 3 ✓
Quality & autonomy
review · rollback · race · spec-first
phase 4 ✓
Replay · CI · ROI · materialize
fork runs · ci bot · savings · files
phase 5 ✓
Hardening
doom-loop · ask · worktree isolate
phase 6 ✓
Store + receipts
node:sqlite · signed receipts
phase 7 ✓
Learned router
UCB-with-cost bandit · the moat
phase 8 ✓
Live home + memory
tmux dashboard · project briefs
phase 9 ✓
Control plane
scheduler + reconciliation loops
phase 10 ✓
One-chat front door
orchestrator decides · fleet from the browser
phase 11 ✓
Conflict-free fleet
scout+reserve · write-fences · self-healing merges
next
Scale-out planned
multi-worker hosts · learned decomposition · semantic merge
365
passing tests
0
dependencies
9
providers
100%
saved vs always-paid*

* on an all-local-model history; your savings depend on your task mix.

get started

Install in 30 seconds

Needs Node ≥ 24 and at least one provider — a CLI agent on your PATH, or an API key. tmux unlocks the live home.

$ git clone https://github.com/greg4fun/apex.git && cd apex $ ./install.sh # or: npm link — exposes the `apex` command $ apex providers # see what's available $ apex # opens the live tmux home — type a goal, watch it build