@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.
- package/README.md +56 -31
- package/dist/builtins/autodoc.workflow.d.ts +4 -4
- package/dist/builtins/autoimplement.workflow.d.ts +797 -142
- package/dist/builtins/autoimplement.workflow.js +17 -105
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/autoplan.workflow.d.ts +126 -13
- package/dist/builtins/autoplan.workflow.js +200 -29
- package/dist/builtins/autoplan.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +7 -5
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +4 -2
- package/dist/builtins/index.js +3 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +56 -23
- package/dist/builtins/monitor.workflow.js +508 -329
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/pi-agent-group.d.ts +72 -0
- package/dist/builtins/pi-agent-group.js +1087 -0
- package/dist/builtins/pi-agent-group.js.map +1 -0
- package/dist/builtins/plain-summary.workflow.d.ts +32 -0
- package/dist/builtins/plain-summary.workflow.js +134 -0
- package/dist/builtins/plain-summary.workflow.js.map +1 -0
- package/dist/builtins/plan-approval.workflow.d.ts +39 -5
- package/dist/builtins/plan-approval.workflow.js +92 -14
- package/dist/builtins/plan-approval.workflow.js.map +1 -1
- package/dist/builtins/plan-change.workflow.d.ts +449 -0
- package/dist/builtins/plan-change.workflow.js +256 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.js +2 -2
- package/dist/builtins/plan-presentation.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.d.ts +50 -6
- package/dist/builtins/sanity-check.workflow.js +150 -28
- package/dist/builtins/sanity-check.workflow.js.map +1 -1
- package/dist/controllers/effects.d.ts +3 -2
- package/dist/controllers/effects.js +8 -1
- package/dist/controllers/effects.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +1 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/manager.d.ts +1 -0
- package/dist/controllers/manager.js +41 -17
- package/dist/controllers/manager.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +107 -85
- package/dist/controllers/sqlite.js +1611 -1486
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/controllers/store.d.ts +9 -8
- package/dist/controllers/store.js +1 -31
- package/dist/controllers/store.js.map +1 -1
- package/dist/controllers/types.d.ts +3 -0
- package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
- package/dist/controllers/workflow-engine-scheduler.js +3 -5
- package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
- package/dist/controllers/workflows.d.ts +2 -2
- package/dist/controllers/workflows.js +11 -10
- package/dist/controllers/workflows.js.map +1 -1
- package/dist/extension/controller-host.js +2 -2
- package/dist/extension/controller-host.js.map +1 -1
- package/dist/extension/decision-channels.d.ts +4 -2
- package/dist/extension/decision-channels.js +333 -146
- package/dist/extension/decision-channels.js.map +1 -1
- package/dist/extension/executor.d.ts +9 -2
- package/dist/extension/executor.js +89 -2
- package/dist/extension/executor.js.map +1 -1
- package/dist/extension/herdr-viewer.d.ts +0 -1
- package/dist/extension/herdr-viewer.js +0 -4
- package/dist/extension/herdr-viewer.js.map +1 -1
- package/dist/extension/index.js +209 -127
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +3 -10
- package/dist/extension/recorder.js +13 -22
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/session-events.d.ts +2 -2
- package/dist/extension/step-message.d.ts +7 -2
- package/dist/extension/step-message.js +94 -2
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.js +29 -3
- package/dist/extension/widget.js.map +1 -1
- package/dist/host/rpc-executor.d.ts +3 -0
- package/dist/host/rpc-executor.js +2 -0
- package/dist/host/rpc-executor.js.map +1 -1
- package/dist/host/runner.d.ts +3 -6
- package/dist/host/runner.js +83 -32
- package/dist/host/runner.js.map +1 -1
- package/dist/render/graph-render.js +15 -10
- package/dist/render/graph-render.js.map +1 -1
- package/dist/state/database.d.ts +35 -0
- package/dist/state/database.js +287 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/index.d.ts +4 -0
- package/dist/state/index.js +5 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/json.d.ts +6 -0
- package/dist/state/json.js +38 -0
- package/dist/state/json.js.map +1 -0
- package/dist/state/mutation.d.ts +57 -0
- package/dist/state/mutation.js +255 -0
- package/dist/state/mutation.js.map +1 -0
- package/dist/state/schema.d.ts +6 -0
- package/dist/state/schema.js +473 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/viewer/cli.d.ts +2 -2
- package/dist/viewer/cli.js +142 -122
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/render.d.ts +4 -4
- package/dist/viewer/render.js +9 -23
- package/dist/viewer/render.js.map +1 -1
- package/dist/viewer/session-reducer.d.ts +1 -1
- package/dist/viewer/session-reducer.js +1 -1
- package/dist/viewer/tui.d.ts +3 -3
- package/dist/viewer/tui.js +15 -13
- package/dist/viewer/tui.js.map +1 -1
- package/dist/viewer/watch.d.ts +2 -5
- package/dist/viewer/watch.js +13 -13
- package/dist/viewer/watch.js.map +1 -1
- package/dist/workflows/catalog.js +7 -2
- package/dist/workflows/catalog.js.map +1 -1
- package/dist/workflows/composition.js +20 -2
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/decision-presentation.d.ts +1 -1
- package/dist/workflows/decision-presentation.js +51 -38
- package/dist/workflows/decision-presentation.js.map +1 -1
- package/dist/workflows/definition.d.ts +6 -2
- package/dist/workflows/definition.js +17 -0
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +7 -7
- package/dist/workflows/engine.js +196 -115
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +16 -3
- package/dist/workflows/errors.js +18 -3
- package/dist/workflows/errors.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +45 -8
- package/dist/workflows/human-decision.js +641 -274
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +5 -6
- package/dist/workflows/index.js +4 -5
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/progress.d.ts +1 -0
- package/dist/workflows/progress.js +15 -3
- package/dist/workflows/progress.js.map +1 -1
- package/dist/workflows/schema.js +27 -1
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +83 -103
- package/dist/workflows/store.js +907 -951
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +88 -126
- package/docs/CONTROLLERS.md +10 -8
- package/docs/DEFERRED_TURNS.md +2 -2
- package/docs/DESIGN_PHILOSOPHY.md +4 -2
- package/docs/HUMAN_DECISIONS.md +36 -47
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +14 -24
- package/docs/MONITOR.md +179 -237
- package/docs/SQLITE_STATE.md +219 -0
- package/docs/WORKFLOW_COMPOSITION.md +27 -26
- package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
- package/docs/WORKFLOW_UPDATES.md +10 -9
- package/docs/development.md +9 -9
- package/docs/live-replay-protocol.md +28 -37
- package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
- package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
- package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
- package/docs/plans/2026-08-21-sanity-check-plan.md +217 -95
- package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
- package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
- package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
- package/docs/plans/session-event-replay-implementation-plan.md +1 -1
- package/docs/plans/tui-viewer-implementation-plan.md +1 -1
- package/docs/session-event-journal.md +63 -434
- package/docs/tui-viewer.md +13 -15
- package/docs/workflows.md +127 -53
- package/examples/workflows/approved-plan.workflow.ts +19 -46
- package/examples/workflows/plain-summary.workflow.ts +1 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +7 -7
- package/plugins/herdr/viewer.mjs +1 -11
- package/schemas/human-decision-accepted-v1.schema.json +15 -3
- package/schemas/human-decision-continuation-v1.schema.json +10 -1
- package/schemas/human-decision-delivery-v1.schema.json +8 -0
- package/schemas/human-decision-receipt-v1.schema.json +8 -0
- package/schemas/human-decision-request-v1.schema.json +24 -4
- package/skills/autoimplement/SKILL.md +27 -0
- package/skills/autoplan/SKILL.md +5 -4
- package/skills/monitor/SKILL.md +91 -135
- package/skills/pi-workflows/SKILL.md +9 -8
- package/skills/sanity-check/SKILL.md +44 -0
- package/src/builtins/autoimplement.workflow.ts +19 -118
- package/src/builtins/autoplan.workflow.ts +290 -40
- package/src/builtins/catalog.ts +7 -5
- package/src/builtins/index.ts +18 -1
- package/src/builtins/monitor.workflow.ts +673 -382
- package/src/builtins/pi-agent-group.ts +1407 -0
- package/src/builtins/plain-summary.workflow.ts +185 -0
- package/src/builtins/plan-approval.workflow.ts +157 -24
- package/src/builtins/plan-change.workflow.ts +321 -0
- package/src/builtins/plan-presentation.ts +2 -2
- package/src/builtins/sanity-check.workflow.ts +248 -48
- package/src/controllers/effects.ts +7 -0
- package/src/controllers/index.ts +0 -6
- package/src/controllers/manager.ts +72 -32
- package/src/controllers/sqlite.ts +2420 -1948
- package/src/controllers/store.ts +17 -38
- package/src/controllers/types.ts +3 -0
- package/src/controllers/workflow-engine-scheduler.ts +4 -8
- package/src/controllers/workflows.ts +45 -21
- package/src/extension/controller-host.ts +1 -2
- package/src/extension/decision-channels.ts +456 -203
- package/src/extension/executor.ts +105 -2
- package/src/extension/herdr-viewer.ts +0 -5
- package/src/extension/index.ts +251 -151
- package/src/extension/recorder.ts +13 -22
- package/src/extension/session-events.ts +2 -2
- package/src/extension/step-message.ts +106 -4
- package/src/extension/widget.ts +32 -5
- package/src/host/rpc-executor.ts +4 -0
- package/src/host/runner.ts +93 -41
- package/src/render/graph-render.ts +12 -6
- package/src/state/database.ts +375 -0
- package/src/state/index.ts +29 -0
- package/src/state/json.ts +42 -0
- package/src/state/mutation.ts +435 -0
- package/src/state/schema.ts +475 -0
- package/src/viewer/cli.ts +151 -144
- package/src/viewer/render.ts +19 -30
- package/src/viewer/session-reducer.ts +1 -1
- package/src/viewer/tui.ts +18 -17
- package/src/viewer/watch.ts +13 -17
- package/src/workflows/catalog.ts +7 -2
- package/src/workflows/composition.ts +21 -3
- package/src/workflows/decision-presentation.ts +56 -43
- package/src/workflows/definition.ts +36 -3
- package/src/workflows/engine.ts +228 -130
- package/src/workflows/errors.ts +27 -3
- package/src/workflows/human-decision.ts +921 -349
- package/src/workflows/index.ts +20 -30
- package/src/workflows/progress.ts +18 -3
- package/src/workflows/schema.ts +36 -1
- package/src/workflows/store.ts +1300 -1163
- package/src/workflows/types.ts +100 -137
- package/dist/builtins/sanity-check-session.d.ts +0 -17
- package/dist/builtins/sanity-check-session.js +0 -168
- package/dist/builtins/sanity-check-session.js.map +0 -1
- package/dist/workflows/artifacts.d.ts +0 -40
- package/dist/workflows/artifacts.js +0 -155
- package/dist/workflows/artifacts.js.map +0 -1
- package/dist/workflows/migrate-sources.d.ts +0 -42
- package/dist/workflows/migrate-sources.js +0 -133
- package/dist/workflows/migrate-sources.js.map +0 -1
- package/docs/run-bundles.md +0 -481
- package/schemas/human-decision-accepted-v2.schema.json +0 -50
- package/schemas/human-decision-delivery-v2.schema.json +0 -36
- package/schemas/human-decision-receipt-v2.schema.json +0 -39
- package/schemas/human-decision-request-v2.schema.json +0 -69
- package/schemas/human-decision-resolution-v2.schema.json +0 -27
- package/src/builtins/sanity-check-session.ts +0 -205
- package/src/workflows/artifacts.ts +0 -188
- 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
|
-
"
|
|
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
|
-
"
|
|
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.
|
package/skills/autoplan/SKILL.md
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
package/skills/monitor/SKILL.md
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
|
13
|
+
## Start the workflow
|
|
14
14
|
|
|
15
|
-
Build the complete input
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
24
|
+
Do not send any other field. Inputs such as `repair`, `checkTimeoutMinutes`, `reportWhen`, and `audience` are invalid.
|
|
26
25
|
|
|
27
|
-
|
|
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
|
-
|
|
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": "
|
|
42
|
-
"
|
|
43
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
44
|
+
## Observation steps
|
|
84
45
|
|
|
85
|
-
|
|
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
|
-
|
|
48
|
+
Answer these questions:
|
|
88
49
|
|
|
89
|
-
|
|
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
|
-
|
|
57
|
+
Select one route:
|
|
92
58
|
|
|
93
|
-
|
|
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
|
-
|
|
63
|
+
Keep Monitor state, goal state, and target work state separate. Never call the target running because Monitor itself is active.
|
|
96
64
|
|
|
97
|
-
|
|
65
|
+
For `act`, provide one exact action with:
|
|
98
66
|
|
|
99
|
-
|
|
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
|
-
|
|
77
|
+
An action description records authority. It does not create authority.
|
|
102
78
|
|
|
103
|
-
|
|
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
|
-
|
|
81
|
+
`advance` starts or continues normal requested work. `recover` restarts or resumes work after an operational stop.
|
|
112
82
|
|
|
113
|
-
|
|
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
|
-
|
|
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
|
-
|
|
87
|
+
## Repair steps
|
|
118
88
|
|
|
119
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
97
|
+
## Authority and paid work
|
|
131
98
|
|
|
132
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
107
|
+
## Progress
|
|
141
108
|
|
|
142
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
115
|
+
## Reports
|
|
149
116
|
|
|
150
|
-
|
|
117
|
+
Every accepted observation produces one status notification. Use this form when target work is active:
|
|
151
118
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
128
|
+
Use this form when the target is idle and an action will run:
|
|
181
129
|
|
|
182
|
-
|
|
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
|
-
|
|
137
|
+
Show absolute progress before deltas. Do not invent an ETA.
|
|
185
138
|
|
|
186
|
-
##
|
|
139
|
+
## Stop conditions
|
|
187
140
|
|
|
188
|
-
|
|
141
|
+
Stop when:
|
|
189
142
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
47
|
-
3.
|
|
48
|
-
4.
|
|
49
|
-
5. After
|
|
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
|
|
74
|
-
- Use an ordinary checkpoint for external continuation data that the model may submit. Use `humanDecision()` for a verified human choice
|
|
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`
|
|
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.
|