Prime Agent: Prime Intellect's Self-Improving RLM Harness
Prime Agent is Prime Intellect's open-source coding harness built on a persistent Python REPL and self-refining harness state. What it is and how to run it.
Prime Agent is an open-source coding and research agent from Prime Intellect. It’s built on two abstractions. The Recursive Language Model (RLM) gives the model a persistent IPython REPL as its only tool, and the Continual Harness lets the agent create, read, update and delete its own prompts, skills, memories and sub-agent specs mid-task. You install it with one command (curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh), run prime-agent inside a repo, and point it at whichever model provider you prefer, including OpenRouter via ori prime-agent.

If you searched “prime agent” after seeing it in an OpenRouter harness list, this is the one. It’s a terminal coding agent in the same category as Claude Code, Codex and OpenCode, with a very different internal design. This post covers what’s different about it, what the published benchmarks claim, how to install and run it, and how it compares with the harnesses you already use.
What Prime Agent is
Most coding harnesses give the model a fixed set of tool-call schemas (read file, write file, run bash) and compact the context when the window fills. The launch post argues that this design was built for an earlier generation of models and now makes the model work around its scaffolding.
So Prime Agent replaces the tool schema with a programming environment:
- Programmatic tool calling (PTC). The model’s only tool is a persistent IPython kernel. Skills, file operations, shell commands, context management and sub-agents are pre-imported modules it calls as functions. It runs functions over data instead of spending tokens reading that data through tool responses.
- Prompt-as-a-variable. Session history lives in variables inside the kernel, so the agent can still reach its past context in code after compaction. The full history is stored as append-only JSONL on disk and can always be recovered via
/tree. - Recursive sub-agents.
await rlm("sub-task", name="...")spawns a full child session with its own model, kernel, session tree and history. It returns a handle immediately; the answer arrives later throughagent_message.send(...). - Continual Harness /
/refine. The harness’s own state (prompt notes, skills, memories, sub-agent specs) is something the agent can create, edit and delete based on its trajectory./refinereads what was tried and what happened, then makes the smallest relevant edit. The base system prompt never changes, and each refinement records its trigger and outcome so a bad update can be rolled back by ID. - Daemon-backed sessions. A background daemon owns all live sessions over a local socket. You can detach your terminal and the agent keeps running; if a worker crashes, the daemon recovers it from the session JSONL plus a kernel snapshot. The Agents View (Left Arrow on an empty prompt) lists running, idle and inactive sessions, including nested sub-agents, which unload from memory after 30 minutes idle and reload on demand.
The authors say plainly that this is early: no model has been trained around Prime Agent or its features yet, and they expect “huge performance gains” from training models and harness together. It’s released under MIT, with a technical report on arXiv and the full source on GitHub. It’s built on top of pi.
What the benchmarks claim
We only report numbers the sources state.
ARC-AGI-3. Prime Agent with Opus 5 in autonomous mode reports 95.5% RHAE Best@1, which the post says beats the ARC-reported human expert baseline of 95.4%. Three runs scored 95.0, 95.2 and 95.5, with 99.97% Best@3 and all 183/183 levels complete. The paper abstract describes this as raising ARC-AGI-3 RHAE Best@1 “from 30% to 95.5%.” The launch post links a median scorecard replay. Prime Agent also reports reaching those scores with lower overall token usage than the native harnesses.
Long-context suite. Prime Agent was compared with Pi-mono (with sub-agents), Claude Code and Codex across OOLONG, OOLONG-Pairs, OBLIQ-Bench, LongBenchPro, LongBenchv2, ManyIH Coding/IF, LongCot-Mini and EmulatorBench. It wins most cells but not all: Pi-mono edges it on LongBenchv2 with GLM-5.2, and Codex leads on ManyIH IF and LongCot-Mini with GPT-5.6 Sol. The post’s own summary: “competitive across a wide range of long tasks, especially against the harness that did not use a model trained around it.”
Other evals. EmulatorBench (building Game Boy Color and SEGA Genesis emulators from scratch in Rust, sandboxed, with no reference implementation), PMPP-Hard GPU-kernel writing verified with KernelGuard, autonomous nanoGPT speedruns, MazeBench 3D spatial reasoning, and a Factorio case study where /refine turned experience from earlier runs into memories and skills and reached a 100K+ production score in hours.
Read the long-context table as a rough indication. The authors note they got worse results running Opus 5 in Claude Code and GPT-5.6 Sol in Codex than those vendors officially report, and they defer to the official numbers. It’s the same problem we covered in the Gemini 4 Argon benchmark post: check the chart’s axes before you trust the headline.
How Prime Agent compares to other harnesses
| Prime Agent | Claude Code / Codex | Pi | OpenCode | |
|---|---|---|---|---|
| Model tool surface | Persistent IPython REPL (everything is code) | Fixed tool-call schemas | REPL-oriented (Prime Agent builds on it) | Fixed tool-call schemas |
| Sub-agents | rlm.spawn(...): full child sessions, persistent, addressable | Task/sub-agent features, session-scoped | Sub-agent mode | Varies |
| Agent-to-agent messaging | Yes, via daemon, limited to parent/sibling/child | No | — | No |
| Self-modifying harness state | Yes: /refine edits prompts, skills, memory, sub-agents | Static skills/config files | — | Static config |
| Background continuity | Daemon-backed; detach and reattach; crash recovery | Terminal-bound | — | Terminal-bound |
| License | MIT, fully open source | Closed | Open source | Open source |
| Model choice | Any provider; OpenRouter via ori prime-agent | Vendor model | BYO | BYO |
The closest relative is the multi-agent fan-out in Grok 4.20’s multi-agent mode, except that here the model writes the fan-out as Python instead of picking it from a menu. For background on daemon-backed, detachable agents in general, our headless agent guide and agent TUI guide build the same patterns from scratch.
Install and run it
macOS/Linux:
curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh
cd /path/to/project
prime-agent
Windows, from PowerShell:
irm https://app.primeintellect.ai/prime-agent/install.ps1 | iex
On first launch, run /login to pick a subscription or API-key provider. Useful commands from the README:
prime-agent agents
prime-agent attach <agent>
prime-agent --resume [path|id]
prime-agent status
prime-agent doctor [--fix]
prime-agent update [--force]
prime-agent shutdown [--force]
Read the security warning before you point it at anything real. Prime Agent executes model-generated Python and project commands with your user permissions. The README states that the worker and kernel process isolation exists for lifecycle and recovery and is not a security sandbox. Use a disposable clone, a clean worktree, or a checkpoint you can restore, and run untrusted code or instructions in an external sandbox. (Prime Agent also ships an E2B sandbox integration if you want that boundary enforced.) Who is liable for what an autonomous agent does is an open question; see who’s accountable when an AI agent breaks the law.
What the model’s code looks like
This is the agent’s side of the loop, code it writes into the REPL, reproduced from the launch post:
auth = await rlm("Summarize the authentication flow in auth/. Reply to me when done.", name="auth-expert")
api = await rlm("Summarize the updated HTTP API layer in src/. Reply to me when done.", name="http-expert")
await agent_message.send(
"Also cover middleware error handling.",
receiver_role="child",
receiver_name=api.name,
)
And the agent editing its own harness through the same interface:
rlm.harness.create_memory("flaky test pattern", "retry three times before failing")
rlm.harness.list("memory")
await refine.run("promote the retry-on-flaky-test pattern to a skill")
await refine.status()
Running it unattended
Autonomous mode is a CLI flag:
prime-agent \
--autonomous \
--autonomous-gate "npm run check" \
--autonomous-max-turns 20 \
"Implement and verify the requested change"
The gate command runs before the session is allowed to finish. A failed gate hands its bounded output back to the agent for another attempt, and it isn’t re-run if the workspace hasn’t changed. --autonomous-max-tokens and --autonomous-timeout-ms cap tokens and wall-clock time. The README adds a caveat worth repeating: a passed gate verifies only what that gate checks, and hitting a limit doesn’t mean the task succeeded.
Using Prime Agent with the model you have
Prime Agent is model-agnostic, which is the main reason it appears on OpenRouter’s harness page. OpenRouter’s ori wraps the real CLI with OAuth-based credentials, org guardrails (allowlists, budgets, per-workspace permissions) and a single bill:
curl -fsSL https://openrouter.ai/labs/ori/install.sh | bash
ori prime-agent
ori prime-agent --model <openrouter-model-id>
ori runs whichever agent CLI is already on your PATH and offers to install it if it’s missing. Everything after the flags is passed through unchanged, so your usual Prime Agent commands still work.
If you aren’t paying for a frontier model, note that the long-context table uses GLM-5.2, an open-weights model, as one of Prime Agent’s baselines. The harness was evaluated specifically to show open-weights models as a competitive option. For cheap or free open-weight inference, see the best open-source LLM APIs and the best free LLM APIs for coding. Expect throughput problems, though: a REPL-driven harness spawning recursive sub-agents makes a lot of calls, and free-tier rate limits run out fast, so compare them here before you wire one in. For per-model compaction tuning, the README documents a provider-scoped modelOverrides.<id>.contextWindow option in models.json; check the repo docs for current defaults.
Should you switch?
Prime Agent is the most interesting harness of the year if your work runs for a long time: multi-hour refactors, evaluation runs, research loops, anything where you want the agent still working after you close the laptop. Daemon-backed sessions, persistent sub-agents, heartbeats, schedules and /refine all target that use case, and fixed-schema harnesses struggle with tasks like the Factorio and emulator case studies.
For a twenty-minute bug fix, a conventional harness is still simpler, and the authors admit there’s “friction when running Prime Agent with models” that haven’t been trained for it. Be sceptical of agent productivity claims in general; the Harvard study on Claude Code productivity is a useful check on any harness benchmark, including this one. A full technical report with more details is promised. Until then, the arXiv paper and the launch post are the authoritative sources.
FAQ
Who makes Prime Agent?
Prime Intellect. The launch post and arXiv paper (2608.23552) credit Seth Karten, Alex L. Zhang, Kevin Thomas, Sebastian Müller, Elie Bakouch, Daniel Auras, Mika Senghaas, Fares Obeid, Konstantin Dunas, Johannes Hagemann and Sami Jaghouar, with the Prime Intellect team.
Is Prime Agent free and open source?
Yes. The repository is MIT-licensed and fully open source. The agent costs nothing, but you still pay whoever serves the model. You choose a model subscription or API key at first launch via /login; pricing is set by your provider, so check their official docs.
What models does Prime Agent work with?
It’s designed for modern open and closed frontier models. The published evaluations used Opus 5, GPT-5.6 Sol and the open-weights GLM-5.2. Through OpenRouter’s ori prime-agent, you can pass any OpenRouter model ID with --model.
What’s the difference between RLM and Continual Harness?
RLM handles context and tools: a persistent REPL where history is variables and sub-agents are function calls. Continual Harness handles the harness’s own state: prompts, skills, memories and sub-agent specs that the agent can create, edit and delete based on its trajectory, and that persist across sessions. The two are independent and work together.
Is it safe to run Prime Agent on my main repo?
By default, the project’s own guidance says no. It executes model-generated Python and project commands with your user permissions, and its process isolation is explicitly not a security sandbox. Use a disposable clone, a clean worktree or a restorable checkpoint, and run untrusted code, instructions or skills in an external sandbox.