@emiliosp/pi-maestro 0.18.5 → 0.18.6

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
@@ -404,3 +404,33 @@ Existing boundaries are described in [subagent integration](docs/subagent-integr
404
404
  [builder execution](src/tools/main/run-builder.ts), and the
405
405
  [child extension](https://github.com/emilioSp/pi-maestro/blob/9d020b9177e93333736ade265db5e332fbb2a291/extensions/maestro-subagent.ts). These links describe the current
406
406
  implementation, not the planned SDK replacement.
407
+
408
+ ## ADR-011: Separate initial setup UI from configuration rules
409
+
410
+ ### Status
411
+
412
+ Accepted in the approved MAESTRO-19 design. Implemented for verification.
413
+
414
+ ### Context
415
+
416
+ Initial configuration needs searchable model selection without access to Pi's private session runtime. The `owner` selected public Pi components and strict separation
417
+ between graphical controls and configuration rules.
418
+
419
+ ### Decision
420
+
421
+ 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
422
+ in `src/ui/`, configuration rules and persistence in `src/config/`, and coordination in `src/maestro/setupConfiguration.ts`.
423
+
424
+ 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
425
+ 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
426
+ selections and replacements, without preferring `off`.
427
+
428
+ ### Consequences
429
+
430
+ Setup needs no private runtime access, separate model runtime, new dependency, or persistent draft. UI components receive supplied choices rather than deciding model
431
+ requirements or phase rules. Initial setup is limited to interactive terminal mode.
432
+
433
+ ### Evidence
434
+
435
+ [Approved design](.specs/20261108-141712-maestro-19-guide-initial-configuration-with-pi-selectors/design.md) and
436
+ [configuration guidance](docs/configuration.md#initial-setup).
package/CHANGELOG.md CHANGED
@@ -3,193 +3,197 @@
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.6
7
+
8
+ - Added guided initial configuration through `/maestro`: the `owner` selects models and thinking levels for `builder`, `verifier`, and `simplifier`, then saves the
9
+ configuration and activates `Maestro`. Selected agents are enabled; selecting none enables `spec` preparation only. Agent models no longer have defaults.
10
+
6
11
  ## 0.18.5
7
12
 
8
- 1. Added [The Pi Maestro Manifesto](MANIFESTO.md), linked from the README, explaining the project's motivation and approach to spec-driven development.
13
+ - Added [The Pi Maestro Manifesto](MANIFESTO.md), linked from the README, explaining the project's motivation and approach to spec-driven development.
9
14
 
10
15
  ## 0.18.2
11
16
 
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.
17
+ - 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
18
+ appear.
14
19
 
15
20
  ## 0.18.1
16
21
 
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.
22
+ - Running `builder`, `verifier`, and `simplifier` tools now show elapsed time, active tools, and streaming normal assistant text. Elapsed time keeps updating during
23
+ silent work. Pi controls preview and expansion, while intermediate activity stays out of the main model's context.
19
24
 
20
25
  ## 0.18.0
21
26
 
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.
27
+ - `Builder`, `verifier`, and `simplifier` now run in fresh native Pi SDK sessions. Activation no longer requires a separate agent extension. The `owner` can interrupt
28
+ them through Pi's cancel action.
29
+ - `Maestro` displays saved child session paths on completion or failure, for direct inspection or HTML export with Pi.
30
+ - `Maestro` no longer requires the `pi-subagents` package. Installation, activation, and agent `runs` use Pi alone.
26
31
 
27
32
  ## 0.17.0
28
33
 
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`.
34
+ - Added a standalone internal Pi SDK executor. Each invocation starts a fresh conversation with supplied model, thinking level, role guidance, working directory, and
35
+ additional tools. Native resource discovery loads instructions, skills, enabled extensions, and configured MCP, codemode, and tool search support, excluding the main
36
+ `Maestro` extension.
37
+ - Added native child session persistence in `subagents/` beneath Pi's project session directory.
38
+ - Replaced the `acceptance criterion` `probe` and `expected result` fields with `GIVEN`, `WHEN`, and `THEN`, keeping the concrete example. Requirement bodies now use a
39
+ named actor followed by `MUST` in the requirement heading. Added an optional bullet-list `## Assumptions` section to `spec.md`.
35
40
 
36
41
  The `builder`, `verifier`, and `simplifier` still use `pi-subagents`. Workflow migration and dependency removal remain separate work.
37
42
 
38
43
  ## 0.16.0
39
44
 
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.
45
+ - 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
46
+ 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`
47
+ field on `exec` results. See [PR #46](https://github.com/emilioSp/pi-maestro/pull/46).
48
+ - Breaking: removed `timeoutMinutes` from the agent configuration. Configuration files that still contain the field fail validation until the `owner` removes it; no
49
+ migration or legacy handling is provided.
50
+ - 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
51
+ duration.
52
+ - 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
53
 
49
54
  ## 0.15.0
50
55
 
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.
56
+ - Added per-agent `required` booleans in `.pi/maestro.json`, all defaulting to `true`. Disabling `builder` completes the workflow at `spec` approval without agents;
57
+ otherwise `verifier` and `simplifier` can be disabled independently. See [PR #45](https://github.com/emilioSp/pi-maestro/pull/45).
58
+ - Limited activation checks and displayed agent details to enabled phases. With `builder` disabled, activation requires no agents, models, or `pi-subagents` ping.
59
+ - Updated workflow transitions, tool messages, agent guidance, and documentation for optional phases. Final-summary guidance identifies skipped work without claiming
60
+ implementation, independent verification, or simplification occurred.
56
61
 
57
62
  ## 0.14.0
58
63
 
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.
64
+ - Removed Maestro's model format regex while retaining activation checks against Pi's available model registry. Complete identifiers, including
65
+ `openrouter/~openai/gpt-mini-latest`, are matched without truncation and passed unchanged to `pi-subagents`. Maestro's other configuration validation remains unchanged.
62
66
 
63
67
  ## 0.13.1
64
68
 
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.
69
+ - Restored `ROADMAP.md` as the planning source of truth from the current Linear issues, retaining their identifiers and recorded evidence. Updated repository guidance,
70
+ documentation links, and package contents so roadmap maintenance no longer requires Linear. Linear data remains unchanged.
67
71
 
68
72
  ## 0.13.0
69
73
 
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).
74
+ - Automatically turn off `Maestro` after successfully delivering the final summary of a completed workflow, including when Git is unavailable and simplification is
75
+ skipped. Clear live tools, status, instructions, and active `spec` selection while preserving saved workflow files and other extensions. See
76
+ [MAESTRO-26](https://linear.app/emilio-spatola/issue/MAESTRO-26).
73
77
 
74
78
  ## 0.12.0
75
79
 
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.
80
+ - 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
81
+ existing test scenarios. Review checks complete coverage and current links, including during revisions. Approval validation and `handoff` formats remain unchanged.
82
+ - Added per-requirement `Delta` labels: `added`, `modified`, and `removed`. Modified or removed behavior can include a brief, evidence-based `Before` description when
83
+ useful. Requirements state the complete required outcome; unchanged behavior remains implicit. Approval validation and `handoff` formats remain unchanged.
84
+ - 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
85
+ read it. Creation returns the new document paths; approval requires the proposal. Historical documents are not migrated.
86
+ - Placed requirement-associated `acceptance criteria` under their requirements as level-four headings. Relevant standalone regression criteria use level-three headings
87
+ under optional `Regression checks`, without inventing unchanged requirements. Both forms share global numbering and are required in `handoffs`. Workflow phases and
88
+ saved report formats remain unchanged.
89
+ - Removed the `Coverage` classification field from current `acceptance criteria`. Each criterion retains its `probe`, `expected result`, and example. Standalone
90
+ regression checks remain identified by their section; validation and report formats are unchanged.
87
91
 
88
92
  ## 0.11.0
89
93
 
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.
94
+ - Added the `simplifier` after successful verification or rejection of all current `findings`, without another approval or verification cycle.
95
+ - Added Git-only readiness and file discovery for simplification. If Git is unavailable, the workflow warns and completes without delegation.
96
+ - Added independent `simplifier` configuration, activation checks and presentation, running status, and the fixed `handoffs/simplifier/S.json` result.
97
+ - Removed the extra code-quality review from the verifier's instructions. The `simplifier` preserves accepted behavior without introducing check failures.
94
98
 
95
99
  ## 0.10.1
96
100
 
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`.
101
+ - Added `success`, `failure`, and `unchanged` coverage labels to the `spec` template and `Maestro` guidance. Approval validation and `handoff` formats remain unchanged.
102
+ - Required `Maestro` to inspect existing tests before writing `acceptance criteria` and remove criteria whose exact scenarios already have coverage. Requirements remain
103
+ documented in the `spec`.
100
104
 
101
105
  ## 0.10.0
102
106
 
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.
107
+ - Saved complete `owner` decision batches in their original `handoffs` before changing phase, including when the `spec` requires revision. See
108
+ [PR #38](https://github.com/emilioSp/pi-maestro/pull/38).
109
+ - Added `revise-spec` decisions for `verifier` `findings`, with the owner's reason and agreed requirement change. Revision takes priority over code fixes and rejections.
110
+ - Unified both revision paths through `drafting-spec`, with renewed `GREEN FLAG` before separate approval and another `builder` `run`. Approval is allowed only from
111
+ `drafting-spec`.
112
+ - Renamed workflow events to identify `builder` and `owner` actions. Both revision paths share `OWNER_REQUEST_SPEC_REVISION`.
113
+ - Breaking: supply the required boolean `specChangeRequired` when calling `maestro_resolve_escalations`.
114
+ - Breaking: saved decision phases are now `escalation-decisions` and `finding-decisions`. Existing workflows using older names require manual `owner` handling. No
115
+ automatic migration is provided.
112
116
 
113
117
  ## 0.9.5
114
118
 
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.
119
+ - Added a shared check that requires every approved `spec` criterion ID in `builder` and `verifier` `handoffs`. See
120
+ [PR #37](https://github.com/emilioSp/pi-maestro/pull/37).
121
+ - Missing IDs reject submission before saving a report or changing phase. Extra report IDs remain allowed, and existing report validation is unchanged.
122
+ - Reused the raw heading rule `^### AC(\d+):`, including leading zeros and matching lines inside code blocks. No matching headings impose no new restriction.
123
+ - Added unit tests for extraction and one missing-ID integration test per role.
120
124
 
121
125
  ## 0.9.4
122
126
 
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`.
127
+ - Added numbering validation to `spec` approval. Matched `acceptance criterion` headings must start at `AC1` and continue without gaps. See
128
+ [PR #36](https://github.com/emilioSp/pi-maestro/pull/36).
129
+ - Invalid numbering rejects approval before saving the workflow and leaves all saved files unchanged. No matching headings still permits approval.
130
+ - Added `Maestro` guidance to correct only numbering and affected references, then retry with the existing `GREEN FLAG`. No additional `owner` approval is required before
131
+ starting the `builder`.
128
132
 
129
133
  ## 0.9.3
130
134
 
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.
135
+ - Added a parent `pi-subagents` availability check during activation. A matching successful version 1 `ping` reply is required within 2000 ms. See
136
+ [PR #35](https://github.com/emilioSp/pi-maestro/pull/35).
137
+ - Failed or invalid replies, emission errors, and timeouts prevent activation. The error includes "Maestro flow requires pi-subagents installed in the Pi environment."
138
+ The check makes no automatic retry.
139
+ - 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
140
+ when turning `Maestro` off.
137
141
 
138
142
  ## 0.9.2
139
143
 
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`.
144
+ - Added code-quality review to `verifier` guidance for code affected by the approved change when applicable `AGENTS.md` directives exist. See
145
+ [PR #34](https://github.com/emilioSp/pi-maestro/pull/34). All existing verification duties remain unchanged.
146
+ - Required instruction-violation `findings` to identify the instruction file, quote the rule, and explain the violating code through existing evidence fields.
147
+ - Skip only the added review when files or code-quality directives are absent. Missing directives and personal style preferences do not produce `findings`.
144
148
 
145
149
  ## 0.9.1
146
150
 
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.
151
+ - Added a brief introduction and an invitation to ask how `Maestro` works to the successful activation notice. See
152
+ [PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
153
+ - Preserved the configured agent details and UI-only activation. Activation does not add session history or start a model request.
154
+ - Added absolute paths to the installed README and documentation directory in active instructions. `Maestro` reads relevant documentation on demand without automatically
155
+ loading its contents.
152
156
 
153
157
  ## 0.9.0
154
158
 
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`.
159
+ - Breaking: `builder` reports now support only `done` and `escalation`. Reportable technical problems use the existing `owner` `escalation` process. See
160
+ [PR #32](https://github.com/emilioSp/pi-maestro/pull/32).
161
+ - Removed the terminal `builder` failure phase and event. Execution errors and missing or invalid saved results still stop the workflow without automatic recovery.
162
+ - No migrations, compatibility readers, or deprecated aliases are provided. `Artifact` versions remain `1.0.0`.
159
163
 
160
164
  ## 0.8.0
161
165
 
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.
166
+ - Updated the bundled `pi-subagents` dependency from `0.76.0` to `0.78.0`.
167
+ - Renamed `test/` to `tests/`. Updated imports, fixture paths, lint configuration, and project instructions. Source tests remain next to their source files.
164
168
 
165
169
  ## 0.7.3
166
170
 
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.
171
+ - Added Oxlint rules for `given ... when ... then ...` test titles, `const` usage, unnecessary `else` branches, type aliases, and ESM imports. See
172
+ [PR #31](https://github.com/emilioSp/pi-maestro/pull/31).
173
+ - Updated `oxlint-anti-slop` from `0.3.3` to `0.3.6`.
174
+ - Updated 106 test titles to match the naming rule without changing test logic.
171
175
 
172
176
  ## 0.7.2
173
177
 
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.
178
+ - Renamed the constitution files to `MISSION.md`, `TECH_STACK.md`, `ROADMAP.md`, and `CHANGELOG.md`. Updated their links, package file list, and audit references.
179
+ - Applied consistent inline code formatting to glossary terms across the documentation. Recorded the formatting rule and its exclusions in `AGENTS.md` and the
180
+ documentation audit skill.
181
+ - Used `spec` consistently for the approved change document and removed the redundant glossary entry.
178
182
 
179
183
  ## 0.7.1
180
184
 
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.
185
+ - Documented the project mission, current tech stack, `owner` responsibilities, roadmap, and codebase change history. See
186
+ [PR #30](https://github.com/emilioSp/pi-maestro/pull/30).
187
+ - Replaced `TODO.md` with the roadmap and included the four project constitution documents in the npm package.
188
+ - Updated documentation audits to compare all current documentation and the project constitution with the working tree without requesting a comparison baseline.
185
189
 
186
190
  ## 0.7.0
187
191
 
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).
192
+ - Stored multiple `escalation` questions and `owner` resolutions inside numbered `builder` `handoffs`. Earlier `handoffs` remain available as history. See
193
+ [PR #27](https://github.com/emilioSp/pi-maestro/pull/27).
194
+ - Breaking: replaced `maestro_open_escalation` and `maestro_resolve_escalation` with `maestro_record_builder_handoff` and `maestro_resolve_escalations`. Done `handoffs`
195
+ require `escalations: []`. Standalone `escalation` storage was removed without migration or compatibility readers. `Artifact` versions remain `1.0.0`.
196
+ - Added LCOV coverage reports and Codecov uploads from CI. See [PR #28](https://github.com/emilioSp/pi-maestro/pull/28).
193
197
 
194
198
  Reload `Maestro` extensions before starting new workflows so sessions use the updated tools.
195
199
 
@@ -200,11 +204,11 @@ session history and model context. See [PR #26](https://github.com/emilioSp/pi-m
200
204
 
201
205
  ## 0.6.0
202
206
 
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.
207
+ - Removed Git requirements, checkpoints, and automatic commits from the workflow. `Maestro` uses Pi's project directory and saved workflow phase. See
208
+ [PR #25](https://github.com/emilioSp/pi-maestro/pull/25).
209
+ - Retained numbered `builder` and `verifier` `handoffs` and explicit `owner` `finding` decisions. Removed workflow revision counters and writer locks.
210
+ - Breaking: changed `artifact` formats, `handoff` paths, and tool results without migration or compatibility readers. Removed revision and commit fields. `Artifact`
211
+ versions remain `1.0.0`. Interrupted and older workflows require manual `owner` handling.
208
212
 
209
213
  ## 0.5.2
210
214
 
@@ -247,9 +251,9 @@ Enabled inheritance of global instructions for `builder` and `verifier` agents,
247
251
 
248
252
  ## 0.4.0
249
253
 
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.
254
+ - Fixed delegated `handoffs` that depended on unavailable parent session memory. See [PR #22](https://github.com/emilioSp/pi-maestro/pull/22).
255
+ - Removed hash-based `spec` guards and checkpoint-based `verifier` comparisons. `Spec` preservation and restoration rely on agent instructions.
256
+ - Refreshed the running status before delegation and required repository investigation before presenting technical decisions during `spec` preparation.
253
257
 
254
258
  ## 0.3.0
255
259
 
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
 
@@ -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.6",
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
+ }));
@@ -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
+ };