@osolmaz/pi-workflows 0.11.2 → 0.12.1

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.
Files changed (177) hide show
  1. package/README.md +15 -10
  2. package/dist/builtins/autoimplement-command-batches.d.ts +52 -0
  3. package/dist/builtins/autoimplement-command-batches.js +258 -0
  4. package/dist/builtins/autoimplement-command-batches.js.map +1 -0
  5. package/dist/builtins/autoimplement.workflow.d.ts +509 -124
  6. package/dist/builtins/autoimplement.workflow.js +884 -327
  7. package/dist/builtins/autoimplement.workflow.js.map +1 -1
  8. package/dist/builtins/catalog.js +5 -3
  9. package/dist/builtins/catalog.js.map +1 -1
  10. package/dist/builtins/index.d.ts +4 -1
  11. package/dist/builtins/index.js +3 -1
  12. package/dist/builtins/index.js.map +1 -1
  13. package/dist/builtins/monitor.workflow.d.ts +2 -4
  14. package/dist/builtins/monitor.workflow.js +26 -128
  15. package/dist/builtins/monitor.workflow.js.map +1 -1
  16. package/dist/builtins/pi-agent-group.d.ts +72 -0
  17. package/dist/builtins/pi-agent-group.js +1087 -0
  18. package/dist/builtins/pi-agent-group.js.map +1 -0
  19. package/dist/builtins/plan-approval.workflow.d.ts +39 -5
  20. package/dist/builtins/plan-approval.workflow.js +92 -14
  21. package/dist/builtins/plan-approval.workflow.js.map +1 -1
  22. package/dist/builtins/plan-change.workflow.d.ts +301 -0
  23. package/dist/builtins/plan-change.workflow.js +256 -0
  24. package/dist/builtins/plan-change.workflow.js.map +1 -0
  25. package/dist/builtins/plan-presentation.js +2 -2
  26. package/dist/builtins/plan-presentation.js.map +1 -1
  27. package/dist/builtins/sanity-check.workflow.d.ts +85 -0
  28. package/dist/builtins/sanity-check.workflow.js +482 -0
  29. package/dist/builtins/sanity-check.workflow.js.map +1 -0
  30. package/dist/controllers/sqlite.d.ts +90 -2
  31. package/dist/controllers/sqlite.js +380 -5
  32. package/dist/controllers/sqlite.js.map +1 -1
  33. package/dist/extension/decision-channels.d.ts +2 -2
  34. package/dist/extension/decision-channels.js +29 -35
  35. package/dist/extension/decision-channels.js.map +1 -1
  36. package/dist/extension/deferred-turn-coordinator.d.ts +32 -0
  37. package/dist/extension/deferred-turn-coordinator.js +143 -0
  38. package/dist/extension/deferred-turn-coordinator.js.map +1 -0
  39. package/dist/extension/deferred-turn.d.ts +44 -0
  40. package/dist/extension/deferred-turn.js +110 -0
  41. package/dist/extension/deferred-turn.js.map +1 -0
  42. package/dist/extension/index.js +348 -80
  43. package/dist/extension/index.js.map +1 -1
  44. package/dist/extension/session-events.d.ts +2 -2
  45. package/dist/extension/step-message.d.ts +1 -0
  46. package/dist/extension/step-message.js.map +1 -1
  47. package/dist/extension/widget.js +23 -3
  48. package/dist/extension/widget.js.map +1 -1
  49. package/dist/herdr/setup.js +4 -4
  50. package/dist/render/graph-render.js +1 -2
  51. package/dist/render/graph-render.js.map +1 -1
  52. package/dist/viewer/render.js +7 -6
  53. package/dist/viewer/render.js.map +1 -1
  54. package/dist/workflows/catalog.js +7 -2
  55. package/dist/workflows/catalog.js.map +1 -1
  56. package/dist/workflows/command-batch.d.ts +38 -0
  57. package/dist/workflows/command-batch.js +176 -0
  58. package/dist/workflows/command-batch.js.map +1 -0
  59. package/dist/workflows/composition.js +8 -0
  60. package/dist/workflows/composition.js.map +1 -1
  61. package/dist/workflows/decision-presentation.d.ts +1 -1
  62. package/dist/workflows/decision-presentation.js +51 -38
  63. package/dist/workflows/decision-presentation.js.map +1 -1
  64. package/dist/workflows/engine.d.ts +2 -2
  65. package/dist/workflows/engine.js +22 -17
  66. package/dist/workflows/engine.js.map +1 -1
  67. package/dist/workflows/errors.d.ts +13 -0
  68. package/dist/workflows/errors.js +15 -0
  69. package/dist/workflows/errors.js.map +1 -1
  70. package/dist/workflows/human-decision.d.ts +16 -4
  71. package/dist/workflows/human-decision.js +175 -72
  72. package/dist/workflows/human-decision.js.map +1 -1
  73. package/dist/workflows/index.d.ts +3 -2
  74. package/dist/workflows/index.js +2 -1
  75. package/dist/workflows/index.js.map +1 -1
  76. package/dist/workflows/progress.d.ts +1 -0
  77. package/dist/workflows/progress.js +15 -3
  78. package/dist/workflows/progress.js.map +1 -1
  79. package/dist/workflows/schema.js +12 -1
  80. package/dist/workflows/schema.js.map +1 -1
  81. package/dist/workflows/shell.d.ts +4 -0
  82. package/dist/workflows/shell.js +6 -0
  83. package/dist/workflows/shell.js.map +1 -1
  84. package/dist/workflows/store.js +8 -1
  85. package/dist/workflows/store.js.map +1 -1
  86. package/dist/workflows/types.d.ts +37 -48
  87. package/docs/2026-08-18-herdr-piw-plan.md +1 -1
  88. package/docs/2026-08-20-durable-workflow-launch-plan.md +19 -23
  89. package/docs/CONTROLLERS.md +2 -2
  90. package/docs/DEFERRED_TURNS.md +298 -0
  91. package/docs/DESIGN_PHILOSOPHY.md +1 -1
  92. package/docs/HUMAN_DECISIONS.md +30 -40
  93. package/docs/HUMAN_DECISION_PRESENTATIONS.md +17 -27
  94. package/docs/MONITOR.md +7 -13
  95. package/docs/WORKFLOW_COMPOSITION.md +10 -9
  96. package/docs/WORKFLOW_STEP_MESSAGES.md +5 -5
  97. package/docs/WORKFLOW_UPDATES.md +28 -5
  98. package/docs/plans/2026-08-04-controller-runtime-plan.md +1 -1
  99. package/docs/plans/2026-08-05-always-on-workflows-plan.md +1 -1
  100. package/docs/plans/2026-08-10-agent-managed-monitor-workflows-plan.md +9 -9
  101. package/docs/plans/2026-08-13-built-in-workflow-catalog-plan.md +1 -1
  102. package/docs/plans/2026-08-13-session-addressed-workflow-notifications-plan.md +1 -1
  103. package/docs/plans/2026-08-16-workflow-updates-plan.md +3 -3
  104. package/docs/plans/2026-08-17-bundled-skills-plan.md +6 -6
  105. package/docs/plans/2026-08-19-human-decision-gates-plan.md +5 -5
  106. package/docs/plans/2026-08-19-human-decision-presentations-plan.md +1 -1
  107. package/docs/plans/2026-08-19-provider-compatible-workflow-tool-schema-plan.md +1 -1
  108. package/docs/plans/2026-08-19-workflow-composition-plan.md +6 -6
  109. package/docs/plans/2026-08-20-autoimplement-blocker-challenge-plan.md +3 -3
  110. package/docs/plans/2026-08-20-bounded-command-batches-plan.md +206 -0
  111. package/docs/plans/2026-08-20-herdr-plugin-sync-plan.md +9 -9
  112. package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +242 -0
  113. package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +324 -0
  114. package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
  115. package/docs/plans/2026-08-21-sanity-check-plan.md +283 -0
  116. package/docs/run-bundles.md +8 -6
  117. package/docs/workflows.md +85 -22
  118. package/examples/workflows/approved-plan.workflow.ts +19 -46
  119. package/examples/workflows/command-batch.workflow.ts +50 -0
  120. package/examples/workflows/sanity-check.workflow.ts +1 -0
  121. package/herdr-plugin.toml +3 -3
  122. package/package.json +7 -7
  123. package/schemas/decision-presentation-v1.schema.json +1 -1
  124. package/schemas/human-decision-accepted-v1.schema.json +16 -4
  125. package/schemas/human-decision-answer-attempt-v1.schema.json +1 -1
  126. package/schemas/human-decision-cancellation-v1.schema.json +1 -1
  127. package/schemas/human-decision-continuation-v1.schema.json +11 -2
  128. package/schemas/human-decision-delivery-v1.schema.json +9 -1
  129. package/schemas/human-decision-receipt-v1.schema.json +9 -1
  130. package/schemas/human-decision-request-v1.schema.json +25 -5
  131. package/schemas/human-decision-resolution-v1.schema.json +1 -1
  132. package/schemas/human-decision-settlement-v1.schema.json +1 -1
  133. package/skills/autodoc/SKILL.md +33 -2
  134. package/skills/autoimplement/SKILL.md +93 -12
  135. package/skills/autoplan/SKILL.md +26 -2
  136. package/skills/monitor/SKILL.md +66 -24
  137. package/skills/pi-workflows/SKILL.md +21 -6
  138. package/skills/sanity-check/SKILL.md +44 -0
  139. package/src/builtins/autoimplement-command-batches.ts +364 -0
  140. package/src/builtins/autoimplement.workflow.ts +1075 -370
  141. package/src/builtins/catalog.ts +5 -3
  142. package/src/builtins/index.ts +24 -0
  143. package/src/builtins/monitor.workflow.ts +27 -150
  144. package/src/builtins/pi-agent-group.ts +1407 -0
  145. package/src/builtins/plan-approval.workflow.ts +157 -24
  146. package/src/builtins/plan-change.workflow.ts +321 -0
  147. package/src/builtins/plan-presentation.ts +2 -2
  148. package/src/builtins/sanity-check.workflow.ts +769 -0
  149. package/src/controllers/sqlite.ts +580 -7
  150. package/src/extension/decision-channels.ts +36 -66
  151. package/src/extension/deferred-turn-coordinator.ts +171 -0
  152. package/src/extension/deferred-turn.ts +166 -0
  153. package/src/extension/index.ts +438 -90
  154. package/src/extension/session-events.ts +2 -2
  155. package/src/extension/step-message.ts +1 -0
  156. package/src/extension/widget.ts +24 -5
  157. package/src/herdr/setup.ts +4 -4
  158. package/src/render/graph-render.ts +1 -2
  159. package/src/viewer/render.ts +7 -6
  160. package/src/workflows/catalog.ts +7 -2
  161. package/src/workflows/command-batch.ts +254 -0
  162. package/src/workflows/composition.ts +9 -0
  163. package/src/workflows/decision-presentation.ts +56 -43
  164. package/src/workflows/engine.ts +25 -20
  165. package/src/workflows/errors.ts +24 -0
  166. package/src/workflows/human-decision.ts +218 -101
  167. package/src/workflows/index.ts +20 -11
  168. package/src/workflows/progress.ts +18 -3
  169. package/src/workflows/schema.ts +19 -1
  170. package/src/workflows/shell.ts +10 -0
  171. package/src/workflows/store.ts +8 -1
  172. package/src/workflows/types.ts +43 -59
  173. package/schemas/human-decision-accepted-v2.schema.json +0 -50
  174. package/schemas/human-decision-delivery-v2.schema.json +0 -36
  175. package/schemas/human-decision-receipt-v2.schema.json +0 -39
  176. package/schemas/human-decision-request-v2.schema.json +0 -69
  177. package/schemas/human-decision-resolution-v2.schema.json +0 -27
