@osolmaz/pi-workflows 0.13.0 → 0.13.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.
- package/README.md +7 -5
- package/dist/builtins/autodoc.workflow.d.ts +191 -4
- package/dist/builtins/autodoc.workflow.js +156 -30
- package/dist/builtins/autodoc.workflow.js.map +1 -1
- package/dist/builtins/autoimplement-command-batches.d.ts +1 -0
- package/dist/builtins/autoimplement-command-batches.js +29 -31
- package/dist/builtins/autoimplement-command-batches.js.map +1 -1
- package/dist/builtins/autoimplement.workflow.d.ts +1255 -29
- package/dist/builtins/autoimplement.workflow.js +416 -153
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +2 -2
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/change-verification.workflow.d.ts +110 -0
- package/dist/builtins/change-verification.workflow.js +860 -0
- package/dist/builtins/change-verification.workflow.js.map +1 -0
- package/dist/builtins/monitor.workflow.js +4 -3
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/plan-change.workflow.d.ts +359 -6
- package/dist/builtins/plan-change.workflow.js +26 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -1
- package/dist/builtins/workspace-preparation.workflow.d.ts +75 -0
- package/dist/builtins/workspace-preparation.workflow.js +498 -0
- package/dist/builtins/workspace-preparation.workflow.js.map +1 -0
- package/dist/extension/executor.js +1 -4
- package/dist/extension/executor.js.map +1 -1
- package/dist/extension/index.js +0 -14
- package/dist/extension/index.js.map +1 -1
- package/docs/WORKFLOW_COMPOSITION.md +8 -0
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +1 -1
- package/docs/plans/2026-08-24-change-scoped-verification-plan.md +419 -0
- package/docs/workflows.md +8 -13
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/skills/autodoc/SKILL.md +7 -0
- package/skills/autoimplement/SKILL.md +4 -0
- package/src/builtins/autodoc.workflow.ts +184 -33
- package/src/builtins/autoimplement-command-batches.ts +39 -33
- package/src/builtins/autoimplement.workflow.ts +483 -175
- package/src/builtins/catalog.ts +2 -2
- package/src/builtins/change-verification.workflow.ts +1143 -0
- package/src/builtins/monitor.workflow.ts +6 -3
- package/src/builtins/plan-change.workflow.ts +35 -0
- package/src/builtins/workspace-preparation.workflow.ts +668 -0
- package/src/extension/executor.ts +1 -4
- package/src/extension/index.ts +0 -14
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Make Autoimplement verification change-scoped
|
|
3
|
+
author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
|
|
4
|
+
date: 2026-08-24
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Make Autoimplement verification change-scoped
|
|
8
|
+
|
|
9
|
+
Autoimplement and Autodoc must judge the current change, not the complete health of the repository. A check failure that already exists on the base branch must stay visible, but it must not stop unrelated work. A new failure caused by the current change must enter a bounded fix-and-check loop.
|
|
10
|
+
|
|
11
|
+
Known commands and safe mechanical fixes must run as program actions. The model must handle only work that needs judgment, such as proposing a branch name, editing prose, changing code, or classifying evidence that a direct comparison cannot settle.
|
|
12
|
+
|
|
13
|
+
This plan also fixes the related workflow problems found during the failed Autoimplement run on 2026-08-24:
|
|
14
|
+
|
|
15
|
+
- documentation verification returns one Boolean result;
|
|
16
|
+
- a documentation failure stops without a repair loop;
|
|
17
|
+
- an included Autodoc blocker bypasses Autoimplement's blocker challenge;
|
|
18
|
+
- documentation can change before Autoimplement selects a safe workspace;
|
|
19
|
+
- the same model can edit documents and run deterministic checks;
|
|
20
|
+
- repository-wide failures are not compared with the base branch;
|
|
21
|
+
- the final blocked result can lose the original reason and evidence;
|
|
22
|
+
- ordinary node failures can stop without safe recovery;
|
|
23
|
+
- a mistaken missing-plan result can stop without challenge; and
|
|
24
|
+
- documentation failure has no clear handoff back to implementation.
|
|
25
|
+
|
|
26
|
+
The failed SimpleDoc check that exposed these problems was unchanged on the candidate and a clean `origin/main` worktree. It reported the same 30 renames, 32 frontmatter insertions, and 8 reference updates in both places. Formatting, links, privacy, whitespace, and changed-file digests passed. Autoimplement should have reported the SimpleDoc backlog and continued.
|
|
27
|
+
|
|
28
|
+
## Goal
|
|
29
|
+
|
|
30
|
+
Add two reusable internal workflow compositions:
|
|
31
|
+
|
|
32
|
+
1. workspace preparation, which selects and confirms where edits will happen; and
|
|
33
|
+
2. change verification, which runs checks, compares eligible failures with the base branch, repairs current-change failures, and preserves exact evidence.
|
|
34
|
+
|
|
35
|
+
Use them in Autodoc first. Then apply the same result and routing rules to Autoimplement's local checks, review commands, CI inspection, and delivery. Keep each stage's external actions separate. Do not add a general effect runner or a workflow-engine primitive.
|
|
36
|
+
|
|
37
|
+
## Principles
|
|
38
|
+
|
|
39
|
+
- Prepare the workspace before the first edit.
|
|
40
|
+
- Let the model propose names and make semantic decisions.
|
|
41
|
+
- Let program actions run Git commands, checks, comparisons, and safe mechanical fixes.
|
|
42
|
+
- Judge failures against the current change.
|
|
43
|
+
- Keep all base failures visible.
|
|
44
|
+
- Repair new failures within a fixed limit.
|
|
45
|
+
- Challenge every claimed blocker except explicit cancellation and verified human rejection.
|
|
46
|
+
- Observe a possible partial effect before retrying a mutating step.
|
|
47
|
+
- Keep the graph explicit, durable, bounded, and easy to inspect.
|
|
48
|
+
|
|
49
|
+
## Workspace selection
|
|
50
|
+
|
|
51
|
+
Autoimplement gains a `workspaceMode` input with these values:
|
|
52
|
+
|
|
53
|
+
- `auto`: select the safest allowed mode from the current repository state and authority;
|
|
54
|
+
- `branch`: work in the current checkout on a task branch;
|
|
55
|
+
- `worktree`: work in a standard sibling worktree on a task branch; and
|
|
56
|
+
- `defaultBranch`: work directly on the repository's real default branch.
|
|
57
|
+
|
|
58
|
+
`auto` is the default. It follows these rules:
|
|
59
|
+
|
|
60
|
+
1. Keep the current branch when it is already the correct non-default task branch.
|
|
61
|
+
2. For a clean default branch, ask the workspace-planning model for a clear task branch name, then create or confirm that branch programmatically.
|
|
62
|
+
3. When unrelated changes must remain in the current checkout, ask for a task branch name and create a standard sibling worktree programmatically.
|
|
63
|
+
4. Use `defaultBranch` only when the task authority or repository policy explicitly permits direct work on the default branch.
|
|
64
|
+
|
|
65
|
+
For `branch` and `worktree`, the model proposes the branch name. A program action validates and applies the proposal. Validation rejects an empty name, an invalid Git reference, a reserved or conflicting name, the wrong base, a path outside the standard worktree location, and a proposal that would move or overwrite existing work.
|
|
66
|
+
|
|
67
|
+
For `defaultBranch`, no task branch or worktree is created. A program action confirms all of these facts before mutation:
|
|
68
|
+
|
|
69
|
+
- the checked-out branch is the repository's actual default branch;
|
|
70
|
+
- direct default-branch work is authorized by the request or repository policy;
|
|
71
|
+
- the expected base revision is current;
|
|
72
|
+
- existing unrelated changes will not be overwritten or included; and
|
|
73
|
+
- later commit and push actions stay within their separate authority.
|
|
74
|
+
|
|
75
|
+
Working directly on the default branch does not imply commit, push, merge, release, or deployment authority. Delivery must support a direct-default result: commit and push only when authorized, otherwise leave the verified local change and report it. It must not try to open a pull request from the default branch to itself.
|
|
76
|
+
|
|
77
|
+
The workspace result becomes the source of truth for later paths. It records:
|
|
78
|
+
|
|
79
|
+
- mode;
|
|
80
|
+
- repository path;
|
|
81
|
+
- worktree path when applicable;
|
|
82
|
+
- base branch and base revision;
|
|
83
|
+
- work branch;
|
|
84
|
+
- whether direct default-branch work is authorized;
|
|
85
|
+
- pre-existing changed paths;
|
|
86
|
+
- creation or adoption evidence; and
|
|
87
|
+
- the scope that later stages may change.
|
|
88
|
+
|
|
89
|
+
All later prompts and actions use the prepared absolute path. They do not fall back to the Pi process working directory.
|
|
90
|
+
|
|
91
|
+
## Programmatic checks
|
|
92
|
+
|
|
93
|
+
Known checks run through action or shell nodes. The model does not run them through tools inside an agent step.
|
|
94
|
+
|
|
95
|
+
Each check request records:
|
|
96
|
+
|
|
97
|
+
- a stable ID;
|
|
98
|
+
- executable and argument array;
|
|
99
|
+
- absolute working directory;
|
|
100
|
+
- timeout;
|
|
101
|
+
- output limit;
|
|
102
|
+
- whether the command is read-only;
|
|
103
|
+
- whether it is eligible for base comparison;
|
|
104
|
+
- whether it supports changed-file scope; and
|
|
105
|
+
- the finding format when the tool provides one.
|
|
106
|
+
|
|
107
|
+
A command request cannot use a shell wrapper, hidden environment changes, standard input, or an unbounded timeout. Verification records the exit code, signal, duration, stdout, stderr, truncation state, timeout state, and spawn failure. A truncated or incomplete result cannot pass.
|
|
108
|
+
|
|
109
|
+
Repository guidance remains the first source for command selection. If it gives a complete command list, the workflow uses it without a model turn. If it does not, one model step proposes a structured command plan. Program code validates that plan before execution.
|
|
110
|
+
|
|
111
|
+
## Candidate and base comparison
|
|
112
|
+
|
|
113
|
+
When a repository-wide read-only check fails and the output does not prove that the current change caused it, change verification runs the same command on a temporary detached worktree at the selected base revision.
|
|
114
|
+
|
|
115
|
+
The base action must:
|
|
116
|
+
|
|
117
|
+
1. create a temporary worktree outside the candidate checkout;
|
|
118
|
+
2. run only checks marked read-only and base-eligible;
|
|
119
|
+
3. use the same executable, arguments, timeout, and output limit;
|
|
120
|
+
4. record setup and dependency limitations;
|
|
121
|
+
5. remove the temporary worktree in a bounded cleanup path; and
|
|
122
|
+
6. preserve cleanup evidence if removal fails.
|
|
123
|
+
|
|
124
|
+
Comparison first uses stable finding IDs when a tool provides them. Otherwise it normalizes only line endings and the temporary worktree path. It does not remove timestamps, counts, file names, or other facts merely to make outputs match.
|
|
125
|
+
|
|
126
|
+
The result separates:
|
|
127
|
+
|
|
128
|
+
- `relatedFailures`: new failures caused by the candidate change;
|
|
129
|
+
- `unrelatedFailures`: matching failures already present on the base;
|
|
130
|
+
- `fixedBaselineFailures`: base failures that the candidate removes;
|
|
131
|
+
- `unknownFailures`: differences that available evidence cannot attribute safely;
|
|
132
|
+
- `untestedChecks`: checks that could not produce complete evidence; and
|
|
133
|
+
- the complete candidate and base command results.
|
|
134
|
+
|
|
135
|
+
Unrelated failures are reported but do not fail the current change. Unknown failures require bounded model judgment or blocker challenge. A `ready` result requires complete candidate checks and no related or unknown failure.
|
|
136
|
+
|
|
137
|
+
## Repair and recheck
|
|
138
|
+
|
|
139
|
+
A change-related failure enters a bounded repair loop. Start with two repair attempts. Keep the limit explicit in the workflow graph.
|
|
140
|
+
|
|
141
|
+
Mechanical repair is allowed only when the command plan declares:
|
|
142
|
+
|
|
143
|
+
- the direct executable and arguments;
|
|
144
|
+
- the exact changed files it may edit;
|
|
145
|
+
- the check IDs it is expected to fix;
|
|
146
|
+
- its timeout; and
|
|
147
|
+
- the expected type of diff.
|
|
148
|
+
|
|
149
|
+
The action records the diff before and after the fixer. It rejects an edit outside the declared files. It does not infer or run a broad repository migration such as applying all SimpleDoc recommendations to an old repository.
|
|
150
|
+
|
|
151
|
+
When no safe mechanical fix exists, a model repair step receives the approved plan plus related and unknown failures. It does not receive unrelated failures as work to fix. It may make semantic documentation or code changes only inside the prepared workspace and declared scope.
|
|
152
|
+
|
|
153
|
+
After each repair, the same programmatic checks run again. Stop the loop when:
|
|
154
|
+
|
|
155
|
+
- verification succeeds;
|
|
156
|
+
- the repair makes no diff;
|
|
157
|
+
- the failure fingerprint repeats; or
|
|
158
|
+
- the attempt limit is reached.
|
|
159
|
+
|
|
160
|
+
An exhausted repair loop creates a complete blocker claim and goes to blocker challenge. It does not stop directly.
|
|
161
|
+
|
|
162
|
+
## Shared verification result
|
|
163
|
+
|
|
164
|
+
Replace stage-specific Boolean results with one internal result shape. It uses these routes:
|
|
165
|
+
|
|
166
|
+
- `ready`: all current-change checks passed;
|
|
167
|
+
- `repairable`: a safe repair path exists;
|
|
168
|
+
- `needsJudgment`: evidence is complete but attribution or repair needs model judgment; and
|
|
169
|
+
- `blocked`: a material outside-scope problem remains after safe recovery.
|
|
170
|
+
|
|
171
|
+
The result records:
|
|
172
|
+
|
|
173
|
+
- originating workflow and qualified node;
|
|
174
|
+
- current workspace identity;
|
|
175
|
+
- changed files;
|
|
176
|
+
- candidate commands;
|
|
177
|
+
- base commands;
|
|
178
|
+
- related, unrelated, fixed, unknown, and untested findings;
|
|
179
|
+
- repair attempts and failure fingerprints;
|
|
180
|
+
- output references;
|
|
181
|
+
- reason; and
|
|
182
|
+
- concrete evidence.
|
|
183
|
+
|
|
184
|
+
Keep large command output in the existing action result and refer to it from findings. Do not copy large output into each failure entry.
|
|
185
|
+
|
|
186
|
+
## Autodoc changes
|
|
187
|
+
|
|
188
|
+
Autodoc keeps model steps for these tasks:
|
|
189
|
+
|
|
190
|
+
- finding or confirming the selected plan;
|
|
191
|
+
- choosing canonical documentation;
|
|
192
|
+
- writing or updating prose; and
|
|
193
|
+
- repairing semantic documentation failures.
|
|
194
|
+
|
|
195
|
+
Autodoc uses program steps for:
|
|
196
|
+
|
|
197
|
+
- workspace preparation when an update is required;
|
|
198
|
+
- documentation checks;
|
|
199
|
+
- base comparison;
|
|
200
|
+
- safe mechanical fixes;
|
|
201
|
+
- result classification when exact comparison is sufficient; and
|
|
202
|
+
- graph routing.
|
|
203
|
+
|
|
204
|
+
Replace `verifyDocumentation` and its `passed` Boolean with the shared change-verification composition. A matching base SimpleDoc failure returns `ready` with visible unrelated failures. A new documentation failure enters repair and recheck.
|
|
205
|
+
|
|
206
|
+
Autodoc's blocked exit must preserve the originating node, exact command evidence, related and unrelated failures, all repair attempts, and the accepted reason. Its blocked reason must not ignore verification output.
|
|
207
|
+
|
|
208
|
+
## Autoimplement changes
|
|
209
|
+
|
|
210
|
+
Run workspace preparation before the first edit-capable node. Read-only plan discovery may run first. Documentation updates and implementation must use the prepared workspace.
|
|
211
|
+
|
|
212
|
+
Route these blocker sources through one challenge path:
|
|
213
|
+
|
|
214
|
+
- included Autodoc blocked exits;
|
|
215
|
+
- missing-plan claims;
|
|
216
|
+
- implementation classification;
|
|
217
|
+
- local verification;
|
|
218
|
+
- review command failures;
|
|
219
|
+
- review findings that claim an external block;
|
|
220
|
+
- CI inspection and CI command failures;
|
|
221
|
+
- delivery failures;
|
|
222
|
+
- exhausted repair loops; and
|
|
223
|
+
- ordinary node execution failures that safe recovery cannot resolve.
|
|
224
|
+
|
|
225
|
+
Explicit cancellation and verified human rejection remain terminal and bypass challenge.
|
|
226
|
+
|
|
227
|
+
A mistaken missing-plan claim may return to bounded discovery or adopt a plan already proved by the input or canonical documents. The challenge cannot invent an initial plan.
|
|
228
|
+
|
|
229
|
+
The blocker challenge must return the next practical stage, such as plan discovery, documentation, implementation, repair, review, CI inspection, delivery, redesign, or terminal blocked. A stable counter and failure fingerprint prevent loops.
|
|
230
|
+
|
|
231
|
+
## Ordinary node failures
|
|
232
|
+
|
|
233
|
+
Extend the current timeout fallback into one bounded step-failure recovery path. Classify workflow steps as:
|
|
234
|
+
|
|
235
|
+
- pure;
|
|
236
|
+
- read-only;
|
|
237
|
+
- idempotent mutation; or
|
|
238
|
+
- mutation that needs observation before retry.
|
|
239
|
+
|
|
240
|
+
Pure and read-only failures can retry within the limit. For a mutating step, inspect durable repository or remote state first. Adopt an effect that already completed. Retry only the missing effect. Send an unsupported or ambiguous effect to blocker challenge with exact evidence.
|
|
241
|
+
|
|
242
|
+
This policy applies to both timeouts and ordinary failed outcomes. It never recovers explicit cancellation.
|
|
243
|
+
|
|
244
|
+
Examples:
|
|
245
|
+
|
|
246
|
+
- inspect the current diff before repeating a model edit;
|
|
247
|
+
- inspect commits before repeating a commit;
|
|
248
|
+
- inspect the remote branch after a lost push response;
|
|
249
|
+
- inspect existing comments before posting again;
|
|
250
|
+
- inspect merge state before repeating merge; and
|
|
251
|
+
- inspect recorded action output before rerunning a command batch.
|
|
252
|
+
|
|
253
|
+
## Later Autoimplement stages
|
|
254
|
+
|
|
255
|
+
Apply the same related, unrelated, unknown, repairable, and blocked meanings to:
|
|
256
|
+
|
|
257
|
+
- local verification;
|
|
258
|
+
- reviewer command execution;
|
|
259
|
+
- CI inspection; and
|
|
260
|
+
- delivery verification.
|
|
261
|
+
|
|
262
|
+
Keep separate adapters for local commands, reviewer output, CI providers, pull-request comments, commits, pushes, and merges. Do not place all effects behind one universal runner.
|
|
263
|
+
|
|
264
|
+
CI failures that predate the candidate or belong to an unrelated target remain visible and do not fail the current change. When local reproduction is not possible, use provider evidence and model judgment. Never classify an unavailable or truncated result as unrelated automatically.
|
|
265
|
+
|
|
266
|
+
## Blocker evidence
|
|
267
|
+
|
|
268
|
+
Create a durable blocker claim before challenge. It records:
|
|
269
|
+
|
|
270
|
+
- qualified source node;
|
|
271
|
+
- node attempt ID;
|
|
272
|
+
- current route;
|
|
273
|
+
- exact reason;
|
|
274
|
+
- evidence references;
|
|
275
|
+
- failed commands;
|
|
276
|
+
- related and unrelated failures;
|
|
277
|
+
- recovery attempts;
|
|
278
|
+
- alternatives checked; and
|
|
279
|
+
- the authority or external fact that could prevent progress.
|
|
280
|
+
|
|
281
|
+
Parent workflows preserve included child evidence. The final blocked result uses the accepted claim directly. It must not replace available evidence with a generic reason or `null`.
|
|
282
|
+
|
|
283
|
+
## Implementation order
|
|
284
|
+
|
|
285
|
+
Implement the change in these complete slices:
|
|
286
|
+
|
|
287
|
+
1. Add the regression for the 2026-08-24 SimpleDoc incident.
|
|
288
|
+
2. Add shared types, validation, finding comparison, and evidence helpers.
|
|
289
|
+
3. Add workspace planning and programmatic workspace preparation with all four modes.
|
|
290
|
+
4. Add candidate checks, base checks, comparison, and temporary worktree cleanup.
|
|
291
|
+
5. Add mechanical and semantic repair with bounded recheck.
|
|
292
|
+
6. Migrate Autodoc and remove the Boolean verification route.
|
|
293
|
+
7. Put workspace preparation before Autoimplement mutation and pass its path to every later stage.
|
|
294
|
+
8. Route all blocker claims through one challenge and preserve qualified child evidence.
|
|
295
|
+
9. Extend timeout fallback to safe ordinary-failure recovery.
|
|
296
|
+
10. Apply the shared verification meanings to local checks, review, CI, and delivery.
|
|
297
|
+
11. Update skills, workflow documentation, examples, and built-in revision data.
|
|
298
|
+
12. Run focused, full, persistence, and real-Pi tests before release.
|
|
299
|
+
|
|
300
|
+
Each slice must compile and pass its focused tests. Use a hard replacement during alpha. Do not keep the old Boolean route, duplicate verification path, compatibility alias, or feature flag.
|
|
301
|
+
|
|
302
|
+
## Tests
|
|
303
|
+
|
|
304
|
+
### Workspace
|
|
305
|
+
|
|
306
|
+
- A clean default branch in `auto` mode gets an LLM-proposed, programmatically created task branch.
|
|
307
|
+
- An existing correct task branch is adopted without creating another branch.
|
|
308
|
+
- A dirty default checkout gets an LLM-proposed branch in a standard sibling worktree.
|
|
309
|
+
- Explicit `branch` and `worktree` modes use the proposed name only after programmatic validation.
|
|
310
|
+
- `defaultBranch` succeeds only with direct-work authority and the actual default branch checked out.
|
|
311
|
+
- `defaultBranch` does not imply commit or push authority and never opens a pull request to itself.
|
|
312
|
+
- Detached HEAD, wrong base, invalid name, name conflict, hook failure, and worktree cleanup failure preserve evidence and route safely.
|
|
313
|
+
- Existing user changes are never stashed, reset, moved, overwritten, or included.
|
|
314
|
+
- Restart adopts the same prepared workspace instead of creating another one.
|
|
315
|
+
|
|
316
|
+
### Verification
|
|
317
|
+
|
|
318
|
+
- All candidate checks pass.
|
|
319
|
+
- Candidate and base fail with the same SimpleDoc backlog; the run reports it as unrelated and continues.
|
|
320
|
+
- A candidate-only documentation failure is related.
|
|
321
|
+
- A base-only failure is recorded as fixed by the candidate.
|
|
322
|
+
- Base setup or command failure stays unknown.
|
|
323
|
+
- Timeout, spawn failure, cancellation, and output truncation cannot pass.
|
|
324
|
+
- Finding order and temporary worktree paths do not cause false differences.
|
|
325
|
+
- Only read-only base-eligible checks run on the base.
|
|
326
|
+
- Temporary base worktrees are cleaned after success, failure, restart, and cancellation.
|
|
327
|
+
|
|
328
|
+
### Repair
|
|
329
|
+
|
|
330
|
+
- An allowlisted formatter changes only declared files and verification then passes.
|
|
331
|
+
- A fixer that changes an undeclared file is rejected with the diff preserved as evidence.
|
|
332
|
+
- A broad repository migration is not run automatically.
|
|
333
|
+
- Semantic repair sees related and unknown failures, not unrelated backlog.
|
|
334
|
+
- No diff, repeated fingerprint, and attempt exhaustion stop the loop and enter blocker challenge.
|
|
335
|
+
|
|
336
|
+
### Routing and evidence
|
|
337
|
+
|
|
338
|
+
- An included Autodoc blocker reaches the shared challenge.
|
|
339
|
+
- A mistaken missing-plan claim retries discovery or adopts proved input without inventing a plan.
|
|
340
|
+
- Every non-exempt blocker source reaches challenge.
|
|
341
|
+
- Explicit cancellation and verified human rejection stay terminal.
|
|
342
|
+
- Qualified child evidence survives composition, restart, and final presentation.
|
|
343
|
+
- The final blocked result names the source node, commands, reason, evidence, and recovery attempts.
|
|
344
|
+
|
|
345
|
+
### Failure recovery
|
|
346
|
+
|
|
347
|
+
- Safe read-only and pure steps retry within the limit.
|
|
348
|
+
- A partial local edit is inspected before continuation.
|
|
349
|
+
- A lost push or comment response is adopted when the remote effect exists.
|
|
350
|
+
- An uncertain consequential effect is not replayed blindly.
|
|
351
|
+
- Repeated failures stop at the bounded challenge path.
|
|
352
|
+
- Existing timeout behavior remains covered by the new general path.
|
|
353
|
+
|
|
354
|
+
### Complete workflow
|
|
355
|
+
|
|
356
|
+
- A real-Pi Autoimplement fixture with a matching base SimpleDoc failure reaches implementation.
|
|
357
|
+
- A change-related documentation failure is repaired and rechecked.
|
|
358
|
+
- A true repository-rule or authority blocker ends with complete evidence.
|
|
359
|
+
- Documentation, local checks, review, CI, and delivery use the same failure meanings.
|
|
360
|
+
- Old terminal run data remains readable.
|
|
361
|
+
- Active runs with an incompatible built-in revision refuse unsafe resume.
|
|
362
|
+
|
|
363
|
+
## Acceptance criteria
|
|
364
|
+
|
|
365
|
+
- No edit-capable node runs before workspace confirmation.
|
|
366
|
+
- The model proposes every new branch name; program actions validate and create branches and worktrees.
|
|
367
|
+
- `auto`, `branch`, `worktree`, and `defaultBranch` modes work as specified.
|
|
368
|
+
- Known checks and mechanical fixes run programmatically.
|
|
369
|
+
- Candidate and base results are recorded separately.
|
|
370
|
+
- Matching base failures remain visible and do not block the current change.
|
|
371
|
+
- New failures enter a bounded repair and recheck loop.
|
|
372
|
+
- No included blocker bypasses challenge.
|
|
373
|
+
- Missing-plan and ordinary-failure claims have bounded recovery.
|
|
374
|
+
- Final blocked results preserve the original reason and evidence.
|
|
375
|
+
- The same policy applies to documentation, local verification, review, CI, and delivery.
|
|
376
|
+
- The implementation uses existing workflow primitives and adds no Pi core change or engine primitive.
|
|
377
|
+
- Full repository and real-Pi tests pass.
|
|
378
|
+
|
|
379
|
+
## Rollout
|
|
380
|
+
|
|
381
|
+
This is a hard built-in replacement under the alpha policy.
|
|
382
|
+
|
|
383
|
+
Land the pure contracts and tests first. Then land workspace preparation, Autodoc migration, Autoimplement blocker and failure recovery, and later-stage adapters in that order. Keep each commit complete and reversible.
|
|
384
|
+
|
|
385
|
+
Finish or cancel active runs that use the old built-in definitions before package reload. Old terminal runs remain readable. An active run with an incompatible source revision continues to use the existing revision guard and must restart rather than mixing graphs.
|
|
386
|
+
|
|
387
|
+
After implementation, update [Workflow authoring reference](../workflows.md), [Workflow composition](../WORKFLOW_COMPOSITION.md), the Autoimplement and Autodoc skills, examples, and built-in revision records. Reload or restart Pi and verify discovery through the installed package path.
|
|
388
|
+
|
|
389
|
+
Do not release or deploy this change without separate authority.
|
|
390
|
+
|
|
391
|
+
## Boundaries
|
|
392
|
+
|
|
393
|
+
- Do not modify Pi core or use a private Pi API.
|
|
394
|
+
- Do not add a workflow-engine primitive, hidden retry, service, database, daemon, or external store.
|
|
395
|
+
- Do not change SimpleDoc, Git, GitHub, CI provider, or target repository behavior.
|
|
396
|
+
- Do not require repositories to add a machine-readable quality manifest.
|
|
397
|
+
- Do not run broad repository migrations automatically.
|
|
398
|
+
- Do not use the model for deterministic command execution, counting, comparison, or routing.
|
|
399
|
+
- Do not hide baseline, nonzero, unknown, or truncated command results.
|
|
400
|
+
- Do not overwrite, stash, reset, or silently move existing user work.
|
|
401
|
+
- Do not merge different remote effects into one universal runner.
|
|
402
|
+
- Do not preserve the superseded alpha behavior through compatibility code.
|
|
403
|
+
|
|
404
|
+
## Contract impact
|
|
405
|
+
|
|
406
|
+
- **Session state:** normal workflow prompts, action results, model results, and final presentation only.
|
|
407
|
+
- **Other persistent data:** normal node outputs in the existing SQLite state. No new persistence location.
|
|
408
|
+
- **Pi internals:** none.
|
|
409
|
+
- **Public Pi API:** existing documented extension and tool interfaces only.
|
|
410
|
+
- **Autoimplement input:** add optional `workspaceMode` with `auto`, `branch`, `worktree`, and `defaultBranch`. Omission means `auto`.
|
|
411
|
+
- **Autodoc input:** add optional base, scope, workspace mode, and prepared-workspace fields so standalone and included runs use the same safety rules.
|
|
412
|
+
- **Public pi-workflows API:** existing `agent`, `action`, `shell`, `compute`, `includeWorkflow`, named exits, structured outputs, command batches, and edge routing. Shared verification and workspace result contracts remain internal unless later use proves a public need.
|
|
413
|
+
|
|
414
|
+
## Related plans
|
|
415
|
+
|
|
416
|
+
- [Confirm blockers before autoimplement stops](2026-08-20-autoimplement-blocker-challenge-plan.md)
|
|
417
|
+
- [Run independent commands in bounded batches](2026-08-20-bounded-command-batches-plan.md)
|
|
418
|
+
- [Add Autoimplement timeout fallback](2026-08-21-autoimplement-timeout-fallback-plan.md)
|
|
419
|
+
- [Add shared plan-change approval](2026-08-21-plan-change-approval-policy-plan.md)
|
package/docs/workflows.md
CHANGED
|
@@ -456,7 +456,7 @@ The built-in `autoplan` workflow records two through four practical candidates,
|
|
|
456
456
|
describes the ideal separately, chooses one option, records a rejection reason
|
|
457
457
|
for every other explicit option, and writes a detailed plan. It then includes
|
|
458
458
|
`plain-summary` to show the chosen plan, its main steps, and the rejected options
|
|
459
|
-
in one short assistant message. The detailed records remain in the run bundle. The standalone `autodoc` workflow finds an already selected plan, records it in canonical documentation,
|
|
459
|
+
in one short assistant message. The detailed records remain in the run bundle. The standalone `autodoc` workflow finds an already selected plan, records it in canonical documentation, and never devises or implements. It prepares a safe workspace only when documentation must change. Program actions run candidate checks, compare eligible failures with the base revision in a temporary detached worktree, and keep matching baseline failures visible without blocking the current change. The built-in `autoimplement` workflow finds a clear existing plan from explicit input, conversation context, or referenced canonical documents. A missing-plan claim and every other non-exempt blocker enter one bounded challenge path. An explicit plan bypasses autodoc only when a current-document receipt carries its matching plan digest; otherwise autodoc inspects and adopts or updates the canonical documents. Later invalidating evidence returns to `autoplan` followed by `autodoc`.
|
|
460
460
|
|
|
461
461
|
The built-in `plan-approval` workflow offers `continue`, `stop`, and exact-text `replan` exits. Its shared policy uses `auto`, `required`, or `skip` mode. Omitted policy defaults to `auto`: ask audience `operator`, then continue with the exact plan after 10 minutes without an answer. Required mode waits for a human. Skip mode creates no decision. Stop and replan always require a human answer.
|
|
462
462
|
|
|
@@ -464,18 +464,13 @@ The internal plan-change workflow composes Autoplan, Autodoc, plan approval, and
|
|
|
464
464
|
|
|
465
465
|
Autoimplement runs independent commands through bounded command batches. A batch is an ordinary function action that calls the public `runCommandBatch` helper. Each command has a stable ID, executable, arguments, absolute working directory, timeout, and output limit. Results stay separate and return in input order. One command uses the same path with concurrency one.
|
|
466
466
|
|
|
467
|
-
Autoimplement
|
|
468
|
-
long-running agent node times out, one shared read-only fallback inspects the
|
|
469
|
-
current repository, accepted workflow outputs, and relevant pull-request state.
|
|
470
|
-
It then retries the timed-out stage or routes to verification, review, CI,
|
|
471
|
-
delivery, the existing redesign workflow, or blocked. The fallback can run at
|
|
472
|
-
most three times in one Autoimplement run. Its own failure or timeout is
|
|
473
|
-
terminal. Cancellation remains immediate and never enters fallback. A repeated
|
|
474
|
-
effect step first checks what already exists and performs only missing work.
|
|
475
|
-
This graph fallback starts after the timed-out turn ends and is separate from
|
|
476
|
-
successor-turn delivery.
|
|
467
|
+
Autoimplement prepares the workspace before its first edit-capable node. `workspaceMode` accepts `auto`, `branch`, `worktree`, or `defaultBranch`. Auto mode adopts a current task branch, creates a model-named branch from a clean default branch, or creates a model-named standard sibling worktree when the default checkout has existing work. Program actions validate and apply names. Direct default-branch work requires explicit authority and does not imply commit, push, merge, or release authority. Every later stage uses the prepared absolute path.
|
|
477
468
|
|
|
478
|
-
Autoimplement
|
|
469
|
+
Autoimplement gives `implement` an eight-hour deadline. When a supported step fails or times out, one shared bounded recovery step inspects accepted outputs and durable repository or pull-request state. It adopts a completed effect or retries only a missing effect. Cancellation remains immediate and never enters recovery. Unsupported or uncertain effects create a qualified blocker claim before challenge.
|
|
470
|
+
|
|
471
|
+
Local verification uses the shared change-verification composition. Direct program actions run candidate checks and read-only base-eligible checks with the same command, arguments, timeout, and output limit. Results separate related, unrelated, fixed-baseline, unknown, and untested findings. Matching base failures do not block the candidate. Related failures enter a two-attempt mechanical or semantic repair loop. Unknown or incomplete evidence needs bounded judgment, and truncated, timed-out, cancelled, or spawn-failed output cannot pass.
|
|
472
|
+
|
|
473
|
+
Autoimplement uses batches for pi-reviewer and pending CI watches. It keeps model turns, fixes, pushes, comment changes, merges, and releases in their existing order. Reviewer commands are tied to the repository, base branch, pushed head, and relevant dependency fingerprint. A later review round includes only repositories whose head or dependency fingerprint changed. P0 or P1 work still requires another review. P2-only work can be addressed and verified without another reviewer run only because of that P2 work.
|
|
479
474
|
|
|
480
475
|
Autoimplement inspects every pull request before it waits for CI. It accepts only supported pending `gh pr checks --watch` or `gh run watch` descriptors and binds each one to the validated pull request as `gh pr checks <PR URL> --watch`. Repository and pull-request overrides are rejected. One watch lasts at most five minutes. A failed or timed-out watch affects only its pull request. When checks remain pending, the model runs more useful local tests before checking CI again. Autoimplement does not invent an ETA.
|
|
481
476
|
|
|
@@ -684,7 +679,7 @@ possible. Defaults worth knowing:
|
|
|
684
679
|
is explicit user control. When no run is live but the widget still shows a parked or finished run,
|
|
685
680
|
the command clears the widget.
|
|
686
681
|
- One workflow runs per session at a time.
|
|
687
|
-
- After the workflow tool accepts an agent-step submission,
|
|
682
|
+
- After the workflow tool accepts an agent-step submission, any assistant text that follows remains visible. The next workflow message continues the graph. A deferred intent makes a workflow prompt, presentation, and factual fallback compete to provide one successor turn, so an abort cannot produce two continuation turns.
|
|
688
683
|
- Agent nudges: if the model ends its turn without submitting the pending
|
|
689
684
|
step, it gets a reminder, twice by default, then the step fails.
|
|
690
685
|
|
package/herdr-plugin.toml
CHANGED
package/package.json
CHANGED
package/skills/autodoc/SKILL.md
CHANGED
|
@@ -15,6 +15,10 @@ Build the input as follows:
|
|
|
15
15
|
- `task`: State what selected plan must be recorded and that this run is documentation-only.
|
|
16
16
|
- `plan`: Pass the complete selected plan. Autodoc does not devise or improve it.
|
|
17
17
|
- `repository`: Use the absolute path of the repository that owns the canonical documentation.
|
|
18
|
+
- `baseBranch`: Use the requested base or the repository default branch.
|
|
19
|
+
- `scope`: Name the allowed repository and documentation edits. Exclude implementation and unauthorized remote actions.
|
|
20
|
+
- `workspaceMode`: Use `auto` unless the conversation requires `branch`, `worktree`, or explicitly authorized `defaultBranch` work. Autodoc prepares the workspace only when documentation needs an update.
|
|
21
|
+
- `preparedWorkspace`: Include a previously confirmed `pi-workflows.prepared-workspace.v1` result when a parent workflow already prepared the workspace. Omit it otherwise.
|
|
18
22
|
- `documents`: Include every known canonical specification or plan candidate. Use an empty array when none is known.
|
|
19
23
|
- `evidence`: Include implementation evidence or current-document evidence when it affects whether documentation is current.
|
|
20
24
|
|
|
@@ -31,6 +35,9 @@ Replace the example values below with facts from the conversation, then make one
|
|
|
31
35
|
"requirements": ["Keep cancellation terminal."]
|
|
32
36
|
},
|
|
33
37
|
"repository": "/absolute/path/to/repository",
|
|
38
|
+
"baseBranch": "main",
|
|
39
|
+
"scope": "Only /absolute/path/to/repository. May update canonical documentation and run documentation checks. Must not implement, push, merge, release, or deploy.",
|
|
40
|
+
"workspaceMode": "auto",
|
|
34
41
|
"documents": ["docs/plans/timeout-fallback-plan.md"],
|
|
35
42
|
"evidence": {
|
|
36
43
|
"currentBehavior": "A timeout ends the run."
|
|
@@ -18,6 +18,9 @@ Build the input as follows:
|
|
|
18
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
19
|
- `constraints`: Include all applicable user and repository constraints. Use an empty array when none apply.
|
|
20
20
|
- `baseBranch`: Use the requested base or the repository default branch.
|
|
21
|
+
- `workspaceMode`: Use `auto` unless the user or repository requires `branch`, `worktree`, or `defaultBranch`. `auto` keeps a correct task branch, creates a task branch from a clean default branch, and isolates a dirty default checkout in a standard sibling worktree. Use `defaultBranch` only with explicit direct-work authority.
|
|
22
|
+
- `preparedWorkspace`: Include a previously confirmed `pi-workflows.prepared-workspace.v1` result when the workspace was prepared before the run. Omit it otherwise.
|
|
23
|
+
- `directDefaultBranchAuthorized`: Set `true` only when direct work on the actual default branch is explicit. It does not grant commit, push, merge, or release authority.
|
|
21
24
|
- `merge`: Set `true` only when the user explicitly requested merge or an applicable standing instruction authorizes it. Otherwise set `false`.
|
|
22
25
|
- `documents`: Include known canonical plan or specification paths. Use an empty array when none are known.
|
|
23
26
|
- `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.
|
|
@@ -46,6 +49,7 @@ Replace the example values below with facts from the conversation, then make one
|
|
|
46
49
|
"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
50
|
"constraints": ["Preserve immediate cancellation.", "Keep deferred-turn work separate."],
|
|
48
51
|
"baseBranch": "main",
|
|
52
|
+
"workspaceMode": "auto",
|
|
49
53
|
"merge": false,
|
|
50
54
|
"documents": ["docs/plans/timeout-fallback-plan.md"]
|
|
51
55
|
}
|