@osolmaz/pi-workflows 0.12.0 → 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 (257) hide show
  1. package/README.md +56 -31
  2. package/dist/builtins/autodoc.workflow.d.ts +4 -4
  3. package/dist/builtins/autoimplement.workflow.d.ts +797 -142
  4. package/dist/builtins/autoimplement.workflow.js +17 -105
  5. package/dist/builtins/autoimplement.workflow.js.map +1 -1
  6. package/dist/builtins/autoplan.workflow.d.ts +126 -13
  7. package/dist/builtins/autoplan.workflow.js +200 -29
  8. package/dist/builtins/autoplan.workflow.js.map +1 -1
  9. package/dist/builtins/catalog.js +7 -5
  10. package/dist/builtins/catalog.js.map +1 -1
  11. package/dist/builtins/index.d.ts +4 -2
  12. package/dist/builtins/index.js +3 -1
  13. package/dist/builtins/index.js.map +1 -1
  14. package/dist/builtins/monitor.workflow.d.ts +56 -23
  15. package/dist/builtins/monitor.workflow.js +508 -329
  16. package/dist/builtins/monitor.workflow.js.map +1 -1
  17. package/dist/builtins/pi-agent-group.d.ts +72 -0
  18. package/dist/builtins/pi-agent-group.js +1087 -0
  19. package/dist/builtins/pi-agent-group.js.map +1 -0
  20. package/dist/builtins/plain-summary.workflow.d.ts +32 -0
  21. package/dist/builtins/plain-summary.workflow.js +134 -0
  22. package/dist/builtins/plain-summary.workflow.js.map +1 -0
  23. package/dist/builtins/plan-approval.workflow.d.ts +39 -5
  24. package/dist/builtins/plan-approval.workflow.js +92 -14
  25. package/dist/builtins/plan-approval.workflow.js.map +1 -1
  26. package/dist/builtins/plan-change.workflow.d.ts +449 -0
  27. package/dist/builtins/plan-change.workflow.js +256 -0
  28. package/dist/builtins/plan-change.workflow.js.map +1 -0
  29. package/dist/builtins/plan-presentation.js +2 -2
  30. package/dist/builtins/plan-presentation.js.map +1 -1
  31. package/dist/builtins/sanity-check.workflow.d.ts +50 -6
  32. package/dist/builtins/sanity-check.workflow.js +150 -28
  33. package/dist/builtins/sanity-check.workflow.js.map +1 -1
  34. package/dist/controllers/effects.d.ts +3 -2
  35. package/dist/controllers/effects.js +8 -1
  36. package/dist/controllers/effects.js.map +1 -1
  37. package/dist/controllers/index.d.ts +1 -1
  38. package/dist/controllers/index.js +1 -1
  39. package/dist/controllers/index.js.map +1 -1
  40. package/dist/controllers/manager.d.ts +1 -0
  41. package/dist/controllers/manager.js +41 -17
  42. package/dist/controllers/manager.js.map +1 -1
  43. package/dist/controllers/sqlite.d.ts +107 -85
  44. package/dist/controllers/sqlite.js +1611 -1486
  45. package/dist/controllers/sqlite.js.map +1 -1
  46. package/dist/controllers/store.d.ts +9 -8
  47. package/dist/controllers/store.js +1 -31
  48. package/dist/controllers/store.js.map +1 -1
  49. package/dist/controllers/types.d.ts +3 -0
  50. package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
  51. package/dist/controllers/workflow-engine-scheduler.js +3 -5
  52. package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
  53. package/dist/controllers/workflows.d.ts +2 -2
  54. package/dist/controllers/workflows.js +11 -10
  55. package/dist/controllers/workflows.js.map +1 -1
  56. package/dist/extension/controller-host.js +2 -2
  57. package/dist/extension/controller-host.js.map +1 -1
  58. package/dist/extension/decision-channels.d.ts +4 -2
  59. package/dist/extension/decision-channels.js +333 -146
  60. package/dist/extension/decision-channels.js.map +1 -1
  61. package/dist/extension/executor.d.ts +9 -2
  62. package/dist/extension/executor.js +89 -2
  63. package/dist/extension/executor.js.map +1 -1
  64. package/dist/extension/herdr-viewer.d.ts +0 -1
  65. package/dist/extension/herdr-viewer.js +0 -4
  66. package/dist/extension/herdr-viewer.js.map +1 -1
  67. package/dist/extension/index.js +209 -127
  68. package/dist/extension/index.js.map +1 -1
  69. package/dist/extension/recorder.d.ts +3 -10
  70. package/dist/extension/recorder.js +13 -22
  71. package/dist/extension/recorder.js.map +1 -1
  72. package/dist/extension/session-events.d.ts +2 -2
  73. package/dist/extension/step-message.d.ts +7 -2
  74. package/dist/extension/step-message.js +94 -2
  75. package/dist/extension/step-message.js.map +1 -1
  76. package/dist/extension/widget.js +29 -3
  77. package/dist/extension/widget.js.map +1 -1
  78. package/dist/host/rpc-executor.d.ts +3 -0
  79. package/dist/host/rpc-executor.js +2 -0
  80. package/dist/host/rpc-executor.js.map +1 -1
  81. package/dist/host/runner.d.ts +3 -6
  82. package/dist/host/runner.js +83 -32
  83. package/dist/host/runner.js.map +1 -1
  84. package/dist/render/graph-render.js +15 -10
  85. package/dist/render/graph-render.js.map +1 -1
  86. package/dist/state/database.d.ts +35 -0
  87. package/dist/state/database.js +287 -0
  88. package/dist/state/database.js.map +1 -0
  89. package/dist/state/index.d.ts +4 -0
  90. package/dist/state/index.js +5 -0
  91. package/dist/state/index.js.map +1 -0
  92. package/dist/state/json.d.ts +6 -0
  93. package/dist/state/json.js +38 -0
  94. package/dist/state/json.js.map +1 -0
  95. package/dist/state/mutation.d.ts +57 -0
  96. package/dist/state/mutation.js +255 -0
  97. package/dist/state/mutation.js.map +1 -0
  98. package/dist/state/schema.d.ts +6 -0
  99. package/dist/state/schema.js +473 -0
  100. package/dist/state/schema.js.map +1 -0
  101. package/dist/viewer/cli.d.ts +2 -2
  102. package/dist/viewer/cli.js +142 -122
  103. package/dist/viewer/cli.js.map +1 -1
  104. package/dist/viewer/render.d.ts +4 -4
  105. package/dist/viewer/render.js +9 -23
  106. package/dist/viewer/render.js.map +1 -1
  107. package/dist/viewer/session-reducer.d.ts +1 -1
  108. package/dist/viewer/session-reducer.js +1 -1
  109. package/dist/viewer/tui.d.ts +3 -3
  110. package/dist/viewer/tui.js +15 -13
  111. package/dist/viewer/tui.js.map +1 -1
  112. package/dist/viewer/watch.d.ts +2 -5
  113. package/dist/viewer/watch.js +13 -13
  114. package/dist/viewer/watch.js.map +1 -1
  115. package/dist/workflows/catalog.js +7 -2
  116. package/dist/workflows/catalog.js.map +1 -1
  117. package/dist/workflows/composition.js +20 -2
  118. package/dist/workflows/composition.js.map +1 -1
  119. package/dist/workflows/decision-presentation.d.ts +1 -1
  120. package/dist/workflows/decision-presentation.js +51 -38
  121. package/dist/workflows/decision-presentation.js.map +1 -1
  122. package/dist/workflows/definition.d.ts +6 -2
  123. package/dist/workflows/definition.js +17 -0
  124. package/dist/workflows/definition.js.map +1 -1
  125. package/dist/workflows/engine.d.ts +7 -7
  126. package/dist/workflows/engine.js +196 -115
  127. package/dist/workflows/engine.js.map +1 -1
  128. package/dist/workflows/errors.d.ts +16 -3
  129. package/dist/workflows/errors.js +18 -3
  130. package/dist/workflows/errors.js.map +1 -1
  131. package/dist/workflows/human-decision.d.ts +45 -8
  132. package/dist/workflows/human-decision.js +641 -274
  133. package/dist/workflows/human-decision.js.map +1 -1
  134. package/dist/workflows/index.d.ts +5 -6
  135. package/dist/workflows/index.js +4 -5
  136. package/dist/workflows/index.js.map +1 -1
  137. package/dist/workflows/progress.d.ts +1 -0
  138. package/dist/workflows/progress.js +15 -3
  139. package/dist/workflows/progress.js.map +1 -1
  140. package/dist/workflows/schema.js +27 -1
  141. package/dist/workflows/schema.js.map +1 -1
  142. package/dist/workflows/store.d.ts +83 -103
  143. package/dist/workflows/store.js +907 -951
  144. package/dist/workflows/store.js.map +1 -1
  145. package/dist/workflows/types.d.ts +88 -126
  146. package/docs/CONTROLLERS.md +10 -8
  147. package/docs/DEFERRED_TURNS.md +2 -2
  148. package/docs/DESIGN_PHILOSOPHY.md +4 -2
  149. package/docs/HUMAN_DECISIONS.md +36 -47
  150. package/docs/HUMAN_DECISION_PRESENTATIONS.md +14 -24
  151. package/docs/MONITOR.md +179 -237
  152. package/docs/SQLITE_STATE.md +219 -0
  153. package/docs/WORKFLOW_COMPOSITION.md +27 -26
  154. package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
  155. package/docs/WORKFLOW_UPDATES.md +10 -9
  156. package/docs/development.md +9 -9
  157. package/docs/live-replay-protocol.md +28 -37
  158. package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
  159. package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
  160. package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
  161. package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
  162. package/docs/plans/2026-08-21-sanity-check-plan.md +217 -95
  163. package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
  164. package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
  165. package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
  166. package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
  167. package/docs/plans/session-event-replay-implementation-plan.md +1 -1
  168. package/docs/plans/tui-viewer-implementation-plan.md +1 -1
  169. package/docs/session-event-journal.md +63 -434
  170. package/docs/tui-viewer.md +13 -15
  171. package/docs/workflows.md +127 -53
  172. package/examples/workflows/approved-plan.workflow.ts +19 -46
  173. package/examples/workflows/plain-summary.workflow.ts +1 -0
  174. package/herdr-plugin.toml +1 -1
  175. package/package.json +7 -7
  176. package/plugins/herdr/viewer.mjs +1 -11
  177. package/schemas/human-decision-accepted-v1.schema.json +15 -3
  178. package/schemas/human-decision-continuation-v1.schema.json +10 -1
  179. package/schemas/human-decision-delivery-v1.schema.json +8 -0
  180. package/schemas/human-decision-receipt-v1.schema.json +8 -0
  181. package/schemas/human-decision-request-v1.schema.json +24 -4
  182. package/skills/autoimplement/SKILL.md +27 -0
  183. package/skills/autoplan/SKILL.md +5 -4
  184. package/skills/monitor/SKILL.md +91 -135
  185. package/skills/pi-workflows/SKILL.md +9 -8
  186. package/skills/sanity-check/SKILL.md +44 -0
  187. package/src/builtins/autoimplement.workflow.ts +19 -118
  188. package/src/builtins/autoplan.workflow.ts +290 -40
  189. package/src/builtins/catalog.ts +7 -5
  190. package/src/builtins/index.ts +18 -1
  191. package/src/builtins/monitor.workflow.ts +673 -382
  192. package/src/builtins/pi-agent-group.ts +1407 -0
  193. package/src/builtins/plain-summary.workflow.ts +185 -0
  194. package/src/builtins/plan-approval.workflow.ts +157 -24
  195. package/src/builtins/plan-change.workflow.ts +321 -0
  196. package/src/builtins/plan-presentation.ts +2 -2
  197. package/src/builtins/sanity-check.workflow.ts +248 -48
  198. package/src/controllers/effects.ts +7 -0
  199. package/src/controllers/index.ts +0 -6
  200. package/src/controllers/manager.ts +72 -32
  201. package/src/controllers/sqlite.ts +2420 -1948
  202. package/src/controllers/store.ts +17 -38
  203. package/src/controllers/types.ts +3 -0
  204. package/src/controllers/workflow-engine-scheduler.ts +4 -8
  205. package/src/controllers/workflows.ts +45 -21
  206. package/src/extension/controller-host.ts +1 -2
  207. package/src/extension/decision-channels.ts +456 -203
  208. package/src/extension/executor.ts +105 -2
  209. package/src/extension/herdr-viewer.ts +0 -5
  210. package/src/extension/index.ts +251 -151
  211. package/src/extension/recorder.ts +13 -22
  212. package/src/extension/session-events.ts +2 -2
  213. package/src/extension/step-message.ts +106 -4
  214. package/src/extension/widget.ts +32 -5
  215. package/src/host/rpc-executor.ts +4 -0
  216. package/src/host/runner.ts +93 -41
  217. package/src/render/graph-render.ts +12 -6
  218. package/src/state/database.ts +375 -0
  219. package/src/state/index.ts +29 -0
  220. package/src/state/json.ts +42 -0
  221. package/src/state/mutation.ts +435 -0
  222. package/src/state/schema.ts +475 -0
  223. package/src/viewer/cli.ts +151 -144
  224. package/src/viewer/render.ts +19 -30
  225. package/src/viewer/session-reducer.ts +1 -1
  226. package/src/viewer/tui.ts +18 -17
  227. package/src/viewer/watch.ts +13 -17
  228. package/src/workflows/catalog.ts +7 -2
  229. package/src/workflows/composition.ts +21 -3
  230. package/src/workflows/decision-presentation.ts +56 -43
  231. package/src/workflows/definition.ts +36 -3
  232. package/src/workflows/engine.ts +228 -130
  233. package/src/workflows/errors.ts +27 -3
  234. package/src/workflows/human-decision.ts +921 -349
  235. package/src/workflows/index.ts +20 -30
  236. package/src/workflows/progress.ts +18 -3
  237. package/src/workflows/schema.ts +36 -1
  238. package/src/workflows/store.ts +1300 -1163
  239. package/src/workflows/types.ts +100 -137
  240. package/dist/builtins/sanity-check-session.d.ts +0 -17
  241. package/dist/builtins/sanity-check-session.js +0 -168
  242. package/dist/builtins/sanity-check-session.js.map +0 -1
  243. package/dist/workflows/artifacts.d.ts +0 -40
  244. package/dist/workflows/artifacts.js +0 -155
  245. package/dist/workflows/artifacts.js.map +0 -1
  246. package/dist/workflows/migrate-sources.d.ts +0 -42
  247. package/dist/workflows/migrate-sources.js +0 -133
  248. package/dist/workflows/migrate-sources.js.map +0 -1
  249. package/docs/run-bundles.md +0 -481
  250. package/schemas/human-decision-accepted-v2.schema.json +0 -50
  251. package/schemas/human-decision-delivery-v2.schema.json +0 -36
  252. package/schemas/human-decision-receipt-v2.schema.json +0 -39
  253. package/schemas/human-decision-request-v2.schema.json +0 -69
  254. package/schemas/human-decision-resolution-v2.schema.json +0 -27
  255. package/src/builtins/sanity-check-session.ts +0 -205
  256. package/src/workflows/artifacts.ts +0 -188
  257. package/src/workflows/migrate-sources.ts +0 -178
