@osolmaz/pi-workflows 0.12.1 → 0.13.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.
Files changed (209) hide show
  1. package/README.md +52 -28
  2. package/dist/builtins/autodoc.workflow.d.ts +4 -4
  3. package/dist/builtins/autoimplement.workflow.d.ts +369 -73
  4. package/dist/builtins/autoplan.workflow.d.ts +126 -13
  5. package/dist/builtins/autoplan.workflow.js +200 -29
  6. package/dist/builtins/autoplan.workflow.js.map +1 -1
  7. package/dist/builtins/catalog.js +6 -4
  8. package/dist/builtins/catalog.js.map +1 -1
  9. package/dist/builtins/index.d.ts +2 -1
  10. package/dist/builtins/index.js +1 -0
  11. package/dist/builtins/index.js.map +1 -1
  12. package/dist/builtins/monitor.workflow.d.ts +56 -21
  13. package/dist/builtins/monitor.workflow.js +497 -216
  14. package/dist/builtins/monitor.workflow.js.map +1 -1
  15. package/dist/builtins/plain-summary.workflow.d.ts +32 -0
  16. package/dist/builtins/plain-summary.workflow.js +134 -0
  17. package/dist/builtins/plain-summary.workflow.js.map +1 -0
  18. package/dist/builtins/plan-change.workflow.d.ts +170 -22
  19. package/dist/builtins/sanity-check.workflow.d.ts +45 -3
  20. package/dist/builtins/sanity-check.workflow.js +45 -7
  21. package/dist/builtins/sanity-check.workflow.js.map +1 -1
  22. package/dist/controllers/effects.d.ts +3 -2
  23. package/dist/controllers/effects.js +8 -1
  24. package/dist/controllers/effects.js.map +1 -1
  25. package/dist/controllers/index.d.ts +1 -1
  26. package/dist/controllers/index.js +1 -1
  27. package/dist/controllers/index.js.map +1 -1
  28. package/dist/controllers/manager.d.ts +1 -0
  29. package/dist/controllers/manager.js +41 -17
  30. package/dist/controllers/manager.js.map +1 -1
  31. package/dist/controllers/sqlite.d.ts +107 -85
  32. package/dist/controllers/sqlite.js +1611 -1486
  33. package/dist/controllers/sqlite.js.map +1 -1
  34. package/dist/controllers/store.d.ts +9 -8
  35. package/dist/controllers/store.js +1 -31
  36. package/dist/controllers/store.js.map +1 -1
  37. package/dist/controllers/types.d.ts +3 -0
  38. package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
  39. package/dist/controllers/workflow-engine-scheduler.js +3 -5
  40. package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
  41. package/dist/controllers/workflows.d.ts +2 -2
  42. package/dist/controllers/workflows.js +11 -10
  43. package/dist/controllers/workflows.js.map +1 -1
  44. package/dist/extension/controller-host.js +2 -2
  45. package/dist/extension/controller-host.js.map +1 -1
  46. package/dist/extension/decision-channels.d.ts +2 -0
  47. package/dist/extension/decision-channels.js +311 -118
  48. package/dist/extension/decision-channels.js.map +1 -1
  49. package/dist/extension/executor.d.ts +9 -2
  50. package/dist/extension/executor.js +89 -2
  51. package/dist/extension/executor.js.map +1 -1
  52. package/dist/extension/herdr-viewer.d.ts +0 -1
  53. package/dist/extension/herdr-viewer.js +0 -4
  54. package/dist/extension/herdr-viewer.js.map +1 -1
  55. package/dist/extension/index.js +156 -103
  56. package/dist/extension/index.js.map +1 -1
  57. package/dist/extension/recorder.d.ts +3 -10
  58. package/dist/extension/recorder.js +13 -22
  59. package/dist/extension/recorder.js.map +1 -1
  60. package/dist/extension/step-message.d.ts +7 -2
  61. package/dist/extension/step-message.js +94 -2
  62. package/dist/extension/step-message.js.map +1 -1
  63. package/dist/extension/widget.js +6 -0
  64. package/dist/extension/widget.js.map +1 -1
  65. package/dist/host/rpc-executor.d.ts +3 -0
  66. package/dist/host/rpc-executor.js +2 -0
  67. package/dist/host/rpc-executor.js.map +1 -1
  68. package/dist/host/runner.d.ts +3 -6
  69. package/dist/host/runner.js +83 -32
  70. package/dist/host/runner.js.map +1 -1
  71. package/dist/render/graph-render.js +14 -8
  72. package/dist/render/graph-render.js.map +1 -1
  73. package/dist/state/database.d.ts +35 -0
  74. package/dist/state/database.js +287 -0
  75. package/dist/state/database.js.map +1 -0
  76. package/dist/state/index.d.ts +4 -0
  77. package/dist/state/index.js +5 -0
  78. package/dist/state/index.js.map +1 -0
  79. package/dist/state/json.d.ts +6 -0
  80. package/dist/state/json.js +38 -0
  81. package/dist/state/json.js.map +1 -0
  82. package/dist/state/mutation.d.ts +57 -0
  83. package/dist/state/mutation.js +255 -0
  84. package/dist/state/mutation.js.map +1 -0
  85. package/dist/state/schema.d.ts +6 -0
  86. package/dist/state/schema.js +473 -0
  87. package/dist/state/schema.js.map +1 -0
  88. package/dist/viewer/cli.d.ts +2 -2
  89. package/dist/viewer/cli.js +142 -122
  90. package/dist/viewer/cli.js.map +1 -1
  91. package/dist/viewer/render.d.ts +4 -4
  92. package/dist/viewer/render.js +2 -17
  93. package/dist/viewer/render.js.map +1 -1
  94. package/dist/viewer/session-reducer.d.ts +1 -1
  95. package/dist/viewer/session-reducer.js +1 -1
  96. package/dist/viewer/tui.d.ts +3 -3
  97. package/dist/viewer/tui.js +15 -13
  98. package/dist/viewer/tui.js.map +1 -1
  99. package/dist/viewer/watch.d.ts +2 -5
  100. package/dist/viewer/watch.js +13 -13
  101. package/dist/viewer/watch.js.map +1 -1
  102. package/dist/workflows/composition.js +12 -2
  103. package/dist/workflows/composition.js.map +1 -1
  104. package/dist/workflows/definition.d.ts +6 -2
  105. package/dist/workflows/definition.js +17 -0
  106. package/dist/workflows/definition.js.map +1 -1
  107. package/dist/workflows/engine.d.ts +6 -6
  108. package/dist/workflows/engine.js +183 -103
  109. package/dist/workflows/engine.js.map +1 -1
  110. package/dist/workflows/errors.d.ts +3 -3
  111. package/dist/workflows/errors.js +3 -3
  112. package/dist/workflows/human-decision.d.ts +29 -4
  113. package/dist/workflows/human-decision.js +547 -283
  114. package/dist/workflows/human-decision.js.map +1 -1
  115. package/dist/workflows/index.d.ts +4 -5
  116. package/dist/workflows/index.js +3 -4
  117. package/dist/workflows/index.js.map +1 -1
  118. package/dist/workflows/schema.js +17 -1
  119. package/dist/workflows/schema.js.map +1 -1
  120. package/dist/workflows/store.d.ts +83 -103
  121. package/dist/workflows/store.js +902 -951
  122. package/dist/workflows/store.js.map +1 -1
  123. package/dist/workflows/types.d.ts +55 -81
  124. package/docs/CONTROLLERS.md +10 -8
  125. package/docs/DEFERRED_TURNS.md +2 -2
  126. package/docs/DESIGN_PHILOSOPHY.md +4 -2
  127. package/docs/HUMAN_DECISIONS.md +13 -14
  128. package/docs/MONITOR.md +179 -231
  129. package/docs/SQLITE_STATE.md +219 -0
  130. package/docs/WORKFLOW_COMPOSITION.md +19 -19
  131. package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
  132. package/docs/WORKFLOW_UPDATES.md +10 -9
  133. package/docs/development.md +9 -9
  134. package/docs/live-replay-protocol.md +28 -37
  135. package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
  136. package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
  137. package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
  138. package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +1 -1
  139. package/docs/plans/2026-08-21-sanity-check-plan.md +30 -16
  140. package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
  141. package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
  142. package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
  143. package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
  144. package/docs/plans/session-event-replay-implementation-plan.md +1 -1
  145. package/docs/plans/tui-viewer-implementation-plan.md +1 -1
  146. package/docs/session-event-journal.md +63 -434
  147. package/docs/tui-viewer.md +13 -15
  148. package/docs/workflows.md +104 -50
  149. package/examples/workflows/plain-summary.workflow.ts +1 -0
  150. package/herdr-plugin.toml +1 -1
  151. package/package.json +1 -1
  152. package/plugins/herdr/viewer.mjs +1 -11
  153. package/skills/autoplan/SKILL.md +5 -4
  154. package/skills/monitor/SKILL.md +91 -163
  155. package/skills/pi-workflows/SKILL.md +7 -7
  156. package/skills/sanity-check/SKILL.md +1 -1
  157. package/src/builtins/autoplan.workflow.ts +290 -40
  158. package/src/builtins/catalog.ts +6 -4
  159. package/src/builtins/index.ts +7 -1
  160. package/src/builtins/monitor.workflow.ts +663 -249
  161. package/src/builtins/plain-summary.workflow.ts +185 -0
  162. package/src/builtins/sanity-check.workflow.ts +62 -7
  163. package/src/controllers/effects.ts +7 -0
  164. package/src/controllers/index.ts +0 -6
  165. package/src/controllers/manager.ts +72 -32
  166. package/src/controllers/sqlite.ts +2420 -1948
  167. package/src/controllers/store.ts +17 -38
  168. package/src/controllers/types.ts +3 -0
  169. package/src/controllers/workflow-engine-scheduler.ts +4 -8
  170. package/src/controllers/workflows.ts +45 -21
  171. package/src/extension/controller-host.ts +1 -2
  172. package/src/extension/decision-channels.ts +427 -144
  173. package/src/extension/executor.ts +105 -2
  174. package/src/extension/herdr-viewer.ts +0 -5
  175. package/src/extension/index.ts +180 -118
  176. package/src/extension/recorder.ts +13 -22
  177. package/src/extension/step-message.ts +106 -4
  178. package/src/extension/widget.ts +8 -0
  179. package/src/host/rpc-executor.ts +4 -0
  180. package/src/host/runner.ts +93 -41
  181. package/src/render/graph-render.ts +11 -4
  182. package/src/state/database.ts +375 -0
  183. package/src/state/index.ts +29 -0
  184. package/src/state/json.ts +42 -0
  185. package/src/state/mutation.ts +435 -0
  186. package/src/state/schema.ts +475 -0
  187. package/src/viewer/cli.ts +151 -144
  188. package/src/viewer/render.ts +12 -24
  189. package/src/viewer/session-reducer.ts +1 -1
  190. package/src/viewer/tui.ts +18 -17
  191. package/src/viewer/watch.ts +13 -17
  192. package/src/workflows/composition.ts +12 -3
  193. package/src/workflows/definition.ts +36 -3
  194. package/src/workflows/engine.ts +212 -116
  195. package/src/workflows/errors.ts +3 -3
  196. package/src/workflows/human-decision.ts +795 -340
  197. package/src/workflows/index.ts +15 -19
  198. package/src/workflows/schema.ts +19 -1
  199. package/src/workflows/store.ts +1295 -1163
  200. package/src/workflows/types.ts +61 -81
  201. package/dist/workflows/artifacts.d.ts +0 -40
  202. package/dist/workflows/artifacts.js +0 -155
  203. package/dist/workflows/artifacts.js.map +0 -1
  204. package/dist/workflows/migrate-sources.d.ts +0 -42
  205. package/dist/workflows/migrate-sources.js +0 -133
  206. package/dist/workflows/migrate-sources.js.map +0 -1
  207. package/docs/run-bundles.md +0 -481
  208. package/src/workflows/artifacts.ts +0 -188
  209. package/src/workflows/migrate-sources.ts +0 -178
