Skip to content

The subagent host

pi-straw-boss hosts subagents itself, on the Maestro engine (@nubl/maestro, pinned to a commit of the weihung fork), in a simple mode: one task per child, in a Herdr split pane, its result back as a message. A plain pi install npm:pi-straw-boss brings it; dispatch needs only Herdr.

  • Tools. subagent (name, task, agent, model as an exact id, a fallback list or task:<category>, thinking, cwd, item, solutionSpace, systemPrompt, skills, tools, fork, interactive), subagent_cancel, subagent_resume, subagents_list, and /subagent; a child gets caller_ping, and subagent_done when it does not exit by itself. The names and parameters are pi-herdr-agents’, so prompts and skills need no change. Not registered: persistent specialists (subagent_send, subagent_stop), subagent_interrupt, managed worktrees (worktree_list, worktree_remove, /worktree), the task-model writer (subagents_write_task_models, /subagents-init), Herdr Core and the Herdr sidebar plugin. A call that passes persistent, notify, worktree or accept, or names a role defined as persistent, is refused with what to do instead.
  • Steer a running child. Steering requires pi-intercom 0.19.0 or newer; the sb server still accepts 0.18.1. subagent_steer({ name, message }) or subagent_steer({ id, message }) addresses only a child this session launched or resumed. Use the full run id if two running children have the same name. A busy child takes the message at its next step; an idle child starts a turn. The child’s pi confirms injection over pi-intercom and records it in the run’s activity. The receipt proves injection within the OS account’s trust boundary: other processes running as that user can already write the session files or type into the child’s pane. Without confirmation within ten seconds the result is unconfirmed, not permission to resend. For an expired delivery or an ended run, the refusal gives the subagent_resume arguments. A train can steer its own child, including a reviewer it dispatched. Members, towers, ally runs and remote turns cannot steer.
  • Who may dispatch. Any pi session: a main, a member, a train, or a session that never joined, with or without todos. A worker launched with no item (a quick scout, a check off the plan) is a normal worker: nothing warns of it, and it shows as a bound one does.
  • Preflight. A subagent or boss_pair call with item has that todo looked at first (spec; boss 2026-11-28), from the raw todo/v1 snapshot of the launcher’s branch. A blockedBy cycle the todo waits on refuses the call with the cycle’s path, since that todo never becomes ready. A missing anchor, an anchor that names no runnable check (no command and nothing concrete that is seen, such as tests pass), a deleted or unknown blocker, and an item that names no todo of the list or a deleted one only warn, in a line on the call’s result. A <session8>#<id> of another session is that session’s to check. On a 5,000-row list with up to 12 blockers a todo its median is at most 5 ms of CPU a launch; the slowest launches run longer (a p95 near 20 ms when every row is open).
  • Where workers show. In pi, through pi-herdr-agents:run-rows:v1 on pi.events, with the event name, payload and claim as pi-herdr-agents defined them: pi-todo-ledger draws a run under its todo, and one with no todo in its group of other workers. The rows no presenter claimed show in the Subagents box above the editor, one row each: name · model · state · time. In the GUI and on the board a worker shows under the session that launched it, a session outside the tabs included.
  • What a todo’s runs spent. When a run bound to a todo ends, pi-todo-ledger (0.10.0) records its tokens, cost, wall time, runs and models on that todo (metadata.herdr.spend), summed over the todo’s runs and every fallback attempt; the session page shows the totals in the todo’s detail line, never the session paths. Maestro names each end’s run id, so sb’s host sends subagent:run-end for an end the model may never read, and the ledger counts it once. The figures are an estimate from the child’s transcript, not a bill (spec).
  • Models. <agent dir>/herdr-agents/config.json (default ~/.pi/agent/herdr-agents/config.json), the file pi-herdr-agents read: models.default, models.agents, models.tasks, models.tasksThinking, and the status, supervision, panes and spawning sections. Without the file, the package’s config.json.example gives the settings other than the models. Edit it by hand, then /reload.
  • A worker lost. When a worker’s pane closes or its pi ends before it reported, Maestro delivers one failed result. Before the model reads it, Straw Boss adds one paragraph with the worker’s name, its session file and the subagent_resume call, and does nothing else: the orphan nudge, pick-up, restore and revive below serve pi-herdr-agents’ runs and stand aside for the runs of sb’s host.
  • A worker idle too long. When a child’s turn has ended (Maestro’s waiting: Herdr says idle or done) and it has sat subagentNudge.idleMinutes (default 10) without a result, sb asks it to finish: once per idle stretch, subagentNudge.max times in all (default 2), and then it tells the parent once, in a Subagent status line in sb’s language that the line cap never drops. The question goes into the child’s own session through the child’s pi: the parent writes a request into <session>.sb-nudge/<run id>/ beside the child’s session file, and the child entry, only while it is in the session it was launched with, sends it as a user message when the child is idle, its input box holds no unsent text, no subagent of its own is pending, and no turn has started since the request was written; it acks sent only once the nudge, marked with its request, has entered its session within 30 seconds, and it takes no request older than 20 seconds. The child is told to write its final report and call subagent_done, or to use caller_ping when it truly waits on its caller. An auto-exit child is never nudged, because a fresh turn would close it and deliver its unfinished work as done: it says so, and the parent is told once instead. Never asked: an interactive child, a persistent specialist, a child whose turn runs (a long tool call too) or is blocked, one being cancelled; a cancel, or a turn that starts, revokes the open request. A request with no acknowledgement within a minute is not repeated, and the parent is told so once. A /reload or a quit revokes the open requests; across a reload the counts and the notices stay, and a notice stays queued until pi has taken its message into the parent’s session. The nudge rides the status loop, so status.enabled: false turns it off too, and subagentNudge.idleMinutes: 0 turns it off alone. Design: docs/specs/2026-11-28-done-nudge.md.
  • Selection. PI_STRAW_BOSS_HOST (sb or off), then <agent dir>/straw-boss/host.json ({ "host": "sb" } or { "host": "off" }), then ~/.pi/agent/straw-boss/host.json; with none of them, on.
  • One host. The host registers nothing while pi loads. At session start every extension has registered, so it reads pi’s own record: pi.getCommands() lists each extension’s /subagent before any dedupe, and pi.getAllTools() the extension whose subagent won, each with the resolved path of the extension that registered it, which the nearest package.json above it names. When pi-herdr-agents, or another copy of pi-straw-boss, registered one, sb’s host stands down: it registers nothing, and the doctor shows why. For pi-herdr-agents, sb also warns once per session (on stderr without a UI), showing where pi loaded it, the pi remove command, and the /reload step. Load order, pi-herdr-agents’ load stamp and the runtime slot an earlier load left are never read. Otherwise it loads Maestro and registers its tools.
  • Packaged. The child entry every launch passes with -e is src/host/child.ts, a path kept in every release. The sb server needs pi-intercom, which a plain install does not bring (pi install npm:pi-intercom); dispatch works without it, steering does not. The operating guide is the package’s skill pi-straw-boss-subagents.