@@ -8,13 +8,17 @@
8
8
  "schema",
9
9
  "decisionId",
10
10
  "requestDigest",
11
+ "subjectDigest",
12
+ "presentationDigest",
11
13
  "runId",
12
14
  "workflowName",
13
15
  "nodeId",
14
16
  "attemptId",
15
17
  "audience",
16
18
  "title",
17
- "body",
19
+ "subject",
20
+ "presentation",
21
+ "revision",
18
22
  "choices",
19
23
  "createdAt"
20
24
  ],
@@ -22,13 +26,19 @@
22
26
  "schema": { "const": "pi-workflows.human-decision-request.v1" },
23
27
  "decisionId": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$" },
24
28
  "requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
29
+ "subjectDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
30
+ "presentationDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
25
31
  "runId": { "type": "string" },
26
32
  "workflowName": { "type": "string" },
27
33
  "nodeId": { "type": "string" },
28
34
  "attemptId": { "type": "string" },
29
35
  "audience": { "type": "string" },
30
36
  "title": { "type": "string", "minLength": 1 },
31
- "body": true,
37
+ "subject": true,
38
+ "presentation": {
39
+ "$ref": "decision-presentation-v1.schema.json"
40
+ },
41
+ "revision": { "type": "integer", "minimum": 1 },
32
42
  "choices": {
33
43
  "type": "object",
34
44
  "minProperties": 1,
@@ -54,6 +64,16 @@
54
64
  }