@@ -1,226 +1,154 @@
1
1
  ---
2
2
  name: monitor
3
- description: Use when the user asks to monitor, watch, track, or periodically check a running command, remote Job, CI run, deployment, publication, or other long-running objective. Starts the built-in Pi monitor workflow immediately in the current session and drives the objective autonomously, including routine recovery, until verified completion or a material blocker.
3
+ description: Use when the user asks to monitor, watch, track, or periodically check a running command, remote Job, CI run, deployment, publication, or other long-running goal. Starts the built-in Pi monitor workflow immediately and finishes the authorized goal through direct advance, recovery, or composed repair work until completion or a material blocker.
4
4
  compatibility: Requires pi-workflows and the built-in monitor workflow.
5
5
  ---
6
6
 
7
7
  # Monitor
8
8
 
9
- Use the built-in Pi `monitor` workflow as an autopilot for the requested objective. Monitoring is not passive status polling. The agent must maintain nominal operation, repair recoverable failures, resume durable work, and continue until the complete objective is verified or a material blocker makes safe continuation impossible.
9
+ Use the built-in Pi `monitor` workflow to finish the user's authorized goal. It observes the real target first, acts when safe authorized work is available, verifies every action immediately, and waits only while useful work is moving or an external event is pending.
10
10
 
11
- A monitor request authorizes routine, bounded work needed to preserve and finish the stated objective, subject to the conversation and repository approval boundaries. Apply other skills as safety and operating instructions. Do not turn their normal checks into new approval requests when the monitored objective and an existing approval already cover the action. Monitoring does not authorize changing the objective, method, model, data source, production selection, or other consequential contract.
11
+ Monitoring does not grant new authority. Preserve the exact objective, allowed and forbidden changes, cost ceiling, provider and runtime contract, required checks, stop conditions, and recovery rules from the conversation and repository instructions.
12
12
 
