Prime Agent Explored

Prime Agent (GitHub) is a self-improving RLM (Recursive Language Modelling) harness by Prime Intellect. Prime Intellect reports a score of 95.5 on the ARC AGI 3 benchmark, while the human expert baseline was 95.4 (AGI before GTA 6?).
This harness takes a different approach from the other harnesses we have seen before. Current "SOTA" harnesses restrict frontier models to rigid paradigms, such as fixed sets of prompts and tools, which constrain the models and hold them back from reaching their true potential.
Prime Agent aims to move away from the traditional notion of a harness by building a self-improving harness based on two research papers:
Recursive Language Model
Over the years, LLMs have come a long way, going from a context window of just 16K tokens to about a million now. But not all of the one-million-token context window is useful. Imagine the LLM's context window as a stack. Research shows that, during inference, the LLM mainly focuses on the top and bottom parts of the stack and less on the middle. This phenomenon is called the "lost in the middle" problem.
Context rot is the performance degradation that happens when LLMs have to process increasingly long input contexts. The attention mechanism has quadratic time complexity because each token must attend to every other token in the sequence. As a result, processing a sequence of length n requires O(n²) operations.
An RLM is not a typical LLM. It is an inference paradigm in which, instead of passing long prompts directly to the model, an accessible REPL is used. Long prompts can be stored as variables, and the LLM can act on them by knowing only what each variable is about and what it contains, without having to read it all and fill its limited and precious context window.
From the paper:
Given a prompt P, the RLM initializes a Read-Eval-Print Loop (REPL) programming environment in which P is set as the value of a variable. It then offers the LLM general context about the REPL environment (e.g., the length of the string P) and permits it to write code that peeks into and decomposes P and to iteratively observe any side effects from execution. Crucially, RLMs encourage the LLM to understand, transform, and execute the input prompt by writing symbolic programs that invoke the LLM itself on as many slices of the input as necessary.

Figure: Recursive Language Model (RLM) uses a REPL to inspect and recursively process an external prompt. Source: Recursive Language Model.
RLM can work with inputs above 10 million tokens on long-context tasks. It does not give the model a 10-million-token context window. The input stays outside the model, and the model uses code and more model calls to inspect parts of it. Each model call still has its normal context limit. This can take more time and money, and a bad plan can cause the agent to miss information.

Figure: RLM benchmark results across long-context and code tasks. Source: Recursive Language Model.
Continual Harness
Traditional coding harnesses like Claude Code and Codex wrap the model around tools, memory, prompts, etc., which work fine for coding but not for embodied agents. Embodied agents are defined as follows:
An embodied agent is an artificial intelligence (AI) system that interacts with its environment through a physical or virtual body rather than operating purely as software on static data.
A harness state can be defined as H = (ρ, G, K, M), where:
- Prompt state p: the instructions and strategic guidance provided to the model at each reasoning step.
- Sub-agents G: specialized modules that can be invoked by the orchestrator for specific tasks (e.g., battle strategy, puzzle solving, self-reflection).
- Skills K: reusable routines available to the model, spanning both text-level behaviors (heuristics cited in reasoning) and executable programs (pathfinders, tool wrappers). Pre-built primitives such as
press_buttonsandget_game_stateare skills the harness ships with; new skills can also be authored during play. - Memory M: a persistent knowledge store that accumulates facts, strategies, and observations across the agent’s trajectory.
The prompt state in the paper is editable. Prime Agent keeps its main system prompt fixed and adds an editable prompt layer around it. The Refiner can change this added layer, but it cannot rewrite the main system prompt.
The base agent interface
These harnesses also have "meta" tools, such as edit_memory and spawn_subagent, which allow the harness to modify its own states to some extent.
Continual Harness builds on this with an added Refiner layer, which acts as an automatic self-improvement component for the harness by editing and modifying its states (p, G, K, M) at fixed intervals of N turns.
The base harness starts with a minimal agent interface.
The agent gets only:
- A game screenshot
- A local ASCII map of visible tiles, walls, NPCs, and the player
- A fixed action set:
UP,DOWN,LEFT,RIGHT,A,B,START,SELECT

Figure: Harness refinement within an episode and co-learning across iterations. Source: Continual Harness.
What the harness records
The harness logs events such as:
- observations and actions
- tool calls and exceptions
- whether navigation made progress
- repeated actions or loops
- milestone completion
- skill creation, use, update, and deletion
The refiner cycle
After every N steps, excluding the warmup, the "Refiner" runs without stopping the game and analyzes:
- tool errors
- failure modes
- broken tool schemas
- weak skills, etc.
It then runs four passes, one for each state:
- Prompt: revise instructions to address the observed failure.
- Sub-agents: add a specialist for repeated complex work, repair one that failed, or delete an unproductive one.
- Skills: turn successful action sequences into reusable functions, or fix executable code that raised errors.
- Memory: write verified discoveries, update stale information, or lower the priority of now-irrelevant notes.
These are CRUD operations: create, read, update, and delete.
The Refiner then creates a delta for (p, G, K, M) and updates the states without stopping the game.
Prime Agent internals
Runtime model
Prime Agent is built around programmatic tool and subagent classes. Its only direct tool is a persistent IPython kernel, which gives the model a stateful Python environment for its work.
A subagent is simply another Prime Agent instance. Calling /rlm starts one asynchronously, with its own session history and IPython REPL kernel. This makes the call recursive: every subagent can, in turn, create further Prime Agent subagents. Each subagent run is persisted.
Related agents can communicate through the A2A (agent-to-agent) protocol. Communication is limited to the same agent family: a parent, child, or sibling process.
State and persistence
Self-improvement
As in the Continual Harness paper, the state of the Prime Agent harness is defined by H=(ρ, G, K, M) and remains editable by the agent at all times. Edits are always persisted to disk.
Tools for CRUD operations on all four states (prompt, memory, subagents, and skills) are available inside the kernel.
# Create a memory and a skill through the same CRUD surface
rlm.harness.create_memory("flaky test pattern", "retry three times before failing")
rlm.harness.create_skill("retry helper", "...", reference={"type": "python", "import": "retry_helper"})
# Read them back
rlm.harness.list("memory")
rlm.harness.get("skill", "retry_helper")
The /refine workflow is available to the agent via the refine.run() function, which it calls after observing repeated errors and instances of getting stuck.
Refinement lifecycle
The main system prompt is never changed, and /refine works only on the state of the agent.
The agent first plans iteratively by observing the failure modes and then suggesting changes to the state of the harness. The edits are then applied to the state without blocking the main state of the agent. The new state is persisted and then swapped in for the old one in only a brief moment.

Figure: Prime Agent architecture. Source: Prime Agent: a self-improving harness.
What is actually improving
Prime Agent does not normally train the model or change its weights. It changes the system around the model. It can update:
- Prompt notes
- Memories
- Skills
- Subagent definitions
This is where the two research ideas meet. With RLM, the agent can use code to work with a large amount of external data during a task. With Continual Harness, the agent can change how it works based on what happened. Prime Agent uses both inside one persistent Python runtime.
An agent can find a useful method, save it as a skill or memory, and use it again later in the same task. Since Prime Agent saves these edits to disk, the agent can also use them in a later session. The saved harness state is what improves over time. The underlying model can stay the same.