omp packages

@dieulc/workflow0.17.5

Plan↔Build mode with an independent Review Mode reviewer, questionnaire, subagent explore, todos and shadow-checkpoint rewind, plus a model-driven Orchestrator that binds the parent's TODO rows and dispatches one in-process Build child per row (no new win

dieulc Published 6 days ago MIT ~2.3K 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

@dieulc/workflow

Plan↔Build mode with an independent Review Mode reviewer, questionnaire, subagent explore, todos and shadow-checkpoint rewind for Pi.

2026-11-24 — model-driven Orchestrator

The frozen plan contract and the automatic acceptance engine are removed. The current flow is:

  1. Plan Mode writes a normal markdown plan. No schema, no executable-check block, no plan_validate, no freeze gate.
  2. Review (optional) submits findings and required revisions. The harness appends one ## Reviewer Revisions section; it never rewrites the plan body.
  3. Approve, then choose Direct Build or Orchestrator.
  4. The approved plan is immutable by prompt convention. Build and Orchestrator implement it; neither edits it.
  5. Orchestrator reads the plan, seeds a mutable TODO list, and dispatches one in-process Build child per row with a complete instruction. The child owns its local TODO list, runs the step's verification/gates, fixes in-scope failures, and reports success or an out-of-scope blocker.
  6. The parent trusts a successful report, marks the row done, and dispatches the next row. On a blocker it inspects the root cause, amends the instruction and re-dispatches. The parent does not fix code itself and does not re-run the child's checks.

Removed: plan_validate, /plan lint, /workflow lint, the freeze gate, the frozen v1/v2 snapshots, the NDJSON run journal, the diff gate, per-row check execution, repair rounds, the final-gate marker, migration-scan and the migration-report script. Old runs are not resumed; restart from the approved plan. The Orchestrator parent now has the same permissions as Build; delegation is a prompt convention, not a mechanical cage.

Features

  • Plan / Build duality — Plan tool gating (edit/write blocked in plan), Build restores full tools; Tab completes the highlighted suggestion while a list is open and otherwise cycles Default → Plan → Orchestrator → Build (Ctrl+Alt+P always cycles; a managed worker omits Orchestrator), --workflow-plan flag. Hosts that render generic contributions (Pi Desktop) get one current-mode control bound to the same cycle through /workflow-cycle.
  • Review Mode — an independent reviewer agent that runs after Plan Mode finishes (sequential — never in parallel), in its own in-process session. It audits the plan, appends its findings and required revisions as a ## Reviewer Revisions section, streams its work into the main transcript, and hands the result to the configured presenter (/handoff: Plannotator, or the workflow's native questionnaire). If Plannotator is unavailable or answers with an error, the handoff falls back to the native questionnaire (the plan is printed into the transcript, the choices are pinned at the bottom). Off by default; see Review Mode below.
  • Questionnaire — 1–4 questions with headers/options, dedup freeform aliases, and an inline ↳ Your answer: editor. Rendered as a bounded bottom-sheet overlay: a short question and the choices stay pinned, while a long question or the optional context body (e.g. a proposed commit message) scrolls with the wheel, PgUp/PgDn or Ctrl+U/Ctrl+D. The freeform editor takes the pane while typing.
  • Explore (subagents) — parallel pi --mode json subagents (max 8, concurrency 4), session_shutdown kill, activeSubagents
  • Todos — plan-faithful todo list (global step refs + statuses + phase groups) that persists as execution state across Build, Orchestrator and Default. Execution TODOs are created by the Build kickoff from the approved plan; Plan and every Review/revision turn are read-only for the list (workflow_todo accepts list only, and the panel renders the rows as a plan preview with no current step). The tool-result footer, the throttled reminder, [DONE:n] completion, the stale ⚠ notice and the per-step auto-commit never fire until execution has started — todoExecutionLive, which is true for Build, Orchestrator and Default (not Plan). workflow_todo (list/update/done/pending/add/toggle/clear) with industry-style wholesale update (send the COMPLETE list; omitted items are removed) plus idempotent done/pending, lenient [DONE:<ref>] markers, throttled Claude-Code-style reminders, a tool-result footer, and a stale ⚠ notice — but no forced turns and no heuristic auto-completion (reference: Claude Code / OpenCode / Codex practice). A pinned panel shows the active list, collapses to one summary line when every step settles, and is controlled by /todos show|expand|collapse|hide|auto or Ctrl+Alt+O (terminal Pi). In Pi Desktop the generic todos action group exposes the active panel's verbs; no Workflow-specific Desktop keyboard path is documented. The display choice is sticky for the current plan across Build edits and Review re-syncs; a different plan returns to automatic.
  • Rewind — shadow bare-repo checkpoints per cwd (agent/checkpoints/checkpoint-<slug>.git), isDirty + createSafetySnapshot + restoreCode
  • Plannotator bridge — plannotator:request/review-result/plan-approved events, with a native handoff fallback (the plan is printed into the transcript as a durable entry; a bottom-sheet questionnaire offers Approve / Feedback / Skip). workflow.handoff + /handoff choose between auto (default), native (never open the browser) and plannotator (always try, native fallback). Approving the plan and choosing where it runs are two separate decisions: the configured presenter asks about the PLAN first, and only an approval opens the execution chooser (Orchestrator or direct Build). getUtcPlanStamp / normalizePlanPath for .pi/plans/<UTC-date>-<UTC-time>-<slug>.md
  • Model roles — Planner/Explorer/Builder roles with one model + thinking level each (roles.ts, ~/.pi/agent/roles.json v2). /plan switches to the planner model, /build to the builder model, explore subagents use the explorer model. /role opens a tabbed picker (scoped models first, Ctrl+O for all). The thinking list follows the selected model's thinkingLevelMap; unsupported stored levels are clamped on save/activation with a warning.
  • Write permission — a user-controlled allow/ask/never permission for file writes in Default mode, the mode that is otherwise ungated. /write-policy sets it; see Write permission below.
  • Shell guard — finite native deadlines for every shell surface (120 s default, 900 s ceiling), a pre-launch refusal for provably empty interpreter-stdin heredocs, and a request-scoped recovery budget: one changed approach, then stop. Covers main bash/powershell, explorer subprocesses and the isolated reviewer's review_bash; never times out human dialogs. See Shell guard.
  • Model profiles — named combinations of role models (profiles.ts, ~/.pi/agent/profiles.json v1). Create a profile per provider or per budget, switch with /profile — activation is session-scoped, so two concurrent sessions can run different profiles. With no profile active the roles.json flow applies unchanged. See Model Profiles.
  • Orchestrator (experimental) — opt-in model-driven dispatcher: the parent reads the plan, seeds mutable TODO rows, dispatches one in-process Build child per row with a complete instruction, trusts a successful child report, and re-instructions on a blocker. No frozen snapshot, no diff gate, no parent-side checks. The parent has Build permissions; delegation is a prompt convention. See Orchestrator below.
  • Prompt refinement (/prompt) — rewrite a drafted request in an isolated child session and hand the candidate back to the composer — never send it, never run it. /prompt <draft> is the Terminal entry; a Desktop host arms the same runtime through the typed composer-transform-v1 capability (a one-shot composer control, not slash concatenation). /prompt-model gives it an independent model, Default-mode inheritance is the fallback, and the main session model, roles and profiles are never touched. Refinement is bounded (inspect → ask → compose → submit), policy-safe, cancellable and recoverable. See Prompt refinement below.