13
- ## Start the workflow without delay
13
+ ## Start the workflow
14
14
 
15
- Build the complete input and start the workflow in the same turn. As soon as the user invokes this skill:
15
+ When no workflow is active, list workflows only when you must confirm that `monitor` is available. Build the complete input before starting, then call `workflow` with `action: "start"` exactly once in the same turn as the user's request.
16
16
 
17
- 1. Read the current conversation, active plan, repository instructions, and applicable compute, runtime, credential, deployment, or publication skills.
18
- 2. Preserve the exact objective, immutable execution contract, current identifiers, durable progress, cost already spent, approval ceilings, finish criteria, and known recovery rules in the workflow input. Write or update a durable plan or incident note first only when the work needs one for safe continuation.
19
- 3. Make the workflow instructions faithful to what the user requested. Do not reduce an implementation or recovery objective to observation-only monitoring.
20
- 4. Call `workflow` with `action: "start"` in the current Pi session without asking for another confirmation or waiting for a later turn.
21
- 5. Let the first workflow check run immediately. Do not use Unified Exec sleeps, manual polling loops, a second scheduler, or a separate Pi session as a substitute.
17
+ The public input has four fields:
22
18
 
23
- Do not finish the initiating turn before the workflow start call. If a safe contract cannot yet be written because a critical identifier or boundary is missing, gather it immediately when possible. Ask the user only when the missing decision is consequential and cannot be inferred safely.
19
+ - `task`: Required. Put the complete goal, stable target identifiers, current durable progress, sources of truth, allowed files and systems, forbidden changes, cost limits, provider/runtime contract, required checks, allowed recovery actions, and stop boundaries here.
20
+ - `stopWhen`: Optional. Use the user's complete finish rule. Omit it only when the user gave no finish rule, which means explicit user stop.
21
+ - `everyMinutes`: Optional. Use the user's interval. The default is 30 minutes.
22
+ - `maxChecks`: Optional. Include it only when the user supplied a check limit.
24
23
 
