@emiliosp/pi-maestro 0.10.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/ADR.md +94 -18
  2. package/CHANGELOG.md +87 -33
  3. package/MISSION.md +4 -4
  4. package/README.md +66 -22
  5. package/ROADMAP.md +141 -112
  6. package/TECH_STACK.md +12 -11
  7. package/agents/builder.md +53 -57
  8. package/agents/simplifier.md +232 -0
  9. package/agents/verifier.md +52 -79
  10. package/docs/configuration.md +27 -16
  11. package/docs/glossary.md +47 -39
  12. package/docs/subagent-integration.md +22 -13
  13. package/docs/workflow.md +207 -103
  14. package/extensions/maestro-subagent.ts +4 -1
  15. package/extensions/maestro.ts +15 -26
  16. package/package.json +38 -39
  17. package/src/MaestroPaths.ts +26 -35
  18. package/src/artifacts/builder-handoff/assertBuilderHandoff.ts +6 -15
  19. package/src/artifacts/builder-handoff/schema.ts +3 -6
  20. package/src/artifacts/simplifier-handoff/assertSimplifierHandoff.ts +56 -0
  21. package/src/artifacts/simplifier-handoff/readSimplifierHandoff.ts +29 -0
  22. package/src/artifacts/simplifier-handoff/schema.ts +27 -0
  23. package/src/artifacts/verifier-handoff/assertVerifierHandoff.ts +4 -10
  24. package/src/artifacts/verifier-handoff/schema.ts +3 -6
  25. package/src/artifacts/verifier-handoff/writeVerifierHandoff.ts +1 -3
  26. package/src/config/assertConfiguration.ts +4 -7
  27. package/src/config/defaults.ts +8 -5
  28. package/src/config/loadConfiguration.ts +5 -11
  29. package/src/config/schema.ts +4 -2
  30. package/src/ids/createSpecId.ts +1 -2
  31. package/src/ids/isValidSpecId.ts +1 -2
  32. package/src/maestro/checks/assertEnvironment.ts +21 -48
  33. package/src/maestro/instructions/getMaestroInstructions.ts +59 -30
  34. package/src/maestro/status/formatMaestroStatus.ts +7 -13
  35. package/src/maestro/status/refreshMaestroStatus.ts +3 -7
  36. package/src/specs/create.ts +14 -4
  37. package/src/specs/template.ts +10 -14
  38. package/src/tools/child/record-builder-handoff.ts +1 -0
  39. package/src/tools/child/record-simplifier-handoff.ts +73 -0
  40. package/src/tools/child/record-verifier-handoff.ts +2 -3
  41. package/src/tools/child/utils/resolveWorkflowContext.ts +1 -4
  42. package/src/tools/main/create-spec.ts +3 -2
  43. package/src/tools/main/mark-spec-ready.ts +2 -1
  44. package/src/tools/main/resolve-escalations.ts +1 -0
  45. package/src/tools/main/resolve-findings.ts +7 -21
  46. package/src/tools/main/run-builder.ts +37 -57
  47. package/src/tools/main/run-simplifier.ts +172 -0
  48. package/src/tools/main/run-verifier.ts +34 -58
  49. package/src/tools/utils/pi-subagent-delegation.ts +13 -22
  50. package/src/tools/utils/resolveToolRunContext.ts +2 -3
  51. package/src/utils/is-errno-exception.ts +1 -3
  52. package/src/utils/path-exists.ts +1 -0
  53. package/src/utils/path-strictly-within.ts +3 -6
  54. package/src/utils/path-within-or-equal.ts +1 -4
  55. package/src/utils/read-json.ts +1 -4
  56. package/src/utils/write-json.ts +1 -4
  57. package/src/workflow/builder/completeBuilderPass.ts +3 -2
  58. package/src/workflow/builder/prepareBuilderRun.ts +3 -8
  59. package/src/workflow/builder/resolveEscalations.ts +2 -6
  60. package/src/workflow/builder/utils/getWorkflowEventByBuilderHandoff.ts +1 -3
  61. package/src/workflow/roles.ts +2 -1
  62. package/src/workflow/simplifier/completeSimplifierPass.ts +56 -0
  63. package/src/workflow/spec/markSpecReady.ts +10 -4
  64. package/src/workflow/state/readWorkflowState.ts +2 -7
  65. package/src/workflow/state/schema.ts +9 -10
  66. package/src/workflow/state/writeWorkflowState.ts +1 -4
  67. package/src/workflow/transitions.ts +12 -12
  68. package/src/workflow/utils/assertSpecAcceptanceCriteria.ts +2 -1
  69. package/src/workflow/utils/getAgentRole.ts +6 -4
  70. package/src/workflow/verifier/completeVerifierPass.ts +1 -0
  71. package/src/workflow/verifier/resolveFindings.ts +9 -29
  72. package/src/workflow/verifier/utils/getWorkflowEventByVerifierHandoff.ts +5 -20
  73. package/templates/design.md +20 -0
  74. package/templates/proposal.md +23 -0
  75. package/templates/spec.md +21 -50