55
65
  },
56
66
  "createdAt": { "type": "string", "format": "date-time" },
57
- "expiresAt": { "type": "string", "format": "date-time" }
58
- }
67
+ "expiresAt": { "type": "string", "format": "date-time" },
68
+ "defaultResponse": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["choice"],
72
+ "properties": {
73
+ "choice": { "type": "string" },
74
+ "input": { "type": "object", "additionalProperties": { "type": "string" } }
75
+ }
76
+ }
77
+ },
78
+ "dependentRequired": { "defaultResponse": ["expiresAt"] }
59
79
  }
@@ -20,6 +20,7 @@ Build the input as follows:
20
20
  - `baseBranch`: Use the requested base or the repository default branch.
21
21
  - `merge`: Set `true` only when the user explicitly requested merge or an applicable standing instruction authorizes it. Otherwise set `false`.
22
22
  - `documents`: Include known canonical plan or specification paths. Use an empty array when none are known.
23
+ - `approval`: Omit it for the default behavior: ask on each new plan and continue after 10 minutes without an answer. Use `{ "mode": "required" }` when the user says to block on plan changes. Use `{ "mode": "skip" }` when the user says to continue without asking about plan changes.
23
24
  - `concurrency`: Include it only when the conversation gives explicit limits.
24
25
 
