omp packages

@ferris1225/pi-subagents7.0.23

Your best model thinks, cheaper models do the legwork: lead/worker orchestration for Pi with background subagents, retained sessions, and Git worktree isolation.

GitHub Actions Published 5 hours ago MIT ~4.7K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-subagents

Your best model thinks. Cheaper models do the legwork.

Subagent delegation for Pi: the main model plans and reviews, background subagents research and build on the models you pick.

npm version npm downloads license

What you get

  • Two roles. researcher only reads and reports evidence. worker edits, runs checks, and reports what it ran.
  • Runs in parallel. Up to five at once. Each worker edits its own Git worktree, so they cannot step on each other.
  • Results come back as files. Each run saves its full output and sends a short summary, so the main model reads results as they land.
  • Fixes go to the same run. A finished run keeps its session, so a correction continues it instead of starting over.
  • Swarm mode for big jobs. Three or more live runs switch to it automatically. Named members coordinate on a shared board, and every Swarm keeps a nitpicking verifier.

It saves main-model usage, not total tokens. Briefs, separate contexts, and review cost tokens too.

Install

pi install npm:@ferris1225/pi-subagents
  1. Run /subagents-setup and pick a model and thinking level for each role.
  2. Give the main model a task. It decides what to delegate.

Needs Pi ≥ 1.7.0 and Node.js ≥ 22.19.0.

Settings

/subagents-setup is a menu; every change saves right away.

  • Model: type to filter, ↑/↓ to move, Enter to pick. "Follow main" tracks the main window's model.
  • Thinking: only levels the chosen model supports. A saved level the model cannot run is lowered.
  • A model that is no longer available shows [unavailable] and pauses that role. The main model is never used as a silent stand-in.
  • "Reset" asks before clearing both roles.

Settings live in ~/.pi/agent/pi-subagents.json:

{
  "version": 2,
  "researcher": { "thinking": "medium" },
  "worker": { "model": "provider/model-id", "thinking": "low" }
}

Broken JSON or an unknown version pauses new runs and leaves the file alone. /subagents-setup offers to repair it.

How a run works

  1. Main writes a brief: goal, known facts, owned paths, what "done" looks like, which checks to run.
  2. Main starts one run with subagent({ agent, task }), or several with subagent({ tasks }) when the tasks are independent.
  3. Each run works in the background and reports when it finishes.
  4. Main reads the result, checks the real diff and check output, then accepts it, sends a correction with subagent_message, or finishes the job itself.

Main keeps design decisions, direct answers, reading one or two files, and small edits.

Role Can do Returns
researcher Read-only tools and read-only Git inspection Answer, evidence, gaps
worker The main model's tools, including codemode Status, changes, checks, notes

Subagents never delegate, commit, push, or release.

Tools

Tool What it does
subagent({ agent, task }) / subagent({ tasks }) Start one run, or up to five independent ones
subagent_status({ id }) Progress, result, session, and worktree integration details; omit id to list all
subagent_message({ id, message }) Steer a running run, or give a finished one its next step
  • Runs start in the background and wake main when they finish. wait: true returns on the first finished run and leaves the rest running.
  • The same task in the same folder cannot start twice while a run owns it.
  • Write locks come from Owned paths: in the brief. Workers that would touch the same files merge into one; a later overlapping worker queues.
  • Every finished run saves its output to a file. Press Ctrl+O on the message to read it.

Swarm mode

Use it when one or two runs are not enough: three or more parallel streams, or work that needs an author and an independent reviewer.

  • Start: by itself, as soon as a subagent call would leave three or more runs live; those tasks become named members. /swarm <goal> starts it by hand, and main can call swarm({ action: "start", title, goal }) to set up the board first. A subagent call with swarm: false keeps plain runs.
  • Members: named worker, researcher, and verifier runs talk on a shared board with @mention wakeups and channels.
  • A verifier is mandatory. The verifier is read-only, hunts for defects and unverified claims, and tags the author with the fix. If you add authors first, a standing @verifier joins by itself and wakes on the first mention. The last verifier cannot be retired while other members remain.
  • Finish: post [done] <summary>, then /swarm end to stop members and bring back the normal tools.
Tool What it does
swarm({ action }) start, title, add (one member, 1–5 shards, or a fork), model, retire, channel, status, end
swarm_post({ text, channel? }) Post to the board; tag @name, @#channel, or @all
swarm_board({ since?, seqs?, channel?, limit? }) Read posts; no polling needed

Panel and widget

  • Alt+S (or /swarm board) opens the panel: ↑/↓ or j/k to move, Enter for details, Esc to go back, q to close. In Swarm mode, Tab or 1–3 switch Overview, Board, and Members.
  • The widget above the editor shows up to four running jobs and what each is doing right now. Every row has its own title, so parallel runs never look the same.

Isolation and stopping

  • Workers edit a temporary Git worktree by default; researchers stay read-only in your folder. Force a mode with isolation: "worktree" | "shared".
  • Worktree changes apply one at a time per repository. If applying fails, the patch and worktree are kept and shown at startup.
  • Escape stops unfinished runs and keeps finished results for your next message. /subagents-stop [id|all] does the same from the background. /tree stops runs and drops their results; quitting stops unfinished runs and keeps nothing from them.
  • A run with no activity for 30 minutes is stopped.
  • Subagents never approve confirmation dialogs on their own.

Storage

Runtime files live in your OS temp folder (<tmpdir>/ferris-pi-subagents-<scope>/), grouped per project. ~/.pi/agent/ keeps only pi-subagents.json.

  • Old sessions, result files, and idle project folders are cleaned up automatically. Live runs and artifacts kept after a failed worktree integration are never deleted.
  • /subagents-cleanup dry-run reports usage; /subagents-cleanup reclaims what is no longer needed.

Development

npm ci
npm run check   # type check, unused-code check, then the test suite

npm ci installs a pre-commit hook. Pushes to main run CI on Windows, macOS, and Linux, and publish a new version with a GitHub Release.

Changelog · MIT license