package/templates/spec.md CHANGED
@@ -1,69 +1,40 @@
1
1
  # <id>: <short, outcome-oriented title>
2
2
 
3
- > After owner approval, this specification is the contract for the builder and verifier.
4
-
5
3
  <!--
6
- Write for the owner, not only for agents. Keep detail proportional to the change.
7
- State each requirement once. Refer to it from acceptance criteria instead of repeating it.
8
- Use the topics below as guidance, not a checklist to fill. Omit empty subsections and these instructions.
9
- Leave local implementation choices, test code, fixtures, mocks, and commands to the builder.
4
+ Define required behavior, not motivation or implementation. See proposal.md for scope and design.md, when present, for approved technical decisions.
5
+ Write for the owner. State each requirement once and keep its acceptance criteria immediately below it.
6
+ Use the topics below as guidance. Omit empty subsections and these instructions.
7
+ Leave test code, fixtures, mocks, and commands to the builder. Keep execution evidence in handoffs.
10
8
  -->
11
9
 
12
- ## 1. Context, goals, and scope
13
-
14
- <Briefly describe the problem, who is affected, and the intended outcome.>
15
-
16
- ### Out of scope
17
-
18
- <Name related changes that are explicitly excluded.>
19
-
20
- ## 2. Requirements and constraints
10
+ ## Requirements
21
11
 
22
- <Describe required behavior and measurable limits. Include performance, reliability, accessibility, or other quality requirements only when relevant.>
12
+ <Give each requirement its own ### REQ<number>: <title> heading and a unique, stable ID. Document only behavior or constraints this change adds, modifies, or removes, with relevant measurable limits, edge cases, and error handling. Existing behavior must continue working unless explicitly changed or removed; do not list unchanged behavior as requirements. Do not copy repository or agent instructions.>
23
13
 
24
- <Include non-negotiable boundaries and existing behavior that this change must preserve. Do not copy repository or agent instructions.>
14
+ <Give each requirement exactly one Delta value: added, modified, or removed. Keep requirements organized by topic, not by delta category. For modified or removed requirements, add a brief Before description only when useful. Verify the previous behavior from repository evidence; do not invent it or repeat the whole old requirement. State the complete required outcome, including the required absence and any agreed replacement or error behavior for removals. Keep the same pre-change baseline during revisions.>
25
15
 
26
- ### Edge cases and error handling
16
+ <Each requirement must have Verified by with Markdown links to its acceptance criteria, using their actual heading anchors. When an existing test covers the exact starting conditions, action, and expected result, link its file relative to spec.md and give the exact scenario name instead of creating a duplicate criterion. Keep criteria for partial or uncertain coverage. A requirement can reference both criteria and tests; check their combined coverage.>
27
17
 
28
- <Describe boundary conditions, failures, and required recovery behavior not already covered above. Keep these requirements even when existing tests cover their scenarios.>
18
+ <Write each requirement-associated AC once, immediately below its primary requirement, with a #### AC<number>: <title> heading. Other requirements can link to it without duplication. A relevant regression AC without an associated changed requirement can instead use a ### AC<number>: <title> heading under an optional ## Regression checks section, with the same probe, expected result, and example fields. Do not invent a REQ or Delta field for it. Include only regressions relevant to this change, not an inventory of existing behavior, and omit the section when unnecessary.>
29
19
 
