@emiliosp/pi-maestro 0.21.0 → 0.23.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 (98) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +42 -79
  3. package/agents/builder.md +7 -7
  4. package/agents/maestro.md +62 -45
  5. package/agents/simplifier.md +6 -5
  6. package/agents/verifier.md +13 -13
  7. package/docs/adr/0001-keep-the-workflow-independent-of-git.md +25 -0
  8. package/docs/adr/0002-store-escalation-decisions-in-builder-handoffs.md +24 -0
  9. package/docs/adr/0003-route-builder-failures-through-owner-escalations.md +23 -0
  10. package/docs/adr/0004-require-git-only-for-the-simplifier.md +35 -0
  11. package/docs/adr/0005-approve-a-specification-document-set-as-one-contract.md +32 -0
  12. package/docs/adr/0006-maintain-the-roadmap-in-linear.md +25 -0
  13. package/docs/adr/0007-maintain-the-roadmap-in-the-repository.md +27 -0
  14. package/docs/adr/0008-use-pis-registry-for-model-availability.md +23 -0
  15. package/docs/adr/0009-select-optional-phases-in-the-transition-table.md +24 -0
  16. package/docs/adr/0010-use-the-pi-sdk-for-sequential-agent-delegation.md +109 -0
  17. package/docs/adr/0011-separate-initial-setup-ui-from-configuration-rules.md +25 -0
  18. package/docs/adr/0012-filter-main-maestro-registrations-after-native-discovery.md +21 -0
  19. package/docs/adr/README.md +21 -0
  20. package/docs/configuration.md +33 -12
  21. package/docs/glossary.md +38 -49
  22. package/docs/inspiration.md +32 -0
  23. package/docs/roadmap/README.md +42 -0
  24. package/docs/roadmap/maestro-10-improve-status-presentation-and-activation-feedback.md +18 -0
  25. package/docs/roadmap/maestro-11-introduce-maestro-at-activation.md +19 -0
  26. package/docs/roadmap/maestro-12-verify-code-quality-against-agentsmd-instructions.md +21 -0
  27. package/docs/roadmap/maestro-13-check-subagent-extensions-at-activation.md +21 -0
  28. package/docs/roadmap/maestro-14-rename-the-test-support-directory.md +16 -0
  29. package/docs/roadmap/maestro-15-match-handoff-criteria-to-the-approved-spec.md +19 -0
  30. package/docs/roadmap/maestro-16-route-finding-driven-spec-revisions-through-drafting-spec.md +19 -0
  31. package/docs/roadmap/maestro-17-keep-acceptance-criterion-numbering-continuous.md +19 -0
  32. package/docs/roadmap/maestro-18-record-escalation-resolutions-when-the-spec-changes.md +18 -0
  33. package/docs/roadmap/maestro-19-guide-initial-configuration.md +22 -0
  34. package/docs/roadmap/maestro-20-rename-the-npm-package.md +17 -0
  35. package/docs/roadmap/maestro-21-label-acceptance-criterion-coverage.md +18 -0
  36. package/docs/roadmap/maestro-22-avoid-acceptance-criteria-already-covered-by-tests.md +16 -0
  37. package/docs/roadmap/maestro-23-change-agent-models-before-a-builder-run.md +14 -0
  38. package/docs/roadmap/maestro-24-add-a-simplifier-with-one-clear-purpose-per-agent.md +23 -0
  39. package/docs/roadmap/maestro-25-define-workflow-reconciliation.md +19 -0
  40. package/docs/roadmap/maestro-26-exit-maestro-mode-automatically-at-workflow-completion.md +18 -0
  41. package/docs/roadmap/maestro-27-make-all-implementation-phases-optional.md +26 -0
  42. package/docs/roadmap/maestro-28-add-maestro-role-instructions-alongside-the-other-agents.md +14 -0
  43. package/docs/roadmap/maestro-6-display-specs-in-a-browser.md +14 -0
  44. package/docs/roadmap/maestro-7-route-builder-failures-through-owner-escalations.md +19 -0
  45. package/docs/roadmap/maestro-8-store-escalations-and-owner-decisions-in-builder-handoffs.md +19 -0
  46. package/docs/roadmap/maestro-9-format-glossary-terms-consistently.md +14 -0
  47. package/docs/roadmap/maestro-free-1-require-pi-150.md +16 -0
  48. package/docs/roadmap/maestro-free-2-remove-maestro-run-timeouts.md +18 -0
  49. package/docs/roadmap/maestro-free-3-run-the-builder-through-the-pi-sdk.md +31 -0
  50. package/docs/roadmap/maestro-free-4-run-the-verifier-through-the-pi-sdk.md +22 -0
  51. package/docs/roadmap/maestro-free-5-run-the-simplifier-through-the-pi-sdk.md +22 -0
  52. package/docs/roadmap/maestro-free-6-show-sdk-agent-activity-through-pi.md +21 -0
  53. package/docs/roadmap/maestro-free-7-remove-the-pi-subagents-dependency.md +21 -0
  54. package/docs/roadmap/maestro-free-pre-3-implement-internal-sdk-delegation.md +37 -0
  55. package/docs/subagent-integration.md +9 -29
  56. package/docs/workflow.md +62 -246
  57. package/extensions/maestro.ts +96 -19
  58. package/package.json +2 -6
  59. package/src/MaestroPaths.ts +9 -0
  60. package/src/config/assertConfiguration.ts +23 -21
  61. package/src/config/defaults.ts +2 -1
  62. package/src/config/loadConfiguration.ts +3 -2
  63. package/src/config/saveConfiguration.ts +38 -14
  64. package/src/config/schema.ts +13 -0
  65. package/src/maestro/checks/assertEnvironment.ts +8 -33
  66. package/src/maestro/selectAgentModels.ts +70 -0
  67. package/src/maestro/setupInitialConfiguration.ts +26 -0
  68. package/src/maestro/status/formatMaestroStatus.ts +3 -0
  69. package/src/score/collectWorkflowEvidence.ts +170 -0
  70. package/src/score/parseClassifierScores.ts +51 -0
  71. package/src/score/questions.json +24 -0
  72. package/src/score/requestEvaluation.ts +54 -0
  73. package/src/score/scoreWorkflow.ts +100 -0
  74. package/src/tools/child/record-builder-handoff.ts +1 -0
  75. package/src/tools/child/record-simplifier-handoff.ts +2 -1
  76. package/src/tools/child/record-verifier-handoff.ts +1 -0
  77. package/src/tools/main/create-spec.ts +1 -0
  78. package/src/tools/main/mark-spec-ready.ts +1 -0
  79. package/src/tools/main/resolve-escalations.ts +1 -0
  80. package/src/tools/main/resolve-findings.ts +6 -1
  81. package/src/tools/main/run-builder.ts +8 -1
  82. package/src/tools/main/run-simplifier.ts +26 -6
  83. package/src/tools/main/run-verifier.ts +8 -1
  84. package/src/tools/main/score-workflow.ts +43 -0
  85. package/src/ui/selectModel.ts +23 -15
  86. package/src/ui/showAgentRolesSetupMenu.ts +65 -0
  87. package/src/workflow/spec/markSpecReady.ts +13 -3
  88. package/src/workflow/state/schema.ts +3 -0
  89. package/src/workflow/transitions.ts +9 -2
  90. package/templates/spec.md +1 -1
  91. package/ADR.md +0 -457
  92. package/ROADMAP.md +0 -641
  93. package/src/maestro/setupConfiguration.ts +0 -50
  94. package/src/ui/selectSpec.ts +0 -14
  95. package/src/ui/showSetupMenu.ts +0 -44
  96. package/src/ui/showSpecMenu.ts +0 -36
  97. /package/{MISSION.md → docs/MISSION.md} +0 -0
  98. /package/{TECH_STACK.md → docs/TECH_STACK.md} +0 -0
