BrainBank

Prime Agent: A Self-Improving RLM Agent

8/9/2026, 4:05:44 PM · Source

#skill

Prime Agent is an open-source AI agent built on the Recursive Language Model (RLM) paradigm, enabling long-running autonomous coding and research tasks through persistent state, subagent orchestration, and a self-improving Continual Harness.

GitHub - PrimeIntellect-ai/prime-agent: A self-improving RLM agent for coding workflows and long-running autonomous tasks.

GitHub - PrimeIntellect-ai/prime-agent: A self-improving RLM agent for coding workflows and long-running autonomous tasks.GitHub - PrimeIntellect-ai/prime-agent: A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Prime Agent: A Self-Improving RLM Agent

Documentation • Verifiers • PRIME-RL • pi-mono

Prime Agent is an open-source coding and research agent for general and long-running work. It is designed around two core abstractions:

The Recursive Language Model (RLM) treats context as variables (prompt-as-a-variable) and tools like recursive subagents as function calls (programmatic tool /sub-agent calling) inside a persistent REPL. The Continual Harness stores supplemental prompts, memories, skill descriptions, and reusable subagent specifications as durable state that Prime Agent can refine through small, evidence-backed updates, local to the session by default.

Prime Agent combines a persistent Python control environment with durable harness state, so useful working context and reusable operating patterns can outlive a single chat window.

Everything is programmatic: persistent IPython is the built-in model tool; file operations, shell commands, tool use, subagents, and context management happen through code. Subagents are built in: rlm(...) spawns real child agents for parallel or background work and returns their results programmatically. The harness can improve: /refine reviews the current trajectory and can apply small, evidence-backed updates to supplemental harness state. It never rewrites the immutable base system prompt, and recorded snapshots support rollback. Skills are executable: skills are importable Python packages, and the built-in skill creator can turn recurring workflows into project or personal skills. Sessions run in the background: daemon-backed agents keep running when the terminal disconnects and can be reattached later. Agents communicate directly: running agents can exchange messages and orchestrate one another without routing everything through the user. Long tasks keep moving: automatic compaction, persistent goals, heartbeats, schedules, autonomous mode, and retained subagents preserve progress across turns and terminal sessions.

Getting Started Install the latest stable release on macOS or Linux: curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh The installer downloads a versioned release, verifies its SHA-256 checksum, installs the prime-agent command, and can prepare the IPython runtime used by the agent. Start Prime Agent from the repository or directory you want it to work in: cd /path/to/project prime-agent On first launch, run /login to choose a subscription or API-key provider. Prime Agent works in the current directory and can run commands and modify files there. Use a disposable clone, clean worktree, or another checkpoint you can inspect and restore. WarningPrime Agent executes model-generated Python and project commands with your user permissions. Its worker and kernel processes improve lifecycle isolation and recovery; they are not a security sandbox. Review changes and use trusted repositories, instructions, skills, and extensions only. Run untrusted code or instructions in an external sandbox or restricted environment.

Useful commands: prime-agent agents # Browse running, idle, and saved sessions prime-agent attach <agent> # Reattach to a running session prime-agent --resume <path|id> # Resume a saved session prime-agent status # Inspect background service state prime-agent doctor [--fix] # Inspect or repair background services prime-agent update [--force] # Update Prime Agent prime-agent shutdown [--force] # Stop every agent, worker, and background service Built for Long-Running Work Prime Agent is built for long-running work, especially for evaluations in research. These features are available in the TUI, and when run autonomously.

Continual Harness: /refine can persist focused, reviewable lessons as supplemental prompts, memories, reusable skill descriptions, or subagent specifications, with recorded refinement history. It does not replace packaging and reviewing new executable skills. Direct agent-to-agent communication: running agents and retained subagents can discover one another, exchange messages, and steer active work. Daemon-backed continuity: active sessions, IPython state, schedules, and subagents keep running when the terminal detaches and can be reattached later. Heartbeats and schedules: /heartbeat, rlm_heartbeat, and prime-agent schedule can re-enter a session periodically or at a specific time. Persistent goals: /goal keeps an objective and its progress active across turns until it is completed, paused, or cleared. Bounded autonomous mode: /autonomous continues within configured turn, token, and time budgets and can run user-defined quality gates. A passed gate checks only what that gate verifies; reaching a limit does not imply task success.

Documentation

Quickstart — install, authenticate, and run a first session Usage and CLI reference — commands, sessions, autonomous limits, and output modes Long-running and background agents — detach and reattach, goals, heartbeats, and schedules RLM programming model — persistent IPython, subagents, skills, and the trust model JSON mode and RPC mode — headless automation and integrations Skills — install and create reusable capabilities Provider setup — subscription and API-key providers Architecture overview — daemon, worker, kernel, and persistence boundaries Development — build and run from source

Acknowledgements Our agent and TUI is built on top of pi. We thank the authors of pi for their valuable work. License Prime Agent is fully open source and released under the MIT License.

Learning map

Stage 1 — Foundations

  1. Understand the RLM core concept: context-as-variables + programmatic tool calls in a persistent REPL
  2. Install Prime Agent on your local machine
  3. Complete initial setup (login/authentication with API key or subscription)
  4. Launch a first session in a disposable project directory

Stage 2 — Core Workflow

  1. Experiment with /refine to review trajectory and apply evidence-backed updates
  2. Create and invoke subagents using rlm(...) for parallel work
  3. Build reusable skills from recurring workflows
  4. Manage sessions across terminal disconnects (detach, resume, reattach)

Stage 3 — Advanced Patterns

  1. Configure daemon-backed agents for background execution
  2. Set up agent-to-agent communication and message passing
  3. Implement heartbeats and scheduled task re-entry
  4. Use bounded autonomous mode with budgets and quality gates
  5. Build persistent goals with cross-turn progress tracking

Get hands-on — step by step

  1. Install Prime Agent by running: curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh
  2. Navigate to your project directory: cd /path/to/project
  3. Start the agent: prime-agent
  4. On first launch, run /login in the TUI to choose a subscription or API-key provider
  5. Create a disposable clone of any repository for safe experimentation: git clone https://github.com/example/repo.git && cd repo
  6. Verify the agent is working by sending a simple coding task, such as "Analyze this directory structure and outline the key modules"
  7. Test subagent capability: invoke rlm(...) in the persistent IPython environment to spawn a child agent for parallel work
  8. Try /refine to review your session's trajectory and apply an evidence-backed update to harness state
  9. Create a reusable skill by writing a Python package with recurring workflows, then import it in a new session
  10. Test long-running mode: start a background task, detach from the terminal, and later resume with: prime-agent --resume <id>
  11. Set a recurring heartbeat: /heartbeat 30 (to re-enter every 30 seconds) or configure a schedule via prime-agent schedule
  12. Experiment with bounded autonomous mode using /autonomous with turn, token, and time budgets plus custom quality gates

Top 3 sources

  1. 1
    Prime Agent GitHub Repository

    Official open-source repository with source code, issue tracker, and detailed documentation links.

    https://github.com/PrimeIntellect-ai/prime-agent

  2. 2
    Prime Agent Quickstart Documentation

    Official quickstart guide covering installation, authentication, and your first session.

    https://docs.primeintellect.ai/prime-agent/quickstart

  3. 3
    PRIME-RL Framework

    The reinforcement learning framework backing Prime Agent's self-improving capabilities and RLM programming model.

    https://github.com/PrimeIntellect-ai/primerl

Links are AI-suggested — worth a quick sanity check before diving in.