@wichayutdew/pi-workflows 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,8 +13,9 @@ extensions, skills, dependency checks, and optional human-review gate.
13
13
 
14
14
  The harness owns state transitions. A step runs in the main Pi agent by default,
15
15
  or in a separate [pi-subagents](https://github.com/nicobailon/pi-subagents)
16
- child when it declares `subagent`. Either execution mode can advance only by
17
- calling `workflow_complete_step` with an outcome declared by that step.
16
+ child when it declares `subagent`. Main-agent steps advance through
17
+ `workflow_complete_step`; delegated steps return the same validated contract
18
+ through pi-subagents' correlated `structured_output`.
18
19
 
19
20
  ## Install
20
21
 
@@ -40,8 +41,8 @@ pi install npm:@plannotator/pi-extension
40
41
  ```
41
42
 
42
43
  Neither integration is required, but both are highly recommended together for
43
- the best isolation and review experience. Pi Workflows targets
44
- pi-subagents `0.35.1` or newer. Run `/subagents-doctor` if an explicitly
44
+ the best isolation and review experience. Delegated steps require
45
+ pi-subagents `0.36.0` or newer. Run `/subagents-doctor` if an explicitly
45
46
  delegated step cannot start.
46
47
 
47
48
  Pi loads `src/index.ts` through the package manifest. Restart Pi or run `/reload` after changing extension source.
@@ -142,15 +143,15 @@ Top-level fields:
142
143
 
143
144
  Each step supports:
144
145
 
145
- | Field | Required | Description |
146
- | ------------- | -------- | ----------------------------------------------------------------------- |
147
- | `title` | No | Human-readable name. Defaults to the step identifier. |
148
- | `prompt` | Yes | Inline text or `{ "file": "relative/path.md" }`. |
149
- | `subagent` | No | Opt into pi-subagents delegation and configure its profile and budgets. |
150
- | `permissions` | No | Resources callable during this step. Everything defaults to denied. |
151
- | `requires` | No | Dependencies that must be detectable before the step starts. |
152
- | `transitions` | Yes | Exact outcome to next step, `$pause`, or `$done`. |
153
- | `gate` | No | Built-in prompt or Plannotator human-review gate. |
146
+ | Field | Required | Description |
147
+ | ------------- | -------- | --------------------------------------------------------------------------------------- |
148
+ | `title` | No | Human-readable name. Defaults to the step identifier. |
149
+ | `prompt` | Yes | Inline text or `{ "file": "relative/path.md" }`. |
150
+ | `subagent` | No | Opt into isolated delegation and select the Pi Subagents profile and execution budgets. |
151
+ | `permissions` | No | Resources callable during this step. Everything defaults to denied. |
152
+ | `requires` | No | Dependencies that must be detectable before the step starts. |
153
+ | `transitions` | Yes | Exact outcome to next step, `$pause`, or `$done`. |
154
+ | `gate` | No | Built-in prompt or Plannotator human-review gate. |
154
155
 
155
156
  Supported prompt variables:
156
157
 
@@ -198,9 +199,13 @@ steps:
198
199
  ```
199
200
 
200
201
  The expanded defaults are `agent: pi-workflows.step`, `context: fresh`,
201
- `timeoutMs: 900000`, and `artifacts: false`.
202
+ `timeoutMs: 900000`, `artifacts: false`, and `retryToolFailures: false`. The
203
+ `agent` value is the actual Pi Subagents profile launched for that step.
204
+ `fresh` is the only supported workflow-step context: each child receives the
205
+ original workflow input and the previous step's compact handoff, never the
206
+ parent or a sibling transcript.
202
207
 
203
- Use a Pi Subagents runtime name directly when only the agent changes:
208
+ Use a profile name directly when only the child profile changes:
204
209
 
205
210
  ```yaml
206
211
  steps:
@@ -211,8 +216,11 @@ steps:
211
216
  done: $done
212
217
  ```
213
218
 
214
- This name-only form inherits the same defaults. Use the object form when the
215
- step also needs a context, model, timeout, budget, or artifact override:
219
+ This name-only form inherits the same execution defaults and launches the
220
+ configured Pi Subagents `scout` profile. Its system prompt and profile defaults
221
+ provide the specialty, while the workflow prompt supplies the exact step
222
+ contract. Use the object form when the step also needs a model, timeout, budget,
223
+ or artifact override:
216
224
 
217
225
  ```yaml
218
226
  subagent:
@@ -221,65 +229,62 @@ subagent:
221
229
  timeoutMs: 600000
222
230
  ```
223
231
 
224
- `agent` is the same runtime name Pi Subagents uses. For example,
225
- `subagent: worker` selects its builtin `worker`, then Pi Subagents applies the
226
- matching `subagents.agentOverrides.worker` entry from
227
- `~/.pi/agent/settings.json` and any higher-precedence project settings. Pi
228
- Workflows does not parse that file or reimplement agent discovery. An
229
- `agentOverrides` entry modifies a discovered builtin, package, user, or project
230
- agent; the entry alone does not create a new agent.
231
-
232
- This is separate from `~/.pi/agent/workflows/settings.yaml`, which configures
233
- Pi Workflows project trust and permission ceilings. Use
234
- `/subagents-models worker` to inspect Pi Subagents' live resolved profile and
235
- `/subagents-doctor` to diagnose discovery or loading problems.
236
-
237
- The bundled `pi-workflows.step` remains the default for `subagent: {}`. It
238
- inherits project instructions but not the parent transcript or its skill
239
- catalog. A named agent contributes its Pi Subagents system prompt, thinking,
240
- model unless the step overrides it, extension loading, and initial tool
241
- visibility. The workflow sends its configured step prompt and explicit skill
242
- selection.
232
+ Pi Workflows passes `subagent.agent` directly to Pi Subagents. Built-in profiles
233
+ such as `scout`, `planner`, `worker`, and `reviewer` therefore retain their own
234
+ system prompts, models, and specialty defaults. The bundled
235
+ `pi-workflows.step` profile remains the default general-purpose profile when
236
+ `agent` is omitted.
237
+
238
+ Every delegated request sets `context: fresh`, `output: false`, an
239
+ `outputSchema` for the workflow result, and `agentContract: { version: 1 }`.
240
+ Pi Subagents supplies `structured_output`, validates the schema, and emits the
241
+ single correlated terminal response. Pi Workflows' child policy independently
242
+ validates the declared outcome and compact handoff before the parent advances.
243
+ Request-level model, timeout, turn-budget, tool-budget, skills, and artifact
244
+ options are still forwarded. Use `/subagents-models <agent>` to inspect the
245
+ selected profile and `/subagents-doctor` to diagnose discovery or loading
246
+ problems. Workflow project trust and permission ceilings remain separately
247
+ configured in `~/.pi/agent/workflows/settings.yaml`.
243
248
 
244
249
  Supported fields:
245
250
 
246
- | Field | Default | Description |
247
- | ------------ | -------------------- | ----------------------------------------------------------------------------------- |
248
- | `agent` | `pi-workflows.step` | Any discovered Pi Subagents runtime name, such as `scout`, `worker`, or `reviewer`. |
249
- | `context` | `fresh` | `fresh` isolates the step; `fork` deliberately includes filtered parent context. |
250
- | `model` | Agent/default model | Optional pi-subagents model override. |
251
- | `timeoutMs` | `900000` | Child deadline, from 1 second through 24 hours. |
252
- | `turnBudget` | pi-subagents default | `{ "maxTurns": n, "graceTurns": n }`. |
253
- | `toolBudget` | pi-subagents default | `{ "soft": n, "hard": n, "block": "*" }`; `block` may instead be a tool-name array. |
254
- | `artifacts` | `false` | Ask pi-subagents to retain its normal run artifacts. |
255
-
256
- Builtin names are unqualified (`worker`); packaged names may be qualified, such
257
- as `pi-workflows.step`. Pi Workflows installs an inert listener in every
258
- Pi Subagents child. It registers `workflow_complete_step` and activates policy
259
- only after a valid, single-use workflow capability arrives, so ordinary
260
- subagent runs remain unchanged.
261
-
262
- A selected profile's active tools and loaded extensions remain an outer
263
- boundary. Effective step tools are the intersection of that profile and
264
- `permissions`, plus the workflow completion tool. Pi Workflows can remove
265
- access but cannot grant a normal tool or load an extension excluded by the
266
- profile. If a custom profile declares `extensions`, it must keep the installed
267
- Pi Workflows extension available; otherwise the child never receives the
268
- policy runtime and the step fails closed.
251
+ | Field | Default | Description |
252
+ | ------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------- |
253
+ | `agent` | `pi-workflows.step` | Actual Pi Subagents profile, such as `scout`, `planner`, `worker`, or `reviewer`. |
254
+ | `context` | `fresh` | Always isolated; parent and sibling transcripts are never inherited. |
255
+ | `model` | Profile/default model | Optional pi-subagents model override for the selected profile. |
256
+ | `timeoutMs` | `900000` | Child deadline, from 1 second through 24 hours. |
257
+ | `turnBudget` | pi-subagents default | `{ "maxTurns": n, "graceTurns": n }`. |
258
+ | `toolBudget` | pi-subagents default | `{ "soft": n, "hard": n, "block": "*" }`; `block` may instead be a tool-name array. |
259
+ | `artifacts` | `false` | Ask pi-subagents to retain its normal run artifacts. |
260
+ | `retryToolFailures` | `false` | Authorize one fresh-context retry after a tool failure; only for wholly replay-safe steps without `edit` or `write`. |
261
+
262
+ Pi Workflows installs an inert listener in every Pi Subagents child and
263
+ activates policy only after a valid, single-use workflow capability arrives, so
264
+ ordinary subagent runs remain unchanged. Delegated completion uses the
265
+ `structured_output` tool provided by Pi Subagents; `workflow_complete_step`
266
+ remains the completion tool only for main-agent steps.
267
+
268
+ After capability verification, Pi Workflows resolves the step permissions
269
+ against every tool registered in the child and activates only that exact set,
270
+ plus the upstream structured completion tool. The selected profile's ordinary
271
+ active-tool allow-list is not a second workflow policy. Profile extension
272
+ loading still controls which extension providers exist in the child; a workflow
273
+ cannot activate a tool whose provider was not loaded.
269
274
 
270
275
  Workflow `permissions.skills` is sent as Pi Subagents' request-level skill
271
276
  selection, so it replaces the selected profile's normal skill list for that
272
- step; an empty list disables injected skills. Pi Workflows also disables Pi
273
- Subagents' separate acceptance report for these requests because the harness
274
- already owns correlated completion, declared outcomes, and optional human
275
- review gates.
277
+ step; an empty list disables injected skills. `output: false` prevents a
278
+ profile-default output file, while omitting acceptance under agent contract v1
279
+ avoids a second acceptance gate. The schema, harness, declared outcomes, and
280
+ optional human review gate own correlated completion.
276
281
 
277
282
  At runtime:
278
283
 
279
284
  1. The harness creates a correlated child policy and result channel.
280
- 2. pi-subagents starts one foreground child for the current step.
281
- 3. The child runtime enforces permissions and writes the validated result.
282
- 4. The parent harness applies the configured transition, then launches the next step.
285
+ 2. pi-subagents starts one foreground child using the step's configured agent profile.
286
+ 3. The child runtime activates the workflow-permitted registered tools and validates `structured_output`.
287
+ 4. The parent waits for the correlated terminal response, applies the transition, and launches the next fresh-context step.
283
288
 
284
289
  Main-agent mode uses the same per-step tool, MCP, Bash, extension-tool, and
285
290
  completion enforcement, but it cannot unload globally visible skills or
@@ -301,9 +306,9 @@ mcp:
301
306
 
302
307
  The harness requires an explicit `server` and `tool` on every proxy call. Proxy search, discovery, connection, and authentication modes are blocked while a workflow step is running.
303
308
 
304
- The generic `mcp` proxy is the portable choice for workflow steps. A custom
305
- subagent profile may expose direct MCP tools through its own `mcp:` frontmatter;
306
- Pi Workflows still requires each direct runtime name in `tools`.
309
+ The generic `mcp` proxy is the portable choice for workflow steps. The bundled
310
+ runtime may also expose direct MCP tools through Pi Subagents settings; Pi
311
+ Workflows still requires each direct runtime name in `tools`.
307
312
 
308
313
  `extensions` contains case-insensitive fragments matched against tool source metadata. Tools registered by matching extensions become visible and callable:
309
314
 
@@ -424,17 +429,33 @@ For example, suppose the approved artifact contains:
424
429
  {
425
430
  "repositories": [
426
431
  {
427
- "worker": [{ "command": "bun test" }]
432
+ "cwd": "/absolute/path/to/repository",
433
+ "sourceCwd": "/absolute/path/to/source",
434
+ "worker": [
435
+ {
436
+ "command": "bun --cwd /absolute/path/to/repository test"
437
+ }
438
+ ]
428
439
  }
429
440
  ]
430
441
  }
431
442
  ```
432
443
 
433
- A later step with `approvedSources: [verification-worker]` may run exactly
434
- `bun test`. It may not run `bun test --watch`, because that is a different
435
- string. `verification-reviewer` reads the sibling `reviewer` list instead.
436
- `remote-actions` reads only Bash actions from `actions[]` and additionally
437
- filters them to supported hosted-API mutations or non-force pushes.
444
+ A later step with `approvedSources: [verification-worker]` may run only the
445
+ exact reviewed command. Cwd-dependent commands must encode that entry's
446
+ absolute `repositories[].cwd`, such as `bun --cwd /reviewed/root test`; they
447
+ may not substitute another directory or add `--watch`.
448
+ `verification-reviewer` reads the sibling `reviewer` list with the same rule.
449
+ `remote-actions` reads only Bash actions from
450
+ `actions[]` and additionally filters them to supported hosted-API mutations or
451
+ non-force pushes.
452
+
453
+ A delegated step accepts one distinct reviewed repository directory; repeated
454
+ entries may name that same absolute `cwd`. Missing, relative, or ambiguous
455
+ multiple directories fail closed before the child starts. A not-yet-created
456
+ worktree may bootstrap only from the same contract's one existing absolute
457
+ `sourceCwd`; file mutations remain confined to the reviewed target `cwd`, and
458
+ all setup and later Bash commands must still match the approved strings.
438
459
 
439
460
  The complete path is:
440
461
 
@@ -516,14 +537,33 @@ transitions:
516
537
  ```
517
538
 
518
539
  Setting `provider: plannotator` is the entire opt-in; the harness preflights the
519
- installed extension automatically. The active step calls
520
- `workflow_complete_step` with outcome `submit` and the full content in
521
- `artifact`. The harness correlates the Plannotator review identifier and
522
- accepts only the matching decision. On approval, that reviewed artifact—not
540
+ installed extension automatically. A main-agent planning step calls
541
+ `workflow_complete_step`; a delegated planning child calls
542
+ `structured_output`. In either case it uses outcome `submit` and places the full
543
+ content in `artifact`. The harness correlates the Plannotator review identifier
544
+ and accepts only the matching decision. On approval, that reviewed artifact—not
523
545
  the step's separate summary—becomes the authoritative handoff to the next step.
524
546
 
525
547
  If review finishes while the workflow is paused, the result is checkpointed and applied only after `/workflow-resume`. Resume also queries Plannotator’s durable review status, so a decision made while Pi was closed is not lost.
526
548
 
549
+ ### Planning is the decision boundary
550
+
551
+ For a delegated plan workflow, put every unresolved choice in the plan artifact
552
+ with evidence, options, a recommendation, and an adopted default. The built-in
553
+ review panel or Plannotator is where the user resolves those choices. Approval
554
+ makes that reviewed artifact the final implementation contract and compact
555
+ handoff.
556
+
557
+ Post-approval implementation and verification children are non-interactive:
558
+ they do not ask questions in the terminal or detach for supervisor input. If an
559
+ approved contract is missing, stale, or contradictory, the child pauses with a
560
+ declarative evidence summary instead of starting a replacement or opening a
561
+ side channel.
562
+
563
+ In print or JSON mode, a pending built-in plan review remains safely paused.
564
+ Reopen the same session in TUI or RPC mode and run `/workflow-resume` to show
565
+ the preserved review instead of restarting the planning child.
566
+
527
567
  ## Pause, repair, resume
528
568
 
529
569
  Use:
@@ -550,6 +590,30 @@ blocked. Wait for the terminal event; if the delegation channel has already
550
590
  failed, restart Pi before resuming. This prevents an old writer and a resumed
551
591
  writer from overlapping.
552
592
 
593
+ When a delegated tool fails, the harness correlates the terminal response with
594
+ the retained Pi child session and records the exact failed tool call, tool
595
+ error, subagent exit code, terminal error, and validated diagnostic session
596
+ path. The fallback accepts only regular, non-symlink session files contained
597
+ by the current parent session's child-run root, reads a bounded tail, and
598
+ requires the tool error to match the terminal failure. If correlation is not
599
+ safe, the terminal error is preserved without claiming an exact command. A
600
+ failed process status is treated as resolved when the retained session proves
601
+ a successful `structured_output` occurred after every failed tool result and
602
+ the correlated result validates. This accepts the same finalized child result;
603
+ it never replays mutation-capable work. Without a valid finalized result, a
604
+ delegated step may receive the actionable detail in one bounded retry prompt
605
+ only when a complete trusted transcript proves every recorded call was
606
+ read-only or rejected before execution. An unknown-effect Bash call, a
607
+ truncated transcript, or missing correlation pauses instead.
608
+
609
+ Inside a live child, recovery is not tied to a list of known error strings. The
610
+ completion contract requires the agent to inspect the exact error and current
611
+ state, try a permitted semantically equivalent alternative, and continue the
612
+ original step. It may pause only after safe alternatives are exhausted, with
613
+ the failed call, error, attempted alternatives, and remaining blocker in its
614
+ handoff. A fresh retry is explicitly a continuation: it inspects state first
615
+ and must not repeat a side effect that is already present.
616
+
553
617
  While paused, fix repository code, workflow YAML, prompts, MCP configuration,
554
618
  an extension, or any other environmental problem. Then run:
555
619
 
@@ -561,7 +625,8 @@ Resume reloads configuration before continuing:
561
625
 
562
626
  - The paused step restarts in its configured main-agent or delegated mode.
563
627
  - A changed current step restarts that step.
564
- - A changed completed step restarts the earliest changed completed step.
628
+ - A changed ordinary completed step restarts the earliest changed completed step.
629
+ - A completed human-approved gate keeps its persisted reviewed artifact authoritative; later prompt or configuration digest changes do not reopen that plan while the gate and approved outcome still match.
565
630
  - Future-only changes preserve the current checkpoint.
566
631
  - Removing the current or a completed step fails closed and requires restoring configuration or aborting.
567
632
  - Restoring a Pi session automatically pauses an in-progress workflow for inspection.
@@ -570,22 +635,40 @@ Resume reloads configuration before continuing:
570
635
 
571
636
  ## Commands
572
637
 
573
- In TUI mode, `/workflow-status` opens a read-only board for the current
574
- checkpoint. It refreshes once per second and shows run timing, the current
575
- execution or review, pause reasons, configuration drift, and the completed
576
- attempt path. Press `q`, `Esc`, `Ctrl-C`, or `Ctrl-D` to close it. Non-TUI modes
577
- receive the same checkpoint as text.
578
-
579
- | Command | Purpose |
580
- | ------------------------------- | ----------------------------------------------------- |
581
- | `/workflow-list` | List loaded workflows and their configured commands. |
582
- | `/workflow-start <id> [input]` | Start by workflow identifier. |
583
- | `/<configured-command> [input]` | Start through a workflow alias. |
584
- | `/workflow-status` | Open a live run-status board (text outside TUI mode). |
585
- | `/workflow-pause [reason]` | Halt without losing the checkpoint. |
586
- | `/workflow-resume` | Reload, reconcile, and continue. |
587
- | `/workflow-abort [reason]` | End the active run and restore baseline tools. |
588
- | `/workflow-reload` | Reload definitions while no workflow is running. |
638
+ The full status overlay opens when a workflow starts and is toggled with
639
+ `Ctrl+Alt+W` by default (`q` or `Esc` also hides it). Set `statusShortcut` in
640
+ `settings.yaml` to another Pi key identifier, then run Pi's `/reload` to
641
+ re-register it; `/workflow-reload` cannot change extension shortcuts. The
642
+ overlay shows run timing, execution or review, pause reasons, configuration
643
+ drift, and the completed attempt path without a task-viewer pane below the
644
+ editor. The main surface shows only one small animated `◐`/`◓`/`◑`/`◒` working
645
+ indicator while a workflow runs, then clears it when execution stops. All step,
646
+ progress, history, failure, and review detail stays in the overlay. There, `✓`
647
+ marks a completed step, `✕` a failed or aborted run, and `◆` a paused step or
648
+ pending review. Long reasons are clamped to the available display width; the
649
+ durable checkpoint retains the full text. On short terminals, use `↑`/`↓`,
650
+ PgUp/PgDn, or Home/End to scroll the overlay.
651
+
652
+ | Command | Purpose |
653
+ | ------------------------------- | ---------------------------------------------------- |
654
+ | `/workflow-list` | List loaded workflows and their configured commands. |
655
+ | `/workflow-start <id> [input]` | Start by workflow identifier. |
656
+ | `/<configured-command> [input]` | Start through a workflow alias. |
657
+ | `/workflow-pause [reason]` | Halt without losing the checkpoint. |
658
+ | `/workflow-resume` | Reload, reconcile, and continue. |
659
+ | `/workflow-abort [reason]` | End the active run and restore baseline tools. |
660
+ | `/workflow-reload` | Reload definitions while no workflow is running. |
661
+
662
+ Configured aliases also accept multiline input. For example, if `work` is a
663
+ loaded workflow command, Pi Workflows normalizes:
664
+
665
+ ```text
666
+ /work
667
+ """inspect and update this repository"""
668
+ ```
669
+
670
+ to the same command with an argument instead of letting the raw multiline text
671
+ start an unrelated parent-agent turn.
589
672
 
590
673
  ## User and project configuration
591
674
 
@@ -603,6 +686,7 @@ Project workflows are disabled by default. Enable them in the user-owned
603
686
  # yaml-language-server: $schema=/absolute/path/to/pi-workflows/schemas/settings.schema.json
604
687
  version: 1
605
688
  allowProjectWorkflows: true
689
+ statusShortcut: ctrl+alt+w
606
690
  permissionCeiling:
607
691
  tools: [read, grep, bash]
608
692
  mcp: []
@@ -610,7 +694,7 @@ permissionCeiling:
610
694
  skills: []
611
695
  bash: { mode: read-only }
612
696
  subagent:
613
- agents: [pi-workflows.step, scout, worker, reviewer]
697
+ agents: [scout, planner, worker, reviewer]
614
698
  contexts: [fresh]
615
699
  models: []
616
700
  maxTimeoutMs: 900000
@@ -618,6 +702,7 @@ permissionCeiling:
618
702
  maxGraceTurns: 3
619
703
  maxToolCalls: 100
620
704
  artifacts: false
705
+ retryToolFailures: false
621
706
  ```
622
707
 
623
708
  Settings use the same strict YAML 1.2 parser as workflow definitions. The
@@ -630,8 +715,8 @@ within this ceiling. The `subagent` ceiling is optional for main-only project
630
715
  workflows; if omitted, any project step that declares `subagent` is rejected.
631
716
  Each delegated project step must declare `turnBudget` and `toolBudget` with
632
717
  `"block": "*"`, so it cannot silently inherit unbounded child defaults or keep
633
- mutation tools after reaching the hard limit. The ceiling also controls child
634
- agent names, context inheritance, model overrides, timeouts, artifact
718
+ mutation tools after reaching the hard limit. The ceiling also controls
719
+ agent profile names, fresh-context use, model overrides, timeouts, artifact
635
720
  retention, and the Bash rules and approved sources that a project workflow may
636
721
  request. Project workflows cannot override user workflow identifiers or
637
722
  commands.
@@ -655,7 +740,7 @@ The package keeps the Pi entry point intentionally small:
655
740
  | `src/runtime/` | Shared completion parsing and main-agent step runtime. |
656
741
  | `src/preflight.ts` | Required tool, extension, and skill checks. |
657
742
  | `src/prompt.ts` | Template rendering and step contract. |
658
- | `agents/step.md` | Bundled dynamic-policy pi-subagents profile. |
743
+ | `agents/step.md` | Default general-purpose profile plus workflow child guidance. |
659
744
 
660
745
  The engine and policy modules do not depend on Pi runtime types, so they are fast to test.
661
746
 
@@ -671,7 +756,7 @@ process separation when a step opts into pi-subagents:
671
756
  - completion as the sole call in its tool batch;
672
757
  - optional separate pi-subagents child process per delegated step;
673
758
  - an idle, tool-isolated main agent while a delegated step runs;
674
- - a single-use, parent-created child capability tied to the selected workflow agent;
759
+ - a single-use, parent-created child capability tied to the delegated step;
675
760
  - explicit MCP server and tool checks;
676
761
  - restricted Bash parsing;
677
762
  - exact Bash capabilities derived from a correlated human-reviewed artifact;
@@ -709,7 +794,9 @@ state, gate handling, MCP isolation, Bash policy, extension tool selection,
709
794
  main-agent completion, built-in feedback/approval, subagent request correlation
710
795
  and cancellation, child policy enforcement, and dependency preflight,
711
796
  including reviewed exact-command propagation and fail-closed legacy
712
- checkpoints.
797
+ checkpoints. `bun run check` also launches real Pi RPC subprocesses, invokes
798
+ `/work`, and verifies fresh `scout`, `worker`, and `reviewer` children receive
799
+ only the explicit compact handoff from the immediately preceding step.
713
800
 
714
801
  ## Publishing checklist
715
802
 
@@ -742,11 +829,11 @@ extensions, without hard-coding them into the orchestrator, are:
742
829
 
743
830
  - A delegated workflow step uses one foreground subagent. Parallel or chained children inside one step are not yet a workflow-level primitive.
744
831
  - Gate providers are built-in prompt and Plannotator; custom providers are not yet configurable.
745
- - A custom subagent profile can be narrower than a step, but Pi Workflows cannot widen that profile.
832
+ - Delegated steps require pi-subagents 0.36.0 or newer and launch the actual profile selected by `subagent.agent`.
746
833
  - Extension tools are enforced; autonomous extension event-handler side effects cannot be disabled per step.
747
834
  - Completion evidence is model-reported; use reviewed executable checks and a fresh verification step when correctness matters.
748
835
  - Workflow configuration uses YAML. Prompt bodies may live in separate Markdown files.
749
836
 
750
837
  ## License
751
838
 
752
- Licensed under the [Apache License 2.0](./LICENSE).
839
+ Licensed under the [MIT License](./LICENSE).
package/agents/step.md CHANGED
@@ -14,4 +14,18 @@ Execute the supplied workflow step exactly as instructed.
14
14
  The Pi Workflows child runtime selects and enforces the step's tools, MCP
15
15
  selectors, Bash policy, extension tools, skills, outcomes, and completion
16
16
  contract. Do not broaden those permissions. If the step or environment is
17
- invalid, return an outcome that pauses the workflow.
17
+ invalid, use a configured pause outcome when one exists. Otherwise, end with a
18
+ concise declarative error without calling the completion tool so the parent
19
+ harness pauses the step.
20
+
21
+ Each step is an isolated, non-interactive child using its configured Pi
22
+ Subagents profile and workflow prompt. Complete delegated work through
23
+ pi-subagents' `structured_output`; `workflow_complete_step` belongs to
24
+ main-agent workflow steps. Never call `contact_supervisor`,
25
+ `subagent_supervisor`, or `intercom`. Gated planning puts unresolved decisions
26
+ in its review artifact with evidence, options, and an adopted default. Other
27
+ steps treat their instructions and incoming handoff as final; if that contract
28
+ is missing, stale, or contradictory, use a configured pause outcome and
29
+ describe the problem declaratively in the compact summary. When no pause
30
+ outcome exists, end with the declarative error instead. Never ask a terminal
31
+ question.