25
- ## Build the monitor contract
24
+ Do not send any other field. Inputs such as `repair`, `checkTimeoutMinutes`, `reportWhen`, and `audience` are invalid.
26
25
 
27
- Derive the workflow input from the full conversation:
26
+ When the task can change code or remote state, make `task` state the absolute repository path, concrete edit and test scope, base branch, commit and push authority, pull-request and merge authority, release and deployment authority, and inherited constraints. A repository path alone is not a scope. Derive a narrow scope when one repository and task are clear instead of asking the user to repeat it.
28
27
 
29
- - `task`: State the complete objective, the exact current target and stable identifiers, authoritative status sources, durable progress and final-output surfaces, routine actions authorized by the monitor request, other recorded approvals, immutable boundaries, cost and credential rules, and required validation or downstream operations.
30
- - `everyMinutes`: Use the user's interval when present. Use `30` when the user gives no interval. The built-in workflow accepts intervals from 1 minute through 24 hours.
31
- - `stopWhen`: Infer verified completion from the full conversation. Describe completion of the complete objective, not only the end of one physical process. Also name material blockers that require human intervention.
32
- - `repair`: Include this object only when the request or an existing approval authorizes mutation. Set `authorized: true` and record the repository, scope, base branch, merge policy, and constraints that apply. Omit it for observation-only work. Omit `repair.approval` for the default behavior: ask on each new repair plan and continue after 10 minutes without an answer. Use `{ "mode": "required" }` to block on plan changes or `{ "mode": "skip" }` to continue without asking.
33
-
34
- Replace the example values below with facts from the conversation, then make one start call:
28
+ Replace the example values with facts from the conversation:
35
29
 
36
30
  ```json
37
31
  {
38
32
  "action": "start",
39
33
  "workflow": "monitor",
40
34
  "input": {
41
- "task": "Monitor GitHub Actions run 123456 in owner/repository. Inspect the run and its artifacts, retry only transient status reads, and report each check. Do not change code or repository state.",
42
- "everyMinutes": 5,
43
- "stopWhen": "Stop when run 123456 completes and its required artifacts are verified, or when a material external blocker prevents truthful verification.",
44
- "checkTimeoutMinutes": 10
45
- }
46
- }
47
- ```
48
-
49
- For authorized repair, add a complete `repair` object instead of leaving mutation authority implicit:
50
-
51
- ```json
52
- {
53
- "repair": {
54
- "authorized": true,
55
- "repository": "/absolute/path/to/repository",
56
- "scope": "Only /absolute/path/to/repository. May diagnose and fix failures related to the monitored objective, test, commit, push, and update its pull request. Must not modify other repositories, merge, release, deploy, change credentials, or change repository policy.",
57
- "constraints": ["Keep the monitored objective and method unchanged."],
58
- "baseBranch": "main",
59
- "merge": false
60
- }
61
- }
62
- ```
63
-
64
- When the conversation gives no clear finish criterion, set `stopWhen` to `Stop only when the user explicitly asks to stop.` Do not use that fallback when a broader implementation, repair, publication, or deployment objective is clear from context.
65
-
66
- Do not invent a finite check count. Omit `maxChecks` unless the user explicitly requests one. The workflow host can apply its own safety upper bound. Disclose that bound if it appears.
67
-
68
- When repair is authorized, route a concrete code or design defect through the monitor's shared plan-change path. Supply the problem, observed evidence, and a stable fingerprint of the issue plus target state. The path runs Autoplan, Autodoc, the configured plan decision, and Autoimplement, then checks the target again. Autoimplement does not ask again for the plan selected by Monitor. It uses the same shared path if later evidence requires another plan. Do not copy their prompts into the monitor task.
69
-
70
- ### Repair plan decisions
71
-
72
- Omit `repair.approval` for autonomous mode. It asks the `operator` audience and continues with the exact presented plan after 10 minutes without an accepted answer.
73
-
74
- Block until the operator answers:
75
-
76
- ```json
77
- {
78
- "repair": {
79
- "approval": {
80
- "mode": "required"
81
- }
82
- }
83
- }
84
- ```
85
-
86
- Continue without asking:
87
-
88
- ```json
89
- {
90
- "repair": {
91
- "approval": {
92
- "mode": "skip"
93
- }
35
+ "task": "Finish the six missing modules in /absolute/path/to/repository. Resume only from verified saved outputs. May edit launch manifests and module outputs, run the named checks, and restart the existing pinned workers. Keep the current provider and runtime. Stay below the recorded cumulative cost ceiling. Do not change unrelated files, credentials, model selection, data source, base branch main, or production state. Commit and push are not authorized. Pull requests, merge, release, and deployment are not authorized. Stop before any action outside these limits.",
36
+ "stopWhen": "All 27 modules have verified durable outputs, or safe continuation is blocked.",
37
+ "everyMinutes": 15
94
38
  }
95
39
  }
96
40
  ```