25
26
  When one repository is clearly named, derive the scope without asking the user to restate it. A safe derived scope permits only work needed for the task in that repository, including local verification and normal branch and pull-request publication. It excludes unrelated repositories, merge, release, deployment, credentials, and policy changes unless those actions are explicitly authorized.
@@ -51,6 +52,32 @@ Replace the example values below with facts from the conversation, then make one
51
52
  }
52
53
  ```
53
54
 
55
+ ### Plan-change decisions
56
+
57
+ The workflow gates only plans that it creates or changes after the run starts. A supplied or discovered existing plan does not receive another decision.
58
+
59
+ Use required approval when the user says to block on plan changes:
60
+
61
+ ```json
62
+ {
63
+ "approval": {
64
+ "mode": "required"
65
+ }
66
+ }
67
+ ```
68
+
69
+ Skip plan decisions when the user says to accept every new plan immediately:
70
+
71
+ ```json
72
+ {
73
+ "approval": {
74
+ "mode": "skip"
75
+ }
76
+ }
77
+ ```
78
+
79
+ Omit `approval` for autonomous mode. It asks the `operator` audience and continues with the exact presented plan after 10 minutes without an accepted answer. The workflow owns this decision. The model must not answer the protected decision through the workflow tool.
80
+
54
81
  Do not manually duplicate stages already owned by the workflow. Autoimplement runs independent pi-reviewer commands, pending CI watches, and local verification commands from separate repositories in bounded batches. It keeps model turns, fixes, pushes, comment changes, merges, and releases ordered. One repository uses the same batch path with concurrency one.
55
82
 
56
83
  When this skill is loaded inside an active workflow step, do not start another workflow. Complete the current step contract with the available tools.
@@ -37,13 +37,14 @@ When this skill is loaded inside an active workflow step, do not start another w
37
37
  Outside Pi, or when the workflow is unavailable:
38
38
 
39
39
  1. Frame the problem, observable success criteria, scope, constraints, and interfaces under our control.
40
- 2. Devise the most elegant long-term production-ready solution within that scope.
40
+ 2. Record two through four distinct practical candidates. Give each one a stable id, short title, plain gist, full solution, rationale, parts, and trade-offs.
41
41
  3. Describe the holy grail separately. Name every dependency outside our authority.
42
- 4. Choose the right option without asking the user to decide between them.
42
+ 4. Choose the right option without asking the user to decide between them. Record one rejection reason for every other explicit candidate.
43
43
  - Choose the ideal when it is proportionate, production-ready, in scope, and implementable through interfaces we control.
44
44
  - Otherwise choose the strongest practical in-scope solution with a clear path toward the ideal.
45
45
  - Do not block only because the ideal requires an upstream or external change.
46
46
  5. Write a detailed implementation plan. For each step, state what changes, where it changes, and how to verify it.
47
- 6. Stop as blocked only when no truthful in-scope solution can meet the success criteria.
47
+ 6. Present one short plain assistant message with the chosen plan, its main steps, and a one-line gist and rejection reason for every other candidate. Call it selected for approval when a later human decision still applies.
48
+ 7. Stop as blocked only when no truthful in-scope solution can meet the success criteria.
48
49
 
49
- When revising a plan, preserve the previous plan and new evidence. State whether the plan changed and why. Do not implement unless the user also requested implementation.
50
+ When revising a plan, preserve the previous plan and new evidence. Record whether the previous plan remains a candidate or why new evidence rejects it. State whether the final plan changed and why. “All plans” means the explicit candidate records, never hidden model reasoning. Do not implement unless the user also requested implementation.
@@ -1,198 +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.
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
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
60
38
  }
61
39
  }
62
40
  ```