Install

pi install npm:@dieulc/workflow            # latest
pi install npm:@dieulc/workflow@0.1.0      # pinned
pi install -l npm:@dieulc/workflow         # project-local (.pi/settings.json)
pi -e npm:@dieulc/workflow                 # try without installing

Manage it with pi list, pi update --extensions, pi remove npm:@dieulc/workflow. Requires Pi on Node ≥ 22.19; the Pi core packages (@earendil-works/*, typebox) are provided by Pi at runtime and declared as peer dependencies.

Commands

Command Description
/plan / /workflow Enter plan mode (tool gating + switches session model to planner model high thinking)
/build Enter build mode (full tools + switches session model to builder model medium thinking)
/rewind Pick checkpoint to restore
/todos List steps, or control the pinned panel: /todos [show|expand|collapse|hide|auto|clear]. No arg lists the active list (Child todos in child view); show aliases expand. clear is parent-only and refuses in child view with /orchestrator view parent guidance; on parent it asks first when UI is available (headless clears immediately)
/btw Queue note for next turn
/role Config screen: one model + thinking per role (planner/explorer/builder/reviewer tabs, custom roles included; type to filter models by provider/id or display name). CLI: list, set <role> <provider/model> [thinking], use <role|auto>, add/remove/reset
/profile Switch or manage model profiles (named role-model combinations). Picker: activate / edit / rename / delete / New profile… / Default… (fuzzy type-to-filter; completed actions close the picker). CLI: list, show <name>, use <name|none>, create <name>, edit <name>, rename <old> <new>, delete <name>, default [name|none] [global|project], retarget-provider <old> <new> [global|project] [--apply]
/prompt <draft> Refine the drafted request in an isolated child session and return it to the composer without sending or running it. Literal arguments; empty shows usage. Handled by the host on a Desktop build that advertises the structured composer capability (use the composer's Refine prompt control there); the Terminal path writes only the editor. Never starts a task, mode, plan, todo, checkpoint, review, handoff or Orchestrator dispatch
/prompt-refine [on|off] Toggle the one-shot composer arm (the control a composer-control publisher exposes). Armed means the next Send refines the draft and returns it in place; it does not run the task. off cancels/disarms a live operation. No model, session or runtime work happens on the toggle itself
/prompt-model [status] Show the effective prompt-refinement model and thinking level, its source (trusted project / global / Default-mode inherit) and any shadowed scope. set <provider/model> [thinking] [global|project] saves a validated override; inherit [global|project] writes an explicit inherit sentinel (a trusted project inherit suppresses a global override); reset [global|project] removes only that scope. Never changes the main session model
/review [path] Run a one-shot review round now, in Plan mode only. Without a path it uses this run's plan write, then the session's latest plan write; works with Review Mode on or off (mode stays OFF). Outside Plan it refuses with guidance (/plan, then /review) and never switches modes implicitly. An explicit path must be under .pi/plans/
/review status Report the current review round: phase, round, snapshotted model, plan hash, findings, any error and pause state. This is the round; /review mode status reports configuration instead
/review pause Pause the in-flight review round (keeps the reviewer session warm). Same as ESC while a review owns the turn
/review resume [note] Continue a paused round on the warm session, or start fresh if the plan changed since the pause. Plan mode only; a refused resume keeps the pause intact for /review abort
/review abort Stop the round or discard the pause. A waiting handoff is handed off to the author's plan through the native questionnaire — never re-opened in Plannotator. Releases the mode-switch and prompt locks
/review say <message> Send a message to the in-flight reviewer (echoed as you → reviewer)
/review mode on|off [global|project] Enable/disable Review Mode (default off). off is allowed while a finished handoff is pending (it becomes a plain handoff) but refused while a reviewer round/pause/gate is active (/review abort first)
/review mode status Print the effective configuration: enabled, the timeout and the settings file that supplied it, the prompt source and any shadowed scope. Not the round — use /review status for that
/review mode timeout <seconds|unlimited> [global|project] Set or show the per-pass time cap (unlimited/0 = no cap). Writes only timeoutMs to global settings by default; it never pins enabled
/review prompt [global] Edit the project's additional reviewer guidance (adds to the fixed criteria — it can never replace or weaken one)
/review help [verb] Print the verb list, or the usage and guards for one verb
/handoff [auto|native|plannotator] [global|project] View or set the plan handoff target (workflow.handoff). auto (default) uses Plannotator when a host is detected, native never opens the browser, plannotator always tries. Refused while a handoff prompt is open — use the next command instead
/handoff approve <decision-id> Stage 1 only: approve the PLAN by the id printed with it. An interactive session then opens the execution chooser; a headless one prints the stage-2 commands
/handoff continue <decision-id> Reopen the execution chooser for an approved plan (e.g. after cancelling it, or after a reload)
/handoff execute <decision-id> orchestrator|build Stage 2 explicitly, for headless use or after cancelling the chooser. Refused before approval, or for a changed/consumed/uncertain decision
/handoff fallback Present a pending PLAN review in the native questionnaire now, without changing workflow.handoff. The escape when the in-app review tab is blank or unusable. An approved plan uses /handoff continue instead
/commit Commit staged changes with an AI-summarized message (-a: stage tracked changes first). Confirmation-gated; the confirmation arms the commit exemption for that run
/commit-policy [never|ask|allow] [global|project] View or set the commit policy (default never: the agent cannot git add/commit/push — you commit, or use /commit)
/write-policy [allow|ask|never] [global|project] View or set the write permission for Default mode (default allow: the agent writes freely; ask prompts per write; never blocks writes — see Write permission)
/folder-policy [repo|cwd|parent|any] [global|project] Shared folder scope for read, write and commit (default repo: nearest .git root, fallback cwd). outside ask|block, grant project|global, templates allow|block, sensitive, exclude [add|revoke|list] <glob> [--global|--project]
/read-policy [status|allow <path>|revoke <path>|shell paths|strict] [global|project] Read grants, shell analysis mode and the shared folder scope. Sensitive files are always blocked
/permissions [explain] <command> Explain a shell command's verdict without running it: each segment's class, the Plan/Review/Explorer answer and whether the write policy would treat it as a write
/shell-guard [status] Show the effective shell deadlines, their settings source, and this request's failure budget. /shell-guard limits <default-seconds> <max-seconds> [global|project] sets them; /shell-guard reset clears a tripped request while idle
/default Switch to Default mode (no workflow gating, full access)
/workflow-cycle Cycle the workflow mode (Default → Plan → Orchestrator → Build); the host-bound equivalent of Tab/Ctrl+Alt+P
/orchestrator Enter Orchestrator mode (bare). Entering the mode launches nothing
/orchestrator start [path] Record the approved plan and send the start kickoff; the model then calls orchestrator_start with the rows. Replaces a completed or cancelled (or fully settled) run when no child is live; an active run must be stopped or retried first. Bare start uses the current/last plan and otherwise refuses with /orchestrator start <path>
/orchestrator status Report the bound run, row progress, the live child and the next row
/orchestrator inspect [rowRef] Show one run row: root, instruction, last report and child detail
/orchestrator pause Pause the in-process Build child (warm session kept)
/orchestrator resume Resume a paused in-process Build child on the warm session, or start a fresh one through the retry path; never revives a completed or cancelled run
/orchestrator abort Abort the in-process Build child and leave the row retryable
/orchestrator retry [rowRef] Dispatch the named row again (or the current/next row) with its stored instruction; a completed or cancelled run is not revivable (use /orchestrator start)
/orchestrator stop Stop the run: dispose the child and cancel the run record. The escape when the rows can no longer settle
/orchestrator say <text> Deliver a message to the running or paused child
/orchestrator view [child|parent|auto] Show or set which session the pinned panel and footer follow
/orchestrator help [verb] Print the verb list, or the usage and guards for one verb
/prompt-refine-companion Internal grant-only bootstrap a composer-transform host invokes for prompt refinement; not a normal user command

/review status and /review mode status answer different questions: the first reports the current round, the second reports configuration. The first token is a verb only on an exact match, so a plan file whose name is exactly status, mode, prompt, pause, resume, abort, say or help is shadowed by that verb — spell the path or rename the file (/review help prints the same caveat).

Mode commands (/plan, /build, /default) and the Tab / Ctrl+Alt+P shortcuts are refused while a reviewer round or review-owned handoff owns the turn — running, paused, or a handoff produced by /review/Review Mode, or applying one (Tab still completes a visible suggestion list); see Controlling a running review. A plain plan handoff (Review Mode off) does not lock modes or prompts: switching or typing a new prompt supersedes it, and the plan file stays on disk.

Orchestrator (experimental)

Orchestrator mode is an opt-in engine for a long, phased roadmap. It is experimental: the contracts, reducers and live composition are implemented and tested, but real provider turns and visible-host acceptance still require a human run (see below). Entering the mode changes nothing by itself and ordinary short Plan → Review → Build work keeps its current behavior.

Core rules

  • Mode entry is not execution. Tab or /orchestrator enters the mode; nothing runs until the user approves a plan (or explicitly agrees the standalone steps) and picks an execution destination.
  • Ownership is execution-phase based, not record based. A run owns the interactive turn only while a child is starting|running|paused|settling, or while the run phase is running between rows. A record in idle, interrupted, paused, completed or cancelled never blocks a prompt — in Orchestrator or any other mode — so the parent can answer between children. While a child is live, prose still reaches it (steering) and a paused child queues the note.
  • A settled run completes itself. When every run row is completed or cancelled and no child is live, the run phase moves to completed — from a TODO write, a child settle, or a session restore. A recorded failure or abort always wins: a fully settled run whose child then fails or is aborted ends interrupted/paused, never completed.
  • A terminal run is replaceable, not revivable. completed and cancelled are sealed: /orchestrator retry, /orchestrator resume and orchestrator_dispatch (including an explicit row) refuse, and the replacement is orchestrator_start with new rows. A new start also replaces a run whose rows are all settled once no child is live, but never a run with a live child.
  • Mode-gated controls apply to live children. /orchestrator abort keeps requiresMode: true unchanged because abort only ever applies to a starting|running|paused child; a dormant run has nothing to abort. /orchestrator stop remains the escape when a run's rows can no longer settle — for example after /todos clear, because settling is read from the live TODO list — and cancels the record so a new run can start.
  • The model owns the row list. After the discussion is agreed the model calls orchestrator_start with one step per row (a string, or {text, workspace} for a non-primary root) and the workspaces the plan declares. The extension records the rows and the resolved roots; it does not compile or validate the plan.
  • Neutral destination every time. An approved plan always asks: direct Build, or Orchestrator, plus Decide later. Both options are equal: there is no saved default, no recommendation and no /handoff execution|once. Feedback keeps the session in Plan.
  • Direct Build stays in-session. It receives one plain kickoff, keeps any rows the model already created and has no freeze/merge step.
  • The child is an in-process Build session — no window or tab. Each row runs in a second SDK session inside the same Pi process with the row's root as cwd: its own model runtime, an in-memory session and a fresh Workflow extension instance. It gets the Workflow-managed Build tool set and every policy gate (write, folder, read, commit, shell), creates its own task-local TODO list before the first edit, and never orchestrates or edits the parent run. A managed child is exempt from the parent/child worktree exclusion.
  • The parent has full Build permissions; the child owns the worktree while live. The parent may read, inspect and use its TODO list, but edit/write and mutating shell are refused while the child is starting|running|settling. A settle releases the child immediately.
  • One panel list authority. The session TodoStore is the list the pinned panel renders and the list workflow_todo mutates; a child has its own.
  • The parent trusts the report. A settle produces a report and releases the child. The report is steered into the parent's next step (never a follow-up queued behind a polling turn) and carries a deterministic Status:/Todos:/Suggested: block built from the child's final task-local list and any policy refusal. The parent reads it, marks the row done with workflow_todo, and dispatches the next row. It does not re-run the child's checks and does not fix code itself.
  • Blocker routing is explicit. An external blocker — a policy refusal such as workflow.commitPolicy: never, or an action only the user may take — is never re-dispatched: the child is already released, the row is marked done, and the reason plus the child's status go into the parent's final report. An in-scope blocker — failing checks, missing code, unfinished work — is retried on the same row with orchestrator_retry and amended instructions.
  • The parent can stop a live child. orchestrator_abort releases a child that is starting|running|paused; the row stays retryable, an existing report is preserved, and a settled child reports "nothing to abort" instead of an error. Dispatch is a short admission: it returns as soon as the child accepts the kickoff, so the parent must end its turn rather than poll orchestrator_status.
  • Reload is a lost child. restoreOrchestratorRun restores the record; a running phase becomes interrupted and the footer says so. Old journals, frozen snapshots and run directories are never read or migrated.
  • Verification is ordinary bash. The model runs the plan's ## Verification before the last row is marked done and states exactly what it ran. There is no hidden gate, no workflow_execution tool and no final check executor.
  • Cross-repo work is multiple rows. One row, one root. cwd is a declared alias or an absolute path inside a declared root; an unknown or ambiguous root is refused rather than guessed.
  • The approved plan's steps are the work. The Orchestrator (and direct Build) consume the plan's ## Steps and nothing else. The ## Reviewer Revisions (round N) appendix is the Reviewer's record of the review that produced that plan: it is never parsed into rows, never counted as steps, and never bound to a row or a child. There is no ## Review notes (advisory) kickoff block and no mission section for notes that could not be placed — the revision argument happens in Plan, before approval, through the Planner↔Reviewer loop (see Review Mode). The approved plan wins on any conflict with an appendix line.

Host contract

Plan/Build/Review/TODO presentation is published through a generic, bounded host contract. Pi Desktop renders arbitrary extension modes, actions, input availability and related sessions without parsing Workflow names; related-session ownership is derived from a registered command's source info, not from an owner string in the payload. Two unrelated fixture extensions cover this contract in both repos (fixtures/two-extension-contract.json).

Orchestrator no longer requests a Desktop related session or a new tab. The related-session contribution kind and session-host.ts remain as the generic host contract for other features; Workflow's own use of them is gone. Pi Desktop may still show the Orchestrator status/actions rows published here.

Action groups, the mode menu and inline controls

Contribution v1 gained two additive presentation features. Neither changes the meaning of an existing row, so a host that predates them keeps rendering the rows it already understands.

  • Action groups. An action may carry group { id, label, order, placement }. Identity is (owner.id, group.id); placement is the closed enum inline (compact bar button) or menu (three-dot drop-up); order defaults to 0 and placement to inline. An action without group stays on the legacy ungrouped path, and a malformed group or unknown placement fails the envelope instead of being guessed. Workflow publishes run-controls (inline, 30), review-controls (inline, 30) and todos (menu, 40).
  • mode-choice. The mode menu is its own kind: "mode-choice" / slot: "mode-choice" row: label, description, tone, order and presentation-only checked. It has no command, enabled or disabledReason; the required same-owner actionRef names the kind: "action" that executes it, exactly like mode.actionRef. A dangling, foreign or wrong-kind reference parses but is refused by the resolver — the host never invents command text.
  • Four mode choices, one glyph identity. The choices read Default, Plan, Orchestrator and Build. The composer mode badge keeps the existing glyph labels ◦ default, ⏸ plan, 🧭 orchestrator and ▶ build byte-for-byte, so a host menu must not replace them with the clean names. Each mode-<key> action resolves to the registered /default, /plan (or /workflow when another owner holds /plan), /orchestrator or /build. The current mode is disabled with current mode; a live Review/handoff lock disables every other mode with the lock notice; a command that could not be registered yields a disabled action with a named reason, never a dead button.
  • TODO menu and Auto todos. The four display verbs are Auto todos, Show todos, Collapse todos and Hide todos in the todos group; there is no computed todos-toggle action. They always target the active panel: child while /orchestrator view child is active, parent otherwise. There are no parent/child command keywords; switch with /orchestrator view parent|child|auto. The orchestrator-view action is labelled Show parent todos or Show child todos as appropriate (child run controls stay in run-controls). Progress counts only a non-empty active list; no 0/0 row is fabricated.
  • Review controls. A running round publishes Pause review + Abort review; a paused round publishes Resume review + Abort review, both in review-controls. The old standalone review action (status/resume) is gone; the workflow-review status line owns the phase, and the handoff/transition phases publish no controls because the review tab owns the decision. Commands use the current grammar — /review pause, /review resume, /review abort — never the retired hyphenated spellings.
  • One child status surface. No orchestrator-child status row is published; the workflow-orchestrator setStatus line already carries the child telemetry. The child action set is the TODO view toggle plus Pause child / Resume child / Abort child in run-controls (the orchestrator command uses the verb grammar: { name: "orchestrator", args: "pause" }, and Review uses { name: "review", args: "pause" }).
  • Working-message ownership. On a generic-contribution Desktop host the extension writes setWorkingMessage only while it owns the turn. The line is the live child hint surface (pause/abort hints and the paused/settling guidance), and setWorkingVisible(true) ships only with a message the extension owns. A running, paused or handoff Review suppresses the write entirely, so the reviewer's message is never overwritten; when the extension owns the turn it clears only a message it set, and visibility is not used as a liveness hack over a native retry/compaction indicator.
Contribution compatibility
Capability 0.13.0 (previous npm release) 0.14.0 milestone 0.17.5 (this release; additions since 0.15.0)
action.group / placement absent; extra fields are ignored absent published (inline + menu)
kind: "mode-choice" / slot absent; older host drops the unknown kind absent published; four choices, same-owner actionRef
Mode and Review commands hyphenated registrations (orchestrator-pause, review-pause, …) verb grammar (/orchestrator pause, /review pause, …) verb grammar (unchanged)
Review controls standalone action/status only /review pause|resume|abort status hints inline Pause/Resume + Abort group
Child status orchestrator-child status row same removed; workflow-orchestrator line only

This package is 0.17.5; the previous npm release was 0.13.0. The intervening changelog versions are development milestones, not separate published artifacts. Hosts supporting groups and mode choices consume these additions additively; older hosts keep supported rows. Publishing Workflow does not update Pi Desktop's bundled artifact. Check that repository's resources/workflow.lock.json and staged bundle for its actual pin; Desktop staging and live acceptance were not verified by this release.

Composer transform (frozen wire contract)

composer-transform.ts freezes the additive composer-transform-v1 capability that lets any extension refine the live composer draft without sending it. The same wire format is read independently by Pi Desktop (src/shared/composer-transform.ts); fixtures/composer-transform.conformance.json is copied byte-for-byte into Desktop's tests/shared/fixtures/ and both suites assert the same SHA-256 and verdicts.

  • Contribution. A kind: "composer-control" row uses the composer-actions slot, a closed semantic icon list, checked/enabled/disabled reason, and an explicit one-shot-return (or persistent) behaviour. Its same-owner actionRef toggles refinement and transformActionRef starts the operation; the host resolves both live actions and their registered commands and refuses a foreign or wrong-kind id. The renderer never supplies command text.
  • Operation metadata and source binding. operation names the public input command and the registered bootstrap companion. The host resolves both from live SDK registrations and requires the same sourceInfo (path, source, scope) — matching names alone are not authority. A foreign command or companion is refused before any work starts.
  • Transport. Start request, started receipt, progress, candidate result, status, cancellation, apply receipt and lifecycle failures are separate bounded frames. Drafts, expanded paste text, image bytes, model/provider context and grants never travel through contribution command.args; the old static 1 000-character args limit is deliberately unchanged. Attachment identity/digest metadata stays separate from optional in-band image bytes, and diagnostics expose counts/ids/revisions only (never draft text, digest, bytes, model or context). The request carries binding/session/epoch, contribution revision and a live draft snapshot with a monotonic draft revision; duplicate request ids join/replay, conflicting reuse is refused.
  • Bootstrap/rendezvous. SDK 1.5 registers string-only command handlers, so the companion receives a grant-only JSON bootstrap. The host installs a single-use, unpredictable request-scoped listener on the existing in-process EventBus before invoking the companion; the grant id selects the private channel and a random proof must match. Exactly one claim is accepted and the typed port is handed directly to the companion callback. Prompt/image data never touches the bus, command string, status row or logs; listeners are removed on claim, expiry, rejection and teardown. The handshake is tested against the unmodified SDK 1.5 EventBus and a real string command handler in composer-transform.test.ts.
  • Old hosts and fallback. Contribution v1 stays additive: an older Desktop drops the unknown composer-control kind and keeps rendering supported status/action rows plus the public text command. composerTransformFallback() explicitly reports nativeControl: false and attachmentAware: false; a text-only fallback never promises attachment-aware transformation.

What is wired, and what still needs a live run

  • Wired in the entrypoint: the four-mode ring, a fresh authoritative mission injection, orchestrator_start (plan path or explicit steps), the mutable TODO row list and its persistence, the model-driven dispatch lifecycle (short admission → child runs → settle report → release → next row), the five parent tools (orchestrator_start|dispatch|status|retry|abort), the child lifecycle controller, the transcript entries, the operator commands (/orchestrator start|status|inspect|pause|resume|abort|retry|stop|say|view| help), and the neutral execution chooser.
  • Child composition: one in-process SDK session per row with noExtensions: true + this extension as the only additional path, an explicit Workflow-managed Build allowlist (questionnaire and orchestrator_* are excluded), the parent UI bridge for permission dialogs, and a registered teardown that runs after AgentSession.dispose() (which never emits session_shutdown).
  • Settle report and release: onSettled prepends a deterministic Status:/Todos:/Cancelled:/Open:/Policy refusals:/Suggested: block to the child's summary, stores it on the row, releases the child session and steers the report into the parent's next step. onError and onAborted use the same builder and record interrupted/paused with a reason; neither overwrites an existing settle report. There is no automatic accept: the parent marks rows done through workflow_todo.
  • NOT RUN: real provider/model turns, real terminal/Desktop rendering of the child transcript entries, and /reload in a live TUI. See ../../../docs/orchestrator-live-acceptance.md for the exact human matrix (currently NOT RUN).
  • The installed SDK's anonymous event bus is not publisher authentication; extensions remain trusted executable code. Privileged host operations require the host-issued, registration-bound grant, and a host without that seam is advertised unsupported.

Approval has no lint or check preview

Approval is a plain confirm plus a destination choice. No code compiles the plan, previews executable checks or gates the approval on a check list:

  • there is no plan_validate tool, no /plan lint, no /workflow lint and no checkPreview in the handoff questionnaire;
  • a plan with indented headings, no ## Verification, or prose-only verification is approved like any other plan;
  • the model reads the plan and runs its ## Verification as ordinary bash when it gets there; the real command and its output are visible.

Plan format

A plan is a normal markdown document, usually .pi/plans/<UTC-date>-<UTC-time>-<slug>.md (for example .pi/plans/2026-11-24-2130-export-endpoint.md). The UTC HHmm time makes same-day plans sort by creation time. Legacy date-only names (.pi/plans/<UTC-date>-<slug>.md) remain valid and are never renamed: an existing plan is written in place, and only a new file gets a prefix.

# Plan: Add the export endpoint

## Context

Why this change is needed.

## Steps

1. Add the route and its handler.
2. Cover the happy path and the validation error.

## Verification

- `npm run typecheck`
- `npm test`

## Steps (or a numbered list under ## Plan Steps) is the human plan; the model supplies one row per step to orchestrator_start for Orchestrator, or creates the execution list with workflow_todo in direct Build. Plan/Review cannot mutate that execution list. ## Verification is a normal list of commands the model runs before the last row is marked done. Nothing parses the plan, validates a schema, compiles checks or reads Acceptance:/Files: metadata at runtime. Old plans with those sections are still readable — the extra sections are simply prose.

Multi-repository workspaces

One row targets one repository root. The model declares the roots it needs:

{
  "steps": [
    "Add the endpoint",
    { "text": "Update the client", "workspace": "B" }
  ],
  "workspaces": [
    { "id": "A", "path": "C:/work/api" },
    { "id": "B", "path": "C:/work/client" }
  ]
}
  • The session root is always resolved as a root (W when undeclared).
  • A step omits workspace for the primary root and names one otherwise.
  • orchestrator_dispatch.cwd may be a declared workspace id or an absolute path inside a declared root; otherwise the row's stored root is used.
  • A multi-root run with a row that names no root fails closed instead of silently running in the primary repository.
  • An unknown alias, a missing path, a duplicate alias, a broad root (drive, home, system umbrella) or overlapping roots is refused before the run is created, with a message naming the declared ids.
  • Cross-repo work is multiple rows. A child launched with a row root as cwd edits only that root; the normal folder/write policy still applies, so declaring a root does not grant automatic cross-root writes.

Shell guard

The guard exists because of the 2026-11-20 erp-atom incident: two valid but empty python - <<'EOF' probes with no timeout waited 52m27s and 21m56s before the user aborted them. Pi's Bash tool has no default timeout; the model's timeout argument is optional. Prompt advice cannot make that finite, so the guard enforces it at the tool boundary.

  • Every shell surface gets a finite deadline. The model's omitted timeout becomes 120 s; an explicit value is capped at 900 s. Both are user-owned under workflow.shellGuard and deliberately finite: no 0, off or unlimited escape. A model cannot widen them or edit the settings file.
  • What it covers. Main bash and powershell, explorer children (the parent's effective limits are carried in PI_SHELL_GUARD_LIMITS and can only narrow the child's own settings) and the isolated reviewer's review_bash. Role, folder, read, write and commit policies still run first and keep their own refusal reasons. Human questionnaire/permission waits are not shell execution and are never timed out.
  • Empty probes are refused before launch. Only a direct Python-family stdin script (python - <<'EOF', including python3/py and a .exe path) with a provably empty body and a simple delimiter is blocked. Non-empty scripts, -c/-m, script files, quoted <<, <<-, multiple heredocs and missing terminators keep the finite deadline instead. The refusal says “empty interpreter probe”, never “malformed Bash”.
  • Bounded recovery is nonfatal. A first qualifying failure (native deadline, empty-probe refusal, invalid timeout value) returns the partial output/error with guidance and allows one changed approach. Repeating the same command, or any second qualifying failure in the same execution, quarantines shell for that execution; it does not abort the run. Further shell calls are refused, while non-shell tools (read, grep, find, ls, edit, write, LSP diagnostics) remain available. Nothing is replayed automatically, and a timeout never rolls back side effects.
  • Quarantine survives boundaries. It is not cleared by agent_end, compaction, an automatic continuation, a child replacement, a reload or a tree rewind. A required shell check that cannot run leaves its row/run blocked/unverified, never green. Only a genuine user prompt or an explicit /shell-guard reset starts a new shell budget; the model cannot reset it.
  • Request scope. The budget resets on a genuinely new idle user prompt, a new/resumed session, a rewind, or /shell-guard reset (including while a quarantined execution is active). A steer, follow-up, extension-authored message, native retry or compaction does not re-arm a tripped request.
  • Honest output. A native timeout keeps the partial output and names the deadline. /shell-guard status shows the effective limits, their source, inherited status and the current quarantine; audit entries record the reason, tool, call id, deadline and failure count — never raw command text or output.

Build completion and reload

Build completion is plain TODO state: when every non-cancelled row is done, the extension emits the completion card. There is no final gate, no workflow_execution tool and no execution-state machine. Verification is an ordinary bash command the model runs; its real output is the evidence.

  • /build switches to Build mode. The pause/resume/stop execution verbs were removed with the execution engine; an Orchestrator child is paused or aborted with its own controls, and a shell quarantine with /shell-guard reset.
  • A reload never resumes a run. The stored OrchestratorRun restores; a running phase becomes interrupted, the footer says so, and /orchestrator retry starts a fresh child. Old frozen/journal entries are ignored, not migrated: restart from the approved plan.
  • A persisted shell quarantine is re-adopted on reload under the workflow entry's shellQuarantine key, so the guard's guarantee survives the session boundary without an execution state.

Model Profiles

A profile is a named combination of role model settings — one {provider, id, thinking} each for planner, explorer, builder and reviewer. Profiles layer on top of Model Roles: role identity (tools, system prompts, custom roles) stays global in roles.json; a profile only overrides models while it is active.

/profile                    # picker: activate / edit / rename / delete / New profile… / Default… (type to filter)
/profile create budget      # name it, then pick model + thinking per role (same flow as /role)
/profile use budget         # activate for THIS session (none = back to the roles.json flow)
/profile edit budget        # re-open the tabbed model editor
/profile rename budget cheap
/profile delete budget      # confirm dialog; deleting the active profile falls back to base roles
/profile default budget     # workflow.defaultProfile — new sessions start on it (global|project)

Semantics

  • What a profile overrides: model + thinking for the four built-in roles only. Tools, systemPromptAddendum and custom roles are global (roles.json) and are never touched by a profile. Partial profiles are allowed in hand-edited files — roles a profile does not name fall back to the base role model.
  • Activation is session-scoped. /profile use changes only the current session and rides the session's workflow entry, so /resume restores it and two concurrent sessions can run different profiles — session 1 on a cheap provider, session 2 on a premium one. There is deliberately no global "active profile" file.
  • Optional default: workflow.defaultProfile (see Settings) seeds sessions that never made an explicit choice; an explicit /profile use <name|none> always wins for that session.
  • Effect: /plan switches to the profile's planner, /build to the profile's builder, explore subagents run on the profile's explorer, and Review Mode's reviewer session uses the profile's reviewer (planner fallback preserved). Activating while in plan/build re-applies the mode model immediately; in Default mode only a profile that carries a defaultModel switches this chat at once, otherwise roles apply on the next plan/build/explore/review use.
  • Live owners follow the switch. /profile use, the profile picker's activate action, /profile use none, /role set and a /role picker save all switch the live owners in place (see the owner matrix below). The in-flight request finishes on the old model and the next provider request uses the new one — no abort, no session restart, no re-seeded review round. If the switch is refused (missing model, provider auth), the live session keeps its model, the warning names both, and the next child/round still uses the profile. A managed child never writes the global default model/thinking.
  • /role keeps editing the base roles. With a profile active, the /role picker shows a notice and /role list prints the profile's overrides; /profile edit <name> is the way to change what actually runs.
  • Fallback: no profiles (or none active) → the roles.json flow, identical to before profiles existed. A profile referencing a model missing from the registry is warned about at save time and refused at switch time ("staying on current model"), same as /role.
Live-switch contract

The parent owns the launch profile and model; each live owner switches only its own session. The warm reviewer keeps its session — its recorded model key, ReviewState.modelLabel, the mode band, the status line and /review status change to the applied model so every surface names what actually runs. A settling Build child is left alone and starts its successor on the new model.

Owner / state What switches live One info notice + one durable entry
Plan (parent) This chat's planner model one activation notice + one workflow-model-switch entry, scope parent
Build (parent) This chat's builder model one activation notice + one entry, scope parent
Orchestrator parent + live child Parent chat and the live Build child (paused children switch before resume); the next child starts on the same selection the parent activation notice carries the live child's applied model plus one builder-child entry
Review: running / paused / handoff-owned / warm-idle The existing reviewer session in place; no new round is seeded. An automatic Plan-loop prefetch session is not a live owner and is picked up at its next round the activation notice carries the applied reviewer line (no notifyReview info notice) plus one reviewer entry; /review status prints the applied model once
Default The profile's defaultModel switches this chat when present; otherwise role models apply on the next mode/role use. No live child or reviewer is reconciled one activation notice + one entry, scope parent
Managed Build child (/profile use inside the row) The child's own session model only one child-local notice + one entry, scope child, in the child transcript

Each activation appends exactly one display-only workflow-model-switch entry per owner: {scope, role, from, to, ok, changed, at} plus error or reason when applicable. role mirrors scope for older readers, and the entry has a Desktop timeline renderer. The entry writer never notifies. Each activation, role, delete and editor command emits exactly one info notice, and it is emitted after every durable entry has been written: the default profile, default model, Default-mode model and live-owner lines (reviewer, builder child, settling child) are folded into that one notice instead of producing notices of their own. A reviewer line folded into this neutral activation notice is deliberately unprefixed — it is profile/role summary content, not reviewer output — while reviewer-authored warnings keep their Review Mode: prefix through notifyReview.

That single-notice rule absorbs a Pi TUI quirk: showStatus builds every info row from one mutable lastStatusMessage field, so a row created before the next entry can be repainted with a later message. The extension therefore guarantees one info notice per command and never interleaves durable entries between two info notices.

Child-local scope / parent-owns-launch-model rule. A managed in-process Build child may activate a profile for its own row, but that choice never leaves the child session: it switches via applyModeModel / pi.setModel(..., { persist: false }), and it must never write workflow.defaultProfile, workflow.modelDefault or Pi's native defaultProvider / defaultModel / defaultThinkingLevel mirror (a model_select mirror is refused too). The child emits only its own scope: "child" entry — no parent, reviewer or builder-child entry, and no default-model-skip entry — and has no channel back to the parent's settings or transcript. The parent alone decides the profile and model with which new children launch.

Picker keys: /profile and /role are fuzzy-filterable — start typing to narrow models by provider/id or display name (e.g. flash, open/beam, muse spark) and profiles by name, marker, description or one of their models. ↑/↓ navigate, Enter selects/commits (inert when nothing matches), Tab/←/→ switch role tabs, and Ctrl+O toggles scoped ↔ all while keeping the filter. Esc (or Ctrl+C) clears a non-empty filter first; a second press backs out or cancels. A completed /profile action closes the overlay; Esc-cancel, a failed save and the action menu's Back keep the profile list open, with its filter remembered.

Why: mix models from different providers in one workflow (frontier planner + cheap explorer), keep one profile per provider to control budget per provider, run concurrent sessions on different providers to work around per-provider concurrency limits, and exploit cheaper starter plans across several providers.

Profile config lives in ~/.pi/agent/profiles.json v1 (user) with optional per-project override at <cwd>/.pi/profiles.json (per-profile replace, project wins). Names are case-insensitively unique, ≤ 40 chars, no whitespace (keep them CLI-addressable), and none/auto/off are reserved (off is a /profile use deactivate keyword, so a profile can never be named it). A missing file is the normal empty state; a corrupt or wrong-version file is never rewritten (warning + in-memory empty config).

Argument completion follows pi's full-argument contract (the same one pi's /mcp uses): accepting a suggestion replaces the entire typed argument text, so completing /profile use Syn-␣ inserts /profile use Syn-Deepseek-… with the subcommand intact — it never collapses to /profile <name>. The dropdown closes (and the first Enter submits) once the typed token is already an exact, unique match. This applies positionally to /profile (use|edit|show|delete|rename <old>|default <name> [global|project]), /commit-policy (never|ask|allow [global|project]) and /role (set <role> <provider/model> [thinking], use <role|auto>, remove <name>).

Review Mode

An independent second agent audits the plan before the handoff renders. The handoff waits for the gated round; the reviewer appends ## Reviewer Revisions (round N) to the plan file mid-round while the author's plan body stays unchanged, and that whole document is what you see. The reviewed text is re-synced into the handoff; Plan and Review are read-only for the execution TODO list — the Build kickoff creates it from the approved plan — and the extension does not parse the appended revisions into new steps. The reviewer runs in its own child session, so Plan Mode and Build Mode never see its prompt, findings or transcript.

The Reviewer is a Plan artifact. A review round starts only in a parent Plan session: automatically after a plan submitted in this run (when Review Mode is on), or through an explicit /review//review resume in Plan mode. Configuration ON is not a trigger, and no reviewer session is pre-warmed speculatively: an ordinary Build turn, an Orchestrator parent turn and every in-process Build child boot zero reviewer sessions. Orchestrator row completion is a parent decision from the child report plus workflow_todo — it is not a review round and never asks a model to audit a child's work. Outside Plan, a manual start refuses with guidance (/plan, then /review) and never switches modes implicitly; /review status, /review pause and /review abort stay available for recovery. Automatic review binds to the terminal end of a run: retries, compaction retries, queued messages and continuation boundaries do not review an incomplete plan, and the later terminal attempt owns the handoff.

Plan Mode (main session) ──plan file──▶ Review Mode (child session, gated)
                                              │ appends `## Reviewer Revisions (round N)`
                                              │ (author's plan body unchanged)
                                              ▼
                                   handoff renders plan + appendices
                                              ▼
        Plannotator webview ◀── plan file + Reviewer Revisions
                │ approve ──▶ destination chooser ──▶ Build / Orchestrator
                │             (review suspends, reviewer session stays warm)
                └─ feedback ──▶ Plan Mode revises the plan body ──▶ Review re-reviews

  Plannotator unavailable/error/closes ──▶ native handoff (no dead end)
        plan entry printed above ──▶ bottom-sheet questionnaire
        Approve ──▶ chooser ──▶ Build / Orchestrator   Feedback ──▶ Plan   Skip ──▶ stay Plan
  • Approve in Plannotator → the destination chooser (direct Build or Orchestrator), not immediate execution; review activity suspends but the reviewer session stays warm for the next round.
  • Feedback → Plan revises, Review re-reviews the revision, Plannotator reopens.
  • A broken Plannotator is never a dead end. Every handoff path (automatic, /review, /review resume, a closed browser tab) falls back to the workflow's own questionnaire: the plan is appended to the transcript (scroll up to read it), and Approve plan (choose execution next) / Give feedback (stay in Plan) / Skip for now (stay in Plan) are pinned at the bottom. The fallback keeps the SAME handoff record, so its identity and recommendation survive; a late browser event cannot act on the native decision.
  • Approval is not execution. Approving the plan (in Plannotator or natively) records the approval and immediately opens a second, separate question: Plan approved — where should it run? with direct Build and Orchestrator as equal options, plus Decide later. No destination is saved or recommended. Cancelling the chooser keeps the approval: the session stays in Plan with no work started, and /handoff continue <id> reopens the chooser while the plan is unchanged. Direct Build sends one execute turn in this session; Orchestrator sends a kickoff so the model binds one TODO row per step with orchestrator_start, then explicitly calls orchestrator_dispatch for the first in-process Build child.
  • Any failure (missing model, unauth'd provider, abort, error) → the author's plan is handed over unchanged with a warning. Review Mode never blocks the plan. A pass whose run ends without a review_submit submission fails immediately (the settle race), so a silent reviewer cannot hang the round. timeoutMs defaults to 5 minutes; set 0 to opt out into unlimited, and a pass that outlives the cap is aborted — though a plan submitted before the deadline is always kept.

Enabling

/review mode on              # global (~/.pi/agent/settings.json)
/review mode on project      # this repo only (<cwd>/.pi/settings.json)
/review mode status
/review mode timeout 600 project # 10-minute cap for this repo only
/review mode timeout unlimited   # remove the cap entirely (not recommended)
/review mode timeout              # show the current value and where it came from

Turning the toggle off stops the reviewer and restores the single-agent plan/build flow exactly as it was. Nothing in Review Mode runs while it is disabled.

/review mode status reflects what the current process loaded, so /role changes and extension edits are picked up on the next /reload (or a new session). After /reload, the reviewer model, the effective timeout and its settings file (and the absence of the old flow row) all reflect the current files on disk.

The reviewer's model

Review Mode runs in its own session with its own model, taken from the reviewer role (/role). The default seed is deliberately a different model from the planner so the review brings an independent perspective — a reviewer that shares the planner's model and thinking tends to share its blind spots.

/role set reviewer opencode-go/muse-spark-1.3-contributor xhigh

If the reviewer role has no model, Review Mode falls back to the planner model and warns rather than silently doing nothing.

The model is snapshotted when a round starts, but a /role or /profile switch now also switches the LIVE reviewer session in place (the next provider request uses it, the round is not aborted, and the warm session is kept for the next round). The mode band, the status widget and /review status name the model that is actually auditing. A switch made in the cold-start window (before the session exists) is retained for that first session. If the switch is refused, the live reviewer keeps its model and the next round applies the new one. The activation or role notice carries the applied reviewer line (unprefixed, as summary content) and one durable workflow-model-switch (scope: "reviewer") entry reports the switch; a refused switch still warns through notifyReview with the Review Mode: prefix. See Live-switch contract for the full owner matrix.

Roles load from ~/.pi/agent/roles.json (with a <cwd>/.pi/roles.json project override) at session start and again whenever either file changes on disk, so a /role change made in another window is picked up without /reload. A missing, unreadable, or legacy roles.json is never overwritten: the built-in defaults are used in memory and a warning naming the file is shown, leaving it intact. /review mode status, the mode band and the reviewer run all read through the same loader.

Reviewer guidance

The five review criteria are fixed in the reviewer's system prompt (REVIEW_CRITERIA, embedded in REVIEW_SYSTEM_PROMPT). No file can override them:

  1. Framework alignment — follow the conventions, module layout, naming, error handling and dependency choices this repository already established; call out every divergence.
  2. Industry best practice — correctness, security, error handling, testability, observability, performance, migration/rollback safety.
  3. Requirement coverage — every requirement maps to at least one plan step (a requirement with no step is a Critical finding).
  4. Executability — each step is concrete enough to implement without guessing: file paths, symbols, a verifiable outcome.
  5. Simplicity and over-engineering — prefer the smallest change that satisfies the requirements; flags unnecessary steps, speculative abstractions, extra layers, dependencies nobody asked for, and out-of-scope work. Solving more than the requirement asks for is a finding, not extra value.

.pi/review-prompt.md (project) wins over ~/.pi/agent/review-prompt.md (global), which wins over the built-in default text. Edit it with /review prompt. Either file is additional guidance appended to the fixed criteria, never a replacement — so an override cannot remove or weaken a criterion, it can only add emphasis or project-specific rules.

Repository context files (AGENTS.md, CLAUDE.md, …) also load into the reviewer's system prompt, which is where most framework alignment actually comes from.

This guidance lives only in the reviewer's session. Plan Mode receives a single neutral line ("a reviewer will audit this plan") and can never see the reviewer's prompt, findings, or transcript.

Permissions

Plan Mode and Review Mode share one role-based command policy (permissions.ts). Review Mode has Plan Mode's permissions: read-only inspection plus test/lint/typecheck runs, and a single plan-write path.

Tool Purpose
read, grep, find, ls Inspect the repository
review_bash Shell access on the same shared classifier as Plan Mode: read-only inspection plus test/lint/typecheck runners (npm test, npm run lint/typecheck, eslint, tsc --noEmit, node --test, pytest, cargo clippy, …), and the supported sed print/select subset (for example sed -n '1,5p' f). Harmless fd/null redirects (2>/dev/null, 2>&1) are allowed; real file redirects, sed -i/-f, arbitrary awk, rm/mv/cp/mkdir/touch, sudo, package installs, builds and git add/commit/push are refused
review_explore Read-only reconnaissance subagents on the explorer role's model, capped by exploreBudget per round
review_submit The only write path, and it is append-only: one call carries the findings, verdict, summary and required revisions, and the harness appends a single ## Reviewer Revisions (round N) section to Plan Mode's own .pi/plans/<UTC-date>-<UTC-time>-<slug>.md (an existing plan keeps its name). The plan body is never modified
review_pass_done Ends a pass with a verdict (refused if nothing was submitted)

The policy classifies commands into three classes and maps them to roles:

Role Command class Write tools Used by
planner read-only + verify .pi/plans/ only Plan Mode
reviewer read-only + verify review_submit only Review Mode
explorer read-only none explore / review_explore subagents
builder full (unrestricted) all Build Mode / normal sessions
  • read-only — inspection only (ls, cat, rg, git log/blame/ls-files/show-ref, npm run / yarn run with no script argument (lists them), docker logs, journalctl, base64, ss, netstat, lsof, …) plus the supported sed print/select subse