97
41
 
98
- `continue` starts implementation. `stop` ends the repair truthfully. `replan` preserves the exact operator text, sends it through the shared plan-change workflow, records the revised plan, and asks again. The model-facing workflow answer tool cannot answer this gate.
99
-
100
- ## Keep routine work moving
101
-
102
- While the workflow is active, do routine, bounded work required by the exact objective without asking for another confirmation. This includes:
103
-
104
- - downloading, building, and running code pinned by the monitored objective;
105
- - building and running task containers from a pinned benchmark or repository revision;
106
- - installing pinned dependencies in the planned isolated environment;
107
- - running canaries, tests, retries, restarts, and temporary cleanup;
108
- - repairing configuration or storage-path errors without changing the method; and
109
- - continuing paid work that already has applicable approval.
110
-
111
- Pinned third-party code is part of the objective when the task names its exact repository, revision, lock file, image digest, or benchmark release. Resolve mutable references to immutable revisions when the applicable safety rules require it. Do not ask once per image, package, or task. New unpinned code, unrelated code, or broader privileges remain outside the monitor's authority.
112
-
113
- ## Paid infrastructure authority
114
-
115
- A monitoring request does not grant spending approval or create a default spending ceiling. Before launching, resuming, retrying, or replacing paid work, load and follow the paid-compute, provider, Job-control, and runtime skills that apply. Use any applicable approval already recorded in the conversation or repository instructions.
42
+ Do not start a second Monitor for the same goal while one is active. When this skill is loaded inside a workflow step, complete that step. Do not start a nested workflow.
116
43
 
117
- When the paid action remains within the approved method, hardware, concurrency, cumulative cost ceiling, and recovery assumptions, continue without asking again. Stop for a decision before new paid work only when there is no applicable approval, the ceiling would be exceeded, or evidence invalidates an approved assumption.
44
+ ## Observation steps
118
45
 
119
- The monitor may use a credential only when the conversation or repository has already authorized that credential's source, destination, and purpose. It may reuse that authorization for retries and replacement attempts under the same objective. It must not discover unrelated credentials, broaden scopes, copy credentials to a new store, or print secret values.
46
+ Every Monitor cycle starts with a read-only `observe` step. Use normal read-only tools to inspect the target's authoritative state, active work, durable outputs, checkpoints, failures, and applicable authority.
120
47
 
121
- Use the user-supplied interval instead of the example value when present. Add `maxChecks` only when the user explicitly supplies that limit. Do not send `reportWhen`; the current monitor reports every accepted check.
48
+ Answer these questions:
122
49
 
123
- Do not start a second monitor for the same objective while one is active. Update or replace the run only when the objective or contract changes. A replacement must preserve the previous accepted observation and durable recovery state.
50
+ - Is the goal complete?
51
+ - Is useful target work active?
52
+ - Is the goal incomplete and idle?
53
+ - Did work fail?
54
+ - Is there a material blocker?
55
+ - Which safe actions are already authorized?
124
56
 
125
- ## Complete workflow checks
57
+ Select one route:
126
58
 
127
- Each workflow check arrives with an exact step contract. Apply only the operational authority recorded in `task`. The default monitor contract is recovery-capable autopilot within recorded approval boundaries, not authority to create new spending or change the objective.
59
+ - `wait`: Useful target work is moving, or an external event must finish.
60
+ - `act`: The goal is incomplete and one safe authorized action is available.
61
+ - `stop`: The goal is complete or cannot continue safely.
128
62
 
129
- For each check:
63
+ Keep Monitor state, goal state, and target work state separate. Never call the target running because Monitor itself is active.
130
64
 
131
- 1. Query the target's authoritative status.
132
- 2. Query durable progress and final-output surfaces. Run independent reads in parallel when useful.
133
- 3. Compare the current values with the previous accepted observation.
134
- 4. If operation is not nominal, preserve evidence, diagnose the issue, apply the smallest authorized repair, and verify that durable progress resumes. Fix issues and restart Jobs or processes when that is necessary to keep the same objective moving.
135
- 5. Include a concise report for every accepted check. Report absolute totals and meaningful deltas when counters matter.
136
- 6. Select `continue` or `stop` as required by the step contract.
137
- 7. Call `workflow` with `action: "submit"` exactly once, using the supplied step and attempt IDs and the required output shape.
65
+ For `act`, provide one exact action with:
138
66
 