63
41
 
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 composed repair path. Supply the problem, observed evidence, and a stable fingerprint of the issue plus target state. The workflow runs outer `autoplan`, standalone `autodoc`, optional `plan-approval`, `autoimplement`, and internal redesign when needed, then checks the target again. Do not copy their prompts into the monitor task.
69
-
70
- Add `repair.approval` only when the user requests a human plan decision. Set its named `audience` and a bounded `maxReplans`. A verified continue answer starts implementation. Stop ends the repair truthfully. Replan preserves the exact operator text, sends it back to autoplan, documents the revised plan, and asks again. The model-facing workflow answer tool cannot answer this gate.
71
-
72
- ## Keep routine work moving
73
-
74
- While the workflow is active, do routine, bounded work required by the exact objective without asking for another confirmation. This includes:
75
-
76
- - downloading, building, and running code pinned by the monitored objective;
77
- - building and running task containers from a pinned benchmark or repository revision;
78
- - installing pinned dependencies in the planned isolated environment;
79
- - running canaries, tests, retries, restarts, and temporary cleanup;
80
- - repairing configuration or storage-path errors without changing the method; and
81
- - continuing paid work that already has applicable approval.
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.
82
43
 
83
- 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.
44
+ ## Observation steps
84
45
 
85
- ## Paid infrastructure authority
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.
86
47
 
