Research

Rust harness wars: grok-build vs codex

We cloned xAI's grok-build and OpenAI's codex and read both line by line, twenty subsystems each, to see where two labs building the same coding agent actually diverge.

Two of the most capable terminal coding agents in the world are written in Rust, ship as a single binary, and were open sourced within months of each other: xAI's grok-build, the grok CLI, and OpenAI's codex. We cloned both and read them line by line, roughly a hundred analysis agents across twenty subsystems, to answer one question. When two labs build the same tool, where do their instincts actually diverge?

The uncomfortable starting point is in grok-build's own THIRD-PARTY-NOTICES. It ports tool implementations from openai/codex and sst/opencode. This is not a clean room rivalry. It is a descendant remixing its ancestor, which makes the places they differ all the more revealing.

One skeleton, two instincts

Read side by side, the two agents share a near identical skeleton. A single session actor sits behind a typed message boundary. One binary wears many thin faces: an interactive terminal UI, a headless exec mode, and an editor server. The core loop is the same, sample the model, run the tools it asks for, repeat until it stops. Both persist an append only log as the durable source of truth, both compact the conversation when the context window fills, both can resume and fork a session.

So the interesting part is not the shape. It is what each team refused to compromise on once they had it. Codex subtracts. grok-build reaches.

SHARED TRUNKSession ActorAppend-only LogCODEX (SUBTRACTIVE)Single 1st-Party WireReasoning KnobDETERMINISTIC PERIMETER3-Platform SandboxLocked History LogGROK-BUILD (REACHING)ACP Leader DaemonWarm Client MultiplexCOMPOUNDING CONTEXTTree-sitter + Memory3-Provider FanoutRUST

Codex subtracts

Codex is the work of a team that owns its model and optimizes for control, safety, and a small surface. Its instinct is to delete optionality. It removed the older chat wire protocol so there is exactly one path to the model. It dropped temperature and top-p sampling in favor of a single reasoning effort knob. It refuses to be a provider marketplace, shipping only a short list of first party backends.

That focus buys depth on the surfaces that actually bite. A three platform sandbox built from source for determinism. A policy engine with per turn, feature gated tool planning. An approval and escalation layer wrapped around every command the model runs. A review enforced rule that the model visible history is sacred and is never rewritten. Codex reads like a platform team building for a fleet of machines it will never see.

LAYER 3: OS KERNEL SANDBOX (Seatbelt / Landlock / AppContainer)LAYER 2: POLICY ENGINE & APPROVAL ESCALATIONModel Reasoning CoreSacred Model History (Zero In-Flight Rewrites)PASSED: In-Bounds Read

grok-build reaches

grok-build is more architecturally ambitious and, in places, less finished. It deleted nothing and reached further. A machine wide leader process serves many warm clients over the Agent Client Protocol, the emerging cross vendor standard, used here as the internal wire rather than a bolt on. A provider agnostic sampler fans out to three different model protocols, so adding a provider is config, not code. Memory is a real subsystem, markdown files indexed for retrieval rather than a grep over past turns. It ships a tree-sitter code graph for structural navigation, and session memory that compounds across runs.

This is the topology of a tool designed to live inside other people's environments and outlast any single model. grok-build hedges against lock in the same way codex hedges against untrusted machines.

MACHINE LEADER DAEMONTree-sitter Code GraphIndexed Markdown MemoryCross-Client Context HubACP WIRE DISPATCHERInteractive TUIHeadless CLI ExecEditor Server (LSP)xAI Grok APIOpenAI ProtocolAnthropic API

The scorecard

Across the twenty subsystems we compared, codex holds the stronger design on eleven, the two are a genuine toss up on eight, and one is a tie. grok-build does not win an axis outright, and the reason is honest. codex is a mature, upstream product. grok-build is a v0.1 alpha, and it shows.

But the eight toss ups are where the ambition pays off. Broader model support, memory retrieval, the editor protocol, cloud execution, and exact cost accounting are all places where reaching further produced a genuinely different, sometimes better, answer. A tally that reads eleven to nothing on paper is really a story about maturity racing ambition.

