@emiliosp/pi-maestro 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/ADR.md +54 -22
  2. package/CHANGELOG.md +42 -28
  3. package/MISSION.md +2 -4
  4. package/README.md +53 -24
  5. package/ROADMAP.md +64 -64
  6. package/TECH_STACK.md +3 -3
  7. package/agents/builder.md +53 -57
  8. package/agents/simplifier.md +79 -61
  9. package/agents/verifier.md +52 -64
  10. package/docs/configuration.md +1 -1
  11. package/docs/glossary.md +43 -40
  12. package/docs/subagent-integration.md +7 -8
  13. package/docs/workflow.md +135 -62
  14. package/extensions/maestro-subagent.ts +1 -0
  15. package/extensions/maestro.ts +9 -30
  16. package/package.json +38 -39
  17. package/src/MaestroPaths.ts +22 -35
  18. package/src/artifacts/builder-handoff/assertBuilderHandoff.ts +6 -15
  19. package/src/artifacts/builder-handoff/schema.ts +3 -6
  20. package/src/artifacts/simplifier-handoff/assertSimplifierHandoff.ts +3 -3
  21. package/src/artifacts/simplifier-handoff/schema.ts +1 -0
  22. package/src/artifacts/verifier-handoff/assertVerifierHandoff.ts +4 -10
  23. package/src/artifacts/verifier-handoff/schema.ts +3 -6
  24. package/src/artifacts/verifier-handoff/writeVerifierHandoff.ts +1 -3
  25. package/src/config/assertConfiguration.ts +3 -6
  26. package/src/config/defaults.ts +1 -5
  27. package/src/config/loadConfiguration.ts +4 -11
  28. package/src/config/schema.ts +1 -2
  29. package/src/ids/createSpecId.ts +1 -2
  30. package/src/ids/isValidSpecId.ts +1 -2
  31. package/src/maestro/checks/assertEnvironment.ts +19 -50
  32. package/src/maestro/instructions/getMaestroInstructions.ts +45 -26
  33. package/src/maestro/status/formatMaestroStatus.ts +4 -13
  34. package/src/maestro/status/refreshMaestroStatus.ts +3 -7
  35. package/src/specs/create.ts +14 -4
  36. package/src/specs/template.ts +10 -14
  37. package/src/tools/child/record-builder-handoff.ts +1 -0
  38. package/src/tools/child/record-simplifier-handoff.ts +4 -4
  39. package/src/tools/child/record-verifier-handoff.ts +2 -3
  40. package/src/tools/child/utils/resolveWorkflowContext.ts +1 -4
  41. package/src/tools/main/create-spec.ts +3 -2
  42. package/src/tools/main/mark-spec-ready.ts +2 -1
  43. package/src/tools/main/resolve-escalations.ts +1 -0
  44. package/src/tools/main/resolve-findings.ts +6 -20
  45. package/src/tools/main/run-builder.ts +37 -57
  46. package/src/tools/main/run-simplifier.ts +10 -20
  47. package/src/tools/main/run-verifier.ts +31 -55
  48. package/src/tools/utils/pi-subagent-delegation.ts +13 -22
  49. package/src/tools/utils/resolveToolRunContext.ts +2 -3
  50. package/src/utils/is-errno-exception.ts +1 -3
  51. package/src/utils/path-exists.ts +1 -0
  52. package/src/utils/path-strictly-within.ts +3 -6
  53. package/src/utils/path-within-or-equal.ts +1 -4
  54. package/src/utils/read-json.ts +1 -4
  55. package/src/utils/write-json.ts +1 -4
  56. package/src/workflow/builder/completeBuilderPass.ts +3 -2
  57. package/src/workflow/builder/prepareBuilderRun.ts +3 -8
  58. package/src/workflow/builder/resolveEscalations.ts +2 -6
  59. package/src/workflow/builder/utils/getWorkflowEventByBuilderHandoff.ts +1 -3
  60. package/src/workflow/simplifier/completeSimplifierPass.ts +2 -3
  61. package/src/workflow/spec/markSpecReady.ts +10 -4
  62. package/src/workflow/state/readWorkflowState.ts +2 -7
  63. package/src/workflow/state/schema.ts +5 -10
  64. package/src/workflow/state/writeWorkflowState.ts +1 -4
  65. package/src/workflow/transitions.ts +3 -11
  66. package/src/workflow/utils/assertSpecAcceptanceCriteria.ts +2 -1
  67. package/src/workflow/utils/getAgentRole.ts +1 -3
  68. package/src/workflow/verifier/completeVerifierPass.ts +1 -0
  69. package/src/workflow/verifier/resolveFindings.ts +9 -29
  70. package/src/workflow/verifier/utils/getWorkflowEventByVerifierHandoff.ts +5 -20
  71. package/templates/design.md +20 -0
  72. package/templates/proposal.md +23 -0
  73. package/templates/spec.md +21 -50
package/ROADMAP.md CHANGED
@@ -10,7 +10,7 @@ Item identifiers remain stable when priorities change. The `owner` approves chan
10
10
  ## Overview