87
- 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.
48
+ Answer these questions:
88
49
 
89
- 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.
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?
90
56
 
91
- 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.
57
+ Select one route:
92
58
 
93
- 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.
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.
94
62
 
95
- 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.
63
+ Keep Monitor state, goal state, and target work state separate. Never call the target running because Monitor itself is active.
96
64
 
97
- ## Complete workflow checks
65
+ For `act`, provide one exact action with:
98
66
 
99
- 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.
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
100
76
 
101
- For each check:
77
+ An action description records authority. It does not create authority.
102
78
 
103
- 1. Query the target's authoritative status.
104
- 2. Query durable progress and final-output surfaces. Run independent reads in parallel when useful.
105
- 3. Compare the current values with the previous accepted observation.
106
- 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.
107
- 5. Include a concise report for every accepted check. Report absolute totals and meaningful deltas when counters matter.
108
- 6. Select `continue` or `stop` as required by the step contract.
109
- 7. Call `workflow` with `action: "submit"` exactly once, using the supplied step and attempt IDs and the required output shape.
79
+ ## Direct action steps
110
80
 
111
- 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.
81
+ `advance` starts or continues normal requested work. `recover` restarts or resumes work after an operational stop.
112
82
 
113
- ## Publish progress when measurable
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.
114
84
 