139
- The workflow sends each report as a Pi notification. Notifications do not start a new assistant turn. Do not add a separate assistant reply to a workflow notification.
67
+ - `kind`: `advance`, `recover`, or `repair`
68
+ - incomplete work and factual evidence
69
+ - the exact next action
70
+ - the existing authorization and its source
71
+ - allowed and forbidden mutation targets
72
+ - cost and provider/runtime limits
73
+ - required checks and stop conditions
74
+ - verification method
75
+ - stable failure and target-state IDs
140
76
 
141
- ## Publish progress when measurable
77
+ An action description records authority. It does not create authority.
142
78
 
143
- The regular Pi model that runs the check is the observation adapter. It reads the target through the tools and sources named in the task, maps observed facts to progress tracks, and publishes them through the existing `workflow` tool. There is no separate monitor model.
79
+ ## Direct action steps
144
80
 
145
- Progress is optional. Do not invent it for work that has no factual count, total, rate, or source estimate.
81
+ `advance` starts or continues normal requested work. `recover` restarts or resumes work after an operational stop.
146
82
 
147
- When the target exposes measurable progress, publish one or more tracks with `workflow` action `update` while the check is active when that gives the user useful current state. Include the latest tracks in the final check output, then call `submit` exactly once. Use a stable key for each independent process or workstream. Use `overall` for a real aggregate only; do not add unrelated tracks together.
83
+ The separate `act` step uses normal tools and performs only the stated action. Do not plan, document, redesign, broaden scope, or add related work. A routine start, resume, retry, launch-file refresh, or checkpoint continuation stays direct and small.
148
84
 
149
- Each track uses `pi-workflows.progress.v1` and can include:
85
+ Submit the real result with the unchanged failure and target-state IDs. Monitor observes again immediately. Do not wait for the next interval first.
150
86
 
151
- - `status`: `pending`, `running`, `waiting`, `blocked`, `completed`, `failed`, `cancelled`, or `unknown`;
152
- - `label` and `phase` for short display text and estimation epochs;
153
- - `completed`, `total`, and `unit` for factual counts;
154
- - `sourceUpdatedAt` and `sourceEstimatedFinishAt` when the target provides its own fresh estimate.
87
+ ## Repair steps
155
88
 
156
- Submit observed facts. The workflow computes rates, confidence, remaining work, and measured ETA from durable samples. Do not guess a count, rate, or ETA. A changed phase, total, unit, or lower completed count starts a new estimation epoch.
89
+ Use `repair` only for a code or configuration defect. Monitor composes the existing plan-change and Autoimplement workflows for repair. Do not start those workflows manually or copy their planning, documentation, implementation, review, or delivery steps.
157
90
 
158
- For several concurrent processes, publish one stable track per process. The Pi widget and viewers show them separately and keep each ETA independent.
91
+ Preserve the repair approval rule in `task`. `required` mode waits for an explicit operator choice. `skip` mode starts the selected repair without a gate. Default `auto` mode asks and then continues with the exact presented plan after 10 minutes when no answer arrives. These become the internal repair action's `"mode": "required"` or `"mode": "skip"`; they are not public Monitor input fields.
159
92
 
160
- Keep the monitored target independent of pi-workflows. Do 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. Do not add provider-specific clients or credentials to pi-workflows. Target-specific observation belongs in the check task and is performed by the regular Pi model with already authorized tools.
93
+ Stop affected paid workers at safe boundaries before repairing a shared code or data defect. Preserve durable outputs and failure evidence.
161
94
 
162
- Before proposing a new progress API, transport, schema, or persistence layer, prove that the model cannot observe the needed facts and publish them through the existing `workflow update` and `submit` path. If the target does not expose enough facts for ETA, report `ETA unavailable`. Application telemetry changes require separate scope and should expose normal operational facts rather than a Pi-specific protocol.
95
+ If the same failure and target-state IDs return after one completed repair, stop. Do not run the same repair cycle again.
163
96
 
164
- ## Apply finish rules
97
+ ## Authority and paid work
165
98
 
166
- ### Still active
99
+ Monitor may perform an action only when the full action is inside existing authority. Stop when authority is absent, unclear, or too narrow.
167
100
 
168
- Continue. Keep reports short unless the state changed materially.
101
+ A monitoring request does not grant spending approval. Before paid work starts or resumes, verify the applicable approval, method, hardware, concurrency, cumulative cost, and remaining ceiling. When the next action remains inside those limits, continue without asking again. Stop when the next action would exceed the limit or when the limit cannot be verified.
169
102
 
170
- ### Completed
103
+ Pinned task code, images, packages, and dependencies that are already part of the authorized goal do not need a new decision for each normal use. Do not ask once per image, package, or task. New unpinned code, broader privileges, or a changed method remain outside authority.
171
104
 
