@osolmaz/pi-workflows 0.11.2 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/README.md +15 -10
  2. package/dist/builtins/autoimplement-command-batches.d.ts +52 -0
  3. package/dist/builtins/autoimplement-command-batches.js +258 -0
  4. package/dist/builtins/autoimplement-command-batches.js.map +1 -0
  5. package/dist/builtins/autoimplement.workflow.d.ts +509 -124
  6. package/dist/builtins/autoimplement.workflow.js +884 -327
  7. package/dist/builtins/autoimplement.workflow.js.map +1 -1
  8. package/dist/builtins/catalog.js +5 -3
  9. package/dist/builtins/catalog.js.map +1 -1
  10. package/dist/builtins/index.d.ts +4 -1
  11. package/dist/builtins/index.js +3 -1
  12. package/dist/builtins/index.js.map +1 -1
  13. package/dist/builtins/monitor.workflow.d.ts +2 -4
  14. package/dist/builtins/monitor.workflow.js +26 -128
  15. package/dist/builtins/monitor.workflow.js.map +1 -1
  16. package/dist/builtins/pi-agent-group.d.ts +72 -0
  17. package/dist/builtins/pi-agent-group.js +1087 -0
  18. package/dist/builtins/pi-agent-group.js.map +1 -0
  19. package/dist/builtins/plan-approval.workflow.d.ts +39 -5
  20. package/dist/builtins/plan-approval.workflow.js +92 -14
  21. package/dist/builtins/plan-approval.workflow.js.map +1 -1
  22. package/dist/builtins/plan-change.workflow.d.ts +301 -0
  23. package/dist/builtins/plan-change.workflow.js +256 -0
  24. package/dist/builtins/plan-change.workflow.js.map +1 -0
  25. package/dist/builtins/plan-presentation.js +2 -2
  26. package/dist/builtins/plan-presentation.js.map +1 -1
  27. package/dist/builtins/sanity-check.workflow.d.ts +85 -0
  28. package/dist/builtins/sanity-check.workflow.js +482 -0
  29. package/dist/builtins/sanity-check.workflow.js.map +1 -0
  30. package/dist/controllers/sqlite.d.ts +90 -2
  31. package/dist/controllers/sqlite.js +380 -5
  32. package/dist/controllers/sqlite.js.map +1 -1
  33. package/dist/extension/decision-channels.d.ts +2 -2
  34. package/dist/extension/decision-channels.js +29 -35
  35. package/dist/extension/decision-channels.js.map +1 -1
  36. package/dist/extension/deferred-turn-coordinator.d.ts +32 -0
  37. package/dist/extension/deferred-turn-coordinator.js +143 -0
  38. package/dist/extension/deferred-turn-coordinator.js.map +1 -0
  39. package/dist/extension/deferred-turn.d.ts +44 -0
  40. package/dist/extension/deferred-turn.js +110 -0
  41. package/dist/extension/deferred-turn.js.map +1 -0
  42. package/dist/extension/index.js +348 -80
  43. package/dist/extension/index.js.map +1 -1
  44. package/dist/extension/session-events.d.ts +2 -2
  45. package/dist/extension/step-message.d.ts +1 -0
  46. package/dist/extension/step-message.js.map +1 -1
  47. package/dist/extension/widget.js +23 -3
  48. package/dist/extension/widget.js.map +1 -1
  49. package/dist/herdr/setup.js +4 -4
  50. package/dist/render/graph-render.js +1 -2
  51. package/dist/render/graph-render.js.map +1 -1
  52. package/dist/viewer/render.js +7 -6
  53. package/dist/viewer/render.js.map +1 -1
  54. package/dist/workflows/catalog.js +7 -2
  55. package/dist/workflows/catalog.js.map +1 -1
  56. package/dist/workflows/command-batch.d.ts +38 -0
  57. package/dist/workflows/command-batch.js +176 -0
  58. package/dist/workflows/command-batch.js.map +1 -0
  59. package/dist/workflows/composition.js +8 -0
  60. package/dist/workflows/composition.js.map +1 -1
  61. package/dist/workflows/decision-presentation.d.ts +1 -1
  62. package/dist/workflows/decision-presentation.js +51 -38
  63. package/dist/workflows/decision-presentation.js.map +1 -1
  64. package/dist/workflows/engine.d.ts +2 -2
  65. package/dist/workflows/engine.js +22 -17
  66. package/dist/workflows/engine.js.map +1 -1
  67. package/dist/workflows/errors.d.ts +13 -0
  68. package/dist/workflows/errors.js +15 -0
  69. package/dist/workflows/errors.js.map +1 -1
  70. package/dist/workflows/human-decision.d.ts +16 -4
  71. package/dist/workflows/human-decision.js +175 -72
  72. package/dist/workflows/human-decision.js.map +1 -1
  73. package/dist/workflows/index.d.ts +3 -2
  74. package/dist/workflows/index.js +2 -1
  75. package/dist/workflows/index.js.map +1 -1
  76. package/dist/workflows/progress.d.ts +1 -0
  77. package/dist/workflows/progress.js +15 -3
  78. package/dist/workflows/progress.js.map +1 -1
  79. package/dist/workflows/schema.js +12 -1
  80. package/dist/workflows/schema.js.map +1 -1
  81. package/dist/workflows/shell.d.ts +4 -0
  82. package/dist/workflows/shell.js +6 -0
  83. package/dist/workflows/shell.js.map +1 -1
  84. package/dist/workflows/store.js +8 -1
  85. package/dist/workflows/store.js.map +1 -1
  86. package/dist/workflows/types.d.ts +37 -48
  87. package/docs/2026-08-18-herdr-piw-plan.md +1 -1
  88. package/docs/2026-08-20-durable-workflow-launch-plan.md +19 -23
  89. package/docs/CONTROLLERS.md +2 -2
  90. package/docs/DEFERRED_TURNS.md +298 -0
  91. package/docs/DESIGN_PHILOSOPHY.md +1 -1
  92. package/docs/HUMAN_DECISIONS.md +30 -40
  93. package/docs/HUMAN_DECISION_PRESENTATIONS.md +17 -27
  94. package/docs/MONITOR.md +7 -13
  95. package/docs/WORKFLOW_COMPOSITION.md +10 -9
  96. package/docs/WORKFLOW_STEP_MESSAGES.md +5 -5
  97. package/docs/WORKFLOW_UPDATES.md +28 -5
  98. package/docs/plans/2026-08-04-controller-runtime-plan.md +1 -1
  99. package/docs/plans/2026-08-05-always-on-workflows-plan.md +1 -1
  100. package/docs/plans/2026-08-10-agent-managed-monitor-workflows-plan.md +9 -9
  101. package/docs/plans/2026-08-13-built-in-workflow-catalog-plan.md +1 -1
  102. package/docs/plans/2026-08-13-session-addressed-workflow-notifications-plan.md +1 -1
  103. package/docs/plans/2026-08-16-workflow-updates-plan.md +3 -3
  104. package/docs/plans/2026-08-17-bundled-skills-plan.md +6 -6
  105. package/docs/plans/2026-08-19-human-decision-gates-plan.md +5 -5
  106. package/docs/plans/2026-08-19-human-decision-presentations-plan.md +1 -1
  107. package/docs/plans/2026-08-19-provider-compatible-workflow-tool-schema-plan.md +1 -1
  108. package/docs/plans/2026-08-19-workflow-composition-plan.md +6 -6
  109. package/docs/plans/2026-08-20-autoimplement-blocker-challenge-plan.md +3 -3
  110. package/docs/plans/2026-08-20-bounded-command-batches-plan.md +206 -0
  111. package/docs/plans/2026-08-20-herdr-plugin-sync-plan.md +9 -9
  112. package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +242 -0
  113. package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +324 -0
  114. package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
  115. package/docs/plans/2026-08-21-sanity-check-plan.md +283 -0
  116. package/docs/run-bundles.md +8 -6
  117. package/docs/workflows.md +85 -22
  118. package/examples/workflows/approved-plan.workflow.ts +19 -46
  119. package/examples/workflows/command-batch.workflow.ts +50 -0
  120. package/examples/workflows/sanity-check.workflow.ts +1 -0
  121. package/herdr-plugin.toml +3 -3
  122. package/package.json +7 -7
  123. package/schemas/decision-presentation-v1.schema.json +1 -1
  124. package/schemas/human-decision-accepted-v1.schema.json +16 -4
  125. package/schemas/human-decision-answer-attempt-v1.schema.json +1 -1
  126. package/schemas/human-decision-cancellation-v1.schema.json +1 -1
  127. package/schemas/human-decision-continuation-v1.schema.json +11 -2
  128. package/schemas/human-decision-delivery-v1.schema.json +9 -1
  129. package/schemas/human-decision-receipt-v1.schema.json +9 -1
  130. package/schemas/human-decision-request-v1.schema.json +25 -5
  131. package/schemas/human-decision-resolution-v1.schema.json +1 -1
  132. package/schemas/human-decision-settlement-v1.schema.json +1 -1
  133. package/skills/autodoc/SKILL.md +33 -2
  134. package/skills/autoimplement/SKILL.md +93 -12
  135. package/skills/autoplan/SKILL.md +26 -2
  136. package/skills/monitor/SKILL.md +66 -24
  137. package/skills/pi-workflows/SKILL.md +21 -6
  138. package/skills/sanity-check/SKILL.md +44 -0
  139. package/src/builtins/autoimplement-command-batches.ts +364 -0
  140. package/src/builtins/autoimplement.workflow.ts +1075 -370
  141. package/src/builtins/catalog.ts +5 -3
  142. package/src/builtins/index.ts +24 -0
  143. package/src/builtins/monitor.workflow.ts +27 -150
  144. package/src/builtins/pi-agent-group.ts +1407 -0
  145. package/src/builtins/plan-approval.workflow.ts +157 -24
  146. package/src/builtins/plan-change.workflow.ts +321 -0
  147. package/src/builtins/plan-presentation.ts +2 -2
  148. package/src/builtins/sanity-check.workflow.ts +769 -0
  149. package/src/controllers/sqlite.ts +580 -7
  150. package/src/extension/decision-channels.ts +36 -66
  151. package/src/extension/deferred-turn-coordinator.ts +171 -0
  152. package/src/extension/deferred-turn.ts +166 -0
  153. package/src/extension/index.ts +438 -90
  154. package/src/extension/session-events.ts +2 -2
  155. package/src/extension/step-message.ts +1 -0
  156. package/src/extension/widget.ts +24 -5
  157. package/src/herdr/setup.ts +4 -4
  158. package/src/render/graph-render.ts +1 -2
  159. package/src/viewer/render.ts +7 -6
  160. package/src/workflows/catalog.ts +7 -2
  161. package/src/workflows/command-batch.ts +254 -0
  162. package/src/workflows/composition.ts +9 -0
  163. package/src/workflows/decision-presentation.ts +56 -43
  164. package/src/workflows/engine.ts +25 -20
  165. package/src/workflows/errors.ts +24 -0
  166. package/src/workflows/human-decision.ts +218 -101
  167. package/src/workflows/index.ts +20 -11
  168. package/src/workflows/progress.ts +18 -3
  169. package/src/workflows/schema.ts +19 -1
  170. package/src/workflows/shell.ts +10 -0
  171. package/src/workflows/store.ts +8 -1
  172. package/src/workflows/types.ts +43 -59
  173. package/schemas/human-decision-accepted-v2.schema.json +0 -50
  174. package/schemas/human-decision-delivery-v2.schema.json +0 -36
  175. package/schemas/human-decision-receipt-v2.schema.json +0 -39
  176. package/schemas/human-decision-request-v2.schema.json +0 -69
  177. package/schemas/human-decision-resolution-v2.schema.json +0 -27
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-resolution-v1.schema.json",
4
- "title": "Pi Workflows human decision resolution v1",
4
+ "title": "pi-workflows human decision resolution v1",
5
5
  "oneOf": [
6
6
  {
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-settlement-v1.schema.json",
4
- "title": "Pi Workflows human decision settlement v1",
4
+ "title": "pi-workflows human decision settlement v1",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": [
@@ -1,12 +1,43 @@
1
1
  ---
2
2
  name: autodoc
3
3
  description: Use when an existing selected solution or clear implementation plan must be recorded or updated in canonical documentation before implementation, including choosing the right repository and applying SimpleDoc conventions.
4
- compatibility: Requires Pi Workflows and the built-in autodoc workflow.
4
+ compatibility: Requires pi-workflows and the built-in autodoc workflow.
5
5
  ---
6
6
 
7
7
  # Autodoc
8
8
 
9
- Use the built-in `autodoc` Pi Workflow when it is available. At top level, list workflows, then start `autodoc` once with the task, existing plan, repository, known documents, and evidence from the conversation. Do not manually duplicate stages owned by the workflow.
9
+ ## Start the workflow
10
+
11
+ Use the built-in `autodoc` workflow when it is available. At top level, list workflows, build the complete input, and start `autodoc` once. Do not manually duplicate stages owned by the workflow.
12
+
13
+ Build the input as follows:
14
+
15
+ - `task`: State what selected plan must be recorded and that this run is documentation-only.
16
+ - `plan`: Pass the complete selected plan. Autodoc does not devise or improve it.
17
+ - `repository`: Use the absolute path of the repository that owns the canonical documentation.
18
+ - `documents`: Include every known canonical specification or plan candidate. Use an empty array when none is known.
19
+ - `evidence`: Include implementation evidence or current-document evidence when it affects whether documentation is current.
20
+
21
+ Replace the example values below with facts from the conversation, then make one start call:
22
+
23
+ ```json
24
+ {
25
+ "action": "start",
26
+ "workflow": "autodoc",
27
+ "input": {
28
+ "task": "Record the selected timeout fallback plan without implementing it.",
29
+ "plan": {
30
+ "summary": "Add one bounded read-only timeout fallback.",
31
+ "requirements": ["Keep cancellation terminal."]
32
+ },
33
+ "repository": "/absolute/path/to/repository",
34
+ "documents": ["docs/plans/timeout-fallback-plan.md"],
35
+ "evidence": {
36
+ "currentBehavior": "A timeout ends the run."
37
+ }
38
+ }
39
+ }
40
+ ```
10
41
 
11
42
  When this skill is loaded inside an active workflow step, do not start another workflow. Complete the current step contract.
12
43
 
@@ -1,10 +1,84 @@
1
1
  ---
2
2
  name: autoimplement
3
- description: Use when the user asks to implement a plan end-to-end, test it, run Pi Reviewer against the base branch in a loop until no P0/P1 issues remain, and make sure CI/CD is green before finishing.
3
+ description: Use when the user asks to implement a plan end-to-end, test it, run pi-reviewer against the base branch in a loop until no P0/P1 issues remain, and make sure CI/CD is green before finishing.
4
4
  compatibility: Requires Pi Workflows and the built-in autoimplement workflow.
5
5
  ---
6
6
 
7
- Use the built-in `autoimplement` Pi Workflow when it is available. At top level, list workflows, then start `autoimplement` once with the task, existing plan, repository, scope, constraints, base branch, and merge policy from the conversation. Set `merge: true` only when the user explicitly requested merge or an applicable standing instruction authorizes it. Otherwise set it to false. Do not manually duplicate stages already owned by the workflow.
7
+ # Autoimplement
8
+
9
+ ## Start the workflow
10
+
11
+ Use the built-in `autoimplement` workflow when it is available. At top level, list workflows, build the complete input, and start `autoimplement` once. Do not start with a partial input and repair it in later turns.
12
+
13
+ Build the input as follows:
14
+
15
+ - `task`: Preserve the user's requested end state.
16
+ - `plan`: Pass the selected plan or the full contents of its canonical plan document. Do not devise a new initial plan.
17
+ - `repository`: Use the absolute path of the repository that owns the work.
18
+ - `scope`: Always include a concrete authority statement. Name every allowed repository and the allowed edit, test, commit, push, pull-request, merge, and release actions. Carry forward exclusions from the conversation. A repository path alone is not a scope.
19
+ - `constraints`: Include all applicable user and repository constraints. Use an empty array when none apply.
20
+ - `baseBranch`: Use the requested base or the repository default branch.
21
+ - `merge`: Set `true` only when the user explicitly requested merge or an applicable standing instruction authorizes it. Otherwise set `false`.
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.
24
+ - `concurrency`: Include it only when the conversation gives explicit limits.
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.
27
+
28
+ Replace the example values below with facts from the conversation, then make one start call:
29
+
30
+ ```json
31
+ {
32
+ "action": "start",
33
+ "workflow": "autoimplement",
34
+ "input": {
35
+ "task": "Implement the selected timeout fallback plan end to end.",
36
+ "plan": {
37
+ "canonicalDocument": "docs/plans/timeout-fallback-plan.md",
38
+ "summary": "Add a bounded timeout fallback.",
39
+ "requirements": [
40
+ "Route supported timeouts to one read-only fallback.",
41
+ "Keep cancellation terminal."
42
+ ],
43
+ "verification": ["npm run check", "npm run test:e2e"]
44
+ },
45
+ "repository": "/absolute/path/to/repository",
46
+ "scope": "Only /absolute/path/to/repository. May edit and test task-related files, create commits, push the task branch, and open or update its pull request. Must not modify other repositories, merge, release, deploy, change credentials, or change repository policy.",
47
+ "constraints": ["Preserve immediate cancellation.", "Keep deferred-turn work separate."],
48
+ "baseBranch": "main",
49
+ "merge": false,
50
+ "documents": ["docs/plans/timeout-fallback-plan.md"]
51
+ }
52
+ }
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
+
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.
8
82
 
9
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.
10
84
 
@@ -21,29 +95,36 @@ Outside Pi, or when the workflow is unavailable, do the following in the order t
21
95
 
22
96
  2. Once you finish implementing, make sure to test it.
23
97
  - This will depend on the nature of the problem. If needed, run local smoke tests, spin up dev servers, make requests and such.
98
+ - Run commands from independent repositories in a bounded batch only when their working directories are distinct and local resources can support the overlap.
99
+ - Keep one repository's dependent checks in order. Do not batch shell wrappers, remote mutations, package publication, or commands with unclear side effects.
24
100
  - Try to test as much as possible, without merging.
25
101
  - State explicitly what could not be tested locally and what still needs staging or production verification.
26
102
  - Do not put mutation testing on the critical path unless repository policy explicitly requires it; keep the mutation test scripts available.
27
103
 
28
104
  3. Push your latest commits before running review so the review is always against the current PR head.
29
- - Run Pi Reviewer with its configured defaults against the base branch: `pi-reviewer --base <branch_name>`. The model and thinking level come from the reviewer's own config, not from this skill.
30
- - Use a 10 minute timeout on the tool call available to the model, not the shell `timeout` program. If Pi Reviewer takes more than 10 minutes, kill it.
31
- - Do not silently fall back to `codex review` when Pi Reviewer is unavailable; stop and report the missing command or configuration.
32
- - Record every review round with separate P0, P1, P2, and lower findings.
33
- - Run Pi Reviewer in a loop and address any P0 or P1 issues until there are none left.
34
- - If a round reports only P2 or lower findings, address valid proportionate P2 findings, verify and push them, then move to the next stage without running Pi Reviewer again solely because of that P2 work.
105
+ - Run pi-reviewer with its configured defaults against the base branch: `pi-reviewer --base <branch_name>`. The model and thinking level come from the reviewer's own config, not from this skill.
106
+ - Run reviewer commands for independent repositories in one bounded batch. Keep each result tied to its repository, base branch, pushed head, and relevant dependency fingerprint.
107
+ - In later rounds, rerun only repositories whose pushed head or relevant dependency fingerprint changed.
108
+ - Use a 10 minute timeout for each reviewer item, not the shell `timeout` program. If pi-reviewer takes more than 10 minutes, stop that item.
109
+ - Do not silently fall back to `codex review` when pi-reviewer is unavailable; stop and report the missing command or configuration for that repository.
110
+ - Treat truncated reviewer output as an invalid review, never a clean result.
111
+ - Record every review round with separate P0, P1, P2, and lower findings for each repository.
112
+ - Run pi-reviewer in a loop and address any P0 or P1 issues until there are none left.
113
+ - If a round reports only P2 or lower findings, address valid proportionate P2 findings, verify and push them, then move to the next stage without running pi-reviewer again solely because of that P2 work.
35
114
  - Ignore issues about supporting legacy behavior unless the plan requires compatibility.
36
- - Look at CI only after Pi Reviewer passes, meaning the last completed run found no issues or only P2 or lower issues.
115
+ - Look at CI only after pi-reviewer passes, meaning the last completed run found no issues or only P2 or lower issues.
37
116
 
38
- 4. Pi Reviewer reports findings locally and does not post them to the pull request.
117
+ 4. pi-reviewer reports findings locally and does not post them to the pull request.
39
118
  - Separately check existing inline review comments and PR issue comments, and address valid comments.
40
119
  - Ignore irrelevant comments and stale comments from before the latest commit unless they still apply.
41
120
  - Reply to and resolve each comment either way.
42
121
  - Do not wait a fixed five minutes; wait only when a required review is known to be pending, and keep that wait bounded.
43
122
 
44
123
  5. In the final step, make sure that CI/CD is green.
45
- - Inspect CI once before deciding to wait. If waiting is useful, state and run the exact `gh` tracking command.
46
- - Bound one CI watch to five minutes. If CI is still pending, use the next model turn for additional useful local tests or smoke tests instead of waiting. Then inspect CI again.
124
+ - Inspect every pull request once before deciding to wait. If waiting is useful, state the exact `gh` tracking command for each pending pull request.
125
+ - Run supported pending CI watches in one bounded batch. Keep every result tied to its pull request and current head.
126
+ - Bound each CI watch to five minutes. If CI is still pending, use the next model turn for additional useful local tests or smoke tests instead of waiting. Then inspect CI again.
127
+ - Do not invent an ETA when the CI provider does not supply one.
47
128
  - Ignore the fails unrelated to your changes, others break stuff sometimes and don't fix it.
48
129
  - Make sure whatever changes you did don't break anything.
49
130
  - If CI/CD is not fully green, state explicitly which failures are unrelated and why.
@@ -1,12 +1,36 @@
1
1
  ---
2
2
  name: autoplan
3
3
  description: Use when the user asks to devise, choose, or plan the most elegant long-term production-ready solution, compare it with the ideal end state, and produce the best practical in-scope implementation plan without asking the user to resolve the gap.
4
- compatibility: Requires Pi Workflows and the built-in autoplan workflow.
4
+ compatibility: Requires pi-workflows and the built-in autoplan workflow.
5
5
  ---
6
6
 
7
7
  # Autoplan
8
8
 
9
- Use the built-in `autoplan` Pi Workflow when it is available. At top level, list workflows, then start `autoplan` once with the problem, authorized scope, constraints, previous plan, and new evidence from the conversation.
9
+ ## Start the workflow
10
+
11
+ Use the built-in `autoplan` workflow when it is available. At top level, list workflows, build the complete input, and start `autoplan` once.
12
+
13
+ Build the input as follows:
14
+
15
+ - `problem`: State the decision or implementation-planning problem and its observable end state.
16
+ - `scope`: Name the repositories, systems, and interfaces that may change. State important exclusions. Derive an unambiguous repository-local scope without asking the user to restate it.
17
+ - `constraints`: Preserve all user, repository, safety, compatibility, cost, and authority limits. Use an empty array when none apply.
18
+ - `previousPlan`: Include it only when revising an existing plan.
19
+ - `newEvidence`: Include it only when evidence caused the revision request.
20
+
21
+ Replace the example values below with facts from the conversation, then make one start call:
22
+
23
+ ```json
24
+ {
25
+ "action": "start",
26
+ "workflow": "autoplan",
27
+ "input": {
28
+ "problem": "Choose a production-ready timeout fallback and write its implementation plan.",
29
+ "scope": "Only /absolute/path/to/repository. Plan changes to its public workflow API, built-in workflow, tests, and documentation. Exclude Pi core, external services, credentials, releases, and unrelated repositories.",
30
+ "constraints": ["Keep cancellation terminal.", "Use only documented public interfaces."]
31
+ }
32
+ }
33
+ ```
10
34
 
11
35
  When this skill is loaded inside an active workflow step, do not start another workflow. Complete the current step contract.
12
36
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: monitor
3
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.
4
- compatibility: Requires Pi Workflows and the built-in monitor workflow.
4
+ compatibility: Requires pi-workflows and the built-in monitor workflow.
5
5
  ---
6
6
 
7
7
  # Monitor
@@ -10,9 +10,9 @@ Use the built-in Pi `monitor` workflow as an autopilot for the requested objecti
10
10
 
11
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.
12
12
 
13
- ## Prepare and start without delay
13
+ ## Start the workflow without delay
14
14
 
15
- As soon as the user invokes this skill:
15
+ Build the complete input and start the workflow in the same turn. As soon as the user invokes this skill:
16
16
 
17
17
  1. Read the current conversation, active plan, repository instructions, and applicable compute, runtime, credential, deployment, or publication skills.
18
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.
@@ -29,15 +29,73 @@ Derive the workflow input from the full conversation:
29
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
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
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.
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:
35
+
36
+ ```json
37
+ {
38
+ "action": "start",
39
+ "workflow": "monitor",
40
+ "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
+ ```
33
63
 
34
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.
35
65
 
36
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.
37
67
 
38
- 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.
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
+ ```
39
85
 
40
- 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.
86
+ Continue without asking:
87
+
88
+ ```json
89
+ {
90
+ "repair": {
91
+ "approval": {
92
+ "mode": "skip"
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
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.
41
99
 
42
100
  ## Keep routine work moving
43
101
 
@@ -60,23 +118,7 @@ When the paid action remains within the approved method, hardware, concurrency,
60
118
 
61
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.
62
120
 
63
- ## Start the workflow
64
-
65
- Start the built-in workflow in the current session with this shape:
66
-
67
- ```text
68
- workflow({
69
- action: "start",
70
- workflow: "monitor",
71
- input: {
72
- task: "<complete objective, contract, recovery authority, and verification task>",
73
- everyMinutes: 30,
74
- stopWhen: "<derived finish criterion or explicit-user-stop fallback>"
75
- }
76
- })
77
- ```
78
-
79
- Use the user-supplied interval instead of `30` when present. Add `maxChecks` only when the user explicitly supplies that limit. Do not send `reportWhen`; the current monitor reports every accepted check.
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.
80
122
 
81
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.
82
124
 
@@ -115,7 +157,7 @@ Submit observed facts. The workflow computes rates, confidence, remaining work,
115
157
 
116
158
  For several concurrent processes, publish one stable track per process. The Pi widget and viewers show them separately and keep each ETA independent.
117
159
 
118
- 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.
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.
119
161
 
120
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.
121
163
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: pi-workflows
3
- description: Use when creating, reviewing, debugging, starting, inspecting, or controlling Pi Workflows; authoring .workflow.ts files; using the workflow tool; handling workflow step contracts, checkpoints, updates, or progress; or deciding how a task should compose workflow primitives.
4
- compatibility: Requires the Pi Workflows extension.
3
+ description: Use when creating, reviewing, debugging, starting, inspecting, or controlling pi-workflows; authoring .workflow.ts files; using the workflow tool; handling workflow step contracts, checkpoints, updates, or progress; or deciding how a task should compose workflow primitives.
4
+ compatibility: Requires the pi-workflows extension.
5
5
  ---
6
6
 
7
- # Pi Workflows
7
+ # pi-workflows
8
8
 
9
- Use Pi Workflows for durable multi-step work that needs explicit routing, retries, checkpoints, scheduled waits, or progress. Keep simple one-turn work outside a workflow.
9
+ Use pi-workflows for durable multi-step work that needs explicit routing, retries, checkpoints, scheduled waits, or progress. Keep simple one-turn work outside a workflow.
10
10
 
11
11
  The `workflow` tool schema is the authority for call shapes. A workflow step message is the authority for its current step id, attempt id, and expected output. Do not guess these values from an earlier attempt.
12
12
 
@@ -22,7 +22,21 @@ Use the smallest applicable action:
22
22
  - `update` publishes a non-completing durable update for the active step attempt.
23
23
  - `submit` completes the active agent step with its required output.
24
24
 
25
- Use `start` only once for one requested run. Do not build a manual polling loop around a workflow that already schedules its own work. Use the `monitor` skill for monitoring requests.
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
+
27
+ For a workflow without a specialized skill, inspect its input contract and make one complete call. For example:
28
+
29
+ ```json
30
+ {
31
+ "action": "start",
32
+ "workflow": "examples/workflows/echo.workflow.ts",
33
+ "input": {
34
+ "task": "Summarize this repository in one sentence."
35
+ }
36
+ }
37
+ ```
38
+
39
+ Do not build a manual polling loop around a workflow that already schedules its own work. Use the `monitor` skill for monitoring requests.
26
40
 
27
41
  ## Complete agent steps
28
42
 
@@ -57,7 +71,8 @@ Follow these rules:
57
71
  - Give included workflows named exits, map their input explicitly, and keep parent edges out of child internals.
58
72
  - Keep `compute` pure. Put external effects in agent, function-action, or shell-action nodes.
59
73
  - Use structured node outputs for routing.
60
- - 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.
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.
61
76
  - Set explicit step and command timeouts.
62
77
  - Bound ordinary loops with `maxSteps` or another clear finish rule.
63
78
  - Use a controller instead of a workflow for indefinite resource reconciliation.
@@ -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, verifies their claims, and reports one verdict. 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.