115
- 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.
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.
116
86
 
117
- Progress is optional. Do not invent it for work that has no factual count, total, rate, or source estimate.
87
+ ## Repair steps
118
88
 
119
- 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.
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.
120
90
 
121
- Each track uses `pi-workflows.progress.v1` and can include:
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.
122
92
 
123
- - `status`: `pending`, `running`, `waiting`, `blocked`, `completed`, `failed`, `cancelled`, or `unknown`;
124
- - `label` and `phase` for short display text and estimation epochs;
125
- - `completed`, `total`, and `unit` for factual counts;
126
- - `sourceUpdatedAt` and `sourceEstimatedFinishAt` when the target provides its own fresh estimate.
93
+ Stop affected paid workers at safe boundaries before repairing a shared code or data defect. Preserve durable outputs and failure evidence.
127
94
 
128
- 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.
95
+ If the same failure and target-state IDs return after one completed repair, stop. Do not run the same repair cycle again.
129
96
 
130
- For several concurrent processes, publish one stable track per process. The Pi widget and viewers show them separately and keep each ETA independent.
97
+ ## Authority and paid work
131
98
 
132
- 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.
99
+ Monitor may perform an action only when the full action is inside existing authority. Stop when authority is absent, unclear, or too narrow.
133
100
 
134
- 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.
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.
135
102
 
136
- ## Apply finish rules
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.
137
104
 
138
- ### Still active
105
+ Do not change protected model, method, data source, hardware class, provider/runtime contract, credential destination, production selection, or objective without new authority.
139
106
 
140
- Continue. Keep reports short unless the state changed materially.
107
+ ## Progress
141
108
 
142
- ### Completed
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.
143
110
 
144
- Stop only after the inferred finish criterion is true. Verify required final artifacts, checksums, receipts, publication state, or downstream health before selecting `stop`.
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.
145
112
 
146
- ### Failed, stopped, or blocked
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.
147
114
 
148
- 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.
115
+ ## Reports
149
116
 
150
- 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.
117
+ Every accepted observation produces one status notification. Use this form when target work is active:
151
118
 
152
- Stop only for a material blocker, such as:
153
-
154
- - a deterministic shared code or data defect that makes further attempts unsafe;
155
- - an invalid, missing, or unverifiable checkpoint when useful state would be lost;
156
- - a required credential that has no prior source-and-destination authorization;
157
- - a changed model, method, source, hardware class, objective, or production decision;
158
- - a destructive or security-sensitive action outside the recorded authority;
159
- - a cost, time, or resource ceiling that cannot safely contain the remaining work;
160
- - evidence that the requested result cannot be made truthful or valid under the current contract.
161
-
162
- 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.
163
-
164
- 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.
165
-
166
- ### Status unavailable
167
-
168
- 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.
169
-
170
- ## Check the right surfaces
171
-
172
- Depending on the target, inspect:
173
-
174
- - Process, Job, workflow, CI, or deployment status.
175
- - Durable receipts and counters.
176
- - Checkpoints or partial outputs.
177
- - Final manifests, databases, publications, or release artifacts.
178
- - 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
+ ```
179
127
 
180
- 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:
181
129
 
182
- ## 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
+ ```
183
136
 