11
11
 
12
12
  | ID | Title | Status | Summary |
13
- |------|------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------------------------|
13
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------ |
14
14
  | R-01 | [Improve status presentation and activation feedback](#r-01-improve-status-presentation-and-activation-feedback) | Completed | Show clearer status and configured agent details without adding model context. |
15
15
  | R-02 | [Store escalations and owner decisions in builder handoffs](#r-02-store-escalations-and-owner-decisions-in-builder-handoffs) | Completed | Keep `escalation` questions and `owner` answers together in numbered `builder` `handoffs`. |
16
16
  | R-03 | [Route builder failures through owner escalations](#r-03-route-builder-failures-through-owner-escalations) | Completed | Route reportable `builder` problems through `owner` `escalations` instead of a terminal failure phase. |
@@ -40,8 +40,9 @@ notice to session history or model context. All 12 `acceptance criteria` passed
40
40
 
41
41
  #### Evidence
42
42
 
43
- [Specification](.specs/20261007-170438-update-maestro-status-bar-with-agent-models-theme-colors-and-phase-icons/spec.md), [verifier report](.specs/20261007-170438-update-maestro-status-bar-with-agent-models-theme-colors-and-phase-icons/handoffs/verifier/V1.json),
44
- and [merged PR #26](https://github.com/emilioSp/pi-maestro/pull/26).
43
+ [Specification](.specs/20261007-170438-update-maestro-status-bar-with-agent-models-theme-colors-and-phase-icons/spec.md),
44
+ [verifier report](.specs/20261007-170438-update-maestro-status-bar-with-agent-models-theme-colors-and-phase-icons/handoffs/verifier/V1.json), and
45
+ [merged PR #26](https://github.com/emilioSp/pi-maestro/pull/26).
45
46
 
46
47
  ### R-02: Store escalations and owner decisions in builder handoffs
47
48
 
@@ -50,8 +51,9 @@ Numbered `builder` `handoffs` contain multiple `escalation` questions and their
50
51
 
51
52
  #### Evidence
52
53
 
53
- [Specification](.specs/20261008-132344-store-escalations-in-builder-handoffs/spec.md), [verifier report](.specs/20261008-132344-store-escalations-in-builder-handoffs/handoffs/verifier/V1.json),
54
- and [merged PR #27](https://github.com/emilioSp/pi-maestro/pull/27).
54
+ [Specification](.specs/20261008-132344-store-escalations-in-builder-handoffs/spec.md),
55
+ [verifier report](.specs/20261008-132344-store-escalations-in-builder-handoffs/handoffs/verifier/V1.json), and
56
+ [merged PR #27](https://github.com/emilioSp/pi-maestro/pull/27).
55
57
 
56
58
  ### R-03: Route builder failures through owner escalations
57
59
 
@@ -62,8 +64,9 @@ All 8 `acceptance criteria` passed with no `verifier` `findings`. The saved work
62
64
 
63
65
  #### Evidence
64
66
 
65
- [Specification](.specs/20261013-101454-route-builder-failures-through-owner-escalations/spec.md), [verifier report](.specs/20261013-101454-route-builder-failures-through-owner-escalations/handoffs/verifier/V1.json),
66
- and [merged PR #32](https://github.com/emilioSp/pi-maestro/pull/32).
67
+ [Specification](.specs/20261013-101454-route-builder-failures-through-owner-escalations/spec.md),
68
+ [verifier report](.specs/20261013-101454-route-builder-failures-through-owner-escalations/handoffs/verifier/V1.json), and
69
+ [merged PR #32](https://github.com/emilioSp/pi-maestro/pull/32).
67
70
 
68
71
  ### R-12: Format glossary terms consistently
69
72
 
@@ -86,8 +89,8 @@ All 6 `acceptance criteria` passed with no `verifier` `findings`. The saved work
86
89
 
87
90
  #### Evidence
88
91
 
89
- [Specification](.specs/20261013-171954-introduce-maestro-at-activation/spec.md), [verifier report](.specs/20261013-171954-introduce-maestro-at-activation/handoffs/verifier/V1.json),
90
- and [merged PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
92
+ [Specification](.specs/20261013-171954-introduce-maestro-at-activation/spec.md),
93
+ [verifier report](.specs/20261013-171954-introduce-maestro-at-activation/handoffs/verifier/V1.json), and [merged PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
91
94
 
92
95
  ### R-15: Rename the test support directory
93
96
 
@@ -96,7 +99,7 @@ keep fixtures under `tests/fixtures`. Source tests remain next to their source f
96
99
 
97
100
  #### Evidence
98
101
 
99
- [Test support](tests/support/), [fixtures](tests/fixtures/), and [lint configuration](biome.json).
102
+ [Test support](tests/support/), [fixtures](tests/fixtures/), and [lint configuration](.oxlintrc.json).
100
103
 
101
104
  ### R-16: Verify code quality against AGENTS.md instructions
102
105
 
@@ -111,8 +114,9 @@ saved workflow reached `candidate-ready`.
111
114
 
112
115
  #### Evidence
113
116
 
114
- [Specification](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/spec.md), [verifier report](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/handoffs/verifier/V1.json),
115
- and [merged PR #34](https://github.com/emilioSp/pi-maestro/pull/34).
117
+ [Specification](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/spec.md),
118
+ [verifier report](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/handoffs/verifier/V1.json), and
119
+ [merged PR #34](https://github.com/emilioSp/pi-maestro/pull/34).
116
120
 
117
121
  ### R-06: Check subagent extensions at activation
118
122
 
@@ -127,8 +131,9 @@ verification.
127
131
 
128
132
  #### Evidence
129
133
 
130
- [Specification](.specs/20261013-194407-check-pi-subagents-availability-with-ping-at-activation/spec.md), [verifier report](.specs/20261013-194407-check-pi-subagents-availability-with-ping-at-activation/handoffs/verifier/V1.json),
131
- and [merged PR #35](https://github.com/emilioSp/pi-maestro/pull/35).
134
+ [Specification](.specs/20261013-194407-check-pi-subagents-availability-with-ping-at-activation/spec.md),
135
+ [verifier report](.specs/20261013-194407-check-pi-subagents-availability-with-ping-at-activation/handoffs/verifier/V1.json), and
136
+ [merged PR #35](https://github.com/emilioSp/pi-maestro/pull/35).
132
137
 
133
138
  ### R-05: Keep acceptance criterion numbering continuous
134
139
 
@@ -142,8 +147,9 @@ All 3 `acceptance criteria` passed with no `verifier` `findings`. The saved work
142
147
 
143
148
  #### Evidence
144
149
 
145
- [Specification](.specs/20261013-202811-check-acceptance-criterion-numbering-before-builder-execution/spec.md), [verifier report](.specs/20261013-202811-check-acceptance-criterion-numbering-before-builder-execution/handoffs/verifier/V1.json),
146
- and [merged PR #36](https://github.com/emilioSp/pi-maestro/pull/36).
150
+ [Specification](.specs/20261013-202811-check-acceptance-criterion-numbering-before-builder-execution/spec.md),
151
+ [verifier report](.specs/20261013-202811-check-acceptance-criterion-numbering-before-builder-execution/handoffs/verifier/V1.json), and
152
+ [merged PR #36](https://github.com/emilioSp/pi-maestro/pull/36).
147
153
 
148
154
  ### R-10: Match handoff criteria to the approved spec
149
155
 
@@ -157,22 +163,23 @@ role. These changes are outside the completed independent verification. The fina
157
163
 
158
164
  #### Evidence
159
165
 
160
- [Specification](.specs/20261013-211629-match-handoff-criteria-to-the-approved-spec/spec.md), [verifier report](.specs/20261013-211629-match-handoff-criteria-to-the-approved-spec/handoffs/verifier/V1.json),
161
- and [merged PR #37](https://github.com/emilioSp/pi-maestro/pull/37).
166
+ [Specification](.specs/20261013-211629-match-handoff-criteria-to-the-approved-spec/spec.md),
167
+ [verifier report](.specs/20261013-211629-match-handoff-criteria-to-the-approved-spec/handoffs/verifier/V1.json), and
168
+ [merged PR #37](https://github.com/emilioSp/pi-maestro/pull/37).
162
169
 
163
170
  ### R-17: Record escalation resolutions when the spec changes
164
171
 
165
172
  #### Objective
166
173
 
167
- Save every current `escalation` answer in the original `builder` `handoff`, whether the `spec` stays unchanged or requires revision.
168
- Each `resolution` records the owner's chosen solution and reason. A decision requiring revision also identifies the `escalation` and describes the agreed `spec` change.
174
+ Save every current `escalation` answer in the original `builder` `handoff`, whether the `spec` stays unchanged or requires revision. Each `resolution` records the owner's
175
+ chosen solution and reason. A decision requiring revision also identifies the `escalation` and describes the agreed `spec` change.
169
176
 
170
177
  #### Agreed flow
171
178
 
172
179
  `Maestro` records the complete decision batch through `maestro_resolve_escalations` before changing phase.
173
180
 
174
181
  | Decision | Next phase and action |
175
- |----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
182
+ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
176
183
  | No `spec` change | `escalation-decisions` → `ready-for-builder`. The `builder` continues under the approved `spec`, without renewed approval. |
177
184
  | `Spec` change required | `escalation-decisions` → `drafting-spec`. The `owner` and `Maestro` revise and review the same `spec`. |
178
185
  | Revised `spec` receives renewed `GREEN FLAG` | `drafting-spec` → `ready-for-builder` through separate `maestro_mark_spec_ready` approval. |
@@ -181,21 +188,21 @@ Direct `spec` approval from `escalation-decisions` is rejected. Recording answer
181
188
 
182
189
  #### Implementation boundaries
183
190
 
184
- Reuse the existing resolution operation and `handoff` fields. Do not add a parallel decision store, tool, or workflow phase.
185
- Define both resolution transitions explicitly in `src/workflow/transitions.ts` and apply them through `transitionWorkflow`. Direct phase assignment elsewhere is banned.
186
- Preserve initial `spec` approval, `verifier` `finding` decisions, existing batch validation, and historical `handoffs`.
191
+ Reuse the existing resolution operation and `handoff` fields. Do not add a parallel decision store, tool, or workflow phase. Define both resolution transitions explicitly
192
+ in `src/workflow/transitions.ts` and apply them through `transitionWorkflow`. Direct phase assignment elsewhere is banned. Preserve initial `spec` approval, `verifier`
193
+ `finding` decisions, existing batch validation, and historical `handoffs`.
187
194
 
188
195
  #### Completed when
189
196
 
190
- Saved `resolutions`, workflow phases, tool results, agent instructions, and human documentation follow the agreed flow.
191
- Verification checks both observable behavior and use of the central transition definitions for each resolution branch. Passing behavior tests alone is not enough.
192
- The new `spec` includes coverage labels and omits `acceptance criteria` already covered by tests of the same scenario.
197
+ Saved `resolutions`, workflow phases, tool results, agent instructions, and human documentation follow the agreed flow. Verification checks both observable behavior and
198
+ use of the central transition definitions for each resolution branch. Passing behavior tests alone is not enough. The new `spec` includes coverage labels and omits
199
+ `acceptance criteria` already covered by tests of the same scenario.
193
200
 
194
201
  ### R-20: Route finding-driven spec revisions through drafting-spec
195
202
 
196
- Implemented the approved revision route. `Maestro` records every current `finding` decision before returning to `drafting-spec` when revision is required.
197
- The `owner` reviews the same revised `spec` and gives renewed `GREEN FLAG` before separate approval and another `builder` `run`.
198
- Revision takes priority in mixed batches. Direct approval from `finding-decisions` is rejected.
203
+ Implemented the approved revision route. `Maestro` records every current `finding` decision before returning to `drafting-spec` when revision is required. The `owner`
204
+ reviews the same revised `spec` and gives renewed `GREEN FLAG` before separate approval and another `builder` `run`. Revision takes priority in mixed batches. Direct
205
+ approval from `finding-decisions` is rejected.
199
206
 
200
207
  Later event naming cleanup identifies `builder` and `owner` actions explicitly. Both revision routes use `OWNER_REQUEST_SPEC_REVISION` without changing the phase flow.
201
208
  Batch resolution uses `RESOLVE_ESCALATIONS`, and the status label refers to `escalations` in the plural. The saved decision phases are named `escalation-decisions` and
@@ -203,70 +210,63 @@ Batch resolution uses `RESOLVE_ESCALATIONS`, and the status label refers to `esc
203
210
 
204
211
  #### Evidence
205
212
 
206
- [Specification](.specs/20261015-154812-route-finding-driven-spec-revisions-through-drafting-spec/spec.md)
207
- and [resolution integration tests](src/tools/main/resolve-findings.integration.test.ts).
213
+ [Specification](.specs/20261015-154812-route-finding-driven-spec-revisions-through-drafting-spec/spec.md) and
214
+ [resolution integration tests](src/tools/main/resolve-findings.integration.test.ts).
208
215
 
209
216
  ### R-18: Label acceptance criterion coverage
210
217
 
211
- Implemented with R-19 as one task, as selected by the `owner`.
212
- The `spec` template and `Maestro` guidance require one `Coverage` label per `acceptance criterion`:
218
+ Implemented with R-19 as one task, as selected by the `owner`. The `spec` template and `Maestro` guidance require one `Coverage` label per `acceptance criterion`:
213
219
 
214
220
  | Label | Purpose |
215
- |-------------|----------------------------------------------|
221
+ | ----------- | -------------------------------------------- |
216
222
  | `success` | A valid action produces the required result. |
217
223
  | `failure` | An invalid action is correctly rejected. |
218
224
  | `unchanged` | The change preserves existing behavior. |
219
225
 
220
- Use `unchanged` when the criterion explicitly checks behavior that the change must preserve.
221
- Labels describe scenarios, not test outcomes. A `failure` scenario passes when the invalid action is correctly rejected.
222
- A `spec` does not need all three categories.
223
- `Maestro` includes labels when presenting criteria to the `owner` and checks them against scenarios and `expected results` during review.
224
- Approval validation and `handoff` formats remain unchanged.
226
+ Use `unchanged` when the criterion explicitly checks behavior that the change must preserve. Labels describe scenarios, not test outcomes. A `failure` scenario passes
227
+ when the invalid action is correctly rejected. A `spec` does not need all three categories. `Maestro` includes labels when presenting criteria to the `owner` and checks
228
+ them against scenarios and `expected results` during review. Approval validation and `handoff` formats remain unchanged.
225
229
 
226
- The existing creation integration test now checks that the generated `spec` includes the coverage field.
227
- The final `npm run check` passed all 238 tests and coverage thresholds. No model trials were performed.
230
+ The existing creation integration test now checks that the generated `spec` includes the coverage field. The final `npm run check` passed all 238 tests and coverage
231
+ thresholds. No model trials were performed.
228
232
 
229
233
  #### Evidence
230
234
 
231
- [Spec template](templates/spec.md), [Maestro guidance](src/maestro/instructions/getMaestroInstructions.ts), [creation integration test](src/specs/create.integration.test.ts),
232
- and [workflow documentation](docs/workflow.md#acceptance-criteria).
235
+ [Spec template](templates/spec.md), [Maestro guidance](src/maestro/instructions/getMaestroInstructions.ts),
236
+ [creation integration test](src/specs/create.integration.test.ts), and [workflow documentation](docs/workflow.md#acceptance-criteria).
233
237
 
234
238
  ### R-19: Avoid acceptance criteria already covered by tests
235
239
 
236
- Implemented with R-18. `Maestro` inspects existing tests before writing `acceptance criteria`.
237
- It omits a criterion only when a test covers the same starting conditions, action, and `expected result`.
238
- Partial or uncertain coverage does not justify omission. Similar tests do not count.
240
+ Implemented with R-18. `Maestro` inspects existing tests before writing `acceptance criteria`. It omits a criterion only when a test covers the same starting conditions,
241
+ action, and `expected result`. Partial or uncertain coverage does not justify omission. Similar tests do not count.
239
242
 
240
- During `spec` review, `Maestro` removes criteria whose exact scenarios already have test coverage.
241
- It keeps numbering continuous from `AC1` and updates affected references. Required behavior remains documented in the requirements and constraints.
242
- The same rules apply during `spec` revisions. No automatic approval check was added.
243
+ During `spec` review, `Maestro` removes criteria whose exact scenarios already have test coverage. It keeps numbering continuous from `AC1` and updates affected
244
+ references. Required behavior remains documented in the requirements and constraints. The same rules apply during `spec` revisions. No automatic approval check was added.
243
245
 
244
246
  Verification consisted of inspecting the written guidance and running `npm run check`. No model trials were performed.
245
247
 
246
248
  #### Evidence
247
249
 
248
- [Maestro guidance](src/maestro/instructions/getMaestroInstructions.ts), [spec template](templates/spec.md),
249
- and [workflow documentation](docs/workflow.md#acceptance-criteria).
250
+ [Maestro guidance](src/maestro/instructions/getMaestroInstructions.ts), [spec template](templates/spec.md), and
251
+ [workflow documentation](docs/workflow.md#acceptance-criteria).
250
252
 
251
253
  ## Now
252
254
 
253
255
  ### R-21: Add a simplifier with one clear purpose per agent
254
256
 
255
- Implemented under the [specification](.specs/20261016-090319-add-a-dedicated-simplifier-after-verification/spec.md). Independent review is pending.
256
- The `builder` implements the approved `spec`. The `verifier` checks its `acceptance criteria`. The `simplifier` refactors accepted code for clarity.
257
- The extra code-quality review introduced in R-16 is removed from the verifier's instructions.
257
+ Implemented under the [specification](.specs/20261016-090319-add-a-dedicated-simplifier-after-verification/spec.md). Independent review is pending. The `builder`
258
+ implements the approved `spec`. The `verifier` checks its `acceptance criteria`. The `simplifier` refactors accepted code for clarity. The extra code-quality review
259
+ introduced in R-16 is removed from the verifier's instructions.
258
260
 
259
- Successful verification and rejection of all current `findings` save `simplifier-running`.
260
- `Maestro` calls `maestro_run_simplifier` without another approval or verification cycle.
261
- Only that tool checks Git readiness. If Git is unavailable, it warns and saves `candidate-ready` without delegation or a `simplifier` `handoff`.
261
+ Successful verification and rejection of all current `findings` save `simplifier-running`. `Maestro` calls `maestro_run_simplifier` without another approval or
262
+ verification cycle. Only that tool checks Git readiness. If Git is unavailable, it warns and saves `candidate-ready` without delegation or a `simplifier` `handoff`.
262
263
 
263
- The `simplifier` selects all uncommitted code changes, including pre-existing staged, unstaged, and untracked files.
264
- It preserves observable behavior and the accepted check baseline. Rejected `findings` remain rejected, not passed.
265
- Required caller updates can include initially unchanged files. Unrelated refactoring, index changes, and automatic commits are excluded.
264
+ The `simplifier` selects all uncommitted code changes, including pre-existing staged, unstaged, and untracked files. It preserves observable behavior and the accepted
265
+ check baseline. Rejected `findings` remain rejected, not passed. Required caller updates can include initially unchanged files. Unrelated refactoring, index changes, and
266
+ automatic commits are excluded.
266
267
 
267
- A completed `pass` saves the fixed, unnumbered `handoffs/simplifier/S.json`, then saves `candidate-ready`.
268
- The report contains refactored files, a summary, and notes. No refactoring is required when selected code is already clear.
269
- Maestro's final summary separates this report from independent `verifier` evidence.
268
+ A completed `pass` saves the fixed, unnumbered `handoffs/simplifier/S.json`, then saves `candidate-ready`. The report contains refactored files, a summary, and notes. No
269
+ refactoring is required when selected code is already clear. Maestro's final summary separates this report from independent `verifier` evidence.
270
270
 
271
271
  ## Next
272
272
 
package/TECH_STACK.md CHANGED
@@ -4,12 +4,12 @@
4
4
  `dist/` directory.
5
5
 
6
6
  | Technology | Use |
7
- |--------------------------------|---------------------------------------------------------------------------------------------------|
7
+ | ------------------------------ | ------------------------------------------------------------------------------------------------- |
8
8
  | TypeScript | Application code and static type checks with `tsc --noEmit`. |
9
9
  | Node.js | Runtime. |
10
10
  | Pi | Extension host, agent APIs, and terminal interface. |
11
11
  | `pi-subagents` | `Builder`, `verifier`, and `simplifier` execution and activity tracking. |
12
12
  | TypeBox | Schemas and runtime validation for configuration, workflow state, tool inputs, and agent reports. |
13
13
  | Vitest with coverage | Unit tests, integration tests, and code coverage. |
14
- | Biome | Formatting and lint checks. |
15
- | Oxlint with `oxlint-anti-slop` | Additional lint and anti-slop checks. |
14
+ | Oxfmt | Formatting |
15
+ | Oxlint with `oxlint-anti-slop` | Linting and additional anti-slop checks. |
package/agents/builder.md CHANGED
@@ -11,83 +11,79 @@ subagentOnlyExtensions: ../extensions/maestro-subagent.ts
11
11
 
12
12
  # Builder
13
13
 
14
- Implement the approved spec and produce one saved result for this pass.
15
- Work in the project directory supplied by Maestro.
16
- The owner decides requirements, scope, spec changes, escalations, and findings. Maestro coordinates those decisions.
17
- Do not delegate, contact the owner directly, or approve your own work.
14
+ Implement the approved spec and produce one saved result for this pass. Work in the project directory supplied by Maestro. The owner decides requirements, scope, spec
15
+ changes, escalations, and findings. Maestro coordinates those decisions. Do not delegate, contact the owner directly, or approve your own work.
18
16
 
19
17
  ## Read the contract and current state
20
18
 
21
19
  1. Use the exact `specId` supplied by Maestro. Do not select another spec.
22
- 2. Locate `<specDirectory>/<specId>/` relative to the canonical Pi working directory supplied by Maestro. Use `specDirectory` from `.pi/maestro.json`, or `.specs` when unset.
23
- 3. Read `spec.md`, relevant `prototypes/`, `workflow.json`, and applicable `AGENTS.md` files.
20
+ 2. Locate `<specDirectory>/<specId>/` relative to the canonical Pi working directory supplied by Maestro. Use `specDirectory` from `.pi/maestro.json`, or `.specs` when
21
+ unset.
22
+ 3. Read `proposal.md` for motivation and scope, `spec.md` for behavior and all acceptance criteria, including standalone regression checks, and `design.md` when present
23
+ for approved technical decisions. Read relevant `prototypes/`, `workflow.json`, and applicable `AGENTS.md` files. The present documents form one approved contract.
24
24
  4. Read available handoffs and their embedded escalation resolutions for this spec. Earlier numbered artifacts remain on the file system.
25
25
  5. Confirm that the workflow identifies this spec and is in `builder-running`. Maestro already saved that phase.
26
26
 
27
- If the supplied spec is missing or the phase is wrong, report the mismatch to Maestro and stop. Do not repair workflow state.
28
- You start with a fresh context. Do not assume prior conversation or owner decisions that are not recorded.
29
- Builder handoffs use `handoffs/builder/B1.json`, `B2.json`, and so on. Verifier handoffs use `handoffs/verifier/V1.json`, `V2.json`, and so on.
30
- The highest numeric sequence is the active handoff for each role. Earlier records are references, not active instructions.
27
+ If the supplied spec is missing or the phase is wrong, report the mismatch to Maestro and stop. Do not repair workflow state. You start with a fresh context. Do not
28
+ assume prior conversation or owner decisions that are not recorded. Builder handoffs use `handoffs/builder/B1.json`, `B2.json`, and so on. Verifier handoffs use
29
+ `handoffs/verifier/V1.json`, `V2.json`, and so on. The highest numeric sequence is the active handoff for each role. Earlier records are references, not active
30
+ instructions.
31
31
 
32
- Do not edit the frozen spec during builder or verifier execution.
33
- The approved spec defines the required behavior, constraints, technical decisions, scope, and acceptance criteria.
34
- If this pass follows escalation resolutions, read them from the active builder handoff and follow each owner decision.
35
- If this pass follows `fix-code`, fix all current findings assigned for repair. These contain an explicit `decision: { decision: "fix-code" }` from the owner.
36
- Do not fix rejected findings merely because they appear in the handoff.
37
- After a spec revision, earlier escalations and findings are historical context, not active repair instructions.
38
- Use the active spec and the active handoff to assess repair instructions. A finding with `decision: null` has no owner decision.
32
+ Do not edit the frozen proposal, spec, design, or prototypes during any agent execution. Do not create a design document after approval. The approved spec defines the
33
+ required behavior, constraints, technical decisions, scope, and acceptance criteria. If this pass follows escalation resolutions, read them from the active builder
34
+ handoff and follow each owner decision. If this pass follows `fix-code`, fix all current findings assigned for repair. These contain an explicit
35
+ `decision: { decision: "fix-code" }` from the owner. Do not fix rejected findings merely because they appear in the handoff. After a spec revision, earlier escalations
36
+ and findings are historical context, not active repair instructions. Use the active spec and the active handoff to assess repair instructions. A finding with
37
+ `decision: null` has no owner decision.
39
38
 
40
39
  ## Implement within the contract
41
40
 
42
- Change only product files needed to meet the approved contract, within the project root.
43
- Use existing repository patterns for routine implementation details that the spec leaves open. Do not add unrelated improvements.
44
- Follow applicable repository commands and technical rules. Inspect scripts before running them. Do not invent required commands.
45
- Do not edit `spec.md`, prototypes, `workflow.json`, or handoffs directly through any tool.
46
- Use `maestro_record_builder_handoff` for protocol changes. The tool supplies artifact paths and versions.
41
+ Change only product files needed to meet the approved contract, within the project root. Use existing repository patterns for routine implementation details that the spec
42
+ leaves open. Do not add unrelated improvements. Follow applicable repository commands and technical rules. Inspect scripts before running them. Do not invent required
43
+ commands. Do not edit `proposal.md`, `spec.md`, `design.md`, prototypes, `workflow.json`, or handoffs directly through any tool. Use `maestro_record_builder_handoff` for
44
+ protocol changes. The tool supplies artifact paths and versions.
47
45
 
48
- If a technical problem prevents completion and you can safely report it, stop implementation and submit an escalation. Use its fields for the reason, evidence, owner question, options, consequences, and next steps. The owner decides how work continues.
49
- If a significant discovery requires an owner choice, stop implementation and use the escalation outcome below.
50
- Examples include a spec conflict, undefined behavior, a material architectural alternative, scope changes, or verification and reversibility decisions.
51
- An escalation does not require a technical failure or blocker.
52
- Do not escalate routine implementation choices that stay within the contract.
53
- Record significant discoveries without an owner decision in handoff `notes`. Do not turn notes into an activity log.
46
+ If a technical problem prevents completion and you can safely report it, stop implementation and submit an escalation. Use its fields for the reason, evidence, owner
47
+ question, options, consequences, and next steps. The owner decides how work continues. If a significant discovery requires an owner choice, stop implementation and use
48
+ the escalation outcome below. Examples include a spec conflict, undefined behavior, a material architectural alternative, scope changes, or verification and reversibility
49
+ decisions. An escalation does not require a technical failure or blocker. Do not escalate routine implementation choices that stay within the contract. Record significant
50
+ discoveries without an owner decision in handoff `notes`. Do not turn notes into an activity log.
54
51
 
55
52
  ## Prove every acceptance criterion
56
53
 
57
- Run every probe, including on repair passes. Previous evidence does not replace this pass's results.
58
- The spec defines probe scenarios, expected results, and concrete examples.
59
- Choose test code, fixtures, mocks, and commands that cover each approved scenario.
60
- These execution details are your responsibility, not missing owner decisions. Follow any explicit execution constraints in the approved spec.
61
- Run each executable probe against the implementation and compare the observed result with the expected result.
62
- Do not change approved probe scenarios, expected results, examples, or design decisions to obtain passing results.
63
- If the implementation fails, repair it within the contract and repeat the proof for affected criteria.
64
- If the contract needs clarification or revision, escalate instead of inventing a replacement probe.
65
- For visual claims, use the specified reproducible procedure and compare with prototypes when required.
66
- Run applicable repository checks. If subsequent changes invalidate earlier evidence, rerun the affected checks and proofs.
67
-
68
- For each criterion, record its exact `id`, actual command or procedure in `probe`, and `probeStatus`.
69
- Use `probeStatus: passed` when the observed result matches the expected result.
70
- Use `failed` for an observed probe failure and `not-run` for an unexecuted probe.
71
- Include every spec criterion once. Do not omit unrun criteria, fabricate evidence, or include secrets or full logs.
54
+ Run every probe, including on repair passes. Previous evidence does not replace this pass's results. The spec defines probe scenarios, expected results, and concrete
55
+ examples. Choose test code, fixtures, mocks, and commands that cover each approved scenario. These execution details are your responsibility, not missing owner decisions.
56
+ Follow any explicit execution constraints in the approved spec. Run each executable probe against the implementation and compare the observed result with the expected
57
+ result. Do not change approved probe scenarios, expected results, examples, or design decisions to obtain passing results. If the implementation fails, repair it within
58
+ the contract and repeat the proof for affected criteria. If the contract needs clarification or revision, escalate instead of inventing a replacement probe. For visual
59
+ claims, use the specified reproducible procedure and compare with prototypes when required. Run applicable repository checks. If subsequent changes invalidate earlier
60
+ evidence, rerun the affected checks and proofs.
61
+
62
+ For each criterion, record its exact `id`, actual command or procedure in `probe`, and `probeStatus`. Use `probeStatus: passed` when the observed result matches the
63
+ expected result. Use `failed` for an observed probe failure and `not-run` for an unexecuted probe. Include every spec criterion once. Do not omit unrun criteria,
64
+ fabricate evidence, or include secrets or full logs.
72
65
 
73
66
  ## Record exactly one outcome
74
67
 
75
- Before any terminal tool call, restore temporary verification changes and remove temporary verification files. Keep the implementation work.
76
- Choose the outcome from the actual result:
68
+ Before any terminal tool call, restore temporary verification changes and remove temporary verification files. Keep the implementation work. Choose the outcome from the
69
+ actual result:
77
70
 
78
- 1. `done`: Implementation and required checks are complete. Every criterion has `probeStatus: passed`. Call `maestro_record_builder_handoff` with `specId`, `status: done`, `summary`, `acceptanceCriteria`, `notes`, and `escalations: []`.
79
- 2. `escalation`: An owner decision is required, including when a reportable technical problem prevents completion. Call `maestro_record_builder_handoff` with `specId`, `status: escalation`, `summary`, every criterion result, `notes`, and all `escalations`. Assign sequential IDs in array order: `E1`, `E2`, and so on. Restart at `E1` for each handoff. Each entry contains `id`, `question`, `context`, `options`, `recommendation`, `notes`, and `resolution: null`. Include evidence in the context. Give each option an ID, description, consequences, and next step. Use `recommendation: null` unless evidence supports an option. Refer to questions with both IDs, such as `B1/E1`. Record actual probe results, including incomplete probes. All probes can pass when an owner decision remains necessary or another required repository check prevents completion. Save one handoff and stop.
71
+ 1. `done`: Implementation and required checks are complete. Every criterion has `probeStatus: passed`. Call `maestro_record_builder_handoff` with `specId`,
72
+ `status: done`, `summary`, `acceptanceCriteria`, `notes`, and `escalations: []`.
73
+ 2. `escalation`: An owner decision is required, including when a reportable technical problem prevents completion. Call `maestro_record_builder_handoff` with `specId`,
74
+ `status: escalation`, `summary`, every criterion result, `notes`, and all `escalations`. Assign sequential IDs in array order: `E1`, `E2`, and so on. Restart at `E1`
75
+ for each handoff. Each entry contains `id`, `question`, `context`, `options`, `recommendation`, `notes`, and `resolution: null`. Include evidence in the context. Give
76
+ each option an ID, description, consequences, and next step. Use `recommendation: null` unless evidence supports an option. Refer to questions with both IDs, such as
77
+ `B1/E1`. Record actual probe results, including incomplete probes. All probes can pass when an owner decision remains necessary or another required repository check
78
+ prevents completion. Save one handoff and stop.
80
79
 
81
- After a successful terminal call, return the saved outcome and artifact path to Maestro. Stop the pass.
82
- Do not delete or replace earlier handoffs. Do not continue implementation after saving the result.
83
- Do not wait for an escalation answer, run the verifier, or continue implementation after the terminal call.
80
+ After a successful terminal call, return the saved outcome and artifact path to Maestro. Stop the pass. Do not delete or replace earlier handoffs. Do not continue
81
+ implementation after saving the result. Do not wait for an escalation answer, run the verifier, or continue implementation after the terminal call.
84
82
 
85
83
  ## Handle protocol errors without bypasses
86
84
 
87
- If a terminal call fails, inspect the error, current phase, and artifacts before retrying.
88
- If validation rejected the submission without writing it, correct the payload to match the tool schema and actual evidence.
89
- If the tool partially wrote an artifact or changed phase before an error, report it and stop. Do not resubmit.
90
- Never change honest statuses or omit criteria merely to make a payload pass validation.
91
- Do not delete a terminal artifact, edit workflow state, or use a different outcome to bypass an error.
92
- If cleanup or the protocol cannot be completed safely, report the exact blocker and remaining changes to Maestro and stop.
93
- Do not claim a saved result when the terminal call did not succeed.
85
+ If a terminal call fails, inspect the error, current phase, and artifacts before retrying. If validation rejected the submission without writing it, correct the payload
86
+ to match the tool schema and actual evidence. If the tool partially wrote an artifact or changed phase before an error, report it and stop. Do not resubmit. Never change
87
+ honest statuses or omit criteria merely to make a payload pass validation. Do not delete a terminal artifact, edit workflow state, or use a different outcome to bypass an
88
+ error. If cleanup or the protocol cannot be completed safely, report the exact blocker and remaining changes to Maestro and stop. Do not claim a saved result when the
89
+ terminal call did not succeed.