172
- Stop only after the inferred finish criterion is true. Verify required final artifacts, checksums, receipts, publication state, or downstream health before selecting `stop`.
105
+ Do not change protected model, method, data source, hardware class, provider/runtime contract, credential destination, production selection, or objective without new authority.
173
106
 
174
- ### Failed, stopped, or blocked
107
+ ## Progress
175
108
 
176
- Do not disarm the monitor for a superficial reason. One failed physical Job, command, CI run, deployment attempt, upload, or status read is not the end of the objective. Treat it as an operational event, preserve evidence and durable state, diagnose it, apply the smallest safe repair, restart or resume the same immutable contract, restore nominal operation, and keep monitoring.
109
+ The regular Pi model is the observation adapter. Read measurable facts with normal tools and publish useful progress through `workflow` action `update` while the step is active. Include the latest tracks in the final observation output.
177
110
 
178
- Examples of recoverable conditions include transient provider or network errors, platform eviction, rate limits, expired physical attempts, safe checkpoint reconciliation, exact path or configuration mistakes, bounded storage failures, and a stalled deployment that has a documented recovery action.
111
+ Use stable keys. Report factual completed and total values, rates, and source ETA values only when the target exposes them. Otherwise report that progress or ETA is unavailable.
179
112
 
180
- Stop only for a material blocker, such as:
113
+ Do not require the monitored process, Job, application, provider, or repository to implement a Pi-specific API, file, endpoint, store, schema, command, service, transport, or dependency.
181
114
 
182
- - a deterministic shared code or data defect that makes further attempts unsafe;
183
- - an invalid, missing, or unverifiable checkpoint when useful state would be lost;
184
- - a required credential that has no prior source-and-destination authorization;
185
- - a changed model, method, source, hardware class, objective, or production decision;
186
- - a destructive or security-sensitive action outside the recorded authority;
187
- - a cost, time, or resource ceiling that cannot safely contain the remaining work;
188
- - evidence that the requested result cannot be made truthful or valid under the current contract.
115
+ ## Reports
189
116
 
190
- Never keep paid workers retrying a deterministic shared failure. When repair is authorized and the defect is inside scope, stop affected work, preserve the evidence, and use the composed repair path. Stop for a decision when repair is outside scope or would change a protected contract.
117
+ Every accepted observation produces one status notification. Use this form when target work is active:
191
118
 
192
- If the same issue and target-state fingerprint return after a completed repair, report the no-progress result and stop. Do not start the same repair again.
193
-
194
- ### Status unavailable
195
-
196
- Retry only a cheap, bounded status read. If the source remains unavailable, report the gap. Continue only when observation remains safe and the finish criterion is not met.
197
-
198
- ## Check the right surfaces
199
-
200
- Depending on the target, inspect:
201
-
202
- - Process, Job, workflow, CI, or deployment status.
203
- - Durable receipts and counters.
204
- - Checkpoints or partial outputs.
205
- - Final manifests, databases, publications, or release artifacts.
206
- - Error state and the freshness of the last durable update.
119
+ ```text
120
+ Monitor: active
121
+ Goal: incomplete
122
+ Work: running
123
+ Progress: 21/27 modules
124
+ Last action: resumed six missing modules
125
+ Next check: 15 minutes
126
+ ```
207
127
 
208
- Logs and progress counters alone do not prove saved work or completion. Prefer durable artifacts and authoritative remote state.
128
+ Use this form when the target is idle and an action will run:
209
129
 
210
- ## Stop on user request
130
+ ```text
131
+ Monitor: active
132
+ Goal: incomplete
133
+ Work: idle
134
+ Next action: refreshing launch files and resuming work now
135
+ ```
211
136
 
212
- When the user asks to stop, cancel the active monitor workflow with `workflow({ action: "cancel" })` and confirm that monitoring stopped. Do not wait for the next scheduled check.
137
+ Show absolute progress before deltas. Do not invent an ETA.
213
138
 
214
- ## Status format
139
+ ## Stop conditions
215
140
 
216
- For an unchanged active target, prefer a compact report:
141
+ Stop when:
217
142
 
218
- ```text
219
- Target remains running:
220
- - Progress: <absolute total> (<delta since last report>)
221
- - Cost or resource use: <total>
222
- - Durable output: <state>
223
- - Next check: <interval>
224
- ```
143
+ - the goal is complete
144
+ - a material blocker prevents safe continuation
145
+ - the next action is outside authority
146
+ - a paid action lacks approval or would exceed its ceiling
147
+ - a protected contract would change
148
+ - a required credential lacks prior source-and-destination authority
149
+ - a useful checkpoint is invalid or cannot be preserved
150
+ - the same failure and target state return after one completed repair
151
+ - the safety limit is reached
152
+ - the user asks to stop
225
153
 