184
- 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.
185
138
 
186
- ## Status format
139
+ ## Stop conditions
187
140
 
188
- For an unchanged active target, prefer a compact report:
141
+ Stop when:
189
142
 
190
- ```text
191
- Target remains running:
192
- - Progress: <absolute total> (<delta since last report>)
193
- - Cost or resource use: <total>
194
- - Durable output: <state>
195
- - Next check: <interval>
196
- ```
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
197
153
 
198
- 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,12 +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.
74
- - Use an ordinary checkpoint for external continuation data that the model may submit. Use `humanDecision()` for a verified human choice, and use the included `plan-approval` workflow for standard continue, stop, and exact-text replan 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
+ - 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
+ - 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.
75
76
  - Set explicit step and command timeouts.
76
77
  - Bound ordinary loops with `maxSteps` or another clear finish rule.
77
78
  - Use a controller instead of a workflow for indefinite resource reconciliation.
78
- - 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.
79
80
  - Preserve the single active workflow rule in one Pi session.
80
81
 
81
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.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: sanity-check
3
+ description: Use when the user asks for a read-only sanity check of a repository contribution, including whether it is necessary, duplicates existing code, adds justified contracts, or has proportionate scope and tests. Starts the built-in sanity-check workflow and returns an evidence-backed keep, simplify, refactor, drop, or needs-evidence verdict.
4
+ compatibility: Requires pi-workflows and the built-in sanity-check workflow.
5
+ ---
6
+
7
+ # Sanity Check
8
+
9
+ ## Start the workflow
10
+
11
+ Use the built-in `sanity-check` workflow when it is available. At top level, list workflows, build the complete input, and start `sanity-check` once.
12
+
13
+ The workflow reviews the repository of the current Pi session. Before starting, confirm that Pi's current working directory is inside the repository that owns the contribution. Do not claim to check a different repository. If the current directory is wrong, start or use a Pi session in the correct repository first.
14
+
15
+ Build the input as follows:
16
+
17
+ - `mode`: Use `serial` unless the user explicitly requests parallel review. Serial mode reviews all four areas in one isolated session. Parallel mode runs one isolated review per area with concurrency four. Both modes run a separate verification review.
18
+ - `baseRef`: Use the requested base Git reference. When the base is clear, pass it explicitly, such as `origin/main`. Omit it only when the workflow should derive the base from `origin/HEAD`, the current branch upstream, or `HEAD^`.
19
+
20
+ Replace the example values below with facts from the conversation, then make one start call:
21
+
22
+ ```json
23
+ {
24
+ "action": "start",
25
+ "workflow": "sanity-check",
26
+ "input": {
27
+ "mode": "serial",
28
+ "baseRef": "origin/main"
29
+ }
30
+ }
31
+ ```
32
+
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
+
35
+ When this skill is loaded inside an active workflow step, do not start another workflow. Complete the current step contract.
36
+
37
+ Outside Pi, or when the workflow is unavailable:
38
+
39
+ 1. Collect the committed diff from the selected base through `HEAD`, the working-tree diff, untracked files, and matching pull-request context.
40
+ 2. Review necessity, duplication, contracts, and scope and tests.
41
+ 3. For each area, report pass, concern, or unclear with exact file and symbol evidence.
42
+ 4. State the strongest evidence-based case for accepting the contribution.
43
+ 5. Verify the findings, remove unsupported claims, and return keep, simplify, refactor, drop, or needs evidence.
44
+ 6. Stay read-only unless the user separately asks to implement the required changes.