@wichayutdew/pi-workflows 0.2.2 → 0.3.0
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/LICENSE +21 -201
- package/README.md +207 -106
- package/agents/step.md +15 -1
- package/dist/index.js +1964 -463
- package/examples/mr-comments.workflow.yaml +4 -4
- package/examples/prompts/mr-comments/implement.md +10 -5
- package/examples/prompts/mr-comments/plan.md +10 -5
- package/examples/prompts/mr-comments/verify.md +5 -4
- package/examples/settings.yaml +3 -1
- package/package.json +10 -6
- package/schemas/settings.schema.json +8 -0
- package/schemas/workflow.schema.json +10 -2
- package/src/command-names.ts +0 -1
- package/src/commands.ts +0 -6
- package/src/config/ceiling.ts +8 -0
- package/src/config/load.ts +3 -9
- package/src/config/types.ts +15 -3
- package/src/config/validate.ts +147 -22
- package/src/engine/state.ts +7 -0
- package/src/engine/transitions.ts +52 -7
- package/src/harness.ts +804 -74
- package/src/index.ts +6 -2
- package/src/integrations/prompt-gate.ts +14 -13
- package/src/integrations/subagents/child-runtime.ts +187 -69
- package/src/integrations/subagents/client.ts +4 -3
- package/src/integrations/subagents/diagnostics.ts +977 -0
- package/src/integrations/subagents/protocol.ts +86 -15
- package/src/policy/approved-commands.ts +212 -5
- package/src/policy/bash.ts +0 -9
- package/src/prompt.ts +115 -7
- package/src/runtime/serial-task-queue.ts +5 -1
- package/src/workflow-status.ts +244 -35
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`.
|
|
17
|
-
|
|
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.
|
|
44
|
-
pi-subagents `0.
|
|
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
|
|
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 `
|
|
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
|
|
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
|
|
215
|
-
|
|
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`
|
|
225
|
-
`
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
|
247
|
-
|
|
|
248
|
-
| `agent`
|
|
249
|
-
| `context`
|
|
250
|
-
| `model`
|
|
251
|
-
| `timeoutMs`
|
|
252
|
-
| `turnBudget`
|
|
253
|
-
| `toolBudget`
|
|
254
|
-
| `artifacts`
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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 reinforcement retry in allow-list or unrestricted Bash mode; runtime still requires a wholly replay-safe attempt 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.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
review
|
|
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
|
|
281
|
-
3. The child runtime
|
|
282
|
-
4. The parent
|
|
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.
|
|
305
|
-
|
|
306
|
-
|
|
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
|
-
"
|
|
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
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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.
|
|
520
|
-
`workflow_complete_step
|
|
521
|
-
`
|
|
522
|
-
|
|
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,43 @@ 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 child returns `failed` or `structured_output_failed` with a
|
|
594
|
+
terminal error or nonzero exit code, the harness audits the retained Pi child
|
|
595
|
+
session before deciding whether to launch one fresh reinforcement retry. The
|
|
596
|
+
audit accepts only regular, non-symlink session files contained by the current
|
|
597
|
+
parent session's child-run root, requires the persisted policy-stripped task and
|
|
598
|
+
its per-request binding to match the active delegation, reads a bounded complete
|
|
599
|
+
tail, and proves that every recorded call was read-only or rejected by that
|
|
600
|
+
step's actual Bash policy before execution. Approved exact Bash commands are
|
|
601
|
+
evaluated with the same authorization inputs used by the child. A zero-tool
|
|
602
|
+
attempt is also replay-safe when the complete bound transcript proves it.
|
|
603
|
+
|
|
604
|
+
When the terminal error identifies a failed tool, the harness also records the
|
|
605
|
+
exact correlated call, tool error, subagent exit code, terminal error, and
|
|
606
|
+
validated diagnostic session path. If exact correlation is unavailable, the
|
|
607
|
+
generic terminal evidence is retained without claiming an unrelated command.
|
|
608
|
+
A failed process status is treated as resolved when the transcript proves a
|
|
609
|
+
successful `structured_output` occurred after every failed tool result and the
|
|
610
|
+
correlated result validates. This accepts the same finalized child result; it
|
|
611
|
+
never replays mutation-capable work.
|
|
612
|
+
|
|
613
|
+
Without a valid finalized result, the next fresh child receives the bounded
|
|
614
|
+
terminal evidence in an escaped JSON data boundary and is told to inspect
|
|
615
|
+
current state, change its approach, resolve the cause, and finish the original
|
|
616
|
+
step. A second failure pauses. Mutation-capable or unknown-effect calls, a
|
|
617
|
+
truncated or malformed transcript, a missing active-request binding,
|
|
618
|
+
cancellation, interruption, timeout, and budget exhaustion do not trigger an
|
|
619
|
+
automatic retry. Local channel failures also wait for confirmed child
|
|
620
|
+
termination instead of risking two live children.
|
|
621
|
+
|
|
622
|
+
Inside a live child, recovery is not tied to a list of known error strings. The
|
|
623
|
+
completion contract requires the agent to inspect the exact error and current
|
|
624
|
+
state, try a permitted semantically equivalent alternative, and continue the
|
|
625
|
+
original step. It may pause only after safe alternatives are exhausted, with
|
|
626
|
+
the failed call, error, attempted alternatives, and remaining blocker in its
|
|
627
|
+
handoff. A fresh retry is explicitly a continuation: it inspects state first
|
|
628
|
+
and must not repeat a side effect that is already present.
|
|
629
|
+
|
|
553
630
|
While paused, fix repository code, workflow YAML, prompts, MCP configuration,
|
|
554
631
|
an extension, or any other environmental problem. Then run:
|
|
555
632
|
|
|
@@ -561,7 +638,8 @@ Resume reloads configuration before continuing:
|
|
|
561
638
|
|
|
562
639
|
- The paused step restarts in its configured main-agent or delegated mode.
|
|
563
640
|
- A changed current step restarts that step.
|
|
564
|
-
- A changed completed step restarts the earliest changed completed step.
|
|
641
|
+
- A changed ordinary completed step restarts the earliest changed completed step.
|
|
642
|
+
- 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
643
|
- Future-only changes preserve the current checkpoint.
|
|
566
644
|
- Removing the current or a completed step fails closed and requires restoring configuration or aborting.
|
|
567
645
|
- Restoring a Pi session automatically pauses an in-progress workflow for inspection.
|
|
@@ -570,22 +648,40 @@ Resume reloads configuration before continuing:
|
|
|
570
648
|
|
|
571
649
|
## Commands
|
|
572
650
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
|
588
|
-
|
|
|
651
|
+
The full status overlay opens when a workflow starts and is toggled with
|
|
652
|
+
`Ctrl+Alt+W` by default (`q` or `Esc` also hides it). Set `statusShortcut` in
|
|
653
|
+
`settings.yaml` to another Pi key identifier, then run Pi's `/reload` to
|
|
654
|
+
re-register it; `/workflow-reload` cannot change extension shortcuts. The
|
|
655
|
+
overlay shows run timing, execution or review, pause reasons, configuration
|
|
656
|
+
drift, and the completed attempt path without a task-viewer pane below the
|
|
657
|
+
editor. The main surface shows only one small animated `◐`/`◓`/`◑`/`◒` working
|
|
658
|
+
indicator while a workflow runs, then clears it when execution stops. All step,
|
|
659
|
+
progress, history, failure, and review detail stays in the overlay. There, `✓`
|
|
660
|
+
marks a completed step, `✕` a failed or aborted run, and `◆` a paused step or
|
|
661
|
+
pending review. Long reasons are clamped to the available display width; the
|
|
662
|
+
durable checkpoint retains the full text. On short terminals, use `↑`/`↓`,
|
|
663
|
+
PgUp/PgDn, or Home/End to scroll the overlay.
|
|
664
|
+
|
|
665
|
+
| Command | Purpose |
|
|
666
|
+
| ------------------------------- | ---------------------------------------------------- |
|
|
667
|
+
| `/workflow-list` | List loaded workflows and their configured commands. |
|
|
668
|
+
| `/workflow-start <id> [input]` | Start by workflow identifier. |
|
|
669
|
+
| `/<configured-command> [input]` | Start through a workflow alias. |
|
|
670
|
+
| `/workflow-pause [reason]` | Halt without losing the checkpoint. |
|
|
671
|
+
| `/workflow-resume` | Reload, reconcile, and continue. |
|
|
672
|
+
| `/workflow-abort [reason]` | End the active run and restore baseline tools. |
|
|
673
|
+
| `/workflow-reload` | Reload definitions while no workflow is running. |
|
|
674
|
+
|
|
675
|
+
Configured aliases also accept multiline input. For example, if `work` is a
|
|
676
|
+
loaded workflow command, Pi Workflows normalizes:
|
|
677
|
+
|
|
678
|
+
```text
|
|
679
|
+
/work
|
|
680
|
+
"""inspect and update this repository"""
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
to the same command with an argument instead of letting the raw multiline text
|
|
684
|
+
start an unrelated parent-agent turn.
|
|
589
685
|
|
|
590
686
|
## User and project configuration
|
|
591
687
|
|
|
@@ -603,6 +699,7 @@ Project workflows are disabled by default. Enable them in the user-owned
|
|
|
603
699
|
# yaml-language-server: $schema=/absolute/path/to/pi-workflows/schemas/settings.schema.json
|
|
604
700
|
version: 1
|
|
605
701
|
allowProjectWorkflows: true
|
|
702
|
+
statusShortcut: ctrl+alt+w
|
|
606
703
|
permissionCeiling:
|
|
607
704
|
tools: [read, grep, bash]
|
|
608
705
|
mcp: []
|
|
@@ -610,7 +707,7 @@ permissionCeiling:
|
|
|
610
707
|
skills: []
|
|
611
708
|
bash: { mode: read-only }
|
|
612
709
|
subagent:
|
|
613
|
-
agents: [
|
|
710
|
+
agents: [scout, planner, worker, reviewer]
|
|
614
711
|
contexts: [fresh]
|
|
615
712
|
models: []
|
|
616
713
|
maxTimeoutMs: 900000
|
|
@@ -618,6 +715,7 @@ permissionCeiling:
|
|
|
618
715
|
maxGraceTurns: 3
|
|
619
716
|
maxToolCalls: 100
|
|
620
717
|
artifacts: false
|
|
718
|
+
retryToolFailures: false
|
|
621
719
|
```
|
|
622
720
|
|
|
623
721
|
Settings use the same strict YAML 1.2 parser as workflow definitions. The
|
|
@@ -630,8 +728,8 @@ within this ceiling. The `subagent` ceiling is optional for main-only project
|
|
|
630
728
|
workflows; if omitted, any project step that declares `subagent` is rejected.
|
|
631
729
|
Each delegated project step must declare `turnBudget` and `toolBudget` with
|
|
632
730
|
`"block": "*"`, so it cannot silently inherit unbounded child defaults or keep
|
|
633
|
-
mutation tools after reaching the hard limit. The ceiling also controls
|
|
634
|
-
agent names, context
|
|
731
|
+
mutation tools after reaching the hard limit. The ceiling also controls
|
|
732
|
+
agent profile names, fresh-context use, model overrides, timeouts, artifact
|
|
635
733
|
retention, and the Bash rules and approved sources that a project workflow may
|
|
636
734
|
request. Project workflows cannot override user workflow identifiers or
|
|
637
735
|
commands.
|
|
@@ -655,7 +753,7 @@ The package keeps the Pi entry point intentionally small:
|
|
|
655
753
|
| `src/runtime/` | Shared completion parsing and main-agent step runtime. |
|
|
656
754
|
| `src/preflight.ts` | Required tool, extension, and skill checks. |
|
|
657
755
|
| `src/prompt.ts` | Template rendering and step contract. |
|
|
658
|
-
| `agents/step.md` |
|
|
756
|
+
| `agents/step.md` | Default general-purpose profile plus workflow child guidance. |
|
|
659
757
|
|
|
660
758
|
The engine and policy modules do not depend on Pi runtime types, so they are fast to test.
|
|
661
759
|
|
|
@@ -671,7 +769,7 @@ process separation when a step opts into pi-subagents:
|
|
|
671
769
|
- completion as the sole call in its tool batch;
|
|
672
770
|
- optional separate pi-subagents child process per delegated step;
|
|
673
771
|
- an idle, tool-isolated main agent while a delegated step runs;
|
|
674
|
-
- a single-use, parent-created child capability tied to the
|
|
772
|
+
- a single-use, parent-created child capability tied to the delegated step;
|
|
675
773
|
- explicit MCP server and tool checks;
|
|
676
774
|
- restricted Bash parsing;
|
|
677
775
|
- exact Bash capabilities derived from a correlated human-reviewed artifact;
|
|
@@ -708,8 +806,11 @@ ceilings, deterministic transitions, configuration reconciliation, pause/resume
|
|
|
708
806
|
state, gate handling, MCP isolation, Bash policy, extension tool selection,
|
|
709
807
|
main-agent completion, built-in feedback/approval, subagent request correlation
|
|
710
808
|
and cancellation, child policy enforcement, and dependency preflight,
|
|
711
|
-
including
|
|
712
|
-
checkpoints.
|
|
809
|
+
including reinforcement retry after replay-safe terminal errors and nonzero
|
|
810
|
+
exits, reviewed exact-command propagation, and fail-closed legacy checkpoints.
|
|
811
|
+
`bun run check` also launches real Pi RPC subprocesses, invokes
|
|
812
|
+
`/work`, and verifies fresh `scout`, `worker`, and `reviewer` children receive
|
|
813
|
+
only the explicit compact handoff from the immediately preceding step.
|
|
713
814
|
|
|
714
815
|
## Publishing checklist
|
|
715
816
|
|
|
@@ -728,7 +829,7 @@ extensions, without hard-coding them into the orchestrator, are:
|
|
|
728
829
|
|
|
729
830
|
| Parameter | Why it belongs in configuration |
|
|
730
831
|
| --------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
731
|
-
|
|
|
832
|
+
| Configurable retry and backoff | Extend the single safe reinforcement retry with per-step transient-failure policy. |
|
|
732
833
|
| Acceptance criteria | Give each step machine-checkable completion evidence and verification commands. |
|
|
733
834
|
| Working directory or worktree | Isolate mutating steps, monorepo packages, and concurrent branches. |
|
|
734
835
|
| Parallel groups and join policy | Run independent steps together and declare fail-fast, quorum, or all-success behavior. |
|
|
@@ -742,11 +843,11 @@ extensions, without hard-coding them into the orchestrator, are:
|
|
|
742
843
|
|
|
743
844
|
- A delegated workflow step uses one foreground subagent. Parallel or chained children inside one step are not yet a workflow-level primitive.
|
|
744
845
|
- Gate providers are built-in prompt and Plannotator; custom providers are not yet configurable.
|
|
745
|
-
-
|
|
846
|
+
- Delegated steps require pi-subagents 0.36.0 or newer and launch the actual profile selected by `subagent.agent`.
|
|
746
847
|
- Extension tools are enforced; autonomous extension event-handler side effects cannot be disabled per step.
|
|
747
848
|
- Completion evidence is model-reported; use reviewed executable checks and a fresh verification step when correctness matters.
|
|
748
849
|
- Workflow configuration uses YAML. Prompt bodies may live in separate Markdown files.
|
|
749
850
|
|
|
750
851
|
## License
|
|
751
852
|
|
|
752
|
-
Licensed under the [
|
|
853
|
+
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,
|
|
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.
|