Deep dive
Prime Agent: The Terminal Agent That Rewrites Its Own Harness
Prime Intellect's Prime Agent is an MIT-licensed terminal coding agent built on a different architecture from Claude Code or Codex: instead of a tool-call loop that dumps every result into the context window, it drives a live IPython session and treats its own context as a variable. It also treats its harness — prompts, memories, skills, sub-agent specs — as editable state that a /refine pass updates from your corrections. The headline benchmark numbers are self-reported, and the project states plainly that it is not a security sandbox.
"Prime Agent + V4 Flash, Claude, Codex: This is OPEN & TECHNICALLY the BEST AGENT HARNESS YET!" by AICodeKing — Watch on YouTube →
Step-by-Step Breakdown
-
Understand the recursive language model (RLM)
The core architectural difference. A normal coding agent calls tools one at a time and every result lands in the context window — which is why long tasks burn tokens and degrade. Prime Agent instead gives the model a persistent IPython kernel that stays alive for the whole conversation. The model treats its own context as a variable, and treats tools and sub-agents as function calls inside that Python session. In practice: rather than reading a huge file into context, it writes a few lines of Python that process the file and return only the part it needs.
-
Spawn sub-agents as function calls
The model calls an RLM function inside the REPL to spawn a child. That child is a full Prime Agent instance with its own model and its own session history, and the parent receives the result back as a plain return value. This is what allows recursive agent spawning — work running in parallel or in the background without every intermediate result flooding one context window.
-
Install it
macOS and Linux only. Installation is a single one-line command (a
curlpiped into a shell, linked in the video's description) that downloads a versioned release, verifies the checksum, installs theprime-agentbinary and sets up the IPython runtime. Then change into your project directory and runprime-agent. -
Authenticate with what you already pay for
On first launch, run
/login. You can authenticate via OAuth with an existing ChatGPT Plus or Pro subscription, a Claude Pro or Max subscription, or GitHub Copilot — so if you already subscribe to one of these, running Prime Agent costs nothing extra. Alternatively, set an API key as an environment variable or inauth.json; over 20 providers are supported including Anthropic, OpenAI, DeepSeek, Gemini, Grok, xAI and OpenRouter. -
Or point it at local models
For a fully local, zero-cost setup, wire it to Ollama, LM Studio or vLLM through the
models.jsonconfig. -
Let the continual harness learn from your corrections
The self-improving part, and the most novel idea here. In most agents the system prompt, skills and memory are static things the developers hand-engineered. In Prime Agent the harness itself is state the agent can create, read, update and delete — supplemental prompts, memories, skill descriptions and sub-agent specifications are all stored durably. Running
/refinereviews your recent trajectory and applies small, evidence-backed updates. Correct the agent once, run/refine, and the lesson is baked in for the next session. -
Check the guardrails on that
Three things keep the self-editing bounded: the base system prompt stays immutable, every change is snapshotted so you can roll back a refinement that made things worse, and the stored state is readable — you can open it and see exactly what the agent decided it learned.
-
Write skills as executable packages
Recurring workflows become actual executable Python packages rather than markdown instruction files, and there is a built-in skill creator that packages them for either the current project or your personal setup.
-
Set it running unattended
Four mechanisms for long-running work:
/goalsets persistent objectives that survive across turns and context compactions;/heartbeatmakes the agent wake up periodically;/autonomousruns it on its own inside turn, token and time budgets you configure, with quality gates you define. Sessions are daemon-backed, so closing your terminal or dropping an SSH connection does not kill the run. -
Reattach to a running session
Use
prime-agent agentsto list running and saved sessions, andprime-agent attachto reconnect to any of them. Running agents can also message each other directly and coordinate without going through you.
Commands & Code Shown
prime-agent
prime-agent
Purpose: Starts the agent in the current directory.
When to use: From inside your project folder, after installation.
/login
/login
Purpose: Authenticates via OAuth against a ChatGPT, Claude or GitHub Copilot subscription, as an alternative to API keys.
When to use: On first launch, if you already pay for one of those subscriptions and want to avoid per-token API billing.
/refine
/refine
Purpose: Reviews the recent trajectory and writes small, evidence-backed updates into the harness state — memories, supplemental prompts, skill descriptions.
When to use: Immediately after you correct the agent on something you don't want to correct again.
/goal
/goal
Purpose: Sets a persistent objective that survives across turns and context compactions.
When to use: For long tasks where the original intent would otherwise be summarised away.
/heartbeat
/heartbeat
Purpose: Wakes the agent on a schedule so it can make progress without you prompting it.
When to use: Background or overnight work.
/autonomous
/autonomous
Purpose: Runs the agent unattended within turn, token and time budgets you configure, against quality gates you define.
When to use: Only with budgets set — this is the mode where an unbounded run gets expensive.
prime-agent agents
prime-agent agents
Purpose: Lists all running and saved sessions.
When to use: After reconnecting to a machine where you left work running.
prime-agent attach
prime-agent attach
Purpose: Reconnects your terminal to a running daemon-backed session.
When to use: After an SSH drop or closing your laptop mid-run.
Reported Benchmarks
All figures below are self-reported by Prime Intellect and had not been independently reproduced at the time of the video. Treat them as claims.
- ARC-AGI 3 — Prime Agent running Claude Opus 5 scored 95.5% best-of-1, against a stated human expert baseline of 95.4%. With best-of-3 it is reported to have solved 99.97% across all 100 levels.
- Long-context benchmarks (OOLong, LongBench Pro) — reported to match or beat Claude Code and Codex, both with proprietary models and with open-weight models such as GLM 5.2.
- Emulator bench — reported to have built working Sega Genesis and Game Boy Color emulators from a written specification.
The efficiency claim is the one most relevant to daily use: Prime Intellect's charts show higher scores at lower token cost than competing harnesses, which is the direct consequence of the RLM approach keeping large data out of the context window.
Gotchas & Caveats
- It is explicitly not a security sandbox. Prime Agent executes model-generated Python and shell commands with your user permissions. The worker and kernel processes add some isolation, but the project states outright that this is not a security boundary. Do not point it at untrusted repositories, and run it inside a container or VM if the work is at all sensitive — see our security center.
- No Windows support beyond running it under WSL.
- The benchmarks are self-reported. The repo is real and gained roughly 11,000 stars within days of release, but nobody outside the team had independently reproduced the ARC-AGI 3 numbers.
- It is days old. Expect rough edges; this is a first-release evaluation, not a settled recommendation.
- A self-editing harness can learn the wrong lesson. The snapshot-and-rollback design exists precisely because refinements can degrade behaviour. Read what it wrote.
Key Takeaways
- The RLM design targets the real failure mode of long agent sessions — context bloat — by processing data in a live Python session instead of reading it into the prompt.
- Sub-agents as function calls, each a full agent instance with its own model, is a cleaner composition primitive than most sub-agent implementations.
- The continual harness makes "the agent gets better at your codebase the more you use it" a concrete, inspectable, reversible mechanism rather than a marketing line.
- OAuth login against an existing Claude or ChatGPT subscription removes the usual cost barrier to trying a new harness.
- Daemon-backed sessions plus
/heartbeatand budgeted/autonomousmode make unattended work a first-class feature, not a script you write yourself. - The absence of a security sandbox is the single most important thing to know before running it — treat it with the same caution as any tool with shell access to your account.





