Prime Agent Runs the Whole Session Inside a Python REPL

1 min read
coding-agentsautonomous-agentssubagentsagent-architecture
View as Markdown
Originally from github.com
View source

My notes

Summary

Prime Agent is an open-source coding and research agent that treats an entire session as a persistent Python (IPython) REPL rather than a chat loop. Context, tools, and subagents are all manipulated as code, an approach it calls “prompt-as-a-variable”. It layers a self-editing “Continual Harness” on top: durable state (memories, skill descriptions, subagent specs) that a /refine command can incrementally update based on evidence from the current trajectory, without ever touching the immutable base system prompt.

Key Insight

  • Core architecture bet: instead of the usual tool-call JSON loop, the agent runs inside a persistent IPython kernel. File ops, shell, subagent spawning (rlm(...)), and context management are just Python calls the model writes.
  • Skills are literally importable Python packages, not markdown prompt files, and there is a built-in skill creator that promotes recurring workflows into project- or user-level skills.
  • Self-improvement is scoped and reversible: /refine only appends small, evidence-backed updates to supplemental state (memories, skill descriptions, subagent specs). The base system prompt is immutable, and every refinement is snapshotted for rollback.
  • Sessions are daemon-backed, not tied to the terminal. prime-agent attach <agent> reattaches to a running session, and agents can run in the background indefinitely with heartbeats and schedules to re-enter periodically.
  • Agents can talk to each other directly (rlm subagents plus running sessions) without the user relaying messages, making agent-to-agent orchestration a first-class feature.
  • “Bounded autonomous mode” (/autonomous) runs within configured turn, token, and time budgets plus user-defined quality gates, but the docs are explicit that a passed gate only verifies what it checks, not overall task success.
  • Explicit non-sandbox warning: it executes model-generated Python and shell commands with the user’s real permissions. Worker and kernel isolation improves recovery, not security. The recommendation is to run in a disposable clone, worktree, or checkpoint rather than directly on a trusted repo.
  • Built on top of pi (earendil-works/pi), alongside PrimeIntellect’s own verifiers and prime-rl projects, so it is part of a broader RL and agent-training ecosystem rather than a standalone toy.