Model-agnostic orchestration engine
We are many.
We move as one.
Legion is the model-agnostic execution layer for AI agents. It routes a unit of work to a capable executor, runs it isolated, meters it, produces evidence, and learns from the outcome. Today, Claude Code, Codex, Cursor, opencode, DeepSeek Harness, Hermes, and Pi are its coding executors.
Seven harnesses. Ten core plugins. One evidence contract. Runs stay inspectable from route decision to final hint.
curl -fsSL https://github.com/Opus-Aether-AI/legion-core/releases/latest/download/install.sh | bashLive run
Watch it work.
One request becomes a plan, routed slices, isolated changes, an independent review, and a validation record. This illustrative session follows the current routing policy and stops at a pull request you control.
add end-to-end multi-tenant org isolation to the API — org_id on every model, a deny-by-default guard on every resolver, a backfill migration, and an isolation test suite. then open a PR. Big one — it touches the schema, the request context, and every resolver, and it's security-sensitive. I'll take it through Legion: plan and grill the intent, fan the slices across the cohort in parallel, cross-verify, self-heal anything that fails your gates, then stop at a PR you approve. First — how wide is this? A scope guard is only safe if it covers every read. Here's the verified diff: the deny-by-default guard, and the resolver that leaked, failed your tests, and self-healed onto gpt-5.6-sol: GPT-5.6 Terra handled the scoped implementation, Luna took the bounded seed work, and Sol healed the failed security slice. Claude Opus 5 planned and signed off. Cursor Grok 4.6 High supplied an independent second opinion. Every slice was cross-verified. The leak was caught by your own tests and rerouted automatically. Nothing shipped on one model's say-so. Done — a verified PR: 9 slices, +884 −90, 412 tests green (28 new isolation specs), one cross-org leak caught and self-healed, $2.05 metered across four models. Yours to review and merge.
A heavy task becomes a proof trail.
Legion runs the execution loop and records what each stage decided. Model output is an input to validation, never the success signal by itself.
Inspect
Doctor checks the installation and the planner loads bounded lessons from earlier runs.
Plan
The goal becomes explicit slices with dependencies, scopes, gates, and review intent.
Route
Each slice resolves once to an executor, model role, sandbox, effort level, and fallback chain.
Execute
Ready slices run concurrently in isolated worktrees. Dependencies release as their own prerequisites finish.
Prove
Legion integrates in stable order, runs review, validation, evaluation, and writes JSON and HTML evidence.
Learn
Outcomes become bounded, typed hints for later runs. Source changes remain review-only proposals.
The merge remains yours. Legion can prepare a draft improvement PR, but it does not merge or deploy it.
One layer. Seven coding executors today.
Legion does not replace the tools your team already uses. It gives its current coding executors a shared execution contract, trace format, artifact model, and learning loop.
Current coding executors
legion-core
Ten released plugins
Durable output
legion-code layers a larger catalog onto the engine without changing the execution contract.
The long run
Long runs need boundaries, not confidence.
Legion gives each slice a sealed base, a narrow task, a sandbox, a budget, and a terminal record. Failed prerequisites block their dependants. Cancellation reaps descendant processes. Integration order stays stable even when workers finish in a different order.
A long run should leave artifacts and decisions, not a mystery diff.
The engine
Core stays small enough to embed and strict enough to trust. Ten plugins cover routing, execution, orchestration, evidence, setup, code intelligence, and harness-native operating modes.
Isolated delegation
Claude, Codex, Cursor, opencode, DeepSeek Harness, Hermes, and Pi workers receive a bounded task in a separate worktree. The parent decides whether to apply the diff.
Evidence and telemetry
Every unit of work emits a legion.span.v1 record with executor, model, timing, tokens, cost when available, trace lineage, and artifact paths.
Typed memory
The learner mines spans, review verdicts, benchmark misses, session corrections, and manual outcomes into bounded hints with provenance.
Review-only improvement
Doctor findings and typed proposals can enter an isolated repair lane with repeated gates and independent review. Draft mode opens a PR and stops.
Deterministic fanout
A completion-driven scheduler releases dependants as soon as their own prerequisites finish, then integrates results in stable input order.
Configured code intelligence
TypeScript and Pyright diagnostics run only for configured projects, share one adapter deadline, and emit bounded machine-readable artifacts.
One command runs the whole lifecycle.
legion-run enforces a fixed proof loop for any heavy task, direct or through a domain plugin. It learns at both ends: past lessons feed the plan, this run's lessons feed the next.
legion-run --repo . --task "..." --validate-command "npm test && npm run build" --jsonThe multi-model brain. Routes each slice to the cheapest capable model, runs it isolated, and meters the outcome.
See everything and close the loop. Telemetry in dollars, doctor, benchmarks, share accounting, self-learn, heal.
Dependency-aware planning, parallel fan-out, cross-verification, and synthesis for larger goals.
The enforced lifecycle: doctor → plan → route → fan-out → review → validate → evidence → learn → heal.
Cross-harness installation, managed repo policy, shared skills, and executable bridges.
The mirror. When Legion runs under Codex, hand the hard calls up to Claude via legion-claude.
Native opencode routing guidance with the same isolation, telemetry, and review contracts.
Metered Hermes delegation guidance for bounded coding and domain-agent work.
A released Legion core component.
A released Legion core component.
Repo-native TypeScript / Pyright diagnostics on changed files, emitted as metered Legion artifacts and spans.
runs on
Claude Code · Codex · Cursor · opencode · DeepSeek Harness · Hermes · Pi
one legion-setup installs the marketplace, bridges, and CLIs across each selected harness. Daily refresh is opt-in.
- doctor
$legion-doctor - planslices.jsonl
- route → fan out · apply
$legion-route$legion-fanout$legion-delegatecodex · gpt-5.6-terraimplements · workspaceclaude · claude-opus-5judges · read onlycursor · cursor-grok-4.6-highchecks · plan mode - review · cross-model
- validate · evaluatetests · build · eval
- verified PR
$legion-report$legion-share
- self-learnmines this run — lessons out
$legion-self-learn - heal-plandrafts the fixes
$legion-heal - memorythe lessons ledger
- self-learn-hintsfeeds the next plan — lessons in
$legion-self-learn hints
It remembers what actually happened.
The learner advances verified byte cursors through local evidence, links outcomes to the narrowest catalog entity it can justify, and compiles only trusted active hints into the next stage.
spans · reviews · evals · sessions
Collect bounded evidence
Legion reads appended telemetry and manual outcomes incrementally. Session mining is capped, provenance-aware, and redacted by default.
Privacy
Counts and hashes by default. Evidence text stays local and opt-in.
Capacity
Project caps, expiry, retirement, and explicit rejection keep context small.
Authority
Memory guides a run. It cannot merge, deploy, or mutate source on its own.
Route by role. Resolve once.
Routing policy maps an archetype to a semantic model role, executor, sandbox, effort, and fallback. A slice carries that immutable decision through execution and into routes.json.
Evidence over intuition.
The last number here came from a saturated tier, where every model passed everything and cost was the only signal left. DeepSWE is not that: 113 original, contamination-free repository tasks, and the best model on its public leaderboard scores 74%. Legion solved 12 of 20 across two runs of the same ten tasks, at $1.39 a task. The two runs disagreed about four of those ten — which is the more useful number, and the reason the one above it should not be quoted on its own.
DeepSWE · 2 × 10-task seeded subset · 2026-08-26
Two runs, same ten tasks, seed 0, one attempt each: 7/10 and 5/10. Four tasks flipped between them on identical code, so at this sample size pass@1 measures run-to-run variance more than it measures the harness — which is exactly why the public leaderboard runs all 113. We are publishing the combined 12/20 rather than the better draw, and the 95% interval (39–78%) overlaps every model on that board, so this ranks nothing. The costs are not measured the same way either: $6.46 is the leaderboard's API price across all 113 tasks, while $1.39 is Legion's own accounting at published token rates on a subscription account that is not billed per token. Directionally real, not like-for-like. Two tasks failed in both runs, and one of them fixed its target tests while breaking 51k passing ones — a failure a pass rate alone would hide. The full 113-task run is the number worth quoting, and we will publish it when it exists.
Two ways to run it
Yours to run. Or ours to run with you.
Open source
free foreverInstall it, connect your own model accounts, and own the whole stack. Legion runs locally with no Legion cloud. The core is Apache-2.0 and available on GitHub and npm.
Enterprise
run with usRun Legion inside your environment, gated by your standards, your Sonar and quality gates, your guardrails, with us on the line and an SLA. Or we build your domain agent on it.
The moat
Your agent. Our spine.
Build your domain agent on legion-core. Vendor the engine into your repo, and it stays fresh, gated, and accountable, while your domain stays yours.
"plugins": [
{ "name": "legion-router", "source": "git-subdir" },
{ "name": "legion-observability", "source": "git-subdir" },
{ "name": "trading-desk", "source": "./your-domain" }
]
$ legion-doctor
✓ marketplace · ✓ skills · ✓ codex bridge · ✓ cursor bridge · 0 findings
#212 chore: weekly legion-core refresh, the spine updates itself
Vendor the engine
One marketplace entry pulls the spine in. The engine stays ours to maintain; your domain stays yours.
It stays fresh
A weekly refresh PR updates the engine like any dependency. Review, merge, move on.
Gate everything
legion-doctor runs in CI and refuses to ship a broken garrison: skills, bridges, schemas, auth.
The engine is open source.
The business is accountability.
Enterprise is for teams who want to run it with us. We onboard your harnesses, design your routing policy, and hold the SLA. Or, we build your domain agent on legion-core.
Contact ai@opusaether.com