11 Codex Advantage8 grok-build Toss-ups1 Direct Tie
SubsystemVerdictArchitectural Analysis
Sandboxing & IsolationCodexCodex ships 3-OS source-built sandbox (macOS/Linux/Windows). grok-build covers 2 OS.
Safety & Policy GatesCodexCodex enforces per-turn feature gates and escalation prompts. grok-build safety hooks fail open.
Model Protocol MultiplexingToss-Upgrok-build cleanly dispatches between OpenAI, Anthropic, and xAI. Codex locks to first-party wire.
Agent Client Protocol (ACP)Toss-Upgrok-build adopts emerging standard ACP for cross-vendor client-daemon architecture.
Memory & State CompoundingToss-Upgrok-build indexes markdown files for retrieval. Codex replays and compacts raw transcripts.
Code Graph & Tree-SitterToss-Upgrok-build includes native Tree-sitter AST navigation crate for repository structural maps.
Skill InteroperabilityToss-Upgrok-build consumes Claude and Cursor SKILL.md folders without manual conversion.
Skill Depth & CapabilityCodexCodex skills are full executable packages with unit test scripts and UI metadata.
Tool Governance MiddlewareCodexCodex wraps execution in strict platform policy guards and validation middlewares.
Transcript IntegrityCodexCodex enforces immutable, unrewritten model history for reproducible audits.
Configuration HardeningCodexCodex embeds cryptographic signing keys. grok-build signing is inert in v0.1.
Headless Execution EngineCodexCodex headless CI runner is deterministic and battle-tested.
Cost & Token AccountingToss-Upgrok-build maintains precise per-turn token and dollar ledgers across mixed backends.
Editor Server IntegrationToss-Upgrok-build integrates natively as an ACP language server.
Error Recovery & ContinuationCodexCodex has sophisticated loop detection and automatic circuit breaking.
Terminal UI (TUI) SafetyCodexCodex TUI is 100% safe Rust. grok-build uses raw pointer casts.
Release Packaging & PortabilityTieBoth compile into single static standalone Rust binaries with zero external runtimes.
Prompt Pruning & CompactionCodexCodex aggressive context compaction preserves reasoning trajectory.
Cloud Execution WireToss-Upgrok-build daemon topology enables remote headless worker handoffs.
Telemetry & ObservabilityCodexCodex structured event traces enable end-to-end replay verification.

Skills, memory, and tools

On skills, both adopt the same SKILL.md convention with progressive disclosure, only a name and description in context until a skill is actually opened. grok-build optimizes for interoperability, reading Claude and Cursor skill directories unmodified, so an existing library just works. codex optimizes for depth, where a skill is a folder with scripts, references, and UI metadata, a richer unit of capability.

On memory, codex keeps the raw transcript and rebuilds from it. grok-build runs a dedicated crate that persists human editable markdown and indexes it for retrieval. On tools, codex splits a tool into a model visible spec and an execution runtime with a whole governance middleware on top. grok-build models tools as a strict three crate contract, cleanly separated but lighter on the safety layer. The same pattern repeats everywhere. codex builds the deeper machine, grok-build builds the more portable one.

CODEX LAYER STACKExecutable Capability Package• Folder bundle with test fixtures & scripts• Strict sandboxed subprocess execution• Deep governance middlewareGROK-BUILD LAYER STACKUniversal Interoperability• Reads Claude and Cursor SKILL.md directly• Zero manual translation into repos• Lean 3-crate modular design

The alpha tax

grok-build's reach comes with a bill, and reading the source makes it concrete. A configuration signing subsystem ships with two thousand lines of tests but no embedded public keys, so it is effectively inert. Hooks fail open, which means a crashed safety hook silently stops enforcing. The sandbox covers two platforms where codex covers three. There is an unsafe pointer cast in the terminal UI guarded by hand rather than by the type system.

None of this is fatal for an alpha, and most of it is the ordinary signature of a young project whose threat model thinking has outrun its shipped hardening. But it is the price of building the more ambitious thing before the more finished one.

Inert Config SigningSecurity Deficit
2,000 lines of test fixtures with zero embedded public root keys in shipped binaries. Signature enforcement passes vacuously.
Fail-Open Safety HooksPolicy Risk
If an external security pre-hook panics or crashes, execution continues unchecked instead of aborting the turn.
2-OS vs 3-OS SandboxingCoverage Gap
Covers macOS and Linux only. Windows developer environments execute unsandboxed (Codex provides AppContainer isolation).
Unsafe TUI Pointer CastRust Invariant
Manual pointer casting in terminal event handling loop, relying on developer discipline rather than the borrow checker.

Why we care

Reason is a company built around agent harnesses, so reading two of the best in the world from the inside is not idle curiosity. The lesson is the one we keep relearning. The model is a commodity you rent. The harness is the product you own. Codex and grok-build are two credible bets on what that harness should be, one subtractive and safe, one additive and portable, and the gap between them is the whole game.

How this was built

Both repositories were cloned and read from source, not from documentation or memory. A multi agent workflow fanned out roughly a hundred analysis agents: architecture mappers, forty subsystem readers running one per repo across twenty dimensions, twenty head to head comparators, and a synthesis panel, each returning a schema validated analysis. Maturity and edge calls are judgments from the code as read, not vendor claims. grok-build at v0.1.220 alpha, codex at current main.

Authors

Reason Machines