@@ -0,0 +1,37 @@
1
+ ---
2
+ type: Roadmap
3
+ id: 'MAESTRO-FREE-PRE-3'
4
+ title: 'Implement internal SDK delegation'
5
+ status: completed
6
+ ---
7
+
8
+ ## Objective
9
+
10
+ Implement and verify one internal execution operation using `createAgentSession()`, following [ADR-010](../adr/0010-use-the-pi-sdk-for-sequential-agent-delegation.md).
11
+ The operation is independent of the `builder`, `verifier`, and `simplifier` roles. Callers supply the task, role instructions, model settings, working directory, and
12
+ additional tools needed for that execution.
13
+
14
+ Requires [MAESTRO-FREE-1](maestro-free-1-require-pi-150.md) and [MAESTRO-FREE-2](maestro-free-2-remove-maestro-run-timeouts.md). This item implements the execution
15
+ mechanism without switching existing workflow tools away from `pi-subagents`. FREE-3, FREE-4, and FREE-5 connect the three roles to it together after it is verified.
16
+
17
+ The executor manages child sessions, not the workflow. It does not select phases, interpret role outcomes, or validate `handoffs`. Those responsibilities remain with the
18
+ callers and existing workflow operations. Communication remains task-and-`handoff`, without shared in-memory workflow state or a live supervisor dialogue. This is not a
19
+ new public tool or a general-purpose orchestration framework. Live progress presentation remains in
20
+ [MAESTRO-FREE-6](maestro-free-6-show-sdk-agent-activity-through-pi.md).
21
+
22
+ See the [specification](../../.specs/20261105-212231-implement-internal-pi-sdk-delegation/spec.md).
23
+
24
+ ## Completed When
25
+
26
+ 1. The operation executes a supplied task in a fresh SDK conversation with the supplied model and thinking level, role guidance, global and project instructions, skills,
27
+ working tools, and caller-supplied additional tools. It does not depend on any of the three workflow roles.
28
+ 2. Enabled global and project extensions and native Pi tool support load as defined in ADR-010, excluding the main `Maestro` extension. The main session retains its
29
+ `Maestro` mode while the child executes. No compatibility adapters, integration health gates, or delegation-prevention tool filters are added.
30
+ 3. Execution waits for the child to finish, fail, or be interrupted before another child starts. The executor imposes no automatic deadline and does not start a new
31
+ session to retry or repair failed work.
32
+ 4. Manual cancellation reaches `session.abort()` and waits for interruption. Sessions, subscriptions, and owned resources are released on every exit, without rollback,
33
+ workflow changes, or synthetic `handoffs`. Execution errors propagate to the caller.
34
+ 5. Native Pi sessions are persisted in `subagents/` beneath Pi's project session directory, resolved through Pi's API. The saved path is available to the caller on
35
+ completion or failure when a file exists. Every execution starts fresh; no automatic resumption is introduced.
36
+ 6. Successful execution, execution failure, cancellation, context and tool loading, and session persistence are verified independently of the workflow migration. The
37
+ existing three role tools still use `pi-subagents` at the end of this item.
@@ -1,45 +1,25 @@
1
1
  # Subagent integration
