@emiliosp/pi-maestro 0.18.5 → 0.18.7

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/ADR.md CHANGED
@@ -280,7 +280,8 @@ Approval can finish at `candidate-ready` without agent execution. Agent and mode
280
280
 
281
281
  ### Status
282
282
 
283
- Design decisions confirmed by the `owner`. Implemented.
283
+ Design decisions confirmed by the `owner`. Implemented. Main-extension pre-load exclusion is superseded by
284
+ [ADR-012](#adr-012-filter-main-maestro-registrations-after-native-discovery).
284
285
 
285
286
  ### Context
286
287
 
@@ -404,3 +405,53 @@ Existing boundaries are described in [subagent integration](docs/subagent-integr
404
405
  [builder execution](src/tools/main/run-builder.ts), and the
405
406
  [child extension](https://github.com/emilioSp/pi-maestro/blob/9d020b9177e93333736ade265db5e332fbb2a291/extensions/maestro-subagent.ts). These links describe the current
406
407
  implementation, not the planned SDK replacement.
408
+
409
+ ## ADR-011: Separate initial setup UI from configuration rules
410
+
411
+ ### Status
412
+
413
+ Accepted in the approved MAESTRO-19 design. Implemented for verification.
414
+
415
+ ### Context
416
+
417
+ Initial configuration needs searchable model selection without access to Pi's private session runtime. The `owner` selected public Pi components and strict separation
418
+ between graphical controls and configuration rules.
419
+
420
+ ### Decision
421
+
422
+ Use `ctx.ui.select()` for short choices and compose public `Input`, `SelectList`, and Pi filtering through `ctx.ui.custom()` for model selection. Keep graphical modules
423
+ in `src/ui/`, configuration rules and persistence in `src/config/`, and coordination in `src/maestro/setupConfiguration.ts`.
424
+
425
+ Keep completed role selections in memory for one command. Replace a role only after both nested choices finish. Configuration rules derive explicit phase flags from those
426
+ completed selections; confirmation is the only persistence boundary. Thinking choices preserve Pi's supported-level order and start at its first level for both initial
427
+ selections and replacements, without preferring `off`.
428
+
429
+ ### Consequences
430
+
431
+ Setup needs no private runtime access, separate model runtime, new dependency, or persistent draft. UI components receive supplied choices rather than deciding model
432
+ requirements or phase rules. Initial setup is limited to interactive terminal mode.
433
+
434
+ ### Evidence
435
+
436
+ [Approved design](.specs/20261108-141712-maestro-19-guide-initial-configuration-with-pi-selectors/design.md) and
437
+ [configuration guidance](docs/configuration.md#initial-setup).
438
+
439
+ ## ADR-012: Filter main Maestro registrations after native discovery
440
+
441
+ ### Status
442
+
443
+ Accepted in the approved [design](.specs/20261108-222326-simplify-child-extension-loading-with-the-native-pi-filter/design.md). Implemented for review. Supersedes only
444
+ the pre-load exclusion constraint in [ADR-010](#adr-010-use-the-pi-sdk-for-sequential-agent-delegation).
445
+
446
+ ### Context
447
+
448
+ Child preparation duplicated Pi's package discovery to exclude the main `Maestro` extension before initialization.
449
+
450
+ ### Decision
451
+
452
+ Use Pi's native discovery and configured selection. Filter the loaded main `Maestro` extension through `extensionsOverride` before constructing the child session.
453
+
454
+ ### Consequences
455
+
456
+ Main-extension initialization may register tools, commands, and handlers, but must not mutate parent state or start resources before filtering. SDK sessions share a
457
+ process; filtering removes registrations from the child runtime, not initialization side effects.
package/CHANGELOG.md CHANGED
@@ -3,193 +3,201 @@
3
3
  This file summarizes meaningful changes to the codebase, including behavior, data formats, architecture, and development tools. Git tags identify version boundaries;
4
4
  GitHub Releases are not required.
5
5
 
6
+ ## 0.18.7
7
+
8
+ - fix: Simplified child agent setup by using Pi's native extension discovery and tool registration.
9
+
10
+ ## 0.18.6
11
+
12
+ - Added guided initial configuration through `/maestro`: the `owner` selects models and thinking levels for `builder`, `verifier`, and `simplifier`, then saves the
13
+ configuration and activates `Maestro`. Selected agents are enabled; selecting none enables `spec` preparation only. Agent models no longer have defaults.
14
+
6
15
  ## 0.18.5
7
16
 
8
- 1. Added [The Pi Maestro Manifesto](MANIFESTO.md), linked from the README, explaining the project's motivation and approach to spec-driven development.
17
+ - Added [The Pi Maestro Manifesto](MANIFESTO.md), linked from the README, explaining the project's motivation and approach to spec-driven development.
9
18
 
10
19
  ## 0.18.2
11
20
 
12
- 1. The `run` progress for `builder`, `verifier`, and `simplifier` now shows only elapsed time and the latest assistant text. The role name and the active tool no longer
13
- appear.
21
+ - The `run` progress for `builder`, `verifier`, and `simplifier` now shows only elapsed time and the latest assistant text. The role name and the active tool no longer
22
+ appear.
14
23
 
15
24
  ## 0.18.1
16
25
 
17
- 1. Running `builder`, `verifier`, and `simplifier` tools now show elapsed time, active tools, and streaming normal assistant text. Elapsed time keeps updating during
18
- silent work. Pi controls preview and expansion, while intermediate activity stays out of the main model's context.
26
+ - Running `builder`, `verifier`, and `simplifier` tools now show elapsed time, active tools, and streaming normal assistant text. Elapsed time keeps updating during
27
+ silent work. Pi controls preview and expansion, while intermediate activity stays out of the main model's context.
19
28
 
20
29
  ## 0.18.0
21
30
 
22
- 1. `Builder`, `verifier`, and `simplifier` now run in fresh native Pi SDK sessions. Activation no longer requires a separate agent extension. The `owner` can interrupt
23
- them through Pi's cancel action.
24
- 2. `Maestro` displays saved child session paths on completion or failure, for direct inspection or HTML export with Pi.
25
- 3. `Maestro` no longer requires the `pi-subagents` package. Installation, activation, and agent `runs` use Pi alone.
31
+ - `Builder`, `verifier`, and `simplifier` now run in fresh native Pi SDK sessions. Activation no longer requires a separate agent extension. The `owner` can interrupt
32
+ them through Pi's cancel action.
33
+ - `Maestro` displays saved child session paths on completion or failure, for direct inspection or HTML export with Pi.
34
+ - `Maestro` no longer requires the `pi-subagents` package. Installation, activation, and agent `runs` use Pi alone.
26
35
 
27
36
  ## 0.17.0
28
37
 
29
- 1. Added a standalone internal Pi SDK executor. Each invocation starts a fresh conversation with supplied model, thinking level, role guidance, working directory, and
30
- additional tools. Native resource discovery loads instructions, skills, enabled extensions, and configured MCP, codemode, and tool search support, excluding the main
31
- `Maestro` extension.
32
- 2. Added native child session persistence in `subagents/` beneath Pi's project session directory.
33
- 3. Replaced the `acceptance criterion` `probe` and `expected result` fields with `GIVEN`, `WHEN`, and `THEN`, keeping the concrete example. Requirement bodies now use a
34
- named actor followed by `MUST` in the requirement heading. Added an optional bullet-list `## Assumptions` section to `spec.md`.
38
+ - Added a standalone internal Pi SDK executor. Each invocation starts a fresh conversation with supplied model, thinking level, role guidance, working directory, and
39
+ additional tools. Native resource discovery loads instructions, skills, enabled extensions, and configured MCP, codemode, and tool search support, excluding the main
40
+ `Maestro` extension.
41
+ - Added native child session persistence in `subagents/` beneath Pi's project session directory.
42
+ - Replaced the `acceptance criterion` `probe` and `expected result` fields with `GIVEN`, `WHEN`, and `THEN`, keeping the concrete example. Requirement bodies now use a
43
+ named actor followed by `MUST` in the requirement heading. Added an optional bullet-list `## Assumptions` section to `spec.md`.
35
44
 
36
45
  The `builder`, `verifier`, and `simplifier` still use `pi-subagents`. Workflow migration and dependency removal remain separate work.
37
46
 
38
47
  ## 0.16.0
39
48
 
40
- 1. Required Pi 1.5.0 or later and pinned the development Pi dependencies to that baseline, so type checks and tests run against the declared host. The extension now uses
41
- TypeBox `Type.Enum` with an explicit string type instead of the `StringEnum` helper, calls `before_agent_start` with Pi's message object, and expects the `truncated`
42
- field on `exec` results. See [PR #46](https://github.com/emilioSp/pi-maestro/pull/46).
43
- 2. Breaking: removed `timeoutMinutes` from the agent configuration. Configuration files that still contain the field fail validation until the `owner` removes it; no
44
- migration or legacy handling is provided.
45
- 3. Replaced the configured per-agent timeout with a fixed, non-configurable deadline passed to `pi-subagents` for every `run`. A `run` is no longer bounded by a
46
- configured duration.
47
- 4. Updated `ADR.md`, `ROADMAP.md`, `README.md`, and `docs/` for the new baseline and the removed timeout settings. `MAESTRO-FREE-1` is recorded as completed.
49
+ - Required Pi 1.5.0 or later and pinned the development Pi dependencies to that baseline, so type checks and tests run against the declared host. The extension now uses
50
+ TypeBox `Type.Enum` with an explicit string type instead of the `StringEnum` helper, calls `before_agent_start` with Pi's message object, and expects the `truncated`
51
+ field on `exec` results. See [PR #46](https://github.com/emilioSp/pi-maestro/pull/46).
52
+ - Breaking: removed `timeoutMinutes` from the agent configuration. Configuration files that still contain the field fail validation until the `owner` removes it; no
53
+ migration or legacy handling is provided.
54
+ - Replaced the configured per-agent timeout with a fixed, non-configurable deadline passed to `pi-subagents` for every `run`. A `run` is no longer bounded by a configured
55
+ duration.
56
+ - Updated `ADR.md`, `ROADMAP.md`, `README.md`, and `docs/` for the new baseline and the removed timeout settings. `MAESTRO-FREE-1` is recorded as completed.
48
57
 
49
58
  ## 0.15.0
50
59
 
51
- 1. Added per-agent `required` booleans in `.pi/maestro.json`, all defaulting to `true`. Disabling `builder` completes the workflow at `spec` approval without agents;
52
- otherwise `verifier` and `simplifier` can be disabled independently. See [PR #45](https://github.com/emilioSp/pi-maestro/pull/45).
53
- 2. Limited activation checks and displayed agent details to enabled phases. With `builder` disabled, activation requires no agents, models, or `pi-subagents` ping.
54
- 3. Updated workflow transitions, tool messages, agent guidance, and documentation for optional phases. Final-summary guidance identifies skipped work without claiming
55
- implementation, independent verification, or simplification occurred.
60
+ - Added per-agent `required` booleans in `.pi/maestro.json`, all defaulting to `true`. Disabling `builder` completes the workflow at `spec` approval without agents;
61
+ otherwise `verifier` and `simplifier` can be disabled independently. See [PR #45](https://github.com/emilioSp/pi-maestro/pull/45).
62
+ - Limited activation checks and displayed agent details to enabled phases. With `builder` disabled, activation requires no agents, models, or `pi-subagents` ping.
63
+ - Updated workflow transitions, tool messages, agent guidance, and documentation for optional phases. Final-summary guidance identifies skipped work without claiming
64
+ implementation, independent verification, or simplification occurred.
56
65
 
57
66
  ## 0.14.0
58
67
 
59
- 1. Removed Maestro's model format regex while retaining activation checks against Pi's available model registry. Complete identifiers, including
60
- `openrouter/~openai/gpt-mini-latest`, are matched without truncation and passed unchanged to `pi-subagents`. Maestro's other configuration validation remains
61
- unchanged.
68
+ - Removed Maestro's model format regex while retaining activation checks against Pi's available model registry. Complete identifiers, including
69
+ `openrouter/~openai/gpt-mini-latest`, are matched without truncation and passed unchanged to `pi-subagents`. Maestro's other configuration validation remains unchanged.
62
70
 
63
71
  ## 0.13.1
64
72
 
65
- 1. Restored `ROADMAP.md` as the planning source of truth from the current Linear issues, retaining their identifiers and recorded evidence. Updated repository guidance,
66
- documentation links, and package contents so roadmap maintenance no longer requires Linear. Linear data remains unchanged.
73
+ - Restored `ROADMAP.md` as the planning source of truth from the current Linear issues, retaining their identifiers and recorded evidence. Updated repository guidance,
74
+ documentation links, and package contents so roadmap maintenance no longer requires Linear. Linear data remains unchanged.
67
75
 
68
76
  ## 0.13.0
69
77
 
70
- 1. Automatically turn off `Maestro` after successfully delivering the final summary of a completed workflow, including when Git is unavailable and simplification is
71
- skipped. Clear live tools, status, instructions, and active `spec` selection while preserving saved workflow files and other extensions. See
72
- [MAESTRO-26](https://linear.app/emilio-spatola/issue/MAESTRO-26).
78
+ - Automatically turn off `Maestro` after successfully delivering the final summary of a completed workflow, including when Git is unavailable and simplification is
79
+ skipped. Clear live tools, status, instructions, and active `spec` selection while preserving saved workflow files and other extensions. See
80
+ [MAESTRO-26](https://linear.app/emilio-spatola/issue/MAESTRO-26).
73
81
 
74
82
  ## 0.12.0
75
83
 
76
- 1. Added stable `REQ` identifiers and a `Verified by` field to the `spec` template and `Maestro` guidance. Each requirement links to its `acceptance criteria` or exact
77
- existing test scenarios. Review checks complete coverage and current links, including during revisions. Approval validation and `handoff` formats remain unchanged.
78
- 2. Added per-requirement `Delta` labels: `added`, `modified`, and `removed`. Modified or removed behavior can include a brief, evidence-based `Before` description when
79
- useful. Requirements state the complete required outcome; unchanged behavior remains implicit. Approval validation and `handoff` formats remain unchanged.
80
- 3. Split new `specs` into required `proposal.md` and `spec.md`, with optional `design.md`. One `GREEN FLAG` approves and freezes the present document set; all agent roles
81
- read it. Creation returns the new document paths; approval requires the proposal. Historical documents are not migrated.
82
- 4. Placed requirement-associated `acceptance criteria` under their requirements as level-four headings. Relevant standalone regression criteria use level-three headings
83
- under optional `Regression checks`, without inventing unchanged requirements. Both forms share global numbering and are required in `handoffs`. Workflow phases and
84
- saved report formats remain unchanged.
85
- 5. Removed the `Coverage` classification field from current `acceptance criteria`. Each criterion retains its `probe`, `expected result`, and example. Standalone
86
- regression checks remain identified by their section; validation and report formats are unchanged.
84
+ - Added stable `REQ` identifiers and a `Verified by` field to the `spec` template and `Maestro` guidance. Each requirement links to its `acceptance criteria` or exact
85
+ existing test scenarios. Review checks complete coverage and current links, including during revisions. Approval validation and `handoff` formats remain unchanged.
86
+ - Added per-requirement `Delta` labels: `added`, `modified`, and `removed`. Modified or removed behavior can include a brief, evidence-based `Before` description when
87
+ useful. Requirements state the complete required outcome; unchanged behavior remains implicit. Approval validation and `handoff` formats remain unchanged.
88
+ - Split new `specs` into required `proposal.md` and `spec.md`, with optional `design.md`. One `GREEN FLAG` approves and freezes the present document set; all agent roles
89
+ read it. Creation returns the new document paths; approval requires the proposal. Historical documents are not migrated.
90
+ - Placed requirement-associated `acceptance criteria` under their requirements as level-four headings. Relevant standalone regression criteria use level-three headings
91
+ under optional `Regression checks`, without inventing unchanged requirements. Both forms share global numbering and are required in `handoffs`. Workflow phases and
92
+ saved report formats remain unchanged.
93
+ - Removed the `Coverage` classification field from current `acceptance criteria`. Each criterion retains its `probe`, `expected result`, and example. Standalone
94
+ regression checks remain identified by their section; validation and report formats are unchanged.
87
95
 
88
96
  ## 0.11.0
89
97
 
90
- 1. Added the `simplifier` after successful verification or rejection of all current `findings`, without another approval or verification cycle.
91
- 2. Added Git-only readiness and file discovery for simplification. If Git is unavailable, the workflow warns and completes without delegation.
92
- 3. Added independent `simplifier` configuration, activation checks and presentation, running status, and the fixed `handoffs/simplifier/S.json` result.
93
- 4. Removed the extra code-quality review from the verifier's instructions. The `simplifier` preserves accepted behavior without introducing check failures.
98
+ - Added the `simplifier` after successful verification or rejection of all current `findings`, without another approval or verification cycle.
99
+ - Added Git-only readiness and file discovery for simplification. If Git is unavailable, the workflow warns and completes without delegation.
100
+ - Added independent `simplifier` configuration, activation checks and presentation, running status, and the fixed `handoffs/simplifier/S.json` result.
101
+ - Removed the extra code-quality review from the verifier's instructions. The `simplifier` preserves accepted behavior without introducing check failures.
94
102
 
95
103
  ## 0.10.1
96
104
 
97
- 1. Added `success`, `failure`, and `unchanged` coverage labels to the `spec` template and `Maestro` guidance. Approval validation and `handoff` formats remain unchanged.
98
- 2. Required `Maestro` to inspect existing tests before writing `acceptance criteria` and remove criteria whose exact scenarios already have coverage. Requirements remain
99
- documented in the `spec`.
105
+ - Added `success`, `failure`, and `unchanged` coverage labels to the `spec` template and `Maestro` guidance. Approval validation and `handoff` formats remain unchanged.
106
+ - Required `Maestro` to inspect existing tests before writing `acceptance criteria` and remove criteria whose exact scenarios already have coverage. Requirements remain
107
+ documented in the `spec`.
100
108
 
101
109
  ## 0.10.0
102
110
 
103
- 1. Saved complete `owner` decision batches in their original `handoffs` before changing phase, including when the `spec` requires revision. See
104
- [PR #38](https://github.com/emilioSp/pi-maestro/pull/38).
105
- 2. Added `revise-spec` decisions for `verifier` `findings`, with the owner's reason and agreed requirement change. Revision takes priority over code fixes and rejections.
106
- 3. Unified both revision paths through `drafting-spec`, with renewed `GREEN FLAG` before separate approval and another `builder` `run`. Approval is allowed only from
107
- `drafting-spec`.
108
- 4. Renamed workflow events to identify `builder` and `owner` actions. Both revision paths share `OWNER_REQUEST_SPEC_REVISION`.
109
- 5. Breaking: supply the required boolean `specChangeRequired` when calling `maestro_resolve_escalations`.
110
- 6. Breaking: saved decision phases are now `escalation-decisions` and `finding-decisions`. Existing workflows using older names require manual `owner` handling. No
111
- automatic migration is provided.
111
+ - Saved complete `owner` decision batches in their original `handoffs` before changing phase, including when the `spec` requires revision. See
112
+ [PR #38](https://github.com/emilioSp/pi-maestro/pull/38).
113
+ - Added `revise-spec` decisions for `verifier` `findings`, with the owner's reason and agreed requirement change. Revision takes priority over code fixes and rejections.
114
+ - Unified both revision paths through `drafting-spec`, with renewed `GREEN FLAG` before separate approval and another `builder` `run`. Approval is allowed only from
115
+ `drafting-spec`.
116
+ - Renamed workflow events to identify `builder` and `owner` actions. Both revision paths share `OWNER_REQUEST_SPEC_REVISION`.
117
+ - Breaking: supply the required boolean `specChangeRequired` when calling `maestro_resolve_escalations`.
118
+ - Breaking: saved decision phases are now `escalation-decisions` and `finding-decisions`. Existing workflows using older names require manual `owner` handling. No
119
+ automatic migration is provided.
112
120
 
113
121
  ## 0.9.5
114
122
 
115
- 1. Added a shared check that requires every approved `spec` criterion ID in `builder` and `verifier` `handoffs`. See
116
- [PR #37](https://github.com/emilioSp/pi-maestro/pull/37).
117
- 2. Missing IDs reject submission before saving a report or changing phase. Extra report IDs remain allowed, and existing report validation is unchanged.
118
- 3. Reused the raw heading rule `^### AC(\d+):`, including leading zeros and matching lines inside code blocks. No matching headings impose no new restriction.
119
- 4. Added unit tests for extraction and one missing-ID integration test per role.
123
+ - Added a shared check that requires every approved `spec` criterion ID in `builder` and `verifier` `handoffs`. See
124
+ [PR #37](https://github.com/emilioSp/pi-maestro/pull/37).
125
+ - Missing IDs reject submission before saving a report or changing phase. Extra report IDs remain allowed, and existing report validation is unchanged.
126
+ - Reused the raw heading rule `^### AC(\d+):`, including leading zeros and matching lines inside code blocks. No matching headings impose no new restriction.
127
+ - Added unit tests for extraction and one missing-ID integration test per role.
120
128
 
121
129
  ## 0.9.4
122
130
 
123
- 1. Added numbering validation to `spec` approval. Matched `acceptance criterion` headings must start at `AC1` and continue without gaps. See
124
- [PR #36](https://github.com/emilioSp/pi-maestro/pull/36).
125
- 2. Invalid numbering rejects approval before saving the workflow and leaves all saved files unchanged. No matching headings still permits approval.
126
- 3. Added `Maestro` guidance to correct only numbering and affected references, then retry with the existing `GREEN FLAG`. No additional `owner` approval is required
127
- before starting the `builder`.
131
+ - Added numbering validation to `spec` approval. Matched `acceptance criterion` headings must start at `AC1` and continue without gaps. See
132
+ [PR #36](https://github.com/emilioSp/pi-maestro/pull/36).
133
+ - Invalid numbering rejects approval before saving the workflow and leaves all saved files unchanged. No matching headings still permits approval.
134
+ - Added `Maestro` guidance to correct only numbering and affected references, then retry with the existing `GREEN FLAG`. No additional `owner` approval is required before
135
+ starting the `builder`.
128
136
 
129
137
  ## 0.9.3
130
138
 
131
- 1. Added a parent `pi-subagents` availability check during activation. A matching successful version 1 `ping` reply is required within 2000 ms. See
132
- [PR #35](https://github.com/emilioSp/pi-maestro/pull/35).
133
- 2. Failed or invalid replies, emission errors, and timeouts prevent activation. The error includes "Maestro flow requires pi-subagents installed in the Pi environment."
134
- The check makes no automatic retry.
135
- 3. Preserved existing activation checks, UI-only notices, and unchanged session history. The availability check starts no agent, makes no model request, and does not run
136
- when turning `Maestro` off.
139
+ - Added a parent `pi-subagents` availability check during activation. A matching successful version 1 `ping` reply is required within 2000 ms. See
140
+ [PR #35](https://github.com/emilioSp/pi-maestro/pull/35).
141
+ - Failed or invalid replies, emission errors, and timeouts prevent activation. The error includes "Maestro flow requires pi-subagents installed in the Pi environment."
142
+ The check makes no automatic retry.
143
+ - Preserved existing activation checks, UI-only notices, and unchanged session history. The availability check starts no agent, makes no model request, and does not run
144
+ when turning `Maestro` off.
137
145
 
138
146
  ## 0.9.2
139
147
 
140
- 1. Added code-quality review to `verifier` guidance for code affected by the approved change when applicable `AGENTS.md` directives exist. See
141
- [PR #34](https://github.com/emilioSp/pi-maestro/pull/34). All existing verification duties remain unchanged.
142
- 2. Required instruction-violation `findings` to identify the instruction file, quote the rule, and explain the violating code through existing evidence fields.
143
- 3. Skip only the added review when files or code-quality directives are absent. Missing directives and personal style preferences do not produce `findings`.
148
+ - Added code-quality review to `verifier` guidance for code affected by the approved change when applicable `AGENTS.md` directives exist. See
149
+ [PR #34](https://github.com/emilioSp/pi-maestro/pull/34). All existing verification duties remain unchanged.
150
+ - Required instruction-violation `findings` to identify the instruction file, quote the rule, and explain the violating code through existing evidence fields.
151
+ - Skip only the added review when files or code-quality directives are absent. Missing directives and personal style preferences do not produce `findings`.
144
152
 
145
153
  ## 0.9.1
146
154
 
147
- 1. Added a brief introduction and an invitation to ask how `Maestro` works to the successful activation notice. See
148
- [PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
149
- 2. Preserved the configured agent details and UI-only activation. Activation does not add session history or start a model request.
150
- 3. Added absolute paths to the installed README and documentation directory in active instructions. `Maestro` reads relevant documentation on demand without automatically
151
- loading its contents.
155
+ - Added a brief introduction and an invitation to ask how `Maestro` works to the successful activation notice. See
156
+ [PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
157
+ - Preserved the configured agent details and UI-only activation. Activation does not add session history or start a model request.
158
+ - Added absolute paths to the installed README and documentation directory in active instructions. `Maestro` reads relevant documentation on demand without automatically
159
+ loading its contents.
152
160
 
153
161
  ## 0.9.0
154
162
 
155
- 1. Breaking: `builder` reports now support only `done` and `escalation`. Reportable technical problems use the existing `owner` `escalation` process. See
156
- [PR #32](https://github.com/emilioSp/pi-maestro/pull/32).
157
- 2. Removed the terminal `builder` failure phase and event. Execution errors and missing or invalid saved results still stop the workflow without automatic recovery.
158
- 3. No migrations, compatibility readers, or deprecated aliases are provided. `Artifact` versions remain `1.0.0`.
163
+ - Breaking: `builder` reports now support only `done` and `escalation`. Reportable technical problems use the existing `owner` `escalation` process. See
164
+ [PR #32](https://github.com/emilioSp/pi-maestro/pull/32).
165
+ - Removed the terminal `builder` failure phase and event. Execution errors and missing or invalid saved results still stop the workflow without automatic recovery.
166
+ - No migrations, compatibility readers, or deprecated aliases are provided. `Artifact` versions remain `1.0.0`.
159
167
 
160
168
  ## 0.8.0
161
169
 
162
- 1. Updated the bundled `pi-subagents` dependency from `0.76.0` to `0.78.0`.
163
- 2. Renamed `test/` to `tests/`. Updated imports, fixture paths, lint configuration, and project instructions. Source tests remain next to their source files.
170
+ - Updated the bundled `pi-subagents` dependency from `0.76.0` to `0.78.0`.
171
+ - Renamed `test/` to `tests/`. Updated imports, fixture paths, lint configuration, and project instructions. Source tests remain next to their source files.
164
172
 
165
173
  ## 0.7.3
166
174
 
167
- 1. Added Oxlint rules for `given ... when ... then ...` test titles, `const` usage, unnecessary `else` branches, type aliases, and ESM imports. See
168
- [PR #31](https://github.com/emilioSp/pi-maestro/pull/31).
169
- 2. Updated `oxlint-anti-slop` from `0.3.3` to `0.3.6`.
170
- 3. Updated 106 test titles to match the naming rule without changing test logic.
175
+ - Added Oxlint rules for `given ... when ... then ...` test titles, `const` usage, unnecessary `else` branches, type aliases, and ESM imports. See
176
+ [PR #31](https://github.com/emilioSp/pi-maestro/pull/31).
177
+ - Updated `oxlint-anti-slop` from `0.3.3` to `0.3.6`.
178
+ - Updated 106 test titles to match the naming rule without changing test logic.
171
179
 
172
180
  ## 0.7.2
173
181
 
174
- 1. Renamed the constitution files to `MISSION.md`, `TECH_STACK.md`, `ROADMAP.md`, and `CHANGELOG.md`. Updated their links, package file list, and audit references.
175
- 2. Applied consistent inline code formatting to glossary terms across the documentation. Recorded the formatting rule and its exclusions in `AGENTS.md` and the
176
- documentation audit skill.
177
- 3. Used `spec` consistently for the approved change document and removed the redundant glossary entry.
182
+ - Renamed the constitution files to `MISSION.md`, `TECH_STACK.md`, `ROADMAP.md`, and `CHANGELOG.md`. Updated their links, package file list, and audit references.
183
+ - Applied consistent inline code formatting to glossary terms across the documentation. Recorded the formatting rule and its exclusions in `AGENTS.md` and the
184
+ documentation audit skill.
185
+ - Used `spec` consistently for the approved change document and removed the redundant glossary entry.
178
186
 
179
187
  ## 0.7.1
180
188
 
181
- 1. Documented the project mission, current tech stack, `owner` responsibilities, roadmap, and codebase change history. See
182
- [PR #30](https://github.com/emilioSp/pi-maestro/pull/30).
183
- 2. Replaced `TODO.md` with the roadmap and included the four project constitution documents in the npm package.
184
- 3. Updated documentation audits to compare all current documentation and the project constitution with the working tree without requesting a comparison baseline.
189
+ - Documented the project mission, current tech stack, `owner` responsibilities, roadmap, and codebase change history. See
190
+ [PR #30](https://github.com/emilioSp/pi-maestro/pull/30).
191
+ - Replaced `TODO.md` with the roadmap and included the four project constitution documents in the npm package.
192
+ - Updated documentation audits to compare all current documentation and the project constitution with the working tree without requesting a comparison baseline.
185
193
 
186
194
  ## 0.7.0
187
195
 
188
- 1. Stored multiple `escalation` questions and `owner` resolutions inside numbered `builder` `handoffs`. Earlier `handoffs` remain available as history. See
189
- [PR #27](https://github.com/emilioSp/pi-maestro/pull/27).
190
- 2. Breaking: replaced `maestro_open_escalation` and `maestro_resolve_escalation` with `maestro_record_builder_handoff` and `maestro_resolve_escalations`. Done `handoffs`
191
- require `escalations: []`. Standalone `escalation` storage was removed without migration or compatibility readers. `Artifact` versions remain `1.0.0`.
192
- 3. Added LCOV coverage reports and Codecov uploads from CI. See [PR #28](https://github.com/emilioSp/pi-maestro/pull/28).
196
+ - Stored multiple `escalation` questions and `owner` resolutions inside numbered `builder` `handoffs`. Earlier `handoffs` remain available as history. See
197
+ [PR #27](https://github.com/emilioSp/pi-maestro/pull/27).
198
+ - Breaking: replaced `maestro_open_escalation` and `maestro_resolve_escalation` with `maestro_record_builder_handoff` and `maestro_resolve_escalations`. Done `handoffs`
199
+ require `escalations: []`. Standalone `escalation` storage was removed without migration or compatibility readers. `Artifact` versions remain `1.0.0`.
200
+ - Added LCOV coverage reports and Codecov uploads from CI. See [PR #28](https://github.com/emilioSp/pi-maestro/pull/28).
193
201
 
194
202
  Reload `Maestro` extensions before starting new workflows so sessions use the updated tools.
195
203
 
@@ -200,11 +208,11 @@ session history and model context. See [PR #26](https://github.com/emilioSp/pi-m
200
208
 
201
209
  ## 0.6.0
202
210
 
203
- 1. Removed Git requirements, checkpoints, and automatic commits from the workflow. `Maestro` uses Pi's project directory and saved workflow phase. See
204
- [PR #25](https://github.com/emilioSp/pi-maestro/pull/25).
205
- 2. Retained numbered `builder` and `verifier` `handoffs` and explicit `owner` `finding` decisions. Removed workflow revision counters and writer locks.
206
- 3. Breaking: changed `artifact` formats, `handoff` paths, and tool results without migration or compatibility readers. Removed revision and commit fields. `Artifact`
207
- versions remain `1.0.0`. Interrupted and older workflows require manual `owner` handling.
211
+ - Removed Git requirements, checkpoints, and automatic commits from the workflow. `Maestro` uses Pi's project directory and saved workflow phase. See
212
+ [PR #25](https://github.com/emilioSp/pi-maestro/pull/25).
213
+ - Retained numbered `builder` and `verifier` `handoffs` and explicit `owner` `finding` decisions. Removed workflow revision counters and writer locks.
214
+ - Breaking: changed `artifact` formats, `handoff` paths, and tool results without migration or compatibility readers. Removed revision and commit fields. `Artifact`
215
+ versions remain `1.0.0`. Interrupted and older workflows require manual `owner` handling.
208
216
 
209
217
  ## 0.5.2
210
218
 
@@ -247,9 +255,9 @@ Enabled inheritance of global instructions for `builder` and `verifier` agents,
247
255
 
248
256
  ## 0.4.0
249
257
 
250
- 1. Fixed delegated `handoffs` that depended on unavailable parent session memory. See [PR #22](https://github.com/emilioSp/pi-maestro/pull/22).
251
- 2. Removed hash-based `spec` guards and checkpoint-based `verifier` comparisons. `Spec` preservation and restoration rely on agent instructions.
252
- 3. Refreshed the running status before delegation and required repository investigation before presenting technical decisions during `spec` preparation.
258
+ - Fixed delegated `handoffs` that depended on unavailable parent session memory. See [PR #22](https://github.com/emilioSp/pi-maestro/pull/22).
259
+ - Removed hash-based `spec` guards and checkpoint-based `verifier` comparisons. `Spec` preservation and restoration rely on agent instructions.
260
+ - Refreshed the running status before delegation and required repository investigation before presenting technical decisions during `spec` preparation.
253
261
 
254
262
  ## 0.3.0
255
263
 
package/README.md CHANGED
@@ -23,7 +23,8 @@ The `owner` can use `Maestro` only to write and approve a `spec`, leaving implem
23
23
  3. The `simplifier` refactors accepted code without changing behavior.
24
24
 
25
25
  Disabling the `builder` skips the entire implementation stage. With the `builder` enabled, the `verifier` and `simplifier` can be disabled independently. All three are
26
- enabled by default. See [Phase selection](docs/configuration.md#phase-selection).
26
+ enabled when their flags are omitted from an existing configuration. Initial setup enables only selected roles. See
27
+ [Phase selection](docs/configuration.md#phase-selection).
27
28
 
28
29
  The `owner` performs the final review.
29
30
 
@@ -85,11 +86,9 @@ An `escalation` asks the `owner` to decide an implementation question. A `findin
85
86
 
86
87
  ## Prerequisites
87
88
 
88
- 1. macOS.
89
- 2. Node.js 26 or later.
90
- 3. Pi 1.5.0 or later.
91
- 4. Access to the models for enabled agents.
92
- 5. A project directory that Pi trusts.
89
+ 1. Node.js 26 or later.
90
+ 2. Pi 1.5.0 or later.
91
+ 3. Access to the models for enabled agents.
93
92
 
94
93
  ## Installation
95
94
 
@@ -114,8 +113,8 @@ Activate `Maestro`:
114
113
  /maestro
115
114
  ```
116
115
 
117
- During activation, `Maestro` checks project trust, configuration, and model availability for enabled agents. With `builder` disabled, only project trust and configuration
118
- are checked. Model availability comes from Pi's model registry. If a check fails, `Maestro` stays disabled and reports the problem.
116
+ During activation, `Maestro` checks configuration and model availability for enabled agents. With `builder` disabled, only configuration is checked. Model availability
117
+ comes from Pi's model registry. If a check fails, `Maestro` stays disabled and reports the problem.
119
118
 
120
119
  The `owner` follows this workflow:
121
120
 
@@ -158,8 +157,12 @@ files do not automatically restore or resume an incomplete workflow. The `owner`
158
157
 
159
158
  ## Configuration
160
159
 
161
- `Maestro` uses default values when `.pi/maestro.json` is absent from the project root. The `owner` can add this file to change the `spec` directory, models, thinking
162
- levels, or selected phases. Each agent has a `required` boolean that defaults to `true`. Set flags before activation and keep configuration unchanged during the workflow.
160
+ When `.pi/maestro.json` is absent, `/maestro` starts a guided setup in Pi's interactive terminal. The `owner` chooses models and thinking levels for `builder`,
161
+ `verifier`, and `simplifier`. The selected agents are enabled, and the configuration is saved before `Maestro` activates. Selecting no agents enables `spec` preparation
162
+ only.
163
+
164
+ There are no default agent models. Existing configurations must supply models for enabled execution phases. The `owner` can edit the file before activation to change the
165
+ `spec` directory, models, thinking levels, or phase flags. Omitted `required` flags in existing files default to `true`. Keep configuration unchanged during the workflow.
163
166
  With `builder.required: false`, approval finishes with only an approved `spec` for implementation elsewhere. Otherwise `verifier` and `simplifier` can be disabled
164
167
  independently. Skipped work is identified in the final summary and is not claimed as completed. See [Configuration](docs/configuration.md#phase-selection).
165
168
 
package/ROADMAP.md CHANGED
@@ -22,7 +22,7 @@ Completed entries preserve recorded outcomes and evidence, which may describe be
22
22
  | MAESTRO-16 | [Route finding-driven spec revisions through drafting-spec](#maestro-16-route-finding-driven-spec-revisions-through-drafting-spec) | Completed |
23
23
  | MAESTRO-17 | [Keep acceptance criterion numbering continuous](#maestro-17-keep-acceptance-criterion-numbering-continuous) | Completed |
24
24
  | MAESTRO-18 | [Record escalation resolutions when the spec changes](#maestro-18-record-escalation-resolutions-when-the-spec-changes) | Completed |
25
- | MAESTRO-19 | [Guide initial configuration](#maestro-19-guide-initial-configuration) | Backlog |
25
+ | MAESTRO-19 | [Guide initial configuration](#maestro-19-guide-initial-configuration) | Completed |
26
26
  | MAESTRO-20 | [Rename the npm package](#maestro-20-rename-the-npm-package) | Backlog |
27
27
  | MAESTRO-21 | [Label acceptance criterion coverage](#maestro-21-label-acceptance-criterion-coverage) | Completed |
28
28
  | MAESTRO-22 | [Avoid acceptance criteria already covered by tests](#maestro-22-avoid-acceptance-criteria-already-covered-by-tests) | Completed |
@@ -55,11 +55,37 @@ The `owner` can read the `spec` documents in a browser with formatting designed
55
55
 
56
56
  ### Objective
57
57
 
58
- Help the `owner` create `Maestro` configuration through an interview. `Maestro` asks questions and writes the agreed configuration.
58
+ Help the `owner` create `Maestro` configuration through selectors, without writing the file manually. Implemented for verification under the
59
+ [approved `specification`](.specs/20261108-141712-maestro-19-guide-initial-configuration-with-pi-selectors/spec.md).
60
+
61
+ ### Agreed UX
62
+
63
+ 1. When `.pi/maestro.json` is absent, `/maestro` opens setup instead of attempting activation with an implicit configuration.
64
+ 2. The setup screen offers `Select builder`, `Select verifier`, `Select simplifier`, and `Confirm`. Each role opens model selection followed by supported thinking choices
65
+ in Pi's returned order, starting at the first level. Completed selections appear on the main screen and can be replaced.
66
+ 3. `Maestro` has no default models or fallback to Pi's main model. Setup uses `.specs`; selected roles are enabled and unselected roles are disabled, without separate
67
+ phase controls. Confirmation with no roles enables `spec` preparation only.
68
+ 4. `Confirm` saves `.pi/maestro.json`, then activates `Maestro` without another command. Escape on the main screen cancels without saving; nested cancellation discards
69
+ only the pending role edit.
70
+ 5. An existing configuration missing a required model produces an error and prevents activation. Setup does not complete the file automatically.
71
+
72
+ ### Selector approach
73
+
74
+ Use Pi's standard `ctx.ui.select()` for short setup choices. For model selection, compose Pi's public `Input` and `SelectList` components through `ctx.ui.custom()`, using
75
+ `ctx.modelRegistry.getAvailable()` as the model source. Provide search and a bounded, navigable list without changing the main conversation's model.
76
+
77
+ Inspection of Pi 1.5.0 confirmed that `ctx.ui.select()` does not provide search or a bounded list. The exported `ModelSelectorComponent` requires the session's
78
+ `ModelRuntime`, which the public extension context does not expose. Do not access private runtime state or create a separate runtime to reuse that component. Reuse Pi's
79
+ public controls instead of rebuilding rendering and navigation. No new library is needed.
80
+
81
+ ### Verification
82
+
83
+ [Verifier report](.specs/20261108-141712-maestro-19-guide-initial-configuration-with-pi-selectors/handoffs/verifier/V1.json). Later owner-requested changes are outside
84
+ that independent verification. The latest `npm run check` passed all 301 tests.
59
85
 
60
86
  ### Completed when
61
87
 
62
- The `owner` can create a valid project configuration without writing the file manually.
88
+ The `owner` can create a valid project configuration through selectors, confirm it, and activate `Maestro` without writing the file manually.
63
89
 
64
90
  ## MAESTRO-20: Rename the npm package
65
91
 
@@ -263,6 +289,9 @@ The `pi-subagents` integration then in use still received a fixed deadline of 9,
263
289
 
264
290
  ### Implementation and evidence
265
291
 
292
+ Registration follow-up: caller-supplied tools use an inline `extensionFactories` entry instead of SDK `customTools`. This `owner`-requested change is implemented for
293
+ review, with role-specific registration checked by the [workflow integration test](extensions/maestro.integration.test.ts).
294
+
266
295
  The standalone executor is implemented under `src/delegation/` against the [approved specification](.specs/20261105-212231-implement-internal-pi-sdk-delegation/spec.md).
267
296
  Review follow-up consolidated execution orchestration and session lifecycle in `executeTask`; pure reply interpretation remains in `readTaskResult`. Manual verification
268
297
  on Pi 1.5.0 exercised fresh context, native and additional tools, MCP through tool search and codemode, sequential waiting, failure, cancellation, cleanup, and native
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- `Maestro` reads `.pi/maestro.json` from the project root. The file is optional. `Maestro` uses all default values when it is absent.
3
+ `Maestro` reads `.pi/maestro.json` from the project root. When it is absent, `/maestro` opens initial setup in Pi's interactive terminal.
4
4
 
5
5
  ## Project root
6
6
 
@@ -8,7 +8,14 @@ The project root is the current Pi working directory. `Builder`, `verifier`, and
8
8
 
9
9
  For example, if Pi starts in `/work/app/src`, `Maestro` reads `/work/app/src/.pi/maestro.json`. A configuration file in `/work/app/.pi/maestro.json` does not apply.
10
10
 
11
- ## Default configuration
11
+ ## Initial setup
12
+
13
+ The `owner` runs `/maestro` in Pi's interactive terminal and follows the guided setup to select models and thinking levels for `builder`, `verifier`, and `simplifier`,
14
+ then confirms to save the configuration and activate `Maestro`.
15
+
16
+ ## Example configuration
17
+
18
+ This is an explicit all-agent configuration, not a set of model defaults. The `owner` supplies identifiers available in Pi:
12
19
 
13
20
  ```json
14
21
  {
@@ -34,22 +41,22 @@ For example, if Pi starts in `/work/app/src`, `Maestro` reads `/work/app/src/.pi
34
41
 
35
42
  ## Fields
36
43
 
37
- | Field | Required | Default | Rules |
38
- | --------------------- | ------------------------: | -------------------------- | -------------------------------------------------------- |
39
- | `version` | Yes, when the file exists | `1.0.0` | Configuration format version. Only `1.0.0` is supported. |
40
- | `specDirectory` | No | `.specs` | Relative path below the project root. |
41
- | `builder` | No | `Builder` defaults | Overrides supported `builder` fields. |
42
- | `builder.required` | No | `true` | Boolean selecting the `builder` phase. |
43
- | `builder.model` | No | `openai-codex/gpt-6.1-sol` | Model string passed unchanged to Pi. |
44
- | `builder.thinking` | No | `high` | One supported thinking level. |
45
- | `verifier` | No | `Verifier` defaults | Overrides supported `verifier` fields. |
46
- | `verifier.required` | No | `true` | Boolean selecting the `verifier` phase. |
47
- | `verifier.model` | No | `openai-codex/gpt-6-astra` | Model string passed unchanged to Pi. |
48
- | `verifier.thinking` | No | `medium` | One supported thinking level. |
49
- | `simplifier` | No | `Simplifier` defaults | Overrides supported `simplifier` fields. |
50
- | `simplifier.required` | No | `true` | Boolean selecting the `simplifier` phase. |
51
- | `simplifier.model` | No | `openai-codex/gpt-6.1-sol` | Model string passed unchanged to Pi. |
52
- | `simplifier.thinking` | No | `high` | One supported thinking level. |
44
+ | Field | Required | Default | Rules |
45
+ | --------------------- | ------------------------: | --------------------- | -------------------------------------------------------- |
46
+ | `version` | Yes, when the file exists | `1.0.0` | Configuration format version. Only `1.0.0` is supported. |
47
+ | `specDirectory` | No | `.specs` | Relative path below the project root. |
48
+ | `builder` | No | `Builder` defaults | Overrides supported `builder` fields. |
49
+ | `builder.required` | No | `true` | Boolean selecting the `builder` phase. |
50
+ | `builder.model` | For enabled execution | None | Model string passed unchanged to Pi. |
51
+ | `builder.thinking` | No | `high` | One supported thinking level. |
52
+ | `verifier` | No | `Verifier` defaults | Overrides supported `verifier` fields. |
53
+ | `verifier.required` | No | `true` | Boolean selecting the `verifier` phase. |
54
+ | `verifier.model` | For enabled execution | None | Model string passed unchanged to Pi. |
55
+ | `verifier.thinking` | No | `medium` | One supported thinking level. |
56
+ | `simplifier` | No | `Simplifier` defaults | Overrides supported `simplifier` fields. |
57
+ | `simplifier.required` | No | `true` | Boolean selecting the `simplifier` phase. |
58
+ | `simplifier.model` | For enabled execution | None | Model string passed unchanged to Pi. |
59
+ | `simplifier.thinking` | No | `high` | One supported thinking level. |
53
60
 
54
61
  Model values use the full `provider/model` identifier supplied by Pi's model registry, such as `openrouter/~openai/gpt-mini-latest`. Model IDs may contain additional
55
62
  slashes. `Maestro` does not apply a separate format rule; it matches the complete identifier against Pi's available models and uses it unchanged for SDK execution.
@@ -68,23 +75,34 @@ max
68
75
 
69
76
  ## Partial configuration
70
77
 
71
- Only `version` is required when the file exists. Each other field overrides its matching default.
78
+ The configuration file can omit fields that have a default in the table above:
79
+
80
+ 1. `version` is always required and must be `1.0.0`.
81
+ 2. Each agent that will execute needs an explicit `model`. If its model is missing, `Maestro` reports an error and does not activate.
82
+ 3. An agent disabled with `required: false` needs no model. With `builder.required: false`, no agents execute, so no models are required.
83
+ 4. Other omitted fields use the defaults in the table. For example, omitting `specDirectory` uses `.specs`.
84
+
85
+ There are no default models: `Maestro` does not automatically assign Pi's current model to an agent.
72
86
 
73
87
  ```json
74
88
  {
75
89
  "version": "1.0.0",
76
90
  "builder": {
91
+ "model": "provider-a/model-a",
77
92
  "thinking": "medium"
78
- }
93
+ },
94
+ "verifier": { "required": false },
95
+ "simplifier": { "required": false }
79
96
  }
80
97
  ```
81
98
 
82
- This example keeps every default except the `builder` thinking level.
99
+ This example runs only `builder` with `provider-a/model-a` and `medium` thinking. `Verifier` and `simplifier` are disabled, so their models are omitted. The document
100
+ directory is `.specs` because `specDirectory` is omitted.
83
101
 
84
102
  ## Phase selection
85
103
 
86
104
  Set each agent's `required` boolean before activation and leave configuration unchanged until the workflow completes. Omitted flags default to `true`, even when an agent
87
- section or the entire file is absent. Strings, numbers, and `null` are invalid.
105
+ section is absent. Strings, numbers, and `null` are invalid.
88
106
 
89
107
  With `builder.required: false`, approval completes the workflow with an approved `spec` and no agent execution, regardless of the other flags. The approved `spec` can be
90
108
  used for implementation in another workflow. With `builder` enabled, `verifier` and `simplifier` can each be disabled independently. Neither runs without `builder`.
@@ -121,7 +139,7 @@ During activation, `Maestro` checks the configured models for enabled agents aga
121
139
  availability; `Maestro` does not maintain a separate model list or authentication check. A missing enabled model stops activation and identifies the full configured
122
140
  identifier.
123
141
 
124
- With `builder` disabled, activation checks only project trust and configuration, without a model lookup.
142
+ With `builder` disabled, activation checks only configuration, without a model lookup.
125
143
 
126
144
  The `owner` can correct the identifier or authenticate the provider in Pi, then retry `/maestro`. Authentication or provider errors during execution still appear as `run`
127
145
  failures. Agent context are described in [Subagent integration](subagent-integration.md#roles-and-context).
@@ -3,12 +3,16 @@
3
3
  * Used: When Pi starts a Maestro main session.
4
4
  */
5
5
 
6
+ import { join } from 'node:path';
7
+
6
8
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
7
9
 
10
+ import { CONFIG_FILE_PATH } from '#config/defaults.ts';
8
11
  import { loadConfiguration } from '#config/loadConfiguration.ts';
9
12
  import { assertEnvironment } from '#maestro/checks/assertEnvironment.ts';
10
13
  import { getMaestroInstructions } from '#maestro/instructions/getMaestroInstructions.ts';
11
14
  import maestroSessionState from '#maestro/session/MaestroSessionState.ts';
15
+ import { setupConfiguration } from '#maestro/setupConfiguration.ts';
12
16
  import { refreshMaestroStatus } from '#maestro/status/refreshMaestroStatus.ts';
13
17
  import { CREATE_SPEC_TOOL, registerCreateSpecTool } from '#tools/main/create-spec.ts';
14
18
  import { MARK_SPEC_READY_TOOL, registerMarkSpecReadyTool } from '#tools/main/mark-spec-ready.ts';
@@ -23,6 +27,7 @@ import {
23
27
  import { RUN_BUILDER_TOOL, registerRunBuilderTool } from '#tools/main/run-builder.ts';
24
28
  import { RUN_SIMPLIFIER_TOOL, registerRunSimplifierTool } from '#tools/main/run-simplifier.ts';
25
29
  import { RUN_VERIFIER_TOOL, registerRunVerifierTool } from '#tools/main/run-verifier.ts';
30
+ import { pathExists } from '#utils/path-exists.ts';
26
31
  import { WORKFLOW_PHASES } from '#workflow/state/schema.ts';
27
32
 
28
33
  const MAIN_TOOL_NAMES: readonly string[] = [
@@ -85,6 +90,13 @@ export default (pi: ExtensionAPI): void => {
85
90
  }
86
91
 
87
92
  try {
93
+ if (
94
+ !(await pathExists(join(context.cwd, CONFIG_FILE_PATH))) &&
95
+ !(await setupConfiguration(context))
96
+ ) {
97
+ return;
98
+ }
99
+
88
100
  await assertEnvironment({ context });
89
101
  const config = await loadConfiguration(context.cwd);
90
102
  const isImplementationEnabled = config.builder.required;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emiliosp/pi-maestro",
3
- "version": "0.18.5",
3
+ "version": "0.18.7",
4
4
  "description": "A spec-driven multiagent development workflow for Pi.",
5
5
  "keywords": [
6
6
  "orchestration",
@@ -36,9 +36,6 @@
36
36
  "README.md",
37
37
  "LICENSE"
38
38
  ],
39
- "os": [
40
- "darwin"
41
- ],
42
39
  "type": "module",
43
40
  "imports": {
44
41
  "#config/*": "./src/config/*",
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Objective: Define immutable default Maestro configuration values.
3
- * Used: When configuration is resolved from missing or partial input.
2
+ * Objective: Define non-model defaults and project configuration paths.
3
+ * Used: When resolving explicit project configuration.
4
4
  */
5
5
 
6
6
  import { type MaestroConfig, SUPPORTED_CONFIG_VERSION, THINKING_LEVELS } from '#config/schema.ts';
@@ -9,16 +9,6 @@ export const DEFAULT_CONFIG_VERSION = SUPPORTED_CONFIG_VERSION;
9
9
 
10
10
  export const DEFAULT_SPEC_DIRECTORY = '.specs';
11
11
 
12
- export const DEFAULT_BUILDER_MODEL = 'openai-codex/gpt-6.1-sol';
13
-
14
- export const DEFAULT_BUILDER_THINKING = THINKING_LEVELS.HIGH;
15
-
16
- export const DEFAULT_VERIFIER_MODEL = 'openai-codex/gpt-6-astra';
17
-
18
- export const DEFAULT_VERIFIER_THINKING = THINKING_LEVELS.MEDIUM;
19
-
20
- export const DEFAULT_SIMPLIFIER_MODEL = 'openai-codex/gpt-6.1-sol';
21
-
22
12
  export const CONFIG_DIRECTORY_NAME = '.pi';
23
13
 
24
14
  export const CONFIG_FILE_NAME = 'maestro.json';
@@ -28,19 +18,7 @@ export const CONFIG_FILE_PATH = `${CONFIG_DIRECTORY_NAME}/${CONFIG_FILE_NAME}`;
28
18
  export const DEFAULT_CONFIG: MaestroConfig = {
29
19
  version: DEFAULT_CONFIG_VERSION,
30
20
  specDirectory: DEFAULT_SPEC_DIRECTORY,
31
- builder: {
32
- required: true,
33
- model: DEFAULT_BUILDER_MODEL,
34
- thinking: DEFAULT_BUILDER_THINKING,
35
- },
36
- simplifier: {
37
- required: true,
38
- model: DEFAULT_SIMPLIFIER_MODEL,
39
- thinking: THINKING_LEVELS.HIGH,
40
- },
41
- verifier: {
42
- required: true,
43
- model: DEFAULT_VERIFIER_MODEL,
44
- thinking: DEFAULT_VERIFIER_THINKING,
45
- },
21
+ builder: { required: true, model: '', thinking: THINKING_LEVELS.HIGH },
22
+ verifier: { required: true, model: '', thinking: THINKING_LEVELS.MEDIUM },
23
+ simplifier: { required: true, model: '', thinking: THINKING_LEVELS.HIGH },
46
24
  };
@@ -85,7 +85,9 @@ export const loadConfiguration = async (cwd: string = process.cwd()): Promise<Ma
85
85
  const targetPath = join(projectRoot, CONFIG_FILE_PATH);
86
86
 
87
87
  if (!(await pathExists(targetPath))) {
88
- return resolveDirectories({ projectRoot, config: DEFAULT_CONFIG });
88
+ throw new Error(
89
+ 'Project configuration is missing. Run /maestro in interactive Pi to set it up.',
90
+ );
89
91
  }
90
92
 
91
93
  const parsed = await readConfigurationFile(targetPath);
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Objective: Build and persist project configuration from confirmed agent model selections.
3
+ * Used: After setup confirmation and before activation checks.
4
+ */
5
+
6
+ import { mkdir, writeFile } from 'node:fs/promises';
7
+ import { join } from 'node:path';
8
+
9
+ import { assertConfiguration } from '#config/assertConfiguration.ts';
10
+ import {
11
+ CONFIG_DIRECTORY_NAME,
12
+ CONFIG_FILE_PATH,
13
+ DEFAULT_SPEC_DIRECTORY,
14
+ } from '#config/defaults.ts';
15
+ import {
16
+ type PartialMaestroConfig,
17
+ SUPPORTED_CONFIG_VERSION,
18
+ type ThinkingLevel,
19
+ } from '#config/schema.ts';
20
+
21
+ export const SETUP_ROLES = {
22
+ BUILDER: 'builder',
23
+ VERIFIER: 'verifier',
24
+ SIMPLIFIER: 'simplifier',
25
+ } as const;
26
+
27
+ export type SetupRole = (typeof SETUP_ROLES)[keyof typeof SETUP_ROLES];
28
+
29
+ export type RoleSelection = { model: string; thinking: ThinkingLevel };
30
+
31
+ export type AgentModelSelections = Partial<Record<SetupRole, RoleSelection>>;
32
+
33
+ type SaveConfigurationInput = {
34
+ cwd: string;
35
+ agentModelSelections: AgentModelSelections;
36
+ };
37
+
38
+ export const saveConfiguration = async ({
39
+ cwd,
40
+ agentModelSelections,
41
+ }: SaveConfigurationInput): Promise<void> => {
42
+ const config: PartialMaestroConfig = {
43
+ version: SUPPORTED_CONFIG_VERSION,
44
+ specDirectory: DEFAULT_SPEC_DIRECTORY,
45
+ builder: agentModelSelections.builder
46
+ ? { required: true, ...agentModelSelections.builder }
47
+ : { required: false },
48
+ verifier: agentModelSelections.verifier
49
+ ? { required: true, ...agentModelSelections.verifier }
50
+ : { required: false },
51
+ simplifier: agentModelSelections.simplifier
52
+ ? { required: true, ...agentModelSelections.simplifier }
53
+ : { required: false },
54
+ };
55
+
56
+ assertConfiguration(config);
57
+ await mkdir(join(cwd, CONFIG_DIRECTORY_NAME), { recursive: true });
58
+ await writeFile(join(cwd, CONFIG_FILE_PATH), `${JSON.stringify(config, null, 2)}\n`, 'utf8');
59
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Objective: Derive setup model and thinking choices from Pi's catalog.
3
+ * Used: Before showing the initial configuration selectors.
4
+ */
5
+
6
+ import type { Api, Model } from '@earendil-works/pi-ai';
7
+ import { getSupportedThinkingLevels } from '@earendil-works/pi-ai/models';
8
+
9
+ import type { ThinkingLevel } from '#config/schema.ts';
10
+
11
+ export type SetupModelChoice = {
12
+ value: string;
13
+ thinkingLevels: ThinkingLevel[];
14
+ };
15
+
16
+ export const setupChoices = (models: Model<Api>[]): SetupModelChoice[] =>
17
+ models.map((model) => ({
18
+ value: `${model.provider}/${model.id}`,
19
+ thinkingLevels: getSupportedThinkingLevels(model),
20
+ }));
@@ -88,7 +88,7 @@ export const executeTask = async ({
88
88
  try {
89
89
  try {
90
90
  const cwd = await realpath(workingDirectory);
91
- const services = await prepareSubagentEnvironment({ cwd, roleGuidance });
91
+ const services = await prepareSubagentEnvironment({ cwd, roleGuidance, additionalTools });
92
92
 
93
93
  const model = (await services.modelRuntime.getAvailable()).find(
94
94
  (entry) => `${entry.provider}/${entry.id}` === modelId,
@@ -106,7 +106,6 @@ export const executeTask = async ({
106
106
  sessionManager,
107
107
  model,
108
108
  thinkingLevel,
109
- customTools: additionalTools,
110
109
  }));
111
110
 
112
111
  if (onEvent) unsubscribe = session.subscribe(onEvent);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Objective: Discover native Pi resources without loading the main Maestro extension.
2
+ * Objective: Discover native Pi resources and exclude main Maestro registrations from children.
3
3
  * Used: During preparation of each standalone child execution.
4
4
  */
5
5
 
@@ -12,9 +12,10 @@ import {
12
12
  createCodemodeExtension,
13
13
  createMcpExtension,
14
14
  createToolSearchExtension,
15
- DefaultPackageManager,
16
15
  getAgentDir,
16
+ type InlineExtension,
17
17
  SettingsManager,
18
+ type ToolDefinition,
18
19
  } from '@earendil-works/pi-coding-agent';
19
20
 
20
21
  const MAIN_EXTENSION = fileURLToPath(new URL('../../extensions/maestro.ts', import.meta.url));
@@ -27,8 +28,8 @@ const isMaestroPackage = (value: unknown): value is MaestroPackage =>
27
28
  'name' in value &&
28
29
  value.name === '@emiliosp/pi-maestro';
29
30
 
30
- const isMainExtension = (path: string): boolean => {
31
- if (path.startsWith('builtin:')) return false;
31
+ const isMainMaestroExtension = (path: string): boolean => {
32
+ if (path.startsWith('builtin:') || path.startsWith('<inline:')) return false;
32
33
 
33
34
  const canonicalPath = realpathSync(path);
34
35
 
@@ -54,52 +55,39 @@ const isMainExtension = (path: string): boolean => {
54
55
  type PrepareSubagentEnvironmentInput = {
55
56
  cwd: string;
56
57
  roleGuidance: string;
58
+ additionalTools: ToolDefinition[];
57
59
  };
58
60
 
59
61
  export const prepareSubagentEnvironment = async ({
60
62
  cwd,
61
63
  roleGuidance,
64
+ additionalTools,
62
65
  }: PrepareSubagentEnvironmentInput) => {
63
66
  const agentDir = getAgentDir();
64
67
  const settingsManager = SettingsManager.create(cwd, agentDir);
65
68
 
66
- const extensionFactories = [
69
+ // SDK sessions need these CLI built-ins supplied explicitly.
70
+ // The inline factory registers the child's additional tools with pi.registerTool.
71
+ const extensionFactories: InlineExtension[] = [
67
72
  { name: 'codemode', factory: createCodemodeExtension(), builtin: true, replaceable: true },
68
73
  { name: 'tool-search', factory: createToolSearchExtension(), builtin: true, replaceable: true },
69
74
  { name: 'mcp', factory: createMcpExtension(), builtin: true, replaceable: true },
75
+ (pi) => {
76
+ for (const tool of additionalTools) pi.registerTool(tool);
77
+ },
70
78
  ];
71
79
 
72
- const packages = new DefaultPackageManager({
73
- cwd,
74
- agentDir,
75
- settingsManager,
76
- builtinExtensions: extensionFactories.map(({ name }) => name),
77
- });
78
-
79
- const resources = await packages.resolve(async () => 'error');
80
-
81
- if (resources.installFailures?.length) {
82
- throw new Error(resources.installFailures.map(({ message }) => message).join('\n'));
83
- }
84
-
85
- // extensionsOverride filters extensions after Pi has loaded and initialized them.
86
- // It would exclude Maestro's event handlers, but its initialization code would still run.
87
- // Use additionalExtensionPaths instead to exclude Maestro before loading it,
88
- // so none of its code executes in the child session.
89
- const additionalExtensionPaths = resources.extensions
90
- .filter(({ enabled, path }) => enabled && !isMainExtension(path))
91
- .map(({ path }) => path);
92
-
93
80
  const services = await createAgentSessionServices({
94
81
  cwd,
95
82
  agentDir,
96
83
  settingsManager,
97
84
  resourceLoaderOptions: {
98
- // Disable automatic extension discovery; load only the filtered paths below
99
- // and the built-in factories, so discovery cannot add Maestro back.
100
- noExtensions: true,
101
- additionalExtensionPaths,
102
85
  extensionFactories,
86
+ // Exclude the main Maestro extension from the child session.
87
+ extensionsOverride: (base) => ({
88
+ ...base,
89
+ extensions: base.extensions.filter(({ path }) => !isMainMaestroExtension(path)),
90
+ }),
103
91
  appendSystemPromptOverride: (base) => [...base, roleGuidance],
104
92
  },
105
93
  });
@@ -14,13 +14,7 @@ const getErrorMessage = (error: unknown): string =>
14
14
 
15
15
  const getProjectRoot = async (context: ExtensionContext): Promise<string> => {
16
16
  try {
17
- const projectRoot = await realpath(context.cwd);
18
-
19
- if (!context.isProjectTrusted()) {
20
- throw new Error(`Project is not trusted: "${projectRoot}".`);
21
- }
22
-
23
- return projectRoot;
17
+ return await realpath(context.cwd);
24
18
  } catch (error) {
25
19
  throw new Error(`Project check failed: ${getErrorMessage(error)}`);
26
20
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Objective: Coordinate first-use setup without mixing UI and configuration rules.
3
+ * Used: By /maestro when interactive projects have no configuration.
4
+ */
5
+
6
+ import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
7
+
8
+ import {
9
+ saveConfiguration,
10
+ SETUP_ROLES,
11
+ type AgentModelSelections,
12
+ } from '#config/saveConfiguration.ts';
13
+ import { setupChoices } from '#config/setupChoices.ts';
14
+ import { selectModel } from '#src/ui/selectModel.ts';
15
+ import { selectThinking } from '#src/ui/selectThinking.ts';
16
+ import { CONFIRM_SETUP, showSetupMenu } from '#src/ui/showSetupMenu.ts';
17
+
18
+ export const setupConfiguration = async (context: ExtensionContext): Promise<boolean> => {
19
+ if (context.mode !== 'tui') {
20
+ throw new Error('Initial Maestro configuration requires interactive Pi.');
21
+ }
22
+
23
+ const choices = setupChoices(context.modelRegistry.getAvailable());
24
+ const selections: AgentModelSelections = {};
25
+
26
+ while (true) {
27
+ const action = await showSetupMenu({
28
+ ui: context.ui,
29
+ roles: Object.values(SETUP_ROLES),
30
+ selections,
31
+ });
32
+
33
+ if (action === undefined) return false;
34
+
35
+ if (action === CONFIRM_SETUP) {
36
+ await saveConfiguration({ cwd: context.cwd, agentModelSelections: selections });
37
+
38
+ return true;
39
+ }
40
+
41
+ const model = await selectModel({ ui: context.ui, choices: choices.map(({ value }) => value) });
42
+ const choice = choices.find(({ value }) => value === model);
43
+
44
+ if (!choice) continue;
45
+ const thinking = await selectThinking({ ui: context.ui, choices: choice.thinkingLevels });
46
+
47
+ if (thinking === undefined) continue;
48
+ selections[action] = { model: choice.value, thinking };
49
+ }
50
+ };
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Objective: Show a searchable, bounded picker for supplied model identifiers.
3
+ * Used: When editing an agent's model during initial setup.
4
+ */
5
+
6
+ import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
7
+ import { fuzzyFilter, Input, SelectList, Text } from '@earendil-works/pi-tui';
8
+
9
+ type SelectModelInput = {
10
+ ui: ExtensionContext['ui'];
11
+ choices: string[];
12
+ };
13
+
14
+ export const selectModel = ({ ui, choices }: SelectModelInput): Promise<string | undefined> =>
15
+ ui.custom<string | undefined>((tui, theme, keybindings, done) => {
16
+ const input = new Input({ prompt: 'Search: ' });
17
+ const title = new Text('Select model', 0, 0);
18
+ const hint = new Text('Type to search. Up/down navigate, Enter select, Escape cancel.', 0, 0);
19
+
20
+ const createList = (query: string) => {
21
+ const list = new SelectList(
22
+ fuzzyFilter(choices, query, (value) => value).map((value) => ({ value, label: value })),
23
+ 10,
24
+ {
25
+ selectedPrefix: (text) => theme.fg('accent', text),
26
+ selectedText: (text) => theme.fg('accent', text),
27
+ description: (text) => theme.fg('muted', text),
28
+ scrollInfo: (text) => theme.fg('dim', text),
29
+ noMatch: (text) => theme.fg('warning', text),
30
+ },
31
+ );
32
+
33
+ list.onSelect = ({ value }) => done(value);
34
+ list.onCancel = () => done(undefined);
35
+
36
+ return list;
37
+ };
38
+
39
+ let list = createList('');
40
+
41
+ const component = {
42
+ focused: false,
43
+ capturesViewportInput: list.capturesViewportInput,
44
+ render: (width: number) => {
45
+ input.focused = component.focused;
46
+
47
+ return [
48
+ ...title.render(width),
49
+ ...input.render(width),
50
+ ...list.render(width),
51
+ ...hint.render(width),
52
+ ];
53
+ },
54
+ invalidate: () => {
55
+ title.invalidate();
56
+ input.invalidate();
57
+ list.invalidate();
58
+ hint.invalidate();
59
+ },
60
+ handleInput: (data: string) => {
61
+ if (
62
+ (
63
+ [
64
+ 'tui.select.up',
65
+ 'tui.select.down',
66
+ 'tui.select.pageUp',
67
+ 'tui.select.pageDown',
68
+ 'tui.select.confirm',
69
+ 'tui.select.cancel',
70
+ ] as const
71
+ ).some((key) => keybindings.matches(data, key))
72
+ ) {
73
+ list.handleInput(data);
74
+ } else {
75
+ const previousQuery = input.getValue();
76
+ input.handleInput(data);
77
+
78
+ if (input.getValue() !== previousQuery) list = createList(input.getValue());
79
+ }
80
+
81
+ tui.requestRender();
82
+ },
83
+ };
84
+
85
+ return component;
86
+ });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Objective: Collect a thinking choice from supplied supported levels.
3
+ * Used: After a model is selected during setup.
4
+ */
5
+
6
+ import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
7
+
8
+ import type { ThinkingLevel } from '#config/schema.ts';
9
+
10
+ type SelectThinkingInput = {
11
+ ui: ExtensionContext['ui'];
12
+ choices: ThinkingLevel[];
13
+ };
14
+
15
+ export const selectThinking = async ({ ui, choices }: SelectThinkingInput) => {
16
+ const selected = await ui.select('Select thinking', choices);
17
+
18
+ return choices.find((choice) => choice === selected);
19
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Objective: Display completed role choices and the setup confirmation action.
3
+ * Used: Between role edits during first-use configuration.
4
+ */
5
+
6
+ import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
7
+
8
+ import type { SetupRole, AgentModelSelections } from '#config/saveConfiguration.ts';
9
+
10
+ export const CONFIRM_SETUP = 'confirm';
11
+
12
+ const ROLE_LABELS: Record<SetupRole, string> = {
13
+ builder: 'Builder',
14
+ verifier: 'Verifier',
15
+ simplifier: 'Simplifier',
16
+ };
17
+
18
+ type ShowSetupMenuInput = {
19
+ ui: ExtensionContext['ui'];
20
+ roles: SetupRole[];
21
+ selections: AgentModelSelections;
22
+ };
23
+
24
+ export const showSetupMenu = async ({ ui, roles, selections }: ShowSetupMenuInput) => {
25
+ const actions = roles.map((role) => {
26
+ const selection = selections[role];
27
+
28
+ return {
29
+ role,
30
+ label: selection
31
+ ? `${ROLE_LABELS[role]}: ${selection.model} (${selection.thinking})`
32
+ : `Select ${role}`,
33
+ };
34
+ });
35
+
36
+ const choice = await ui.select('Maestro setup', [
37
+ ...actions.map(({ label }) => label),
38
+ 'Confirm',
39
+ ]);
40
+
41
+ if (choice === 'Confirm') return CONFIRM_SETUP;
42
+
43
+ return actions.find(({ label }) => label === choice)?.role;
44
+ };