226
- Explain anomalies, failures, or approval boundaries when they occur. Avoid repeating the full history at every check.
154
+ When the user asks to stop, cancel the active Monitor immediately with `workflow({ action: "cancel" })` and confirm that monitoring stopped.
@@ -20,7 +20,7 @@ Use the smallest applicable action:
20
20
  - `pause`, `resume`, and `cancel` control the current active run.
21
21
  - `answer` supplies input to an ordinary waiting checkpoint. It cannot satisfy a protected `humanDecision()` gate.
22
22
  - `update` publishes a non-completing durable update for the active step attempt.
23
- - `submit` completes the active agent step with its required output.
23
+ - `submit` completes an active submitted agent step with its required output. An assistant-message step completes through its normal visible reply instead.
24
24
 
25
25
  Use `start` only once for one requested run. Before starting, load the matching workflow skill when one exists and build its complete input. Include scope, authority, constraints, identifiers, and finish criteria required by that skill. Do not start with placeholders that still need user or model repair.
26
26
 
@@ -43,10 +43,10 @@ Do not build a manual polling loop around a workflow that already schedules its
43
43
  When a workflow step message arrives:
44
44
 
45
45
  1. Do the requested work with the available tools.
46
- 2. Produce output that matches the exact expected shape.
47
- 3. Call `workflow` with `action: "submit"` exactly once, using the step and attempt ids from that message.
48
- 4. If validation rejects the output, correct it and submit again with the same current ids.
49
- 5. After acceptance, end the turn. The workflow sends the next step or presentation message when needed.
46
+ 2. Follow the completion form in the current step contract.
47
+ 3. For a submitted step, produce the exact expected shape and call `workflow` with `action: "submit"` exactly once, using the current step and attempt ids. If validation rejects the output, correct it and submit again with the same ids.
48
+ 4. For an assistant-message step, reply with the requested normal assistant message. Do not call `workflow submit`; the settled visible reply is the node output.
49
+ 5. After completion, do not add another response. The workflow sends the next step or final presentation when needed.
50
50
 
51
51
  A node id can run more than once in a loop. Each run has a new attempt id. Never reuse an attempt id from conversation history.
52
52
 
@@ -70,13 +70,13 @@ Follow these rules:
70
70
  - Reuse a finite workflow with a direct typed `includeWorkflow()` mount. Use a controller only when the child needs an independent run or indefinite reconciliation.
71
71
  - Give included workflows named exits, map their input explicitly, and keep parent edges out of child internals.
72
72
  - Keep `compute` pure. Put external effects in agent, function-action, or shell-action nodes.
73
- - Use structured node outputs for routing.
73
+ - Use structured node outputs when the graph must inspect fields or choose a route. Use `expectedOutput: assistantMessage()` when exact visible text is the node result.
74
74
  - Use an ordinary checkpoint for external continuation data that the model may submit. Use `humanDecision()` for a verified human choice. Use its typed `onTimeout` policy only when the workflow may supply a named automatic response after a durable deadline. A timeout response is recorded as policy provenance, not as a human answer.
75
75
  - Use the shared internal plan-change workflow for Autoplan, Autodoc, plan approval, and bounded exact-text replanning. Do not copy that sequence into Autoimplement, Monitor, or another workflow.
76
76
  - Set explicit step and command timeouts.
77
77
  - Bound ordinary loops with `maxSteps` or another clear finish rule.
78
78
  - Use a controller instead of a workflow for indefinite resource reconciliation.
79
- - Keep presentation separate from execution. Use `presentationPrompt` only when a final assistant response is needed.
79
+ - Keep presentation separate from execution. Use `presentationPrompt` for one root response after the run. Use an assistant-message agent when the visible response belongs inside the graph and a parent must continue after it.
80
80
  - Preserve the single active workflow rule in one Pi session.
81
81
 
82
82
  Read [../../docs/workflows.md](../../docs/workflows.md) before creating or changing a workflow. Read [../../docs/WORKFLOW_COMPOSITION.md](../../docs/WORKFLOW_COMPOSITION.md) for nested workflows. Read [../../docs/HUMAN_DECISIONS.md](../../docs/HUMAN_DECISIONS.md) before adding a human gate or channel. Read [../../docs/DESIGN_PHILOSOPHY.md](../../docs/DESIGN_PHILOSOPHY.md) before adding public primitives. Use the examples under [../../examples/workflows](../../examples/workflows) as starting points.
@@ -30,7 +30,7 @@ Replace the example values below with facts from the conversation, then make one
30
30
  }
31
31
  ```
32
32
 
33
- The workflow is read-only. It collects committed and working-tree evidence, reads matching pull-request metadata when available, runs isolated reviews, verifies their claims, and reports one verdict. It does not edit files, post comments, or fix findings.
33
+ The workflow is read-only. It collects committed and working-tree evidence, reads matching pull-request metadata when available, runs isolated reviews, and verifies their claims. It then shows the full detailed report as a normal assistant message, followed by a short plain-language assistant summary. The strict verified verdict remains the workflow result. It does not edit files, post comments, or fix findings.
34
34
 
35
35
  When this skill is loaded inside an active workflow step, do not start another workflow. Complete the current step contract.
36
36