2
2
 
3
- `Maestro` runs the `builder`, `verifier`, and `simplifier` through Pi's SDK. Each child session handles one role while the `owner` stays in the main `Maestro`
4
- conversation.
3
+ The `owner` stays in the main `Maestro` conversation while the `builder`, `verifier`, and `simplifier` each work in a separate Pi session. The optional `scorer` uses a Pi
4
+ classifier instead of a separate agent session. See [Workflow evaluation](workflow.md#workflow-evaluation).
5
5
 
6
6
  ## Roles and context
7
7
 
8
- The package supplies the three roles:
8
+ Each agent `run` starts a fresh conversation. Agents use the `spec`, relevant saved `artifacts`, and Pi's global and project instructions, including `AGENTS.md`. They do
9
+ not see the main conversation or earlier agent conversations. Requirements discussed in chat should be captured in the `spec`.
9
10
 
10
- | Role | Instructions |
11
- | ------------ | ------------------------------------------------- |
12
- | `Builder` | [`agents/builder.md`](../agents/builder.md) |
13
- | `Verifier` | [`agents/verifier.md`](../agents/verifier.md) |
14
- | `Simplifier` | [`agents/simplifier.md`](../agents/simplifier.md) |
11
+ Agents can use Pi's enabled extensions and skills, including configured MCP, codemode, and tool search support.
15
12
 
16
- Each `run` starts a fresh conversation, without the main session's history or automatic resumption of earlier child sessions. The bundled role instructions supplement
17
- Pi's normal instructions. Global and project instructions, including `AGENTS.md`, and available skills are discovered through Pi. Models and thinking levels come from
18
- [Maestro configuration](configuration.md).
19
-
20
- Enabled global and project extensions load in child sessions. Native Pi tools and configured MCP, codemode, and tool search support are available.
21
-
22
- The `owner` approves the `spec` and selected phases through the main conversation. See [Phase selection](configuration.md#phase-selection).
23
-
24
- ## Following a run
25
-
26
- `Runs` stay in the foreground and occur one at a time. Pi waits for each `run` to finish before `Maestro` continues. Maestro's Pi status shows the workflow phase.
27
-
28
- Saved `handoffs` contain the structured results. See [Stored artifacts](workflow.md#stored-artifacts) for further details.
13
+ Maestro's status in Pi shows the current workflow phase.
29
14
 
30
15
  ## Cancellation and errors
31
16
 
32
- The `owner` can interrupt a running agent with Pi's cancel action (`Escape` by default). `Maestro` forwards cancellation to the child and waits for cleanup.
33
-
34
- Execution errors, interruptions, and missing or invalid `handoffs` stop the workflow. Completed file changes remain.
17
+ Press `Escape` (Pi's default cancel key) to stop a running agent. Cancellation does not undo file changes. After an interruption or error, see
18
+ [Restart an existing spec](workflow.md#restart-an-existing-spec).
35
19
 
36
20
  ## Inspecting saved sessions
37
21
 
38
- When a native child session file exists, `Maestro` displays its exact path on completion or failure, including interruptions and invalid `handoffs`. No path is displayed
39
- when execution fails before a session file is saved.
40
-
41
- Child session files live under `subagents/` in Pi's project session directory, outside the project repository. The `owner` can read the displayed JSONL file directly or
42
- export it with Pi:
22
+ If `Maestro` displays a saved session path, open the JSONL file or export it to HTML to inspect the agent's messages and tool calls:
43
23
 
44
24
  ```bash
45
25
  pi --export /sessions/weather/subagents/child.jsonl conversation.html
package/docs/workflow.md CHANGED
@@ -1,57 +1,8 @@
1
1
  # Workflow
2
2
 
3
- `Maestro` guides one spec-driven workflow inside the current Pi session. You, the `owner`, work with `Maestro` directly.
4
-
5
- The approved `spec` is a set of documents that together form one contract for the change. `proposal.md` explains why we are doing it and what is in scope. `spec.md`
6
- describes how things should behave and lists the `acceptance criteria`. `design.md` is optional and records the important technical decisions.
7
-
8
- Each `acceptance criterion` has one `GIVEN`, one `WHEN`, one `THEN`, and a behavioral example table or a written example. `GIVEN` and `WHEN` set up the scenario. `THEN`
9
- says what result we expect, in a way we can measure.
10
-
11
- A `handoff` is a report saved by an agent. Reports from the `builder` and the `verifier` include `probe` outcomes. The simplifier's report lists the files it refactored,
12
- a short summary, and any notes.
13
-
14
- A `builder` `handoff` may include `escalations`, which are questions that only you can decide. A `verifier` `handoff` may include `findings`, which are technical issues
15
- it found.
16
-
17
- ## Roles
18
-
19
- | Role | Responsibility |
20
- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
- | `Owner` | Decides requirements, scope, technical decisions, `spec` approval, `escalation` answers, and `finding` decisions. Performs the final review. |
22
- | `Maestro` | Prepares the `spec` with the `owner`, records workflow progress, runs agents, presents issues, and saves `owner` decisions. |
23
- | `Builder` | Implements the approved `spec` and checks every `GIVEN`, `WHEN`, and `THEN` scenario. Reports completion or an `escalation`, including technical problems that prevent completion. |
24
- | `Verifier` | Independently checks every `GIVEN`, `WHEN`, and `THEN` scenario against the live project files. Reports `findings` without repairing product code. |
25
- | `Simplifier` | Refactors accepted code for clarity without changing behavior or introducing check failures. |
26
-
27
- `Builder`, `verifier`, and `simplifier` `runs` are sequential foreground operations. Each starts with a fresh conversation and reads the `spec` and saved `artifacts`.
28
-
29
- ## Observability
30
-
31
- `Observability` is the owner's ability to inspect workflow progress and reported results.
32
-
33
- Maestro's Pi status shows the current phase.
34
-
35
- `Maestro` displays the saved native child session path when one exists, including after a failed or interrupted `run`. The `owner` can inspect the file or export it with
36
- Pi. See [Inspecting saved sessions](subagent-integration.md#inspecting-saved-sessions).
37
-
38
- Saved `handoffs` provide a structured account of each reported `run`. The `builder` reports its outcome, `probe` results, notes, and any `escalation` questions. The
39
- `verifier` reports its independent checks, results, and `findings`. The `simplifier` reports its refactoring separately. Recorded `owner` decisions explain how questions
40
- and issues were resolved. Earlier numbered reports remain available for inspection.
41
-
42
- For example, the `owner` can read `B1.json` to see what the `builder` reports implementing and which `probes` it ran. `V1.json` shows what the `verifier` reports checking
43
- independently and which issues it found.
44
-
45
3
  ## Main flow
46
4
 
47
- The diagram shows the default flow with all three agents enabled. The green arrows and lines show the path without `escalations` or `findings`.
48
-
49
- The `owner` selects phases through each agent's `required` boolean before activation and leaves configuration unchanged during the workflow. All flags default to `true`.
50
- See [Phase selection](configuration.md#phase-selection).
51
-
52
- With `builder` disabled, approval moves directly to `candidate-ready` and all agents are skipped. Otherwise, after `builder` completion, disabled verification is
53
- bypassed: the workflow enters `simplifier-running` if simplification is enabled, or `candidate-ready` otherwise. Successful verification and rejection of all current
54
- `findings` also move directly to `candidate-ready` when simplification is disabled. Skipped agents are not delegated and need no `handoffs`.
5
+ The diagram shows a flow with all three agents and scoring enabled. The green arrows and lines show the path without `escalations` or `findings`.
55
6
 
56
7
  ```mermaid
57
8
  flowchart TD
@@ -62,6 +13,7 @@ flowchart TD
62
13
  verify[Verifier checks live project files]
63
14
  findings{Findings?}
64
15
  simplify[Simplifier refactors accepted code]
16
+ evaluate["LLM as Judge: scores correctness and verification quality"]
65
17
  candidate[Candidate ready]
66
18
  summary[Maestro summarizes results]
67
19
  review[Owner performs the final review]
@@ -81,18 +33,16 @@ flowchart TD
81
33
  recordFindings -->|Reject all with reasons| simplify
82
34
  recordFindings -->|Fix code without spec changes| build
83
35
  recordFindings -->|Spec changes| reviseSpec
84
- simplify --> candidate
36
+ simplify --> evaluate
37
+ evaluate --> candidate
85
38
  candidate --> summary
86
39
  summary --> review
87
- linkStyle 0,1,2,3,4,5,16,17,18 stroke: #2e7d32, stroke-width: 3px
40
+ linkStyle 0,1,2,3,4,5,16,17,18,19 stroke: #2e7d32, stroke-width: 3px
88
41
  ```
89
42
 
90
43
  ## Workflow phases
91
44
 
92
- Each `spec` has a `workflow.json` file that records its identity and current phase. The saved phase controls the next permitted workflow action. An agent's final message
93
- alone does not establish a completed action.
94
-
95
- The default path is `.specs/<spec-id>/workflow.json`. The `spec` directory is [configurable](configuration.md).
45
+ The saved phase in `workflow.json` determines what can happen next.
96
46
 
97
47
  | Phase | Meaning |
98
48
  | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
@@ -104,7 +54,8 @@ The default path is `.specs/<spec-id>/workflow.json`. The `spec` directory is [c
104
54
  | `verifier-running` | A `verifier` `run` is active. |
105
55
  | `finding-decisions` | The `owner` must decide how to handle every current `finding`. |
106
56
  | `simplifier-running` | Selected preceding phases finished. The enabled `simplifier` can run or skip if Git is unavailable. |
107
- | `candidate-ready` | The selected phases completed or were skipped. The workflow is complete. |
57
+ | `scorer-running` | Implementation is finished. Evaluation gathers evidence and saves scores or a failure before completion. |
58
+ | `candidate-ready` | The workflow is complete; the `owner` can review its results. |
108
59
 
109
60
  ## Specification documents
110
61
 
@@ -118,169 +69,38 @@ Each new `spec` uses these documents in the same directory:
118
69
 
119
70
  ## Spec approval
120
71
 
121
- For the initial `spec`:
122
-
123
- 1. `Maestro` creates `proposal.md`, `spec.md`, and `workflow.json` in `drafting-spec`, then prepares the documents with the `owner`. It adds `design.md` only when needed.
124
- 2. The `owner` reviews the complete document set: motivation, scope, requirements, `acceptance criteria`, `assumptions`, and any approved technical decisions.
125
- 3. `Maestro` asks the `owner` to inspect `proposal.md`, `spec.md`, and `design.md` when present and reply `GREEN FLAG` once to approve the entire set and proceed through
126
- the selected phases.
127
- 4. After that reply, `Maestro` saves `ready-for-builder` and starts the enabled `builder` in the foreground, or saves `candidate-ready` with all agents skipped.
128
-
129
- Approval freezes all present `spec` documents and visual prototypes together. None may change during `builder`, `verifier`, or `simplifier` execution. See
130
- [Spec revision](#spec-revision) for permitted revisions.
131
-
132
- ## Requirement deltas
133
-
134
- Each requirement has exactly one `Delta` field. It describes the impact of the requirement against the current system's behavior.
135
-
136
- | Value | Meaning |
137
- | ---------- | ------------------------------------------------------------------------- |
138
- | `added` | Introduces behavior or a constraint that did not exist before the change. |
139
- | `modified` | Changes existing behavior or a constraint. |
140
- | `removed` | Removes behavior that must no longer be available. |
141
-
142
- The `spec` describes only requirements added, modified, or removed by the change. Existing behavior must continue working unless explicitly changed or removed. Unchanged
143
- behavior is implicit, not an inventory of requirements to repeat in every `spec`.
144
-
145
- For `modified` or `removed` requirements, a short `Before` description is included only when it helps explain the change. For example,
146
- `Before: Tokens expire 30 minutes after issuance.`
147
-
148
- ## Requirement coverage
149
-
150
- Each requirement has its own section and a unique, stable ID, such as `REQ1`. Its `Verified by` field links to the `acceptance criteria` or existing tests that verify it.
151
- The mapping appears only under the requirement, not again inside each `acceptance criterion`. Requirements use `### REQ<number>:` headings; their criteria immediately
152
- follow as `#### AC<number>:` subsections. Each requirement-associated AC is defined once under its primary requirement; other requirements can link to it. AC numbering is
153
- continuous across the whole document, including standalone regression criteria, not restarted for each requirement or section.
154
-
155
- For example, a change that introduces persistent item titles can describe its requirement and linked `acceptance criterion` in `spec.md` as follows:
156
-
157
- ```markdown
158
- ### REQ1: The system MUST persist saved titles
159
-
160
- Delta: added
161
-
162
- Verified by: [AC1](#ac1-saved-title-is-persisted)
163
-
164
- #### AC1: Saved title is persisted
165
-
166
- - GIVEN a saved item.
167
- - WHEN its title is changed and saved, then the item is reopened.
168
- - THEN the saved title is present.
169
-
170
- | Saved title | Action | Title after reopening |
171
- | ----------- | -------------------------------------------------- | --------------------- |
172
- | Draft | Change title to "Ready", save, and reopen the item | Ready |
173
- ```
174
-
175
- A requirement can link to several `acceptance criteria`, and one criterion can verify several requirements (1:N). When an existing test covers the exact starting
176
- conditions, action, and outcome, `Verified by` links to the test file relative to `spec.md` and includes the exact scenario name. No duplicate criterion is needed. A
177
- requirement can reference both criteria and existing tests.
178
-
179
- Before approval, `Maestro` follows the links and checks that their combined scenarios verify the whole requirement. Missing, partial, or uncertain coverage must be
180
- resolved with an appropriate criterion or a confirmed existing test. References are updated when criterion headings or test locations change, including during `spec`
181
- revisions.
182
-
183
- ## Acceptance criteria
184
-
185
- Each `acceptance criterion` has a unique ID and describes one observable result. A criterion can verify a changed requirement or check a relevant regression in existing
186
- behavior without an associated requirement.
187
-
188
- Standalone regression criteria belong in an optional `## Regression checks` section, with `### AC<number>:` headings. They do not need a `REQ` heading, `Delta`, or an
189
- artificial requirement association. Only regressions relevant to the change belong here; unchanged requirements are not listed. The section is omitted when unnecessary.
190
-
191
- For example, if saving item descriptions already works, adding title persistence may warrant this regression check without a new requirement for descriptions:
192
-
193
- ```markdown
194
- ## Regression checks
195
-
196
- ### AC2: Existing descriptions remain saved
197
-
198
- - GIVEN an item with a saved description.
199
- - WHEN its title is changed and saved, then the item is reopened.
200
- - THEN the description is unchanged.
201
-
202
- | Saved title | Saved description | Action | Description after reopening |
203
- | ----------- | ----------------- | ----------------------------------------------------- | --------------------------- |
204
- | Draft | Buy milk | Change title to "Shopping", save, and reopen the item | Buy milk |
205
- ```
206
-
207
- Both nested and standalone criteria share one continuous AC sequence and are checked by the `builder` and `verifier`. Standalone criteria have the same fields as
208
- requirement-associated criteria:
209
-
210
- | Part | Content |
211
- | -------- | -------------------------------------------------------------------------------- |
212
- | `GIVEN` | Starting conditions. |
213
- | `WHEN` | The action or observation that checks the behavior. |
214
- | `THEN` | The measurable outcome the `WHEN` must produce. |
215
- | Examples | A behavioral table by default, or a written `Example` when a table does not fit. |
216
-
217
- Concrete examples normally appear as tables. Each row describes a complete case with its starting conditions, action, and expected outcome. When a table would be
218
- difficult to read, the criterion uses a written example instead.
219
-
220
- During approval, the `owner` reviews these examples as part of the required behavior. Every case must be satisfied and independently checked, but an automated test is not
221
- always necessary; code inspection may provide sufficient evidence.
222
-
223
- ## Assumptions
224
-
225
- An `assumption` records a detail the request did not specify or a scope boundary taken as given. `Maestro` writes short `assumptions` in a `## Assumptions` section of
226
- `spec.md` as a bullet list, without paragraphs. The section is omitted when there are none. An `assumption` that proves false during implementation is an `escalation`
227
- trigger.
72
+ Review `proposal.md`, `spec.md`, and `design.md` if present. Reply `GREEN FLAG` when `Maestro` asks for approval. This approves the whole set, including any visual
73
+ prototypes, and starts the selected [implementation phases](configuration.md#phase-selection). The approved files are frozen until a [spec revision](#spec-revision).
228
74
 
229
75
  ## Escalations
230
76
 
231
- An `escalation` returns an implementation decision or a technical problem to the `owner`. For instance a technical failure, an undefined behavior, a conflict with the
232
- `spec`, or a possible scope change.
233
-
234
- The `builder` saves all questions from one `pass` in the `escalations` list of its numbered `handoff`. `Maestro` identifies each question with both report and
235
- `escalation` IDs, such as `B1/E1`. See [Escalation references](glossary.md#escalation-references) for their scope.
236
-
237
- `Maestro` presents each question, evidence, options, consequences, and next steps. The workflow pauses in `escalation-decisions` while the `owner` decides how to proceed.
238
-
239
- The `owner` gives `Maestro` an answer and reason for every current question, whether or not the `spec` must change. The `owner` can select a listed option or give a
240
- different decision.
241
-
242
- `Maestro` saves all answers in the current `builder` `handoff` before the workflow continues.
77
+ The `builder` raises an `escalation` when an implementation question or blocker needs an `owner` decision. The `owner` gives `Maestro` an answer and a reason for each
78
+ question and can pick a suggested option or give a different answer. References such as [B1/E1](glossary.md#identifiers-and-file-names) identify the question in its
79
+ report.
243
80
 
244
81
  | `Owner` choice | Result |
245
82
  | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
246
83
  | Keep the current `spec` | `Maestro` starts another `builder` `run` without renewed approval. |
247
84
  | Change the `spec` | The `owner` and `Maestro` revise the same `spec`. The `owner` reviews it and replies `GREEN FLAG` before another `builder` `run`. |
248
85
 
249
- `Owner` decisions update only the questions' `resolution` fields. The handoff's other content and earlier `handoffs` remain unchanged.
250
-
251
86
  ## Findings
252
87
 
253
- Every current `finding` requires an `owner` decision, regardless of severity. `Maestro` explains the issue, evidence, practical effect, and available choices.
88
+ A `finding` is an issue the `verifier` identifies while independently checking the implementation against the approved `spec`. The `owner` decides how to handle each
89
+ `finding`, regardless of severity. References such as [V1/F2](glossary.md#identifiers-and-file-names) identify the issue in its report.
254
90
 
255
- `Maestro` identifies each `finding` with its report and `finding` IDs. For example, `V1/F2` means `finding` 2 in `verifier` report `V1.json`. The `finding` is an entry in
256
- that file's `findings` list, not a separate `F2.json` file. `Finding` numbers restart at `F1` in each `verifier` report. See
257
- [Finding references](glossary.md#finding-references) for a worked example.
91
+ | Decision | Result |
92
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
+ | `reject` | Records the owner's reason. If every `finding` is rejected, the workflow reaches `simplifier-running` when enabled, otherwise `scorer-running` if scoring is enabled, or `candidate-ready`. |
94
+ | `fix-code` | Keeps the current `spec` and returns to `ready-for-builder` for code fixes when no decision requires revision. |
95
+ | `revise-spec` | Records the owner's reason and agreed requirement change, then returns to `drafting-spec`. |
258
96
 
259
- `Maestro` records `owner` decisions in the same `verifier` report, e.g. decisions about `V1/F2` update `V1.json`, not a new `V2.json`. A new `verifier` result creates the
260
- next report (`V2.json`).
261
-
262
- | Decision | Result |
263
- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
264
- | `reject` | Records the owner's reason. If every `finding` is rejected, the workflow reaches `simplifier-running` when enabled, otherwise `candidate-ready`. |
265
- | `fix-code` | Keeps the current `spec` and returns to `ready-for-builder` for code fixes when no decision requires revision. |
266
- | `revise-spec` | Records the owner's reason and agreed requirement change, then returns to `drafting-spec`. |
267
-
268
- `Maestro` saves every current decision together before the phase changes. If any `finding` requires revision, revision takes priority over code fixes and rejections. See
269
- [Spec revision](#spec-revision).
270
-
271
- Without revision, any `fix-code` decision requires another `builder` `run`, including when other `findings` are rejected. After the `builder` completes the fixes, the
272
- `verifier` checks the work again.
97
+ If any `finding` requires revision, revise the `spec` before any code fixes. Otherwise, if any decision is `fix-code`, the `verifier` checks the work again after the
98
+ `builder` fixes it. Rejecting a `finding` does not mean its check passed.
273
99
 
274
100
  ## Spec revision
275
101
 
276
- For either `escalation` answers or `finding` decisions, `Maestro` records the complete batch before the workflow returns to `drafting-spec`. This decision does not
277
- approve the `spec` or start an agent. The `owner` and `Maestro` then revise the same `spec` together in `drafting-spec`.
278
-
279
- The `owner` reviews the complete revised set of `proposal.md`, `spec.md`, and `design.md` when present and replies `GREEN FLAG` once again. `Maestro` records that renewed
280
- approval separately, moves to `ready-for-builder`, and starts another `builder` `run`. Approval is permitted only in `drafting-spec`, not directly from either decision
281
- phase.
282
-
283
- The revised `spec` controls subsequent work. Earlier `escalations`, `findings`, and their decisions remain historical context.
102
+ A decision to change the `spec` pauses implementation. Review the revised document set and reply `GREEN FLAG` again before the `builder` restarts. Earlier reports and
103
+ decisions remain available as context.
284
104
 
285
105
  ## Verification boundary
286
106
 
@@ -297,54 +117,45 @@ When enabled, `Maestro` starts the `simplifier` after successful verification, r
297
117
  The `simplifier` starts from all staged, unstaged, and untracked code changes, including pre-existing changes. It preserves observable behavior and introduces no new
298
118
  check failures. If no code needs refactoring, the `simplifier` does not make any change.
299
119
 
300
- ## Workflow completion
301
-
302
- The workflow ends at `candidate-ready`. `Maestro` summarizes the changes, verification results, rejected `findings` and reasons, relevant `builder` notes from the saved
303
- `artifacts`, and simplifier's summary and notes, only for phases that ran. It identifies every skipped phase and its reason. An approved `spec` alone does not mean code
304
- was implemented or verified. `Builder` checks and the simplifier's report are not independent verification when `verifier` is disabled. The `owner` can use an approved
305
- `spec` for implementation in another workflow without further `Maestro` execution.
120
+ ## Workflow evaluation
306
121
 
307
- `Maestro` stays active while delivering this final summary, then automatically turns off after successful delivery. The `owner` performs the final review and controls any
308
- later Git use, pull request, or merge. Changes after completion are outside the completed verification.
122
+ When scoring is enabled, `scorer-running` evaluates the entire workflow against the approved `spec` after the selected implementation phases, including simplification.
123
+ The selected Pi classifier receives the approved documents, available `handoffs` and `owner` decisions, and staged, unstaged, and untracked Git changes against `HEAD`.
124
+ Scoring is off by default. The `owner` can choose a classifier in [Agent models](configuration.md#agent-models) before starting or restarting a `spec`.
309
125
 
310
- ## Stored artifacts
126
+ The classifier's ratings are converted to two separate scores on a **0–100 scale**. Each retains its confidence value from 0 to 1:
311
127
 
312
- An `artifact` is a saved workflow file. `Maestro` creates the `spec` directory with `proposal.md`, `spec.md`, `workflow.json`, and an empty `prototypes/` directory.
313
- `design.md` is created during drafting only when needed. `Builder`, `verifier`, and `simplifier` `handoff` directories appear when those results are saved.
128
+ | Score | Criteria |
129
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
130
+ | Correctness | How fully the implementation meets the approved requirements: from missing or fundamentally wrong behavior to all required behavior supported with no identified defect. |
131
+ | Verification quality | How well execution or code inspection supports the required scenarios: from unsupported claims to complete, traceable evidence, including relevant failure cases. |
314
132
 
315
- The agents submit results through `Maestro` tools instead of writing the reports directly. A successful submission saves the result and updates the phase in
316
- `workflow.json` before the agent returns.
133
+ Missing verification evidence is not a code defect. Checks run by the `Builder` can support the evaluation, but they are not independent verification.
317
134
 
318
- `Builder` (`B`) and `verifier` (`V`) numbers count saved `handoffs` within one `spec`. Each sequence starts at 1 and advances independently. Every saved `builder`
319
- outcome, including `escalation`, creates the next `B` report. Revising the same `spec` keeps these sequences. A new `spec` starts new sequences.
135
+ The automatic grading helps the `owner` decide how much to trust the workflow's outcome. It does not prove the work is correct.
320
136
 
321
- `Escalation` (`E`) numbers identify questions within a `builder` `handoff`. They restart at `E1` in each `handoff`.
137
+ Results are saved in the `spec-score/` folder inside the active `spec` directory:
322
138
 
323
- For example, a repair cycle with successful `builder` results produces these files:
139
+ - `evaluation.json` has the scores and confidence values, or the reason for a failure.
140
+ - `evaluation.raw.json` has the classifier response, if one was returned.
324
141
 
325
- | Step | Action | Report saved or updated |
326
- | ---- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
327
- | 1 | The `builder` completes the implementation. | Creates `handoffs/builder/B1.json`. |
328
- | 2 | The `verifier` checks it and reports `findings`. | Creates `handoffs/verifier/V1.json`. |
329
- | 3 | The `owner` decides every `finding` and requests a code fix. | Updates decisions in the existing `V1.json`. |
330
- | 4 | A new `builder` `run` completes the fixes. | Creates `handoffs/builder/B2.json`. |
331
- | 5 | A new `verifier` `run` checks the work again and reports no `findings`. | Creates `handoffs/verifier/V2.json`. The workflow reaches `simplifier-running`. |
332
- | 6 | The `simplifier` completes its refactoring. | Creates `handoffs/simplifier/S.json`, then saves `candidate-ready`. |
142
+ Evaluation needs Git with an existing `HEAD`. Once a success or a failure is saved, the workflow moves to `candidate-ready`. If the evaluation hits an error or is
143
+ cancelled, a failure report is saved without scores. If the report cannot be saved, the workflow cannot finish. Maestro adds the workflow evaluation in the final summary.
333
144
 
334
- If the first `builder` `run` escalates, it creates `B1.json` with its questions. `Owner` answers update `B1.json`. The next saved `builder` result creates `B2.json`.
145
+ ## Workflow completion
335
146
 
336
- A `builder` report has `status: done` or `status: escalation`. A `done` report requires every recorded `probe` to pass and an empty `escalations` list. An `escalation`
337
- retains actual `probe` results: `passed`, `failed`, or `not-run`.
147
+ When the workflow ends, `Maestro` presents a summary and turns off. The `owner` then reviews the changes.
338
148
 
339
- Execution errors or missing or invalid saved results stop the workflow. See [Limitations](#limitations).
149
+ ## Stored artifacts
340
150
 
341
- The default layout after multiple `runs` is:
151
+ A new `spec` starts with `proposal.md`, `spec.md`, `workflow.json`, and an empty `prototypes/` directory. `design.md` is optional, and `handoff` directories appear when
152
+ the first reports are saved. This example shows the files saved when all phases are enabled and the `verifier` checks the code again after a fix.
342
153
 
343
154
  ```text
344
155
  .specs/<spec-id>/
345
156
  ├── proposal.md
346
157
  ├── spec.md
347
- ├── design.md # only when needed
158
+ ├── design.md
348
159
  ├── workflow.json
349
160
  ├── handoffs/
350
161
  │ ├── builder/
@@ -355,11 +166,21 @@ The default layout after multiple `runs` is:
355
166
  │ │ └── V2.json
356
167
  │ └── simplifier/
357
168
  │ └── S.json
169
+ ├── spec-score/
170
+ │ ├── evaluation.json
171
+ │ └── evaluation.raw.json
358
172
  └── prototypes/
359
173
  ```
360
174
 
361
- `Maestro` uses the latest saved `builder` and `verifier` `handoffs` as their active results. New results do not replace earlier numbered reports. Earlier reports remain
362
- available as context, not as proof for the current `run`. `Owner` decisions update the active `builder` or `verifier` `handoff` without creating another numbered report.
175
+ | What happens | Report saved or updated |
176
+ | -------------------------------------------------------- | ----------------------- |
177
+ | The `builder` implements the change. | Creates `B1.json`. |
178
+ | The `verifier` checks the change and reports `findings`. | Creates `V1.json`. |
179
+ | The `owner` requests a code fix for `V1/F2`. | Updates `V1.json`. |
180
+ | The `builder` fixes the issue. | Creates `B2.json`. |
181
+ | The `verifier` checks the fix. | Creates `V2.json`. |
182
+
183
+ `B` and `V` are numbered separately within each `spec`. Revising the `spec` does not reset the numbering or remove earlier reports.
363
184
 
364
185
  ## Limitations
365
186
 
@@ -373,18 +194,13 @@ these project-specific checks.
373
194
 
374
195
  ### No automatic rollback
375
196
 
376
- The `owner` can stop a running agent through Pi's cancel action (`Escape` by default). There is no automatic `Maestro` execution deadline. Cancellation does not request a
377
- final agent turn or create a synthetic `handoff`.
378
-
379
- Launch errors, execution failures, interruptions, cancellations, and missing or invalid `handoffs` stop the workflow without a recovery transition. If a `run` saves no
380
- completed transition, its saved running phase remains unchanged. Partial protocol writes require manual `owner` follow-up. `Maestro` provides no automatic rollback,
381
- repair, or recovery for these errors. The files that remain are available for `owner` inspection.
197
+ A failed or interrupted `run` can leave file changes on disk and a running phase in `workflow.json`. `Maestro` does not roll back or repair partial changes. The `owner`
198
+ should inspect the project files and saved reports before restarting.
382
199
 
383
200
  ### Restart an existing spec
384
201
 
385
- When existing `specs` are available, `/maestro` activation offers "New spec" and "Restart spec". Restart opens a selector of existing `specs` in the configured directory.
386
- The selected `spec` returns to `drafting-spec` from any saved phase. `Maestro` reads and reviews its proposal, `spec`, and optional design with the `owner` before asking
387
- for renewed `GREEN FLAG`.
202
+ To revisit an existing `spec`, choose "Restart spec" in `/maestro`. The selected `spec` returns to `drafting-spec` from any saved phase. `Maestro` reads and reviews its
203
+ proposal, `spec`, and optional design with the `owner` before asking for renewed `GREEN FLAG`.
388
204
 
389
205
  Restart preserves the existing files except for the workflow phase. Saved `owner` decisions retain their normal effect for the same approved documents. Restart does not
390
206
  recover an interrupted agent or its conversation, reconstruct progress from the previous phase, or reconcile partial saves.