@@ -1,6 +1,6 @@
1
1
  # Human decisions
2
2
 
3
- Pi Workflows needs a reusable way to stop at a proposal and wait for a person. The same decision must appear in Pi and Telegram, and either channel must be able to continue the run. Workflows must be able to offer plain choices, choices that collect text, and choices that route back to planning.
3
+ pi-workflows needs a reusable way to stop at a proposal and wait for a person. The same decision must appear in Pi and Telegram, and either channel must be able to continue the run. Workflows must be able to offer plain choices, choices that collect text, and choices that route back to planning.
4
4
 
5
5
  This document defines that behavior. The implementation is tracked in the [human decision gates plan](plans/2026-08-19-human-decision-gates-plan.md).
6
6
 
@@ -60,6 +60,10 @@ export default defineWorkflow({
60
60
  approve: humanDecision({
61
61
  audience: "operator",
62
62
  choices: planChoices,
63
+ onTimeout: {
64
+ afterMs: 10 * 60_000,
65
+ response: { choice: "continue" },
66
+ },
63
67
  request: ({ outputs }) => ({
64
68
  title: "Approve the implementation plan",
65
69
  subject: outputs.propose,
@@ -106,6 +110,8 @@ type PlanDecision =
106
110
 
107
111
  `humanDecisionEdge()` requires one destination for every choice. A missing or extra case is a TypeScript error. Runtime validation applies the same choice and input contract before an answer can win.
108
112
 
113
+ `onTimeout` is optional. It supplies a positive duration and a response that satisfies the same choice contract. The request stores the resulting absolute deadline and validated response. When no human answer wins before the deadline, the decision recovery owner applies that response with `timeout` provenance. Omitting `onTimeout` keeps an indefinite wait. A request cannot combine `onTimeout` with a separate `expiresAt` value.
114
+
109
115
  ## Checkpoint behavior
110
116
 
111
117
  A human decision still has `nodeType: "checkpoint"`. The helper adds a human decision contract to that checkpoint.
@@ -118,9 +124,7 @@ When the engine reaches the node, it:
118
124
  4. asks the configured channels to deliver it; and
119
125
  5. parks the run in `waiting` state.
120
126
 
121
- When a valid answer is accepted, the continuation keeps the workflow's original input. The human answer becomes the checkpoint node's output in the continuation. Existing checkpoints keep their current behavior, where `/workflow answer` supplies the continuation input.
122
-
123
- This distinction preserves old workflow definitions and run bundles.
127
+ When a valid answer is accepted, the continuation keeps the workflow's original input. The human answer becomes the checkpoint node's output in the continuation. Ordinary checkpoints keep their current behavior, where `/workflow answer` supplies the continuation input.
124
128
 
125
129
  ## Request and response contracts
126
130
 
@@ -136,12 +140,12 @@ A new decision request contains:
136
140
  - the logical audience;
137
141
  - the complete choice contract;
138
142
  - the canonical request digest;
139
- - an optional expiry rule; and
143
+ - an optional absolute deadline and automatic response; and
140
144
  - the creation time.
141
145
 
142
- The presentation is an explicit display allowlist. A channel does not receive the subject and cannot infer operator text from it. The request digest binds the subject, visible presentation, title, revision, choices, and input prompts. Each choice has a stable ID and may have no input or one validated text input contract.
146
+ The presentation is an explicit display allowlist. A channel does not receive the subject and cannot infer operator text from it. The request digest binds the subject, visible presentation, title, revision, choices, input prompts, deadline, and automatic response. Each choice has a stable ID and may have no input or one validated text input contract.
143
147
 
144
- The former `body` form remains available for existing workflow definitions. It creates a v1 request and uses a deterministic readable compatibility formatter. Oversized historical bodies receive a bounded readable prefix and an explicit omission notice with the full body digest and size. V1 request bytes and digests do not change.
148
+ Human decisions use only `pi-workflows.human-decision-request.v1`. The former `body` request and all human-decision `v2` records are invalid. This is an alpha hard cutover: old waiting runs and decision state must be reset rather than migrated or reinterpreted.
145
149
 
146
150
  A submitted response contains:
147
151
 
@@ -197,7 +201,7 @@ Private configuration maps the audience to channels:
197
201
 
198
202
  The workflow never receives a bot token, user ID, chat ID, Telegram message ID, or Pi session detail. Channel profiles are private host configuration and are excluded from run presentation.
199
203
 
200
- Pi Workflows keeps credential references in a separate private file. A Telegram credential points to an existing absolute mode-`0600` token file:
204
+ pi-workflows keeps credential references in a separate private file. A Telegram credential points to an existing absolute mode-`0600` token file:
201
205
 
202
206
  ```json
203
207
  {
@@ -254,11 +258,11 @@ The adapter does not infer a choice from ordinary chat text. Callback payloads c
254
258
 
255
259
  Telegram permits one long-polling consumer for a bot profile. Active Pi processes use a shared lease so one process owns polling and the others use the same private channel state. The lease owner can accept a verified reply, but only the Pi session that owns the waiting run creates its continuation. Active sessions inspect the durable accepted-answer fence and recover their own continuation. If no Pi process is running, Telegram delivery and reply collection resume when Pi starts again. Running an always-on service is outside this design.
256
260
 
257
- The Bot API does not provide an idempotency key for `sendMessage`. Pi Workflows therefore writes a delivery intent before sending and never blindly retries an ambiguous send. A timed-out send is recorded as `unknown`; Pi remains available and an operator can request another delivery. This avoids automatic duplicate messages while keeping decision acceptance exactly once.
261
+ The Bot API does not provide an idempotency key for `sendMessage`. pi-workflows therefore writes a delivery intent before sending and never blindly retries an ambiguous send. A timed-out send is recorded as `unknown`; Pi remains available and an operator can request another delivery. This avoids automatic duplicate messages while keeping decision acceptance exactly once.
258
262
 
259
263
  ## Durable decision records
260
264
 
261
- Decision records live next to workflow run bundles under the Pi Workflows state root. They are additive and linked by run ID. A decision directory contains immutable records for:
265
+ Decision records live next to workflow run bundles under the pi-workflows state root. They are additive and linked by run ID. A decision directory contains immutable records for:
262
266
 
263
267
  - the request;
264
268
  - channel delivery intents and results;
@@ -268,15 +272,15 @@ Decision records live next to workflow run bundles under the Pi Workflows state
268
272
  - channel settlement results; and
269
273
  - the continuation request and result.
270
274
 
271
- The resolution record uses a no-replace create. The first valid acceptance, cancellation, or expiry writer wins. Acceptance then materializes the matching accepted-answer detail. Cancellation or expiry materializes cancellation detail. A retry with the same response and idempotency key adopts the existing answer. A conflicting answer receives an `already decided` result.
275
+ The resolution record uses a no-replace create. A valid human answer or eligible timeout response claims the same immutable resolution. The saved result includes `human` or `timeout` provenance. A timeout result has no human actor or channel identity. Cancellation writes a terminal tombstone that takes precedence over automatic continuation. A retry adopts the existing matching result. A conflicting or late answer receives an `already decided` result.
272
276
 
273
- The continuation run ID is derived from the accepted decision ID. Recovery adopts an existing matching continuation or creates it once. A crash after answer acceptance cannot run the next workflow step twice. The continuation run carries a redacted receipt with the decision ID, request digest, gate node ID, choice, acceptance time, and answer digest. Actor, channel, event, and idempotency provenance stays only in the private decision records and never enters the run bundle or model context.
277
+ The continuation run ID is derived from the decision ID. Recovery adopts an existing matching continuation or creates it once. A crash after resolution cannot run the next workflow step twice. The continuation record and redacted receipt carry the resolution provenance, decision ID, request digest, gate node ID, choice, acceptance time, and answer digest. Human actor, channel, event, and idempotency details stay only in the private decision records and never enter the run bundle or model context.
274
278
 
275
279
  SQLite may index pending decisions and channel leases, but immutable decision files remain the source of truth. The index is disposable and rebuildable.
276
280
 
277
281
  ## Planning workflow composition
278
282
 
279
- Pi Workflows keeps solution choice, documentation, and implementation in separate built-ins:
283
+ pi-workflows keeps solution choice, documentation, and implementation in separate built-ins:
280
284
 
281
285
  - `autoplan` chooses a solution or revises one after new evidence.
282
286
  - `autodoc` records an already selected solution in the canonical specification and implementation plan. It does not choose a solution or implement it.
@@ -286,33 +290,19 @@ Pi Workflows keeps solution choice, documentation, and implementation in separat
286
290
 
287
291
  `autoimplement` first finds the clear existing plan in its input, the conversation, or referenced canonical documents. It blocks when no clear plan exists. A caller can bypass discovery and autodoc only by supplying both the explicit plan and a `documentation` receipt whose plan digest matches it. A plan without that current-document evidence enters autodoc so the canonical documents are inspected and adopted or updated. The absence of a structured `plan` input never authorizes `autoplan`.
288
292
 
289
- If later implementation, verification, review, comments, or CI evidence invalidates the plan, autoimplement runs `autoplan`, sends the revised plan through `autodoc`, and then resumes implementation. An optional approval policy inserts `plan-approval` after the revised documentation.
293
+ If later implementation, verification, review, comments, or CI evidence invalidates the plan, Autoimplement enters the shared plan-change workflow. That workflow runs Autoplan, Autodoc, plan approval, and bounded exact-text replanning. Monitor uses the same workflow for each new repair plan and passes the selected plan into Autoimplement without a second decision.
290
294
 
291
295
  ## Reusable plan approval workflow
292
296
 
293
- Pi Workflows ships a typed `plan-approval` workflow built on `humanDecision()`. Its input contains the documented plan, plan digest, audience, and display summary. It has three named exits:
294
-
295
- - `continue`, with the approval receipt;
296
- - `stop`, with the stop receipt; and
297
- - `replan`, with the exact instructions and receipt.
298
-
299
- A parent can include it without copying prompts or channel handling:
297
+ pi-workflows ships a typed `plan-approval` workflow built on `humanDecision()`. Its policy has three modes:
300
298
 
301
- ```typescript
302
- includes: {
303
- approval: includeWorkflow(planApproval, {
304
- input: ({ outputs }) => ({
305
- plan: outputs.devise.plan,
306
- planDigest: outputs.devise.planDigest,
307
- audience: "operator",
308
- }),
309
- }),
310
- },
311
- ```
299
+ - `auto` asks the configured audience and continues after the configured deadline. It defaults to audience `operator` and 10 minutes.
300
+ - `required` waits for an explicit human answer.
301
+ - `skip` creates no human decision and continues immediately.
312
302
 
313
- A `replan` exit returns to `autoplan` with the previous plan and the exact human instructions as new evidence. The revised plan passes through `autodoc`, receives a new digest, and enters a new approval decision. Step limits bound repeated replanning.
303
+ The workflow has `continue`, `stop`, and exact-text `replan` exits. Continue reports `human`, `timeout`, or `skipped` provenance. Stop and replan always require a human answer.
314
304
 
315
- Monitor repair composes `autoplan`, `autodoc`, optional `plan-approval`, `autoimplement`, and a fresh target check. Autoimplement can mount the same approval workflow after evidence-driven redesign. Existing behavior stays unchanged when no approval policy is present.
305
+ The internal plan-change workflow composes Autoplan, Autodoc, and plan approval once. It owns the replan count, plan digest, and positive revision. Autoimplement and Monitor include this workflow instead of copying approval routes. A plan supplied by the caller or already selected by Monitor bypasses another decision. Only a changed plan digest enters the gate.
316
306
 
317
307
  ## Recovery and cancellation
318
308
 
@@ -325,27 +315,27 @@ Recovery follows these rules:
325
315
  - ambiguous Telegram sends are not retried automatically;
326
316
  - duplicate channel updates are harmless;
327
317
  - stale responses are rejected;
328
- - one accepted response creates one continuation;
329
- - the winning channel dismisses any pending Pi dialog;
318
+ - one human or timeout response creates one continuation;
319
+ - the winning human answer or timeout policy dismisses any pending Pi dialog;
330
320
  - confirmed channel settlement is adopted without another remote call;
331
321
  - failed channel settlement has a bounded retry count and cannot create an unbounded record loop; and
332
322
  - cancellation resolves the owned waiting decision from durable state, even after restart, closes pending views, and prevents a later answer from continuing the run.
333
323
 
334
- A decision with no available channel remains waiting and reports the configuration problem. It does not silently continue or choose a default.
324
+ A required decision with no available channel remains waiting and reports the configuration problem. An automatic decision does not need a channel to apply its saved response after the deadline. A skipped plan policy creates no decision.
335
325
 
336
326
  ## Compatibility
337
327
 
338
- Ordinary checkpoints, their continuation input behavior, and existing run bundles remain unchanged. V2 requests, accepted records, receipts, resolutions, and multipart delivery records are additive. Older viewers ignore them. Updated viewers label a human decision as a checkpoint, show the readable presentation and its fingerprint, and keep the canonical subject separate. Private channel configuration and transport identifiers remain hidden.
328
+ This alpha change updates the current request, accepted-result, receipt, resolution, continuation, and snapshot contracts in place. Old active runs refuse resume through normal source and definition identity checks. There is no compatibility reader, migration, dual path, or new schema generation. Updated viewers label a human decision as a checkpoint, show its deadline and automatic action when present, and keep the canonical subject separate. Private channel configuration and transport identifiers remain hidden.
339
329
 
340
330
  The engine remains independent from Pi and Telegram. Core code owns decision contracts, validation, durable acceptance, and continuation. The Pi extension owns UI and channel lifecycle. The Telegram adapter owns Bot API translation. Workflow definitions own only the question, choices, audience, and routes.
341
331
 
342
332
  ## Contract impact
343
333
 
344
334
  - **Session state:** Pi records normal workflow messages and interactive decision results.
345
- - **Other persistent data:** additive decision records, a rebuildable private channel index, and private channel configuration.
335
+ - **Other persistent data:** decision requests and resolutions can carry a deadline, automatic response, and resolution provenance in the existing decision store. The private channel index remains rebuildable.
346
336
  - **Pi internals:** none.
347
337
  - **Public Pi API:** documented extension lifecycle and UI methods only.
348
- - **Public Pi Workflows API:** typed human choices, `humanDecision()`, `humanDecisionEdge()`, the channel interface, and the `plan-approval` workflow.
338
+ - **Public pi-workflows API:** typed human choices, `humanDecision().onTimeout`, `humanDecisionEdge()`, the channel interface, the plan approval policy, and the shared plan-change workflow.
349
339
 
350
340
  ## Verification requirements
351
341
 
@@ -1,13 +1,13 @@
1
1
  # Human decision presentations
2
2
 
3
- This contract is implemented. New human decision requests separate their canonical
4
- subject from the complete readable message shown to an operator. Historical requests
5
- that use `body` remain compatible through a deterministic readable formatter.
3
+ This contract is implemented. Human decision requests separate their canonical
4
+ subject from the complete readable message shown to an operator. Human decisions use
5
+ one v1 contract with no legacy body form or parallel schema version.
6
6
  The implementation plan is in
7
7
  [the human decision presentations plan](plans/2026-08-19-human-decision-presentations-plan.md).
8
8
 
9
9
  A human decision contains machine data and a separate message for the operator.
10
- Pi Workflows stores and validates the machine data. Pi and Telegram render only
10
+ pi-workflows stores and validates the machine data. Pi and Telegram render only
11
11
  the operator message, and future channels follow the same rule.
12
12
 
13
13
  ## Minimal example
@@ -52,7 +52,7 @@ not see `subject` unless the workflow explicitly copies selected text into
52
52
 
53
53
  ## Request contract
54
54
 
55
- A new request uses `pi-workflows.human-decision-request.v2`. It contains:
55
+ A request uses `pi-workflows.human-decision-request.v1`. It contains:
56
56
 
57
57
  | Field | Required | Meaning |
58
58
  | -------------------- | -------- | ----------------------------------------------- |
@@ -229,7 +229,7 @@ text prompt. It wraps and scrolls while responding to resize, theme, cancellatio
229
229
  and `AbortSignal` events.
230
230
 
231
231
  When Telegram or another channel accepts the decision, the signal closes the Pi
232
- dialog. Pi Workflows does not modify Pi core or use undocumented TUI state.
232
+ dialog. pi-workflows does not modify Pi core or use undocumented TUI state.
233
233
 
234
234
  ### Other channels
235
235
 
@@ -239,7 +239,7 @@ for display.
239
239
 
240
240
  ## Plan presentation
241
241
 
242
- Pi Workflows provides a reusable plan presenter for built-in workflows. It
242
+ pi-workflows provides a reusable plan presenter for built-in workflows. It
243
243
  derives a presentation from the same typed plan stored as the subject.
244
244
 
245
245
  The presenter uses these sections when data exists:
@@ -255,25 +255,15 @@ It omits absent sections. It never serializes the plan object. `plan-approval`,
255
255
  `monitor`, `autoplan`, `autodoc`, and `autoimplement` reuse this presenter where
256
256
  they ask a person to approve a plan.
257
257
 
258
- ## Compatibility
258
+ ## Alpha cutover
259
259
 
260
- Current v1 requests remain immutable.
260
+ The human-decision request, accepted result, receipt, delivery, and resolution use one
261
+ v1 schema family. The current structured subject and explicit presentation contract
262
+ replaced the former body request and parallel v2 records in place.
261
263
 
262
- - A v1 string body becomes one readable paragraph at delivery time.
263
- - A v1 object body uses a deterministic compatibility formatter. It converts
264
- stable key order into readable labels and fields with sections and lists.
265
- - An oversized v1 body remains answerable. The formatter keeps a bounded readable
266
- prefix and adds an explicit omission notice with the full body digest and size.
267
- It never hides omitted content behind an ellipsis.
268
- - The compatibility formatter reads only the historical `body`, which was
269
- already the display field. It never reads a new structured subject.
270
- - V1 request bytes and digests do not change.
271
- - Pending and accepted v1 decisions continue to use v1 validation and digest
272
- rules.
273
- - New preferred authoring emits v2. The existing body form remains a deprecated
274
- compatibility overload until a separate removal is approved.
275
-
276
- No migration rewrites run bundles or decision records.
264
+ Old waiting runs and human-decision state are incompatible. The runtime fails with a
265
+ reset instruction instead of reading, migrating, or silently reinterpreting them.
266
+ There is no compatibility reader, dual path, alias, or migration.
277
267
 
278
268
  ## Privacy and security
279
269
 
@@ -311,10 +301,10 @@ npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
311
301
  npx -y @simpledoc/simpledoc check
312
302
  ```
313
303
 
314
- Tests must cover schema validation, canonical digests, readable legacy bodies,
304
+ Tests must cover schema validation, canonical digests, structured-value formatting,
315
305
  plan rendering, Pi and Telegram content parity, unsafe text, Unicode, multipart
316
- delivery, ambiguous sends, recovery, stale answers, viewer output, and proof
317
- that no channel serializes a subject as JSON.
306
+ delivery, ambiguous sends, recovery, stale answers, viewer output, incompatible-state
307
+ failure, and proof that no channel serializes a subject as JSON.
318
308
 
319
309
  ## Boundaries
320
310
 
package/docs/MONITOR.md CHANGED
@@ -38,7 +38,7 @@ The monitor checks a target, sends one status notification after every accepted
38
38
 
39
39
  `repair` must set `authorized: true`. It can constrain scope, repository, base branch, merge behavior, and other implementation constraints. Omitted `merge` means the repair can prepare but cannot merge a pull request; merging requires explicit `merge: true`. Without this object the monitor is observation-only. Repair authority does not permit a protected model, benchmark, credential, hardware, spending, or scope change.
40
40
 
41
- `repair.approval` is optional. It contains a logical `audience` and `maxReplans` from 1 through 20. When present, monitor sends the documented repair plan through the reusable human `plan-approval` workflow. Continue starts implementation, stop ends the repair truthfully, and replan preserves exact operator text before autoplan and autodoc run again. The model-facing workflow tool cannot approve the gate.
41
+ `repair.approval` uses `auto`, `required`, or `skip` mode. When omitted, Monitor uses `auto` with audience `operator`, a 10-minute timeout, and three allowed replans. Auto mode asks and then continues with the exact plan if no answer is accepted by the deadline. Required mode waits for an explicit human answer. Skip mode asks nothing. Continue starts implementation, stop ends the repair truthfully, and replan preserves exact operator text before the shared plan-change workflow runs again. The model-facing workflow tool cannot approve the gate.
42
42
 
43
43
  `reportWhen` is removed. The monitor always reports after every accepted check.
44
44
 
@@ -102,17 +102,11 @@ prepare
102
102
  ├─ continue → schedule → sleep → check
103
103
  └─ repair → repairGuard
104
104
  ├─ blocked → repairBlocked → repairReport → finish
105
- └─ initialDesign: autoplan
105
+ └─ planChange
106
106
  ├─ blocked → repairBlocked
107
- └─ documentation: autodoc
107
+ └─ ready → implementation: autoimplement
108
108
  ├─ blocked → repairBlocked
109
- ├─ no approval implementation: autoimplement
110
- └─ approval: plan-approval
111
- ├─ stop → repairBlocked
112
- ├─ replan → initialDesign
113
- └─ continue → implementation: autoimplement
114
- ├─ blocked → repairBlocked
115
- └─ completed → check
109
+ └─ completedcheck
116
110
  ```
117
111
 
118
112
  - `prepare` is a `compute` node that validates and applies input defaults.
@@ -122,7 +116,7 @@ prepare
122
116
  - `report` is a `notify` node that queues exactly one report.
123
117
  - `decide` is a `compute` node that applies the route and check safety limit.
124
118
  - `repairGuard` stops a repeated issue when a completed repair did not change its fingerprint or observed target state.
125
- - `initialDesign`, `documentation`, optional `approval`, and `implementation` are included workflows. Replan returns exact operator text to initialDesign. Autoimplement can enter nested `autoplan`, then autodoc, when later evidence requires redesign.
119
+ - `planChange` and `implementation` are included workflows. Plan change owns Autoplan, Autodoc, approval policy, and exact-text replanning. Autoimplement receives the selected plan without another decision and enters its own plan-change mount only when later evidence requires a changed plan.
126
120
  - `repairBlocked` and `repairReport` preserve a truthful blocked result and user notification.
127
121
  - `schedule` is a function `action` that publishes the next-check time.
128
122
  - `sleep` is the existing runtime-owned shell wait.
@@ -148,9 +142,9 @@ A check may use available tools to read current state. It must use the target's
148
142
 
149
143
  ## Progress ownership boundary
150
144
 
151
- The regular Pi model running the check is the observation adapter. It uses the target-specific tools authorized by the task, converts observed facts into `pi-workflows.progress.v1` tracks, and publishes them through the existing `workflow` tool. Pi Workflows validates, stores, estimates, and displays those tracks.
145
+ The regular Pi model running the check is the observation adapter. It uses the target-specific tools authorized by the task, converts observed facts into `pi-workflows.progress.v1` tracks, and publishes them through the existing `workflow` tool. pi-workflows validates, stores, estimates, and displays those tracks.
152
146
 
153
- The monitored target stays independent of Pi Workflows. A monitor must not require a target Job or application to import Pi Workflows, emit a Pi schema, write a Pi progress file, expose a Pi endpoint, create a progress store, or add a progress reader command solely for monitoring. Provider-specific clients and credentials do not belong in Pi Workflows.
147
+ The monitored target stays independent of pi-workflows. A monitor must not require a target Job or application to import pi-workflows, emit a Pi schema, write a Pi progress file, expose a Pi endpoint, create a progress store, or add a progress reader command solely for monitoring. Provider-specific clients and credentials do not belong in pi-workflows.
154
148
 
155
149
  When a target does not expose a factual count, total, or source estimate, the check reports that ETA is unavailable. Better application telemetry is separate work. It should expose normal operational facts for all operators, not a Pi-specific reporting protocol.
156
150
 
@@ -1,6 +1,6 @@
1
1
  # Workflow composition
2
2
 
3
- Pi Workflows can include one workflow inside another without copying nodes, prompts, or routing logic. The included workflow still runs on its own. The parent supplies input and connects the included workflow's named exits to later parent steps.
3
+ pi-workflows can include one workflow inside another without copying nodes, prompts, or routing logic. The included workflow still runs on its own. The parent supplies input and connects the included workflow's named exits to later parent steps.
4
4
 
5
5
  Composition keeps one run, trace, pause state, cancellation state, and final presentation. Controllers remain the correct tool for independent or indefinitely reconciled child runs.
6
6
 
@@ -265,7 +265,7 @@ monitor
265
265
 
266
266
  `autoimplement` requires a clear existing plan, but the structured `plan` input is optional because the plan can already be in conversation context or canonical documentation. It blocks when it cannot find a clear plan. It skips autodoc when documentation is current and includes autodoc when documentation is missing or stale. The absence of `input.plan` never routes to initial autoplan.
267
267
 
268
- Autoimplement includes `autoplan` only as evidence-driven `redesign`. When implementation, verification, review, comments, or CI proves that the approach is wrong, the revised plan passes through autodoc before implementation resumes. Local bugs go to a fix step instead.
268
+ Autoimplement includes the shared plan-change workflow only as evidence-driven `redesign`. When implementation, verification, review, comments, or CI proves that the approach is wrong, the shared workflow runs Autoplan, Autodoc, the configured plan decision, and bounded replanning before implementation resumes. Local bugs go to a fix step instead. Existing supplied or discovered plans bypass the decision.
269
269
 
270
270
  Review rounds record findings at every severity from P0 through P2. P0 or P1 findings require another implementation and review round. A P2-only round can be addressed, but the workflow does not run the reviewer again solely because P2 work changed files.
271
271
 
@@ -281,16 +281,17 @@ Monitor remains observation-only unless its input explicitly authorizes mutation
281
281
 
282
282
  ```text
283
283
  check
284
- -> initialDesign: autoplan
285
- -> documentation: autodoc
286
- -> approval: plan-approval when requested
287
- -> replan: initialDesign
284
+ -> planChange
285
+ -> autoplan
286
+ -> autodoc
287
+ -> plan-approval
288
+ -> replan: autoplan
288
289
  -> implementation: autoimplement
289
- -> redesign: autoplan -> autodoc when needed
290
+ -> redesign: planChange when needed
290
291
  -> check
291
292
  ```
292
293
 
293
- The outer `autoplan` creates the first plan. Autodoc records it before implementation. An optional plan approval gate can continue, stop, or return exact replan instructions to autoplan. The inner redesign mount revises a plan only when new evidence invalidates it and records the revision through autodoc. The monitor checks the target again after implementation and does not trust a repair claim by itself.
294
+ The shared plan-change workflow creates, records, and gates each repair plan. Its default policy asks the `operator` audience and continues after 10 minutes without an answer. Required mode waits for an explicit answer. Skip mode creates no decision. Monitor passes the selected plan into Autoimplement, so Autoimplement does not ask about that digest again. A later Autoimplement redesign uses the same shared workflow for the changed digest. The monitor checks the target again after implementation and does not trust a repair claim by itself.
294
295
 
295
296
  A protected change to model choice, benchmark method, credentials, hardware, spending authority, or another user decision exits as blocked. The workflow never changes the protected part of the task silently.
296
297
 
@@ -306,7 +307,7 @@ This is a compatible public API addition under the project's pre-1.0 policy. It
306
307
  - **Other persistent data:** additive source and mount data, definition digests, and include events in existing run bundles.
307
308
  - **Pi internals:** none.
308
309
  - **Public Pi API:** existing extension APIs only.
309
- - **Public Pi Workflows API:** typed workflow inputs and exits, `includeWorkflow()`, direct imports, dynamic references, and `defineWorkflowRegistry()`.
310
+ - **Public pi-workflows API:** typed workflow inputs and exits, `includeWorkflow()`, direct imports, dynamic references, and `defineWorkflowRegistry()`.
310
311
 
311
312
  ## Required tests
312
313
 
@@ -1,6 +1,6 @@
1
1
  # Workflow step messages
2
2
 
3
- This specification defines how Pi Workflows shows agent-step instructions in an interactive Pi session. The model receives the complete step prompt, while the user sees a small workflow card that can be expanded.
3
+ This specification defines how pi-workflows shows agent-step instructions in an interactive Pi session. The model receives the complete step prompt, while the user sees a small workflow card that can be expanded.
4
4
 
5
5
  This contract is implemented for the release after `0.5.3`.
6
6
 
@@ -8,7 +8,7 @@ This contract is implemented for the release after `0.5.3`.
8
8
 
9
9
  Agent-step prompts contain the task, workflow identity, attempt identity, output shape, and submission rules. This information is required by the model, but showing it as a large user message makes the conversation hard to read.
10
10
 
11
- Pi Workflows will send the same prompt as a custom Pi message. A custom renderer will show a compact summary by default and the full content when expanded.
11
+ pi-workflows will send the same prompt as a custom Pi message. A custom renderer will show a compact summary by default and the full content when expanded.
12
12
 
13
13
  This is a presentation change. It does not add a workflow primitive, change graph execution, or change the step completion contract.
14
14
 
@@ -85,7 +85,7 @@ The expanded card shows:
85
85
  - expected output
86
86
  - full model prompt
87
87
 
88
- Expansion uses Pi's existing custom-message expansion state and keys. Pi Workflows does not add another toggle or store separate expansion state.
88
+ Expansion uses Pi's existing custom-message expansion state and keys. pi-workflows does not add another toggle or store separate expansion state.
89
89
 
90
90
  ## Reminders and resumes
91
91
 
@@ -105,9 +105,9 @@ The two message types must not share delivery code that can accidentally change
105
105
 
106
106
  New interactive step deliveries replace `sendUserMessage` with `sendMessage`. Existing session entries remain readable and are not rewritten.
107
107
 
108
- The custom message is a normal documented Pi session message. Pi Workflows adds no Pi session schema, private entry type, or separate persistent store. Run bundles keep the existing full prompt and structured step contract, so this change does not alter the run-bundle schema.
108
+ The custom message is a normal documented Pi session message. pi-workflows adds no Pi session schema, private entry type, or separate persistent store. Run bundles keep the existing full prompt and structured step contract, so this change does not alter the run-bundle schema.
109
109
 
110
- If the renderer is unavailable, Pi still retains the custom message content. Pi Workflows does not add a fallback path that sends a duplicate user message.
110
+ If the renderer is unavailable, Pi still retains the custom message content. pi-workflows does not add a fallback path that sends a duplicate user message.
111
111
 
112
112
  ## Public API boundary
113
113
 
@@ -1,6 +1,6 @@
1
1
  # Workflow updates
2
2
 
3
- This specification defines durable, non-terminal updates from running Pi Workflows nodes. An update reports current state without finishing a node or choosing a graph route.
3
+ This specification defines durable, non-terminal updates from running pi-workflows nodes. An update reports current state without finishing a node or choosing a graph route.
4
4
 
5
5
  ## Minimal examples
6
6
 
@@ -54,7 +54,7 @@ The `update` tool action does not complete the agent step. The agent still calls
54
54
 
55
55
  ## Place in the workflow model
56
56
 
57
- Pi Workflows keeps its current node primitives:
57
+ pi-workflows keeps its current node primitives:
58
58
 
59
59
  - `agent` for model judgment and language work
60
60
  - `compute` for pure local calculation
@@ -76,11 +76,34 @@ Updates do not:
76
76
 
77
77
  A node's final result remains the only value that completes the node and controls routing.
78
78
 
79
+ ## Command batch updates
80
+
81
+ A bounded command-batch action can publish one metadata update when an item settles:
82
+
83
+ ```json
84
+ {
85
+ "type": "command-batch.item",
86
+ "key": "review/4f2a9c1d",
87
+ "data": {
88
+ "schema": "pi-workflows.command-batch-item.v1",
89
+ "batchKind": "review",
90
+ "itemId": "4f2a9c1d",
91
+ "outcome": "succeeded",
92
+ "completed": 2,
93
+ "total": 4
94
+ }
95
+ }
96
+ ```
97
+
98
+ `batchKind` identifies `review`, `ciWatch`, or `verification`. `outcome` is `succeeded`, `failed`, `timedOut`, or `cancelled`. `completed` and `total` are observed command counts. The key stays stable for one batch item.
99
+
100
+ These updates do not contain stdout, stderr, command environments, credentials, or private provider data. The accepted action output contains command receipts and controls workflow routing. A command-batch update cannot satisfy review, CI, or verification. If an unaccepted batch runs again after interruption, its earlier updates remain diagnostic records only.
101
+
79
102
  ## Model-mediated observation
80
103
 
81
104
  For monitoring, the regular Pi model running the workflow step observes the external target and publishes progress with the existing `workflow` tool. This is the intended adapter boundary. Deterministic runtime code validates, persists, estimates, and renders the submitted data.
82
105
 
83
- External Jobs and applications do not need a Pi Workflows dependency or reporting protocol. Provider-specific observation stays in the agent task and its authorized tools. If the target does not expose enough facts, the model publishes only what is known and leaves ETA unavailable.
106
+ External Jobs and applications do not need a pi-workflows dependency or reporting protocol. Provider-specific observation stays in the agent task and its authorized tools. If the target does not expose enough facts, the model publishes only what is known and leaves ETA unavailable.
84
107
 
85
108
  Do not add a transport, endpoint, store, schema, or provider integration when the regular Pi model can observe the target and use `workflow update` or `submit`.
86
109
 
@@ -333,7 +356,7 @@ Fields:
333
356
 
334
357
  A progress object is a full snapshot for its key. Omitted optional fields clear their previous values. Publishers mark finished tracks with a terminal status instead of deleting them.
335
358
 
336
- The reserved key `overall` represents an explicit aggregate supplied by the workflow. Pi Workflows never combines unrelated tracks automatically. Without `overall`, displays list independent tracks.
359
+ The reserved key `overall` represents an explicit aggregate supplied by the workflow. pi-workflows never combines unrelated tracks automatically. Without `overall`, displays list independent tracks.
337
360
 
338
361
  Unknown fields in `pi-workflows.progress.v1` are validation errors.
339
362
 
@@ -355,7 +378,7 @@ A measured ETA requires a known total and at least two usable samples in the cur
355
378
 
356
379
  The median interval rate is the central estimate. The 25th and 75th percentile rates form the ETA range. The faster rate gives the lower remaining-time bound and the slower rate gives the upper bound. One usable interval has low confidence. With two through four intervals, a ratio of interquartile range to median no greater than 0.5 gives medium confidence; a wider spread gives low confidence. With five or more intervals, a ratio no greater than 0.25 gives high confidence, a ratio through 0.5 gives medium confidence, and a wider spread gives low confidence. A non-positive median makes ETA unavailable. A non-positive lower rate removes the upper time bound, so the formatter shows the central ETA with low confidence instead of a closed range.
357
380
 
358
- A fresh `sourceEstimatedFinishAt` takes priority over a measured ETA and is labelled as a source estimate. It is fresh when it comes from the latest track update, is later than the matching `sourceUpdatedAt` or runtime receipt time, and has not passed. When `sourceUpdatedAt` is absent, the runtime receipt time is the source time. A passed source estimate is expired and does not override a measured estimate. Pi Workflows does not ask a model to invent an ETA. When the target supplies no usable estimate and the samples cannot support one, the formatter says `ETA unavailable` and states the reason.
381
+ A fresh `sourceEstimatedFinishAt` takes priority over a measured ETA and is labelled as a source estimate. It is fresh when it comes from the latest track update, is later than the matching `sourceUpdatedAt` or runtime receipt time, and has not passed. When `sourceUpdatedAt` is absent, the runtime receipt time is the source time. A passed source estimate is expired and does not override a measured estimate. pi-workflows does not ask a model to invent an ETA. When the target supplies no usable estimate and the samples cannot support one, the formatter says `ETA unavailable` and states the reason.
359
382
 
360
383
  For `waiting` or `blocked` tracks, measured ETA is paused and the display reports the current state. A source estimate may still be shown when the target reports one. For terminal tracks, remaining work and ETA are omitted.
361
384
 
@@ -8,7 +8,7 @@ status: implemented
8
8
 
9
9
  # Controller runtime plan
10
10
 
11
- Pi Workflows needs a controller mode for automation that spans repeated events, external state changes, and process restarts. The design in [CONTROLLERS.md](../CONTROLLERS.md) follows the Kubernetes controller pattern. Durable resources hold desired and observed state, events enqueue resource keys, and each reconciliation reads current facts before acting.
11
+ pi-workflows needs a controller mode for automation that spans repeated events, external state changes, and process restarts. The design in [CONTROLLERS.md](../CONTROLLERS.md) follows the Kubernetes controller pattern. Durable resources hold desired and observed state, events enqueue resource keys, and each reconciliation reads current facts before acting.
12
12
 
13
13
  The implementation keeps the graph engine focused on finite jobs. Controllers start and observe workflows through a child-run interface. Workflow graphs keep their finite execution model.
14
14
 
@@ -8,7 +8,7 @@ status: implemented
8
8
 
9
9
  # Always-on workflows plan
10
10
 
11
- Pi Workflows should feel the same whether the user watches a run or walks away from it. In the user's words: "I might start a workflow locally in Pi then I wait for it to complete. All the while I am looking at the screen and I'm not closing the Pi window. When the workflow ends I just want to be able to continue the same Pi session like normal with a session up to date with what happened in the workflow." And: "I just want to interact by starting a workflow, closing it, and then coming back and then still being able to continue it when I open it up. It's syncing continuously or something."
11
+ pi-workflows should feel the same whether the user watches a run or walks away from it. In the user's words: "I might start a workflow locally in Pi then I wait for it to complete. All the while I am looking at the screen and I'm not closing the Pi window. When the workflow ends I just want to be able to continue the same Pi session like normal with a session up to date with what happened in the workflow." And: "I just want to interact by starting a workflow, closing it, and then coming back and then still being able to continue it when I open it up. It's syncing continuously or something."
12
12
 
13
13
  These are not two modes. The user asked for "both in a single unified system." This plan makes the Pi window irrelevant to execution: closing or opening the window is a change in observation, not in the run. The work stays on one machine, uses the merged controller runtime as its foundation, and does not modify Pi core.
14
14
 
@@ -10,7 +10,7 @@ status: implemented
10
10
 
11
11
  The user should be able to tell an agent, "Monitor this every 30 minutes," and have the agent start the right workflow. The user must not write controller records or JSON. The existing `workflow` model tool should manage workflows instead of serving only as a step-submission tool.
12
12
 
13
- A monitor is one Pi Workflows graph. It checks the target, reports a meaningful change, sleeps for the requested interval with the existing shell node, and loops. This plan does not use controllers, Unified Exec, a new wait node, or a second scheduler.
13
+ A monitor is one pi-workflows graph. It checks the target, reports a meaningful change, sleeps for the requested interval with the existing shell node, and loops. This plan does not use controllers, Unified Exec, a new wait node, or a second scheduler.
14
14
 
15
15
  ## Shipped design
16
16
 
@@ -84,11 +84,11 @@ The `list` result identifies `monitor` as a built-in workflow and gives a short
84
84
 
85
85
  ## Built-in monitor workflow
86
86
 
87
- Ship `monitor` as a built-in workflow in the Pi Workflows package. Built-ins have the lowest discovery precedence:
87
+ Ship `monitor` as a built-in workflow in the pi-workflows package. Built-ins have the lowest discovery precedence:
88
88
 
89
89
  1. Project workflows under `.pi/workflows/`
90
90
  2. Global workflows under `~/.pi/agent/workflows/`
91
- 3. Workflows bundled with Pi Workflows
91
+ 3. Workflows bundled with pi-workflows
92
92
 
93
93
  A project or global `monitor.workflow.ts` can therefore replace the default. The built-in remains a real workflow file so run bundles can record its path and source hash with the existing rules.
94
94
 
@@ -112,13 +112,13 @@ prepare -> guard -> check
112
112
  | stop and report -> report-final -> finish
113
113
  ```
114
114
 
115
- `prepare` validates and normalizes the input. `guard` enforces `maxChecks`. `check` is an agent node that performs one observation and returns a validated route, a bounded observation, and an optional report. The next `check` can read the previous accepted `check` output, which Pi Workflows already keeps for looped nodes.
115
+ `prepare` validates and normalizes the input. `guard` enforces `maxChecks`. `check` is an agent node that performs one observation and returns a validated route, a bounded observation, and an optional report. The next `check` can read the previous accepted `check` output, which pi-workflows already keeps for looped nodes.
116
116
 
117
117
  The report nodes write a normal assistant message and then submit an acknowledgement. Keeping reporting after accepted check output prevents the agent from showing a report before the structured result passes validation. The final presentation reports why the monitor stopped without repeating a report that the user already saw.
118
118
 
119
- The sleep node uses the existing Pi Workflows shell action to launch the current Node executable with a timer. Set the node timeout above the largest supported interval because the engine default is 15 minutes. Set the shell execution timeout above the requested wait by a small fixed margin. Cancellation aborts the timer process immediately.
119
+ The sleep node uses the existing pi-workflows shell action to launch the current Node executable with a timer. Set the node timeout above the largest supported interval because the engine default is 15 minutes. Set the shell execution timeout above the requested wait by a small fixed margin. Cancellation aborts the timer process immediately.
120
120
 
121
- If the Pi TUI or standalone workflow host stops during sleep, Pi Workflows parks the run and kills the shell child. Resuming the run starts that sleep node again from the beginning. This is existing workflow behavior and is acceptable for this feature. No special timer persistence is added.
121
+ If the Pi TUI or standalone workflow host stops during sleep, pi-workflows parks the run and kills the shell child. Resuming the run starts that sleep node again from the beginning. This is existing workflow behavior and is acceptable for this feature. No special timer persistence is added.
122
122
 
123
123
  The workflow uses a high but finite `maxSteps` value as a second safety guard. Check and report values have explicit size limits so a long run cannot grow its bundle without bound.
124
124
 
@@ -133,7 +133,7 @@ Make the feature in `osolmaz/pi-workflows`:
133
133
  - Add the built-in monitor workflow and focused tests.
134
134
  - Update `README.md` and `docs/workflows.md`.
135
135
 
136
- After the upstream change is complete, update the pinned Pi Workflows commit in OnurPi's thin `packages/workflows` wrapper. Do not add a new OnurPi extension or copy a monitor file into live global state.
136
+ After the upstream change is complete, update the pinned pi-workflows commit in OnurPi's thin `packages/workflows` wrapper. Do not add a new OnurPi extension or copy a monitor file into live global state.
137
137
 
138
138
  ## State and API impact
139
139
 
@@ -141,7 +141,7 @@ After the upstream change is complete, update the pinned Pi Workflows commit in
141
141
  - **Other persistent data:** No new data model. The feature uses existing run bundles and the existing workflow run queue.
142
142
  - **Pi internals:** None.
143
143
  - **Pi public API:** `registerTool`, `registerCommand`, `sendUserMessage`, and documented agent and session lifecycle events.
144
- - **Pi Workflows API:** The workflow definition and run-state models do not change. The model-facing `workflow` tool contract changes, and discovery gains a lowest-priority built-in source.
144
+ - **pi-workflows API:** The workflow definition and run-state models do not change. The model-facing `workflow` tool contract changes, and discovery gains a lowest-priority built-in source.
145
145
 
146
146
  ## Non-goals
147
147
 
@@ -179,6 +179,6 @@ npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
179
179
  npx -y @simpledoc/simpledoc check
180
180
  ```
181
181
 
182
- Test the extension from the Pi Workflows checkout with `pi -e src/extension/index.ts`. Use a short test interval in a controlled fixture, then perform one manual 30-minute monitor run to confirm that the configured node timeout does not stop it. Test plain-language startup with the normal model, then test list, status, pause, resume, cancel, and checkpoint answer actions.
182
+ Test the extension from the pi-workflows checkout with `pi -e src/extension/index.ts`. Use a short test interval in a controlled fixture, then perform one manual 30-minute monitor run to confirm that the configured node timeout does not stop it. Test plain-language startup with the normal model, then test list, status, pause, resume, cancel, and checkpoint answer actions.
183
183
 
184
184
  After updating OnurPi, run its full checks and start Pi with the installed OnurPi package. Confirm that the model sees one `workflow` tool, discovers `monitor`, and can start it from a plain-language request.
@@ -66,7 +66,7 @@ If identity or revision cannot be proved, leave the run unchanged and report a c
66
66
 
67
67
  ## Scope and non-goals
68
68
 
69
- This changes Pi Workflows only. It uses no Pi internals and changes no Pi session entry. It updates Pi Workflows run bundles and controller queue records as described above.
69
+ This changes pi-workflows only. It uses no Pi internals and changes no Pi session entry. It updates pi-workflows run bundles and controller queue records as described above.
70
70
 
71
71
  It does not add runtime compatibility readers, aliases, dual-write fields, or a permanent migration service. It does not hot-reload package-provided built-ins. A package update takes effect after Pi reload or restart.
72
72
 
@@ -6,7 +6,7 @@ date: 2026-08-13
6
6
 
7
7
  # Route workflow reports to their starting session
8
8
 
9
- Pi Workflows must not send one workflow's report into an unrelated conversation. A workflow started in one Pi session must report only to that session, even when another session or the standalone host executes part of the run.
9
+ pi-workflows must not send one workflow's report into an unrelated conversation. A workflow started in one Pi session must report only to that session, even when another session or the standalone host executes part of the run.
10
10
 
11
11
  ## Requirements
12
12