pi-continual
v0.1.0
Published
Minimal self-improving harness for pi: persistent Python REPL with rlm() sub-agents, continual-harness CRUD, /refine, and bounded autonomous goals
Maintainers
Readme
pi-continual
A minimal self-improving harness for pi, inspired by Prime Agent's RLM + Continual Harness abstractions — implemented entirely as a pi extension, no changes to pi (or pi-pod) required.
What you get
repl tool — persistent Python kernel (RLM-style programmatic tool calling).
One kernel per session; variables and imports survive across calls. Pre-loaded globals:
rlm(task, name=None, agent=None, model=None)— spawn a persistent sub-agent: a fullpi -psession with its own session file under.pi/harness/subagents/<name>/. Returns a handle immediately (non-blocking) so the model can fan out parallel work. Callingrlm()again with the samenamesends a follow-up turn into the same sub-agent session — it keeps its context.handle.wait(),handle.result(),handle.running(),subagents().harness— CRUD over the harness's own state, stored as markdown files: | kind | where | effect | | --- | --- | --- | |memory|.pi/harness/memory/| injected into the system prompt every turn | |prompt|.pi/harness/prompts/| injected into the system prompt every turn | |agent|.pi/harness/agents/| sub-agent spec, used viarlm(..., agent=name)| |skill|.pi/skills/| native pi skill (SKILL.md with frontmatter) |history(n=None)— this session's own JSONL entries, including context that was compacted away: the model has programmatic access to its full past.
/refine command + refine tool — evidence-backed self-improvement.
Runs a background pi -p agent over the current session's trajectory that applies the
smallest useful edit to the harness state (create/update one memory, prompt note, agent
spec, or skill) and appends a record to .pi/harness/refine-log.jsonl. Non-blocking; the
agent itself can call refine mid-task when it notices a repeated failure or reusable tactic.
/goal, /gate, goal_complete tool, --goal flag — bounded autonomous mode.
/goal <text> sets a persistent objective; after every settled turn the harness re-prompts
the agent to continue (capped at 12 turns). The agent ends the run by calling
goal_complete; if /gate <cmd> is set, the gate command must exit 0 first — a failing
gate returns its output to the agent for another attempt.
Install
pi install npm:pi-continual # user-wide (recommended)
pi install -l npm:pi-continual # project (shared via .pi/settings.json)
pi -e npm:pi-continual # try once without installing
# or from git:
pi install git:github.com/pi-pod/pi-continualRequires python3 on PATH.
Self-improvement that travels through git
All harness state lives in the repository (.pi/harness/, .pi/skills/). Commit it and
refinements become reviewable diffs that follow the repo — including into fresh
pi-pod pods, where each session starts from a clean
clone. Nothing here needs pod-side support.
Layout
extensions/continual.ts # the extension: repl tool, prompt injection, /refine, goals
extensions/kernel.py # persistent Python kernel: rlm(), harness, history()Notes / limits (deliberately minimal)
- The kernel restarts (state lost) on repl timeout or abort; sub-agent sessions survive on disk.
- Goal state is session-scoped and not persisted across restarts.
- Sub-agent messaging is parent→child only (
rlm()follow-up turns); there is no cross-session daemon. Inside a pi-pod pod that boundary is intentional.