30
- ## 3. Technical decisions and prototypes
20
+ <Number ACs continuously from AC1 across the whole document, including nested and standalone regression criteria. During review, remove criteria already covered exactly by existing tests and update numbering and affected links. Keep required behavior documented when a requirement-associated criterion is omitted; omitting a standalone regression criterion does not require creating a requirement.>
31
21
 
32
- <Record only approved architectural decisions or technical constraints that affect scope or behavior. Explain their reasons briefly. Leave routine implementation choices to the builder.>
22
+ ### REQ1: <short required behavior>
33
23
 
34
- <For each relevant topic below, add a short subsection. Omit topics that do not apply.>
24
+ Delta: <added | modified | removed>
35
25
 
36
- 1. Components and data flow: changed responsibilities, data contracts, and important boundaries. No file inventory or function-level design.
37
- 2. API specification: changed operations, permissions, inputs, outputs, errors, side effects, and delivery guarantees.
38
- 3. Prototype and user interaction: link prototypes and identify approved states and interactions. Distinguish illustrative content from requirements.
39
- 4. External integrations: affected services, failure behavior, and retries.
40
- 5. Security and privacy: access rules, sensitive data, retention, and trust boundaries.
41
- 6. Compatibility and migration: compatibility limits, migration, rollout, and rollback requirements.
42
- 7. Monitoring and observability: required signals, alerts, and ownership.
26
+ <Describe the requirement once, including relevant boundary conditions and required failure or recovery behavior.>
43
27
 
44
- <Include only evidence and unresolved limits that affect an owner decision. Do not include investigation logs or general verification disclaimers.>
28
+ Verified by: [AC1](#ac1-short-observable-claim)
45
29
 
46
- ## 4. Acceptance criteria
30
+ #### AC1: <short observable claim>
47
31
 
48
- <Inspect existing tests before writing criteria. Omit a criterion only if a test covers the same starting conditions, action, and expected result. Keep criteria when coverage is partial or uncertain. During review, remove criteria already covered by tests. Keep numbering continuous from AC1 and update affected references. Keep required behavior in section 2 even when its criterion is omitted.>
49
-
50
- <Give each criterion a unique ID, one observable claim, and one coverage label. A probe is the scenario used to check that claim. Describe it in plain language. Use success for a valid action that produces the required result. Use failure for an invalid action that is correctly rejected. Use unchanged when the criterion explicitly checks existing behavior that the change must preserve. The label describes the scenario, not the test outcome. A failure scenario passes when the invalid action is correctly rejected. Do not require all three categories.>
51
-
52
- ### AC1: <short observable claim>
53
-
54
- 1. Coverage: <success | failure | unchanged>
55
- 2. Probe: <starting conditions and action or observation, without prescribing test implementation>
56
- 3. Expected result: <observable and measurable outcome>
57
- 4. Example: <specific starting conditions, concrete input or action, and exact expected result for this probe, not a restatement of the claim>
32
+ 1. Probe: <starting conditions and action or observation, without prescribing test implementation>
33
+ 2. Expected result: <observable and measurable outcome>
34
+ 3. Example: <specific starting conditions, concrete input or action, and exact expected result, not a restatement of the claim>
58
35
 
59
36
  <!--
60
- Example:
61
- Coverage: success
62
- Probe: Save a change to an item's title, then reopen the item.
63
- Expected result: The saved title is still present.
64
- Example: An item's title is "Draft". Change it to "Ready", save, and reopen the item. The title is "Ready".
65
-
66
- The builder and verifier each run every probe.
67
- The builder chooses executable checks. The verifier checks their coverage independently.
68
- Keep execution evidence in handoffs, not in this spec.
37
+ Each AC has one observable claim, a probe, an expected result, and a concrete example.
38
+ Describe relevant valid actions, invalid actions, and regressions directly through those fields, without a separate classification label.
39
+ The builder and verifier each run every probe independently. The builder chooses executable checks; the verifier checks their coverage independently.
69
40
  -->