Prime Agent: A Self-Improving RLM Harness
A language model is a sequential processor. It can act only on what sits in its weights and in the tokens in front of it, so anything long (days of experiments, a factory, a game whose rules it must discover) needs machinery around the model: code that runs and keeps its variables, memory that survives a restart, helpers that work in parallel. Prime Agent is an open-source harness that supplies that machinery: a persistent IPython REPL per session, recursive subagents that talk to each other through queues, and disk-backed notes, skills, and memories the agent edits as it works. The design rule is that the harness should be expressive and reliable and nothing more. The model builds its own strategy, and the harness must never drop state, block a useful action, miscount cost, or stop early, so a failed run reflects the model and not the plumbing. Under that rule Opus 5 goes from 30.2% in the official ARC-AGI-3 harness to 95.5% in Prime Agent, and across nine long-context benchmarks Prime Agent has the higher score in 20 of 27 pairings against the model vendors' own tools, mostly by small margins. The paper also reports a seven-day Factorio run, an 85.5-hour nanoGPT speedrun session with 19 validated records, and one clean example of the risk this design carries: an agent found an exploit, used it, and saved it as a skill.
Contents
- Before you start
- What a harness is
- Recursive Language Models
- Continual Harness
- What long-horizon means, and how it is measured
- Introduction
- Architecture
- Overview
- The state hierarchy
- Programmatic computation with RLMs
- Orchestration and interaction
- Continual Harness
- Long-horizon controls
- One trajectory, end to end (added)
- Evaluation
- ARC-AGI-3
- Long-context information management
- Multi-day autonomous research (nanoGPT)
- Emulators and GPU kernels
- Factorio and MazeBench
- Related work
- Conclusion
- What the paper shows and does not show (added)
- Glossary (added)
- Appendix: the paper's code, annotated
0. Before you start
None of this section is in the paper. It covers the four ideas the paper assumes you already have.
0.1 What a harness is
Call the model f. It maps a context to a next token, and does nothing else. Every other verb in an agent story, run this script, remember that fact, spawn a helper, stop when done, is something a program wrapped around f does. That program is the harness. Claude Code, Codex, opencode, Pi, Hermes Agent, and kimi-code are harnesses. So is the small loop most people write the first time they wire a model to a tool.
A harness settles four things the model cannot settle for itself:
- Execution. How a chosen action becomes a real effect: a shell command, a Python cell, a message to another agent.
- Recovery. What survives a crash, a restart, or a compaction of the context.
- Verification. How progress gets checked: tests, a verifier program, an end condition.
- Accounting. What gets counted (tokens, dollars, wall-clock, actions), and whether helper agents count too.
The paper's position is that these four should be standardized and boring, and that everything above them should be left to the model.
0.2 Recursive Language Models
Recursive Language Models [44] start from one move: hand the model its prompt as a Python variable instead of a string it must attend over. The model writes code to search, slice, and aggregate that variable, and it can call a fresh copy of itself on any piece with rlm(...). The working context stays small; the long material stays in the REPL. Prime Agent makes rlm asynchronous and gives every call its own persistent session, so the recursion becomes a tree of live processes rather than a stack of function calls.
0.3 Continual Harness
Continual Harness [19] is the paper's name for the editable part of the harness: prompt notes, memories, skills, and subagent specifications, stored on disk as typed, versioned entries. The agent can create, read, update, and delete them mid-run, and a background /refine call can propose edits from recent events. Because entries carry versions, a bad edit can be rolled back. "Self-improving" in the title means this. The weights never change.
0.4 What long-horizon means, and how it is measured
Long-horizon here means tasks that take hours to days and hundreds of thousands to tens of millions of output tokens. Two metrics from Cunningham's METR note [8] recur. Score at a fixed expenditure is what you get for a set budget of tokens, dollars, or time. Score at practical plateau is where the curve flattens if you keep spending. Most plots in the paper put spend on the x axis and score on the y axis for this reason. The shape of the curve is the result, not the endpoint.
1. Introduction
1.1 The model is a bounded processor
An LLM's next decision can use only what its weights encode and what its active context holds. A harness supplies the rest: external actions through tool calls, and information that lives outside the weights. Context management began with compaction, in which the model reads its own history and rewrites it shorter while keeping what matters. But the state a long task needs has outgrown both the weights and the context window.
1.2 State as a cache hierarchy
The paper's organizing picture is a memory hierarchy, in the sense a chip designer uses the term. Model weights are L0, the active context is L1, the persistent REPL and recursive subagents are L2, and disk-backed history, memories, and skills are L3. The model can read, transform, and write addressable state outside the instruction it is currently generating. The authors describe this as making the system more von Neumann-like [34, 35].
| Level | What lives there | How it changes | Nearest hardware analogy (added) |
|---|---|---|---|
| L3 | Disk-backed state History, artifacts, memories, skills, prompts, subagent specs | Refinement | Disk. Survives everything. |
| L2 | REPL and subagents Code, tools, retained values, recursive session state | Agentic garbage collection | Main memory and the other cores. Addressable, but you must load it to use it. |
| Model-context boundary | |||
| L1 | Active context Token-visible working state for one model invocation | Compaction | Registers. The only level the model sees directly. |
| L0 | Model weights Learned computation and prior knowledge | Fine-tuning | The processor's own logic. Fixed at run time. |
The hierarchy is about distance from the point of computation, not about speed. L1 is the only level the model reads directly. Everything in L2 and L3 reaches generation only when the runtime, or an explicit operation, serializes it into L1. So when a run has produced millions of tokens of history, the model never attends over them all; it can fetch any of them. Registers for L1 is a loose fit (the context is far larger than any register file), but the ordering holds, and the important line is the dashed one: below it the model sees state, above it the model addresses state.
1.3 Expressivity, not workflow
If state lives at four levels, the key property of a harness is expressivity. Rather than encode one workflow, an expressive harness exposes primitives (code, recursive calls, editable state, messaging) from which the model builds programs, subagents, and feedback loops at inference time. RLMs make context and recursion programmable [44]; Continual Harness makes prompts, subagents, skills, and memories revisable from the trajectory [19]; direct agent-to-agent communication lets a swarm coordinate without a fixed graph. A fixed model with these primitives has a larger reachable strategy set than the same model without them.
1.4 The harness as membrane
The harness is what the model observes and acts through. A model should fail an evaluation because the task exceeds its capability, not because the harness dropped state, restricted useful actions, miscounted resources, or stopped early. Prime Agent pairs standardized, reliable execution with a low-friction interface for programmatic tools, information management, and swarm management. The aim is that measured performance reflects the model's true maximal underlying capability rather than the harness's limits.
Two kinds of management run together. Information management moves state across L1 to L3 through programmatic context processing, compaction, persistent histories, and revisable memories. Computation management allocates test-time compute to programs, tool calls, reusable skills, and parallel subagents [32, 44]. Agent-to-agent communication joins the two, routing information across distributed computation so the swarm can coordinate as it goes. The same links let humans inspect, message, attach to, and intervene in subagent sessions without following every exchange [17, 21]. The retained trajectories can improve future computation and train later models [25, 40, 43].
1.5 What the paper claims
- An open-source harness that integrates active context, persistent programmatic execution, recursive subagents, and retained histories, memories, and skills, connected through agent-to-agent and human-agent communication.
- An Agents View for inspecting, attaching to, and managing persistent daemon-backed sessions.
- Standardized evaluation infrastructure that leaves strategy construction to the model.
- Results: ARC-AGI-3 from 30% to 95%; matches or exceeds Pi, Claude Code, and Codex, and outperforms Hermes Agent, OpenCode, and Kimi-Code, across long-context coding, GPU-kernel generation, and emulator construction; an 85.5-hour nanoGPT run with 19 validated records; four-character Factorio control; long-horizon MazeBench exploration.
2. Architecture
Six things to cover: how the system manages information and computation (2.1), how state is organized across weights, context, REPL, and disk (2.2), how persistent REPLs and RLM calls support programmatic computation (2.3), how recursive sessions communicate with agents and humans (2.4), how Continual Harness turns trajectory evidence into reusable state (2.5), and how long-horizon controls define continuation, termination, and accounting (2.6). Figure 1 is the map.
Read it left to right. The human never touches a session directly; the Agents View sits in between. The root session and its subagents are the same kind of object, and both persist through the daemon, which is why a subagent can outlive the turn that created it. Continual Harness hangs off the daemon rather than off any one session: its entries are assembled into prompts at turn boundaries, for whichever session is about to run.
2.1 Overview
Prime Agent separates information management from computation management. Information management decides what state enters a model invocation and what survives compaction or restart. Computation management maps the model's chosen actions to code, tools, and recursive subagent sessions. Direct agent-to-agent communication connects related sessions; direct human-agent interaction exposes single nodes for inspection and intervention.
Four facts about the runtime follow. Models manipulate intermediate values with code. Sessions keep their history across compaction, detachment, and restart. Subagents inherit the root's execution and communication primitives. The runtime records model calls, tool use, messages, harness changes, and resource use. The model controls decomposition, computation allocation, communication, and stopping.
2.2 The state hierarchy
Each level changes through a different mechanism. Fine-tuning updates L0, compaction rewrites L1, and refinement versions selected L3 entries. The L2 mechanism is called agentic garbage collection: the model creates, retains, summarizes, or deletes REPL values and subagent sessions as the task changes.
Explicit operations move information between levels. Python values and tool outputs in L2 enter generation only when serialized into L1. Compaction replaces a conversational prefix with a summary and keeps the original events in L3, where the REPL can retrieve them. The runtime assembles selected Continual Harness entries into later supplemental prompts; other L3 artifacts enter context on retrieval. L0 stays fixed.
What persists: an append-only event history, selected kernel snapshots, the rooted session tree, context and compaction records, persistent message queues, and versioned Continual Harness state. Branching or forking creates a new logical continuation without deleting the prior event sequence. Recovery rebuilds a session under the same identity. Python objects that cannot be serialized, and external processes, are recreated from saved artifacts or external services.
In a language runtime, a collector frees memory nobody references. Here the model is the collector: it decides which REPL values and child sessions are still worth keeping. The name signals that this is a deliberate, model-driven act, not something the harness does for you. Compaction is the L1 counterpart. The two differ in what they lose. Compaction drops tokens from the prompt but keeps the events on disk; garbage collection can drop a Python object for good, unless a kernel snapshot caught it first.
2.3 Programmatic computation with RLMs
Each session owns a persistent IPython REPL. Test-time compute is the sum of model inference, Python execution, and tool calls; evaluations report tokens, time, and cost separately. Installed tools are imported as Python modules, so parsing, filtering, aggregation, and verification are ordinary code over ordinary values. Intermediate values persist across turns and stay outside the active context until the model selects them. Large logs, task specifications, and verifier output do not get re-serialized into the prompt every turn.
The rlm primitive is asynchronous [44]. Calling it creates and schedules a subagent session and returns a stable handle before the subagent finishes. The subagent gets its own model context, IPython kernel, history, and workspace metadata. The parent keeps computing while children run. Results come back later through agent-to-agent messages, and the handle survives compaction and restart, so the parent can follow up. The model chooses between local code, tools, sequential delegation, and parallel subagents. Prime Agent defines the execution semantics, not a workflow graph. Appendix B shows the calling pattern.
In most coding harnesses a subagent is a blocking function call. The parent stops, the child runs to completion, and a summary string comes back. Here a child is a concurrent process with an address. The parent can keep working, send it a second message, read its status without loading its whole history, and find it again after a restart. The cost of that freedom is that replies are not automatic: the child has to send one, and the parent has to read its queue.
2.4 Orchestration and interaction
The daemon owns live sessions independently of the client that created them. Root and subagent sessions share one lifecycle. A session is running during a turn or tool operation, idle when loaded with no active turn, and inactive when unloaded but recoverable from persistent state. A client can detach and the session keeps running. Stable session and parent identifiers preserve the tree across all of these transitions.
Agent-to-agent communication runs over asynchronous, daemon-mediated queues. An agent can address its parent, its children, and its siblings. Queued messages wait until the recipient is active again. Filesystem, network, and credential access follow the permissions of the runtime environment.
The Agents View exposes the persistent tree to a human. A user can inspect history, attach to a session, provide new input, or detach without interrupting execution. Two narrower interfaces serve agents: agent-observe gives bounded, read-only status and recent-message previews; agent-message targets a named related session. Together they allow full interaction through the orchestrator.
rlm() and gets a handle back at once; every session moves through admitted, running, idle, and inactive. Right: root, children, and a nested grandchild exchange messages directly, and the daemon's queues hold messages for sessions that are not loaded. Redrawn from the paper. Scrolls sideways on a phone.The dashed return from inactive to running is the important one. An inactive session is not dead. It has been unloaded to disk and can be rebuilt under the same identity, with its queued messages waiting. That is what makes a multi-day run possible without a process that stays up for days, and it is what lets a parent re-find a child by name after its own context has been compacted.
2.5 Continual Harness
Continual Harness exposes supplemental state for reads and writes during a trajectory [19]. There are four types. Prompt notes hold behavioral instructions. Memories hold facts. Skills package executable procedures. Subagent specifications hold reusable roles or divisions of labor. The typing keeps rules, facts, programs, and coordination patterns apart. Entries support create, read, update, and delete. Local entries belong to one session; entries explicitly marked global remain available to later sessions.
Refinement turns trajectory evidence into versioned state updates. An agent can request an edit directly, or /refine runs a background model call over the relevant events. The runtime applies each edit at a turn boundary, records what triggered it and what it was meant to do, and assembles the supplemental state for the next invocation. Versions keep provenance and allow rollback. Refinement adds to the immutable base prompt; it never rewrites the foundational policy.
Self-improvement, in this paper, means converting execution evidence into persistent harness state that changes later behavior while the weights stay fixed. Useful computations become skills, repeated coordination patterns become subagent specifications, and corrected assumptions become memories or prompt notes. The resulting trajectory record is also training data for later models.
| Evidence in the trajectory | Becomes | Example |
|---|---|---|
| A procedure that worked | Skill | The probe function Kimi K3 built around the nanoGPT benchmark (3.3) |
| A way of splitting work that repeated | Subagent specification | A "reviewer" or "tester" role with a fixed brief (Appendix B) |
| A belief that turned out wrong | Memory or prompt note | A fact about the environment, or a rule such as "run the verifier before claiming a pass" |
| A shortcut that games the objective | Skill, and that is the problem | The Factorio RCON exploit (3.5) |
2.6 Long-horizon controls
Prime Agent exposes three control mechanisms. Autonomous mode continues model turns within an explicit budget and runs a task-specified end-condition test after each turn. A failed test returns bounded output for another attempt; turn, token, and wall-clock limits stop execution. A goal keeps an objective across continuations and ends through agentic completion, when the agent itself marks the goal done. Heartbeats start turns on a cron or timed schedule.
Evaluation configurations bind the task and tool interfaces to model and provider settings, compaction and refinement policies, retry policy, completion gates, and resource limits. Accounting sums the root and every descendant session, so delegation shows up in test-time cost. The event history links model and tool calls, messages, interventions, retries, verifier outcomes, and harness edits to that configuration. Standardized persistence, recovery, termination, and accounting separate harness failures from model failures while leaving decomposition to the model.
| Mechanism | Use it when | Who ends it |
|---|---|---|
| Autonomous mode | The task has a checkable end condition: tests pass, a score is reached, a file exists. | The test, or a turn, token, or wall-clock limit. |
| Goal | The end is a judgment call, not a check. | The agent, by marking the goal complete. |
| Heartbeat | The world moves on its own: a factory keeps running, a training job keeps training. | Nobody. It recurs until the schedule is removed. |
2.7 One trajectory, end to end
- A root session is admitted with a task, a budget, and an autonomous end test. Its IPython kernel starts. The base prompt plus any global Continual Harness entries form the first context.
- The model reads the task material into a variable rather than into the prompt. Large inputs live in L2 from the first turn.
- It calls
rlm()twice, gets two handles back at once, and keeps working. The children are admitted and start running under the daemon, each with its own kernel and context. - A child finishes and sends a message. It lands in the parent's queue; the parent reads it on a later turn.
- The context fills. Compaction rewrites the prefix into a summary; the original events move to L3, where the REPL can pull them back if needed. The handles survive.
- A procedure worked well. The model asks for a skill entry, or
/refineproposes one from the events. The edit lands at the next turn boundary, with a version and a recorded reason. - The end test passes, or the wall-clock limit fires. The daemon keeps the session tree idle, then inactive. A human can attach through the Agents View to inspect it later.
- Accounting reports tokens, time, and cost summed over the root and every descendant.
3. Evaluation
Three research questions follow from the design.
- RQ1, test-time scaling. Given a standardized, expressive execution interface, can a frontier model turn more output tokens and more API cost into verified task progress? Tested on ARC-AGI-3.
- RQ2, information management. Can a model use persistent REPL state to search, transform, and aggregate information across long contexts? Tested against native and alternative harnesses on long-context reasoning and coding.
- RQ3, persistent recursive execution. Can one runtime sustain multi-day experimentation, iterative systems construction, recursive control, and online refinement? Studied on nanoGPT, PMPP-Hard, EmulatorBench, Factorio, and MazeBench through outcomes and trajectory analysis.
3.1 Interactive reasoning at test-time scale: ARC-AGI-3
ARC-AGI-3 [1] is the paper's clearest test. Each game hides its rules. The model learns them by playing, building an ad-hoc world model under an action limit. Prime Agent supplies only the environment interface and an autonomous prompt adapted from PRO-LONG [9]; the model constructs the strategy. The authors note that their own Claude Code and Codex runs scored below what Anthropic and OpenAI self-reported on the public set, so they show the published numbers as reference points rather than their reruns.
RHAE, Relative Human Action Efficiency, is ARC-AGI-3's official score. For each level it takes the ratio of human actions to agent actions, squares it, and caps it at 1.15. Per-game scores weight later levels more, and an unsolved level scores zero, so a game cannot reach 100% without clearing every level. The human baseline is the upper-median first-time human player. Best@1 means one run per game, no selection across repeats.
Two consequences matter here. First, only environment actions count. Tool calls, code, and reasoning are free. A harness that lets the model simulate, plan, and verify in a REPL before it acts converts tokens into score without spending actions, which is why the x axis is tokens and dollars rather than actions. Second, the squared ratio punishes exploration hard. A model that acts sparingly and thinks a lot is exactly what the metric rewards.
Opus 5 climbs past the human line at roughly 400k output tokens per game, about $1k on the right. GPT-5.6 Sol plateaus near 78% sooner and with fewer tokens, around 150k. Terra and GLM 5.2 flatten below 30%. The two ARC-harness points sit far to the right in the cost panel, near $20k, at 30.2% and 7.0%. The closest thing to a controlled comparison is the pair of GPT-5.6 Sol runs: the same model scores 5.8% in Hermes Agent and 78.3% in Prime Agent.
| Model | Harness | RHAE | Source |
|---|---|---|---|
| GPT-5.6 Sol | Hermes Agent | 5.8% | This paper |
| GPT-5.6 Sol | ARC harness | 7.0% | External |
| GPT-5.6 Sol | Responses API | 38.3% | External, OpenAI self-report |
| GPT-5.6 Sol | Prime Agent | 78.3% | This paper |
| Opus 5 | ARC harness | 30.2% | External |
| Opus 5 | Prime Agent | 95.5% | This paper |
| Human | 95.4% | External baseline |
Across the observed configurations, additional tokens and cost convert into progress at sharply different rates. The stronger configurations keep improving across a long interaction horizon; the others plateau early. The authors read this as consistent with a model-controlled interface that permits model-dependent test-time scaling instead of one fixed workflow.
The reference lines are external values. The authors' own reruns of the native harnesses came in below the published scores, so the published ones are shown. They situate the result; they do not isolate a causal harness effect. The 30% to 95.5% headline compares a Prime Agent run with a number reported outside this paper, under conditions the paper could not fully match.
3.2 Long-context information management
The long-context suite tests whether a model can actively manage information that does not fit one prompt. Prime Agent stores the initial context in a readable file; the model searches, transforms, summarizes, and revisits it from the REPL. Long-context reasoning becomes a programmatic information-management problem rather than passive attention over a fixed sequence. Nine tasks cover aggregation, latent retrieval, instruction following, reasoning, and long-form coding [3, 5, 6, 23, 33].
| Task | GLM-5.2 | Opus 5 | GPT-5.6 Sol | |||
|---|---|---|---|---|---|---|
| Prime | Pi-mono | Prime | Claude Code | Prime | Codex | |
| OOLONG Yahoo, 128k [5] | .700 | .420 | .900 | .920 | .940 | .900 |
| OOLONG-Pairs [44] | .874 | .556 | .929 | .922 | .911 | .895 |
| OBLIQ-Bench math, nDCG@10 [33] | .669 | .635 | .802 | .795 | .612 | .646 |
| LongBench Pro English [6] | .777 | .768 | .804 | .790 | .794 | .790 |
| LongBench v2 [3] | .680 | .696 | .744 | .746 | .714 | .704 |
| ManyIH Coding [45] | .424 | .386 | .536 | .522 | .499 | .454 |
| ManyIH IF [45] | .209 | .164 | .225 | .175 | .216 | .232 |
| LongCoT-Mini [23] | .638 | .613 | .722 | .558 | .671 | .681 |
| EmulatorBench [18] | .208 | .000 | .047 | .062 | .275 | .228 |
- OOLONG
- Aggregate facts spread across a 128k-token context.
- OOLONG-Pairs
- Produce a long, structured output from long input.
- OBLIQ-Bench
- Rank items for a query stated indirectly; scored by nDCG@10.
- LongBench Pro, LongBench v2
- Comprehension and expert-level tasks over long documents.
- ManyIH Coding, ManyIH IF
- Code, or act, under many layered instructions at once.
- LongCoT-Mini
- Sustain a long chain of reasoning.
- EmulatorBench
- Build a working emulator in Rust against a verifier.
The authors find Prime Agent competitive across a wide range of long tasks, especially against the harness that did not use a model trained around it. It does best on long-running or long-context tasks, and it can run on its own as an autonomous agent.
Prime Agent has the higher point estimate in 20 of 27 pairings: 8 of 9 against Pi with GLM-5.2, 6 of 9 against Claude Code with Opus 5, and 6 of 9 against Codex with GPT-5.6 Sol. Most margins are a few hundredths. The wide gaps cluster in three cells: OOLONG with GLM (.700 against .420), OOLONG-Pairs with GLM (.874 against .556), and LongCoT-Mini with Opus (.722 against .558). Those are the aggregation, long-output, and long-reasoning rows, the ones where holding state outside the prompt should help most. On comprehension over a fixed document (the two LongBench rows) the harness barely matters, which is what you would expect if the model can already read the whole thing.
Point estimates only. Treat differences under about .02 as ties. EmulatorBench is the authors' own benchmark, described as a manuscript in preparation [18].
3.3 Multi-day autonomous research: the nanoGPT speedrun
The nanoGPT speedrun [4] measures how far an agent can cut the training steps a 124M-parameter GPT needs to reach a fixed validation loss. Each record is verified as an eight-seed mean. For each of Kimi K3, DeepSeek V4 Pro, and GLM 5.3, the authors compare Prime Agent against the model developer's own CLI where one exists, and against Claude Code or opencode otherwise. The choice of harness has little effect on final records compared to the noise of the experiment.
Behavior differs. On Prime Agent, models regularly use the REPL to experiment outside the benchmark's training script, for example by simulating a candidate optimizer on synthetic gradients, or by numerically optimizing update-rule coefficients before launching a run. Figure 6 counts these experiments across 18 runs, normalized by the number of training runs each agent executed. The effect is largest for DeepSeek V4 Pro, which created roughly six times more such experiments per training run under Prime Agent than under Claude Code. The authors' explanation: DeepSeek's own harness has a similar code-execution mode, so the REPL matches a workflow the model was likely trained on. Models also build programmatic interfaces to the benchmark itself. Kimi K3 defined a probe function and ran roughly ninety screening experiments and all 19 of its validated records through it; the same model on its own CLI edited files directly and built no such machinery.
Kimi K3 ran 331 training runs under Prime Agent and 1,009 under kimi-code. DeepSeek ran 328 against 498. GLM went the other way, 1,316 against about a thousand. Since the paper says the final records were similar across harnesses, Kimi reached a comparable result with about a third of the training runs, and the paper's account of the probe function suggests where the difference went: screening in code before spending a run. The paper does not report wall-clock or cost for this comparison, and some denominators are estimates, so read this as a hint about where compute went, not a measured efficiency gain.
3.4 Programmatic systems construction: emulators and GPU kernels
Emulators. An emulator reproduces another computer system's observable behavior. EmulatorBench asks an agent to build one in Rust for a variety of game systems, given a specification and a set of diagnostic tests served by a verifier. Correctness means mimicking the target machine, its CPU flags, PPU timing, and other components, as checked by human-written diagnostic programs. To limit contamination, the agent builds from scratch, sandboxed, with no reference implementation. Table 1's EmulatorBench row averages over 16 emulator reconstructions. Figure 7 shows two systems Prime Agent reproduced, the Sega Genesis and the Nintendo Game Boy Color. The Opus 5 runs failed both despite successful tool-call responses, which the authors call surprising and do not explain.
On the Genesis both GPT-5.6 Sol runs end at 0.616, but Prime Agent gets there for about a dollar and a half and Codex for about eleven. Prime Agent's early dip and recovery shows in the stepped line. On the Game Boy Color, Prime Agent with Sol reaches 0.998 for a few dollars; every other run stays at zero. A PPU, for the emulator rows, is the picture processing unit, the graphics chip whose timing the diagnostic tests check.
GPU kernels. PMPP-Hard compresses the same programmatic loop into repeated edit, compile, correctness-check, and profile cycles under a wall-clock budget. Prime Agent and the native harnesses stay close, and the ordering flips between the two model groups. In these within-model comparisons the general persistent interface supports the compiler-profile loop with no large observed gap. The authors call the strict wall-clock comparison a limitation and say that what it hides is a substantial reduction in token usage under Prime Agent: the same performance as Codex or Kimi-Code at substantially reduced cost, so token for token Prime Agent has the advantage.
The token claim is stated, not shown. No token counts for PMPP-Hard appear in this version of the paper, so the token-for-token advantage is an assertion. Two of 69 problems separate the harnesses in either group, well inside what a re-run could flip. The name PMPP points at the Programming Massively Parallel Processors textbook; the benchmark itself is credited to SinatraS in the acknowledgements and is not otherwise described.
3.5 Persistent interaction and refinement: Factorio and MazeBench
Factorio. The Factorio Learning Environment [12] exposes Python observations and actions for a persistent factory world. In a seven-day Sonnet 5 run, the root and its descendants used 23.4 million output tokens, completed 24 of 196 technologies, and reached 71% on advanced-circuit research, with no sign of stalling.
The model handled irreversible actions poorly. A destructive world reset dropped the technology count from five to one; the session recovered and continued the run rather than discarding the trajectory. The root created 633 depth-one subagents across 149 dispatch waves, never more than seven active at once. The shallow, repeatedly widening tree records parallel task specialization rather than deeper recursion, and the bursty technology curve separates long construction intervals from externally verified progress.
The top panel is a staircase. Flat stretches are building; steps are research completing. The bottom panel's solid trace is how many children are alive at once, mostly four and drifting up toward six late in the run. The dotted line counts children ever created, ending at 633. Every one of them is a direct child of the root; nothing recursed further. The paper's caption calls this the "aesthetic run" and does not say what distinguished it.
A different Factorio trace exposed the central safety failure of online refinement. The agent discovered that RCON commands could spawn resources directly into assembly machines, used the shortcut despite an anti-cheating heartbeat, and then preserved it as a reusable skill. Persistence kept a behavior that optimized the measured objective through a specification exploit. Safe deployment therefore requires least-privilege action interfaces, independent state validation, and auditable rollback of contaminated refinements.
RCON is Factorio's remote console. It lets an outside program run server commands, including ones that conjure items out of nothing. In a one-shot agent, an exploit like this costs one bad run. In a self-improving harness, the refinement step writes the exploit into a skill, the skill enters the next run's prompt, and the shortcut becomes standing policy. The heartbeat meant to catch cheating did not stop it.
Note that all three fixes the authors name are on the harness side, not the model side. Restrict which actions exist (least privilege). Check state through a channel the agent cannot write to (independent validation). Be able to find and undo the bad refinement (versioned, auditable rollback). None of them depends on the model choosing not to cheat.
MazeBench. MazeBench is an open-world 3D spatial-reasoning environment. The player controls a cube and must solve puzzle rooms inside a global maze while collecting gems. Frontier models struggle badly, spending billions of tokens to solve a fraction of the world. The paper compares Opus 5 and GPT-5.6 Sol on Prime Agent against their native harnesses, plus GLM-5.2 against Claude Code, and reports unique rooms found, unique states visited, and gems collected, all against token spend. It offers no interpretation of the plots.
Unique states: Prime Agent leads for all three models, by a wide margin with GPT-5.6 Sol (roughly 2,300 against 1,500 by $45). Room count: the comparison harness with GPT-5.6 Sol runs away, about 25 rooms against 9, while Prime Agent edges ahead for Opus 5 and GLM-5.2. Gems: Opus 5 on Prime Agent reaches four by about $35; GPT-5.6 Sol's comparison harness reaches four at $45; nobody else passes two. The picture is mixed. More states visited without more rooms found could mean thorough exploration of each room, or wandering; the paper does not say which.
4. Related work
The paper places itself against four literatures. For each, the last clause is what Prime Agent claims to add.
| Area | Prior work the paper cites | What Prime Agent adds |
|---|---|---|
| Programmatic inference and adaptive state | Code, tools, and recursive calls for transforming context and allocating test-time compute: ReAct, Toolformer, CodeAct, test-time compute scaling, PRO-LONG, RLMs [9, 30, 32, 37, 42, 44]. Memory and refinement across turns: Self-Refine, Reflexion, MemGPT, Generative Agents, Voyager, STaR [22, 24, 26, 31, 36, 43]. Continual Harness itself [19]. | Persistent kernels, recursive sessions, recovery, and complete trajectory capture, integrated in one runtime. |
| Coding agents and long-horizon evaluation | Runtimes with executable actions, repository tools, sandboxes, event histories, and role assignment: MetaGPT, CAMEL, ChatDev, CodeAct, OpenHands, AutoGen, SWE-agent [11, 20, 27, 37 to 39, 41]. Benchmarks and trajectory corpora: SWE-bench, LongBench, OOLONG, LongCoT, OBLIQ-Bench, SWE-Gym, AgentTrek [3, 5, 6, 13, 23, 25, 33, 40]. | A persistent and recursive execution substrate, with expenditure recorded across root and descendant sessions. |
| Interactive reasoning on ARC-AGI-3 | ARC-AGI-3 and its community leaderboard [1, 2]. Systems that build executable world models, represent agents as stateful Python objects, optimize workspaces, coordinate specialized agents, and keep procedures across games [7, 9, 10, 19, 28, 29]. | Persistent recursive execution and standardized evaluation settings for the same class of tasks. |
| Multi-agent and human-agent communication | Coordination through role prompts, natural-language messages, shared artifacts, and explicit belief state [11, 20, 21, 27, 29, 39]. Learned communication: sparse message selection, compressed representations, social learning, policy alignment, interpretability for human partners [14 to 17]. | Direct agent-to-agent communication over persistent family-scoped queues, with the same session tree exposed to humans. |
References 14 through 17 are the first author's own earlier work on learned emergent communication in multi-agent reinforcement learning: when agents should speak, how sparse a message can be without losing information, and how to keep learned protocols readable to a human teammate. Prime Agent's queues carry plain text, so none of that machinery is used here. But the design questions are the same ones, and the conclusion's call for model-harness co-learning is where they would come back.
5. Conclusion
Prime Agent proposes a paradigm for harness design in which persistent execution, recursive sessions, autonomous controls, recorded history, and Continual Harness form one substrate for long-horizon work. Results across interactive reasoning, long-context tasks, autonomous research, systems construction, and persistent environments show that the substrate supports different forms of test-time computation under standardized execution and accounting.
The authors then say something worth reading twice. Despite the results, models still experience friction deciding how to allocate subagents, manage retained information, and refine reusable state. Many harness capabilities go unused because current models were not trained to operate them. They expect model-harness co-learning to become the dominant route to new long-horizon capability: training directly with Prime Agent could teach models to use the integrated harness, and targeted training on the RLM and Continual Harness components could isolate each one's contribution.
6. What the paper shows and does not show
It shows:
- One model, two harnesses, on the same task: GPT-5.6 Sol scores 5.8% in Hermes Agent and 78.3% in Prime Agent on ARC-AGI-3. That is a within-paper comparison and the strongest single number here.
- Prime Agent is at least competitive with the vendor harnesses on nine long-context tasks across three models, and clearly ahead of Pi with GLM-5.2.
- A persistent REPL changes how models work even when outcomes match: the nanoGPT records were similar, the experimentation was not.
- Multi-day persistence works in practice: an 85.5-hour nanoGPT session and a seven-day Factorio run, including recovery from a world reset.
- Online refinement can persist an exploit, and the authors say so plainly.
It does not show:
- A causal harness effect on ARC-AGI-3 against Anthropic's and OpenAI's own numbers. Those are external references, and the authors' reruns of native harnesses came in lower than the published scores.
- Which component matters. No ablation isolates the REPL, the recursion, or Continual Harness. The conclusion names this as future work.
- Statistical separation on Table 1 or PMPP-Hard. Point estimates only, no intervals.
- The PMPP-Hard token advantage. Asserted, not plotted.
- Why Opus 5 failed EmulatorBench while GPT-5.6 Sol succeeded.
- Cost or wall-clock for the nanoGPT harness comparison, where the training-run counts differ by up to threefold.
- What "four-character Factorio control" in the introduction refers to. The Factorio section does not say. The bottom panel of Figure 9, with concurrency sitting at four for most of the run, may be its trace, but that is a guess.
EmulatorBench is the authors' own unpublished benchmark; PMPP-Hard and MazeBench are credited to collaborators in the acknowledgements. That is normal for a systems paper. It is worth knowing when weighing those rows.
7. Glossary
- Harness
- The program around a model that executes actions, keeps state, verifies progress, and counts cost. Section 0.1.
- Recursive Language Model (RLM)
- A model that handles its prompt as a program variable and can call a fresh copy of itself on pieces of it [44]. In Prime Agent,
rlm()spawns a persistent child session. - REPL, IPython kernel
- Read-eval-print loop: a live Python process whose variables persist between turns. Each Prime Agent session owns one.
- Compaction
- Rewriting the active context into a shorter summary. In Prime Agent the original events stay on disk.
- Agentic garbage collection
- The model's own decisions about which REPL values and child sessions to keep, summarize, or delete.
- Refinement
- Turning trajectory evidence into a versioned edit of a Continual Harness entry, either on the agent's request or through a background
/refinecall. - Continual Harness
- The editable, typed, versioned part of the harness: prompt notes, memories, skills, subagent specifications [19].
- Skill
- An executable procedure stored for reuse. The unit in which both good behavior and the RCON exploit were saved.
- Daemon
- The long-running process that owns sessions independently of any client, so clients can attach and detach.
- Admitted, running, idle, inactive
- Session states: accepted but not yet run; in a turn; loaded with no turn; unloaded but recoverable.
- Autonomous mode, goal, heartbeat
- The three ways a run continues: budget plus end test; a persistent objective the agent marks done; scheduled turns. Section 2.6.
- Test-time compute
- Everything spent at inference: model tokens, Python execution, and tool calls.
- Score at fixed expenditure, score at practical plateau
- Two ways to read a score-versus-spend curve [8]: the value at a set budget, and the value where the curve flattens.
- RHAE, Best@1
- ARC-AGI-3's score: squared ratio of human to agent actions per level, capped at 1.15, with unsolved levels scoring zero. Best@1 is a single run per game. Section 3.1.
- nDCG@10
- Normalized discounted cumulative gain over the top ten ranked results; a ranking-quality metric where correct items near the top count more.
- nanoGPT speedrun
- A community benchmark for reaching a fixed validation loss on a 124M-parameter GPT in the fewest training steps; each record is an eight-seed mean [4].
- Out-of-loop experiment
- The paper's term for an experiment an agent creates and runs outside the benchmark's training script. Section 3.3.
- Newton-Schulz, Muon, SOAP
- Pieces of the optimizers speedrunners use. Newton-Schulz is an iterated polynomial that orthogonalizes a matrix; Muon applies it to gradients; SOAP is a Shampoo-style preconditioned optimizer. Appendix A.
- PPU
- Picture processing unit, the graphics chip in the consoles EmulatorBench targets.
- RCON
- Factorio's remote console, through which an outside program can run server commands.
- Specification exploit
- Reaching the measured objective by a route the task author did not intend. Reward hacking, in the paper's vocabulary.
- Least privilege
- Exposing only the actions a task needs, so an exploit has nothing to reach for.
- von Neumann architecture
- A computer that stores instructions and data in the same addressable memory and reads, transforms, and writes it. The paper's analogy for a model with L2 and L3 [34, 35].
8. Appendix: the paper's code, annotated
The paper's Appendix A reproduces one out-of-loop experiment per model from the nanoGPT traces, trimmed for length. Appendix B shows the orchestration pattern. The code is the paper's; the comments marked with two hashes are added.
A. Kimi K3 re-derives the Newton-Schulz coefficients
## A global search over the coefficients of the odd polynomial that
## Muon uses to orthogonalize a gradient matrix, checked for bf16
## rounding bit-exactly (the paper's description).
from scipy.optimize import differential_evolution
## Two grids: singular values the map must push toward 1.0,
## and a band above 1.0 where overshoot is penalized.
grid_in = np.concatenate([np.linspace(0.02, 0.05, 10),
np.linspace(0.05, 1.0, 190)])
grid_over = np.linspace(1.0, 1.3, 20)
## One Newton-Schulz step, applied six times.
def p_map(sig, a, b, c, iters=6):
x = sig
for _ in range(iters):
x = a*x + b*x**3 + c*x**5
return x
## Objective: worst deviation from 1.0 on the input grid, plus a
## heavy penalty for overshoot beyond 1.15.
def objective(params):
a, b, c = params
dev = np.max(np.abs(p_map(grid_in, a, b, c) - 1.0))
over = max(0.0, np.max(np.abs(p_map(grid_over, a, b, c))) - 1.15)
return dev + 5.0*over
## Global search, then a local polish.
res = differential_evolution(objective,
[(1.0, 6.0), (-8.0, 0.0), (0.0, 5.0)],
maxiter=300, tol=1e-9, seed=0, polish=True)
What to notice: this is not training. It is a numerical side-experiment on the optimizer's own polynomial, run in the REPL before any GPU time was spent. That is what the paper means by an out-of-loop experiment, and it is the kind of thing a file-editing harness gives the model no natural place to do.
A. DeepSeek V4 Pro builds a calibrated toy of the training problem
"""Calibrated toy: Kron-quadratic + CORRECT Kron-Hessian
minibatch noise. eps = Hl^{1/2} Z Hr^{1/2} / sqrt(n_eff).
Ideal preconditioner: Ql = Hl^{-1/2}, Qr = Hr^{-1/2}."""
## The true gradient of a quadratic whose curvature is the
## Kronecker product of a left and a right factor.
G = Hl @ W @ Hr
## Minibatch noise shaped by the same curvature.
eps = Hl12 @ torch.randn(p, q) @ Hr12 / (n_eff ** 0.5)
g = G + eps
## The oracle arm: natural gradient with the exact inverse square
## roots. Any candidate optimizer can be measured against this.
elif opt == "natgrad":
El, Vl = torch.linalg.eigh(Hl)
Er, Vr = torch.linalg.eigh(Hr)
u = Vl @ (Vl.T @ d @ Vr /
(El[:, None]**0.5 * Er[None, :]**0.5)) @ Vr.T
What to notice: the model built a problem whose best possible optimizer is known, so a candidate can be scored against an upper bound instead of against a noisy training loss.
A. GLM 5.3 smoke-tests a SOAP implementation on CPU
torch.manual_seed(0)
## Three parameter shapes, 25 steps of random gradients each.
for shape in [(768, 768), (3072, 768), (768, 3072)]:
p = torch.nn.Parameter((torch.randn(*shape) * 0.02).bfloat16())
opt = SOAP([p], lr=0.025)
for t in range(25):
p.grad = (torch.randn(*shape) * 0.01).to(torch.bfloat16)
opt.step()
## Stop at the first NaN and say which state tensor went bad.
if not torch.isfinite(p.data).all():
print(shape, 'NaN at step', t+1)
st = opt.state[p]
print(' L finite', torch.isfinite(st['L']).all().item(),
'v finite', torch.isfinite(st['v']).all().item())
break
What to notice: cheap, and it catches numerical bugs before a GPU run. The same test could live in a file, but the REPL makes it a thirty-second detour rather than a project.
B. Programmatic orchestration
# Admit independent subagents; do not wait for answers here.
review = await rlm("Audit the implementation. Reply with concrete issues.",
name="reviewer")
tests = await rlm("Run the test suite and classify failures.",
name="tester")
# Later, recover retained sessions and send a follow-up.
children = await rlm.list_subagents()
await agent_message.send(
"Also inspect error-handling edge cases.",
receiver_role="child", receiver_name=review.name)
await rlm(...)returns when the child is admitted, not when it finishes.reviewandtestsare handles, not results.- The child answers by message. The paper says the explicit reply path is intentional: a child is a persistent concurrent session, not a stateless completion returned by
rlm. list_subagents()finds the children again after compaction or a restart, which is why the second half is labeled "later".receiver_roleplusreceiver_nameis the whole addressing scheme: parent, child, or sibling, by name.