@pareto4/pp-core 1.19.0 → 1.21.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 (126) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/pp-nyquist-auditor.md +19 -14
  3. package/agents/pp-phase-researcher.md +10 -0
  4. package/agents/pp-plan-checker.md +59 -36
  5. package/agents/pp-planner.md +49 -53
  6. package/agents/pp-vault-reviewer.md +2 -0
  7. package/agents/pp-verifier.md +15 -60
  8. package/commands/pp-autonomous.md +2 -1
  9. package/commands/pp-discovery.md +3 -2
  10. package/commands/pp-plan-phase.md +2 -1
  11. package/commands/pp-plan-review-convergence.md +2 -1
  12. package/gemini-extension.json +1 -1
  13. package/package.json +6 -3
  14. package/pareto-skills/_shared/pp-claude-md-protocol.md +1 -1
  15. package/pareto-skills/pp-project-setup/SKILL.md +18 -343
  16. package/pp-core/bin/lib/capability-activation.cjs +77 -0
  17. package/pp-core/bin/lib/capability-registry.cjs +15 -15
  18. package/pp-core/bin/lib/capability-state.cjs +8 -18
  19. package/pp-core/bin/lib/ceremony.cjs +1342 -0
  20. package/pp-core/bin/lib/check-command-router.cjs +62 -1
  21. package/pp-core/bin/lib/commands.cjs +29 -3
  22. package/pp-core/bin/lib/config.cjs +5 -0
  23. package/pp-core/bin/lib/discovery-access.cjs +276 -0
  24. package/pp-core/bin/lib/discovery-charter.cjs +664 -0
  25. package/pp-core/bin/lib/discovery-deviations.cjs +264 -0
  26. package/pp-core/bin/lib/discovery-entities.cjs +323 -0
  27. package/pp-core/bin/lib/discovery-for-phase.cjs +628 -0
  28. package/pp-core/bin/lib/discovery-integrations.cjs +286 -0
  29. package/pp-core/bin/lib/discovery-migration.cjs +246 -0
  30. package/pp-core/bin/lib/discovery-phases.cjs +233 -0
  31. package/pp-core/bin/lib/discovery-processes.cjs +355 -0
  32. package/pp-core/bin/lib/discovery-research-track.cjs +5 -4
  33. package/pp-core/bin/lib/discovery-rollup.cjs +8 -7
  34. package/pp-core/bin/lib/discovery-rules.cjs +216 -0
  35. package/pp-core/bin/lib/discovery-screens.cjs +1 -1
  36. package/pp-core/bin/lib/discovery-session-check.cjs +264 -0
  37. package/pp-core/bin/lib/discovery-stories.cjs +273 -0
  38. package/pp-core/bin/lib/discovery-sweep.cjs +1 -1
  39. package/pp-core/bin/lib/discovery-table.cjs +55 -0
  40. package/pp-core/bin/lib/init.cjs +50 -1
  41. package/pp-core/bin/lib/io.cjs +24 -0
  42. package/pp-core/bin/lib/loop-resolver.cjs +26 -12
  43. package/pp-core/bin/lib/phase.cjs +39 -3
  44. package/pp-core/bin/lib/plan-sizing.cjs +346 -0
  45. package/pp-core/bin/lib/test-substance.cjs +3190 -0
  46. package/pp-core/bin/lib/timeline.cjs +605 -0
  47. package/pp-core/bin/lib/vault-standards-review.cjs +50 -2
  48. package/pp-core/bin/pp-tools.cjs +214 -5
  49. package/pp-core/bin/shared/ceremony-gates.json +17 -0
  50. package/pp-core/bin/shared/config-schema.manifest.json +1 -0
  51. package/pp-core/references/ceremony.md +81 -0
  52. package/pp-core/references/discovery-access.md +112 -0
  53. package/pp-core/references/discovery-build-consumption.md +256 -0
  54. package/pp-core/references/discovery-charter.md +127 -0
  55. package/pp-core/references/discovery-data-model.md +145 -0
  56. package/pp-core/references/discovery-id-conventions.md +50 -14
  57. package/pp-core/references/discovery-integrations.md +151 -0
  58. package/pp-core/references/discovery-processes.md +190 -0
  59. package/pp-core/references/discovery-rebaseline.md +2 -2
  60. package/pp-core/references/discovery-research-track.md +5 -6
  61. package/pp-core/references/discovery-session-output.md +70 -0
  62. package/pp-core/references/discovery-standards.md +107 -0
  63. package/pp-core/references/discovery-traceability.md +2 -2
  64. package/pp-core/references/few-shot-examples/plan-checker.md +8 -8
  65. package/pp-core/references/phase-timeline.md +107 -0
  66. package/pp-core/references/planner-antipatterns.md +32 -0
  67. package/pp-core/references/planner-discovery-extract.md +35 -0
  68. package/pp-core/references/planner-guidance.md +17 -14
  69. package/pp-core/references/planner-revision.md +1 -1
  70. package/pp-core/references/planning-config.md +3 -2
  71. package/pp-core/references/test-substance.md +324 -0
  72. package/pp-core/references/verifier-discovery-conformance.md +36 -0
  73. package/pp-core/references/verifier-stub-patterns.md +51 -0
  74. package/pp-core/templates/VALIDATION.md +1 -0
  75. package/pp-core/templates/phase-prompt.md +19 -7
  76. package/pp-core/templates/project-charter.md +161 -100
  77. package/pp-core/templates/project.md +3 -3
  78. package/pp-core/templates/requirements.md +18 -0
  79. package/pp-core/templates/roadmap.md +1 -1
  80. package/pp-core/templates/verification-report.md +17 -1
  81. package/pp-core/workflows/audit-milestone.md +4 -1
  82. package/pp-core/workflows/autonomous.md +11 -8
  83. package/pp-core/workflows/code-review.md +15 -6
  84. package/pp-core/workflows/discovery-sprint/charter.md +114 -0
  85. package/pp-core/workflows/discovery-sprint/prefill.md +1 -1
  86. package/pp-core/workflows/discovery-sprint/prototype.md +4 -4
  87. package/pp-core/workflows/discovery-sprint/session-13-gates.md +10 -0
  88. package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +5 -2
  89. package/pp-core/workflows/discovery-sprint/sessions/02-as-is.md +27 -5
  90. package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +56 -31
  91. package/pp-core/workflows/discovery-sprint/sessions/04-ux-design.md +1 -1
  92. package/pp-core/workflows/discovery-sprint/sessions/05-architecture.md +42 -19
  93. package/pp-core/workflows/discovery-sprint/sessions/06-security.md +27 -12
  94. package/pp-core/workflows/discovery-sprint/sessions/07-identity.md +41 -23
  95. package/pp-core/workflows/discovery-sprint/sessions/08-integration.md +50 -23
  96. package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +26 -11
  97. package/pp-core/workflows/discovery-sprint/sessions/10-infrastructure.md +28 -9
  98. package/pp-core/workflows/discovery-sprint/sessions/11-roadmap.md +21 -0
  99. package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +24 -9
  100. package/pp-core/workflows/discovery-sprint.md +12 -15
  101. package/pp-core/workflows/discovery-to-build/steps/architecture-deliverables.md +80 -29
  102. package/pp-core/workflows/discovery-to-build/steps/{screen-inventory-gate.md → handoff-gates.md} +111 -3
  103. package/pp-core/workflows/discovery-to-build/templates/discovery-references.md +12 -9
  104. package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +27 -26
  105. package/pp-core/workflows/discovery-to-build.md +70 -34
  106. package/pp-core/workflows/discuss-phase/discovery.md +83 -0
  107. package/pp-core/workflows/discuss-phase/templates/context.md +4 -0
  108. package/pp-core/workflows/discuss-phase.md +10 -7
  109. package/pp-core/workflows/execute-phase/steps/check-query-gate.md +7 -7
  110. package/pp-core/workflows/execute-phase/steps/codebase-drift-gate.md +3 -2
  111. package/pp-core/workflows/execute-phase.md +14 -3
  112. package/pp-core/workflows/new-project.md +3 -3
  113. package/pp-core/workflows/plan-phase/steps/chunked-planning.md +7 -3
  114. package/pp-core/workflows/plan-phase/steps/discovery-extract.md +41 -0
  115. package/pp-core/workflows/plan-phase/steps/prd-express.md +104 -0
  116. package/pp-core/workflows/plan-phase.md +62 -124
  117. package/pp-core/workflows/plan-review-convergence.md +6 -3
  118. package/pp-core/workflows/ship.md +2 -2
  119. package/pp-core/workflows/stats.md +19 -4
  120. package/pp-core/workflows/validate-phase.md +19 -4
  121. package/pp-core/workflows/vault-review.md +5 -0
  122. package/pp-core/workflows/verify-phase.md +1 -1
  123. package/pp-core/workflows/verify-work.md +1 -1
  124. package/scripts/gen-capability-registry.cjs +43 -45
  125. package/scripts/run-tests.cjs +54 -30
  126. package/pp-core/workflows/discovery-sprint/templates/context-template.md +0 -272
@@ -19,11 +19,11 @@ Before facilitating any topics, execute the **Session 13: Cross-Reference Protoc
19
19
  - Which assumptions were validated and which were invalidated?
20
20
  - What issues were identified and resolved by the cross-reference analysis?
21
21
 
22
- 2. **Project Definition Document (PDD) review**
23
- *Why it matters: this is the client's last chance to catch a scoping or architecture error before build starts. Skip when: never — always required before go/no-go.*
24
- - Walk through the PDD structure and key sections
25
- - Are there sections requiring further refinement?
26
- - Does the client agree with documented scope, architecture, and approach?
22
+ 2. **Project Charter review**
23
+ *Why it matters: the charter (`docs/discovery/PROJECT-CHARTER.md`, drafted in Step 0.5 from `templates/project-charter.md`) is the one document every stakeholder signs, so this is the client's last chance to catch a scoping or architecture error before build starts. Skip when: never — always required before go/no-go.*
24
+ - Walk through the drafted charter section by section; every statement traces to a session, decision or requirement ID
25
+ - Are there sections requiring further refinement? Correct the charter in place; a correction that changes a recorded fact is a Key Decisions row `D-13-<n>` and a back-amend of the original line (Flow 2 Step 6)
26
+ - Does the client agree with documented scope, architecture, approach, deviations and conditions?
27
27
 
28
28
  3. **Go / No-Go assessment**
29
29
  *Why it matters: this is the literal decision gate that authorizes spend on the build phase. Skip when: never — always required.*
@@ -31,6 +31,7 @@ Before facilitating any topics, execute the **Session 13: Cross-Reference Protoc
31
31
  - Is the technical architecture validated and feasible?
32
32
  - Are there blocking risks or unresolved dependencies?
33
33
  - What is the confidence level for the proposed timeline and budget? [needs-business-input]
34
+ - Record the assessment in the Notes Template below; the Closing Step copies it into the charter § 17 and its frontmatter as recorded — the charter never re-judges it
34
35
 
35
36
  4. **Open items and parking lot**
36
37
  *Why it matters: unresolved items surfaced here become explicit known-gaps in the handoff, not silent omissions. Skip when: never — always required, even an empty parking lot is worth stating explicitly.*
@@ -64,12 +65,16 @@ Before facilitating any topics, execute the **Session 13: Cross-Reference Protoc
64
65
  | Stakeholder alignment | | |
65
66
  | **Overall Recommendation** | | |
66
67
 
68
+ This table is copied into the charter § 17 as recorded here — the charter never re-judges it. **Status** is `Green`, `Amber` or `Red`; **Overall Recommendation** is `Go`, `Go with conditions` or `No-Go` — `charter-check` compares these literals.
69
+
67
70
  **Open Items Register**
68
71
 
69
72
  | ID | Item | Source Session | Priority (H/M/L) | Must Resolve Before Build? | Owner | Target Date | Status |
70
73
  |----|------|---------------|-------------------|---------------------------|-------|-------------|--------|
71
74
  | OI-01 | | | | | | | |
72
75
 
76
+ **Must Resolve Before Build?** starts with `Yes` or `No` (a reason may follow); **Status** starts with `Open`, `Closed`, `Resolved` or `Parked`. `charter-check` reads these literals: an item that must resolve before build and is not `Closed`/`Resolved` has to stand in the charter § 16 Conditions.
77
+
73
78
  **Cross-Reference Analysis Results**
74
79
 
75
80
  | Metric | Count | Notes |
@@ -115,6 +120,10 @@ Before facilitating any topics, execute the **Session 13: Cross-Reference Protoc
115
120
 
116
121
  ---
117
122
 
123
+ **Closing Step — charter for sign-off.** Run it after Step 7 and before Step 8, every time Session 13 completes, including a redo. Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/charter.md` § **Finish** and follow it: the Go / No-Go table and the Open Items Register are copied into `docs/discovery/PROJECT-CHARTER.md` as recorded, must-resolve items become § 16 conditions, the status becomes `For sign-off`, `pp_run query discovery.charter-check` exits 0, the DOCX and PDF are rendered next to the markdown, and all of it is committed.
124
+
125
+ ---
126
+
118
127
  ## Session 13: Cross-Reference Protocol
119
128
 
120
129
  **Run this protocol (Step 0) before facilitating Session 13 topics.**
@@ -134,7 +143,7 @@ Analyze all prior sessions in three groups. Use Explore agents if available, or
134
143
  | Technical | 5–8 (Architecture, Security, Identity, Integration) | Technology stack consistency, role/RBAC alignment, integration point definitions, API contracts |
135
144
  | Governance & Costs | 9–12 (QA, Infrastructure, Roadmap, Team) | Timeline feasibility, resource allocation, test strategy alignment, sprint capacity |
136
145
 
137
- For each group: read all session files AND `.planning/discovery/_context.md`. Cross-reference factual claims, role names, technology choices, integration points, and requirement IDs. Check for contradictions between sessions.
146
+ For each group: read all session files — their Notes Template sections and the registers they cite. Cross-reference factual claims, role names, technology choices, integration points, and requirement IDs. Check for contradictions between sessions.
138
147
 
139
148
  #### 0b. Issue Severity Categories
140
149
 
@@ -147,9 +156,11 @@ For each group: read all session files AND `.planning/discovery/_context.md`. Cr
147
156
 
148
157
  #### 0c. Cross-Reference Checklist
149
158
 
150
- - [ ] **Roles & RBAC:** Same role names, count, and permissions across all sessions (especially S5 vs S7)
159
+ - [ ] **Roles & RBAC:** Same role names, count, and permissions across all sessions (especially S5 vs S7); `discovery roles-check` exits 0 (every role a persona or step actor, every permission citing an existing entity and requirement, every screen row resolving)
151
160
  - [ ] **Technology stack:** Consistent tools/frameworks referenced (especially S5, S8, S10)
152
- - [ ] **Integration points:** Same systems, directions, and protocols across S5, S8, S10
161
+ - [ ] **Integration points:** Same systems, directions, and protocols across S5, S8, S10; `discovery integrations-check` and `discovery migration-check` exit 0 (every step-matrix `IF-` resolving, every contract and error row naming a known interface, every migration source in the Systems Landscape)
162
+ - [ ] **Deviations:** every Standards Applied `Deviation` that is not `none` is a `DEV-` row of `_deviations.md`; `discovery deviations-check` exits 0 (standard in the vault cache, approver in the Session 1 Approval Matrix, a decision on every approved or rejected row)
163
+ - [ ] **Session outputs:** `discovery session-check --all` exits 0 (every Notes Template section of every completed session present once, with a data row, prose or `None identified in Discovery.`)
153
164
  - [ ] **Requirements traceability:** Every S3 requirement addressable in S5 architecture
154
165
  - [ ] **Requirements roll-up:** `discovery rollup --check` exits 0 (totals block matches table)
155
166
  - [ ] **Pre-fill/confidential gate:** `discovery input-check` exits 0 (no unconfirmed markers, no tracked confidential files)
@@ -193,7 +204,7 @@ Ask the user how to proceed (AskUserQuestion or text-mode numbered list):
193
204
  3. Review each finding one by one
194
205
  4. Skip cross-reference (not recommended)
195
206
 
196
- Apply fixes using Edit tool across affected session files. Update `.planning/discovery/_context.md` if key facts change.
207
+ Apply fixes using Edit tool across affected session files and registers — the original line, per the back-amend rule (Flow 2 Step 6).
197
208
 
198
209
  #### 0f. Record Cross-Reference Results
199
210
 
@@ -202,4 +213,8 @@ Capture in `.planning/discovery/session-13.md` notes:
202
213
  - List of all fixes applied (file, what changed, why)
203
214
  - Any findings deferred or noted but not fixed
204
215
 
216
+ #### 0.5. Draft the Project Charter
217
+
218
+ Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/charter.md` § **Draft** and follow it: the charter is written to `docs/discovery/PROJECT-CHARTER.md` from `templates/project-charter.md`, in the sprint language, every section from its source map, `status: Draft`, and `pp_run query discovery.charter-check` exits 0 before you go on. Topics 2 and 3 review and score that document, not a summary of the sessions.
219
+
205
220
  Then proceed to Step 5 (Facilitate Session 13 topics).
@@ -1,7 +1,7 @@
1
1
  <purpose>
2
2
  Facilitate the 13-session Pareto Discovery Sprint. Guide each session topic-by-topic,
3
3
  capture outputs into structured notes templates, and write all artifacts to
4
- .planning/discovery/ (session-01.md … session-13.md, _progress.md, _context.md).
4
+ .planning/discovery/ (session-01.md … session-13.md, _progress.md and the registers).
5
5
  </purpose>
6
6
 
7
7
  <required_reading>
@@ -46,6 +46,7 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
46
46
  - Else if `FIRST_TOKEN` is `gap` → Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/gap-analysis.md` and follow it. Stop. The numeric token is a document accession number, not a session number — the 1–13 range check and `SESSION_INVALID` do not apply here (the subfile re-derives the accession from `$ARGUMENTS` in its Step 0).
47
47
  - Else if `FIRST_TOKEN` is `rebaseline` → Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/rebaseline.md` and follow it. Stop. The numeric token is a document accession number, not a session number — the 1–13 range check and `SESSION_INVALID` do not apply here (the subfile re-derives the accession from `$ARGUMENTS` in its Step 0).
48
48
  - Else if `FIRST_TOKEN` is `prototype` → Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/prototype.md` and follow it. Stop. It builds the clickable prototype from Sessions 1–4 and can be run at any moment, also after a No at the end of Session 4.
49
+ - Else if `FIRST_TOKEN` is `charter` → Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/charter.md` § Redraft and follow it. Stop. It records signatures on, or redrafts and re-exports, `docs/discovery/PROJECT-CHARTER.md`; the first draft is Session 13's Step 0.5.
49
50
  - Else if `--prefill` is in `$ARGUMENTS` → requires a session number: if `SESSION_ARG` is empty, say so politely and stop; else Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/prefill.md` and follow it. Stop.
50
51
  - Else if `SESSION_INVALID` is non-empty → show a usage error: "Session `$SESSION_INVALID` is out
51
52
  of range — valid sessions are 1–13." Do not run any session or the progress view.
@@ -77,7 +78,6 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
77
78
  **Artifact paths:**
78
79
  - Session files: `.planning/discovery/session-01.md` … `.planning/discovery/session-13.md`
79
80
  - Progress tracker: `.planning/discovery/_progress.md`
80
- - Context file: `.planning/discovery/_context.md`
81
81
  - Research track: `.planning/discovery/_research.md` (backlog), `.planning/discovery/_risks.md` (data-gathering), `.planning/discovery/_sparring.md` (positions)
82
82
  - Scope re-baseline matrix: `.planning/discovery/_rebaseline.md`
83
83
  - Prototype: `.planning/discovery/prototype/` (built by `/pp-discovery prototype`)
@@ -112,7 +112,7 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
112
112
  > "Confirm Session N — [Name] (pre-filled). Run `/pp-discovery N` to walk its `[TO CONFIRM]` markers."
113
113
  - Otherwise, find the first "Not Started" session whose dependencies are all "Completed":
114
114
  > "Next recommended session: Session N — [Name]. Run `/pp-discovery N` to start."
115
- - If every session is "Completed", say the Discovery Sprint is complete and point to Session 13's wrap-up output.
115
+ - If every session is "Completed", say the Discovery Sprint is complete and report the Project Charter: read the frontmatter of `docs/discovery/PROJECT-CHARTER.md` and state its `version`, `status` and `go_no_go` (`/pp-discovery charter` records signatures; `/pp-discovery-to-build` needs `Signed` or `Signed with conditions`). If the file does not exist, say so and point to `/pp-discovery 13` — its Step 0.5 drafts it.
116
116
 
117
117
  ---
118
118
 
@@ -127,9 +127,8 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
127
127
  1. Determine the session file path: `.planning/discovery/session-NN.md` (zero-padded, e.g. `session-03.md`).
128
128
  2. If the file does not exist, create it using the session template from the session content file.
129
129
  3. Read `.planning/discovery/_progress.md` (create if absent — use the **Bootstrap Templates** section near the end of this workflow for the literal schema).
130
- 4. Read `.planning/discovery/_context.md` (create if absent — use the **Bootstrap Templates** section near the end of this workflow for the literal schema).
131
- 5. Read `.planning/discovery/_risks.md` and `.planning/discovery/_sparring.md` when they exist — they are created on first need (see the research-track reference named in **Bootstrap Templates**). Surface as opening context every `DG-`/`SP-` item whose `Feeds:` names this session (D-40).
132
- 6. If the session content file carries a **Precondition**, run it now. When it stops, stop the session here — do not mark it In Progress.
130
+ 4. Read `.planning/discovery/_risks.md` and `.planning/discovery/_sparring.md` when they exist — they are created on first need (see the research-track reference named in **Bootstrap Templates**). Surface as opening context every `DG-`/`SP-` item whose `Feeds:` names this session (D-40).
131
+ 5. If the session content file carries a **Precondition**, run it now. When it stops, stop the session here — do not mark it In Progress.
133
132
 
134
133
  ### Step 2: Check Dependencies
135
134
 
@@ -189,9 +188,9 @@ Ask: "Any positions taken that aren't decisions yet?" → append or update an `S
189
188
 
190
189
  ### Step 7: Complete the Session
191
190
 
192
- 1. Update `.planning/discovery/session-NN.md` frontmatter: `status: "Completed"`, `completed_date: "[YYYY-MM-DD]"`, `completeness_score: [N]`. Compute `N = round(100 × topics_covered ÷ total_topics)` for this session — only use 100 when every topic was covered. If topics were skipped (see Edge Cases) **or parked** (Step 5.3), the score reflects the proportion actually completed — a session with parked items must read honestly below 100%. Topics whose captured answers still carry `[TO CONFIRM]` count as **not covered**, exactly like parked topics — a pre-filled session must read honestly below 100 until its markers are confirmed (D-18/D-19). A section carrying `⚠️ CONDITIONAL — <RS-nn|DG-nn>` counts as **covered** — the decision was made in the room and is knowingly contingent on outside work, the deliberate opposite of `[TO CONFIRM]` (D-47). Record the cited IDs in frontmatter as `conditional: [RS-03, DG-07]`, set the session's `Conditional` count in `_progress.md` and its `Conditional sections (open):` total (D-48).
191
+ 1. Update `.planning/discovery/session-NN.md` frontmatter: `status: "Completed"`, `completed_date: "[YYYY-MM-DD]"`, `completeness_score: [N]`. Compute `N = round(100 × topics_covered ÷ total_topics)` for this session — only use 100 when every topic was covered. A topic whose Notes Template section `pp_run query discovery.session-check <N>` (item 3) reports `empty_section` counts as **not covered**, however long it was discussed — the output is the measure, not the conversation (`references/discovery-session-output.md`). If topics were skipped (see Edge Cases) **or parked** (Step 5.3), the score reflects the proportion actually completed — a session with parked items must read honestly below 100%. Topics whose captured answers still carry `[TO CONFIRM]` count as **not covered**, exactly like parked topics — a pre-filled session must read honestly below 100 until its markers are confirmed (D-18/D-19). A section carrying `⚠️ CONDITIONAL — <RS-nn|DG-nn>` counts as **covered** — the decision was made in the room and is knowingly contingent on outside work, the deliberate opposite of `[TO CONFIRM]` (D-47). Record the cited IDs in frontmatter as `conditional: [RS-03, DG-07]`, set the session's `Conditional` count in `_progress.md` and its `Conditional sections (open):` total (D-48).
193
192
  2. Update `.planning/discovery/_progress.md`: set row to Completed with date and score.
194
- 3. Update `.planning/discovery/_context.md`: populate the session's output section with concise summaries.
193
+ 3. Run `pp_run query discovery.session-check <N>`. Exit 0 → continue. Non-zero → a Notes Template section is missing, repeated, off its template columns or still empty: fill it from what the room said, or write `None identified in Discovery.` on one line under its title when the session found nothing — never leave a template row blank and never record the answer in a second file. Re-run until 0, then set the score as item 1 says. Read `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-session-output.md` for the contract.
195
194
  4. If the session content file carries a **Closing Step**, run it now, before Step 8.
196
195
  5. If `_feedback.md` exists, run `pp_run query discovery.screen-check --require-processed`. Non-zero: process the `Open` rows as `prototype.md` Step 7 describes before the session counts as closed.
197
196
  6. If `session-NN.md` carries a `## Vault Context` section, run `pp_run query discovery.vault-check <N>`. Non-zero: cite each named document `[vault: <path>]` beside the answer it informed, or append `— not used: <reason>` to its record line; for `cross_cutting_missing`, add the named document's record line, read it against this session's decisions, and cite or mark it the same way. Then re-run.
@@ -223,7 +222,7 @@ Each session's Goal, "What We Cover" topics and Notes Template live in their own
223
222
 
224
223
  ## Context-Awareness Rules
225
224
 
226
- When facilitating sessions, reference prior session outputs from `.planning/discovery/_context.md`:
225
+ When facilitating sessions, reference prior session outputs from the earlier session files' Notes Template sections and from the registers they point at (`_requirements.md`, `_entities.md`, `_processes.md`, `_roles.md`, `_integrations.md`, `_deviations.md`) — never from a summary written at session close; the session tables are the single source:
227
226
 
228
227
  | Current Session | Reference From |
229
228
  |----------------|----------------|
@@ -247,7 +246,7 @@ When facilitating sessions, reference prior session outputs from `.planning/disc
247
246
  ## Edge Cases
248
247
 
249
248
  - **Session file not found:** Create it from the session template content above.
250
- - **All sessions completed:** Congratulate the user and suggest reviewing `_context.md` for a full summary.
249
+ - **All sessions completed:** Congratulate the user and point at the Project Charter Session 13 drafted and at `/pp-discovery-to-build`.
251
250
  - **User wants to skip a topic:** Allow it. Note the topic was skipped and continue.
252
251
  - **User provides very brief answers:** Ask at least one follow-up question before accepting.
253
252
  - **Session 3:** ALWAYS use the Process-First Protocol (Steps 5A–5G) — never use the generic topic loop.
@@ -258,7 +257,7 @@ When facilitating sessions, reference prior session outputs from `.planning/disc
258
257
 
259
258
  ## Bootstrap Templates
260
259
 
261
- `/pp-discovery` is self-sufficient — it does not depend on any other skill or command having run first. When `.planning/discovery/_progress.md` or `.planning/discovery/_context.md` is absent (first-ever session on this project — see Flow 2 Step 1), create it verbatim from its schema: the `_progress.md` schema is below, and the `_context.md` schema is one lazy Read away under `workflows/discovery-sprint/templates/`. Both paths are fixed under `.planning/discovery/` (T-04-03) — never write to a root-level directory, an absolute path, or a path containing `..`.
260
+ `/pp-discovery` is self-sufficient — it does not depend on any other skill or command having run first. When `.planning/discovery/_progress.md` is absent (first-ever session on this project — see Flow 2 Step 1), create it verbatim from the schema below. The path is fixed under `.planning/discovery/` (T-04-03) — never write to a root-level directory, an absolute path, or a path containing `..`.
262
261
 
263
262
  **`.planning/discovery/_progress.md`** (Parked-aware schema — D-11):
264
263
 
@@ -313,16 +312,14 @@ When facilitating sessions, reference prior session outputs from `.planning/disc
313
312
 
314
313
  The Status column takes one of four values: Not Started / Pre-Filled / In Progress / Completed — "Pre-Filled" marks a session populated from source documents but not yet confirmed live. The `Parked` column tracks how many topics in that session were marked `PARKED — needs business/senior input` instead of being answered — increment it whenever a topic is parked, and add a matching row to the `Open Action Items` table (owner: `business/senior`). Decrement that session's `completeness_score` in Step 7 to reflect the parked topic as not-covered. Keep `Parked questions (open):` in the Summary block equal to the sum of the `Parked` column across all sessions, minus any parked items subsequently resolved. The `Conditional` column tracks how many sections in that session carry a `⚠️ CONDITIONAL — <RS-nn|DG-nn>` marker. Unlike a parked topic, a conditional section does **not** decrement that session's `completeness_score` — it counts as covered (D-47). Keep `Conditional sections (open):` equal to that column's sum across all sessions.
315
314
 
316
- **`.planning/discovery/_context.md`:** Read `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/templates/context-template.md` lazily and create the file verbatim from the schema it carries. The path is fixed under `.planning/discovery/` (T-04-03) — never a root-level directory, never an absolute path, never a path containing `..`.
317
-
318
- **Research track (`_research.md` / `_risks.md` / `_sparring.md`):** these three registers are created on first need exactly like `_progress.md` and `_context.md` — no sub-command bootstraps them (D-31). Read `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-research-track.md` lazily for their three schemas, the `⚠️ CONDITIONAL —` marker grammar and the `research-check` parser contract; never `@`-import it, as with `discovery-id-conventions.md` (D-30).
315
+ **Research track (`_research.md` / `_risks.md` / `_sparring.md`):** these three registers are created on first need exactly like `_progress.md` — no sub-command bootstraps them (D-31). Read `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-research-track.md` lazily for their three schemas, the `⚠️ CONDITIONAL —` marker grammar and the `research-check` parser contract; never `@`-import it, as with `discovery-id-conventions.md` (D-30).
319
316
 
320
317
  </process>
321
318
 
322
319
  <success_criteria>
323
320
  - All 13 sessions are facilitated as substantive guided steps with Goal, guiding questions, and notes templates, each held in its `sessions/` content file.
324
321
  - The Session 3 process-first protocol and Session 13 cross-reference protocol are present as text procedures in `sessions/03-to-be.md` and `sessions/13-wrap-up.md`.
325
- - All artifact writes resolve to `.planning/discovery/session-NN.md`, `.planning/discovery/_progress.md`, `.planning/discovery/_context.md`, `.planning/discovery/_research.md`, `.planning/discovery/_risks.md`, `.planning/discovery/_sparring.md`, the `.planning/discovery-input/` package family (incl. `00-README.md` and `confidential/.gitignore`), `.planning/discovery/gap-<accession>.md` gap reports, or the `.planning/discovery/prototype/` tree.
322
+ - All artifact writes resolve to `.planning/discovery/session-NN.md`, `.planning/discovery/_progress.md`, `.planning/discovery/_research.md`, `.planning/discovery/_risks.md`, `.planning/discovery/_sparring.md`, the `.planning/discovery-input/` package family (incl. `00-README.md` and `confidential/.gitignore`), `.planning/discovery/gap-<accession>.md` gap reports, or the `.planning/discovery/prototype/` tree.
326
323
  - No writes target a root-level capital-D Discovery directory, an absolute path, or a `..` path.
327
324
  - Text-mode fallback is documented for all AskUserQuestion steps.
328
325
  </success_criteria>
@@ -15,13 +15,16 @@
15
15
 
16
16
  ## What this step produces
17
17
 
18
- Two deliverables, both written under the client project's `docs/` tree —
18
+ Three deliverables, all written under the client project's `docs/` tree —
19
19
  **never** under `.planning/`, which stays process-state only:
20
20
 
21
21
  1. `docs/architecture/architecture.md` — one arc42-lite document with four
22
22
  sections: Introduction & Goals, Context, Containers, Data Model.
23
23
  2. `docs/architecture/adr/NNNN-title.md` — one file per row of Session 5's
24
24
  Architecture Decision Records table.
25
+ 3. `docs/processes/MP-nn.md` — one file per main process of
26
+ `.planning/discovery/_processes.md`: its swimlane and its step matrix,
27
+ verbatim (Discovery Sprint improvement plan, Batch 2).
25
28
 
26
29
  ## Source of truth
27
30
 
@@ -31,12 +34,18 @@ captured elsewhere in the synthesis:
31
34
 
32
35
  - **Introduction & Goals** — `.planning/PROJECT.md`'s core problem statement
33
36
  (from Session 1) plus Session 5's stated architecture goals/constraints.
34
- - **Context (C4Context)** — Session 5's Integration Points Map plus Session 8
35
- (external systems, direction, protocol) for `System_Ext`/`Rel` actors.
37
+ - **Context (C4Context)** — `.planning/discovery/_integrations.md` § Interfaces
38
+ (one `System_Ext` per `IF-` row, `Rel` carrying `Direction` and `Protocol` —
39
+ `references/discovery-integrations.md`); an engagement without that file falls
40
+ back to Session 5's Integration Points Map plus Session 8's Integration Design
41
+ Register.
36
42
  - **Containers (C4Container)** — Session 5's Component Inventory and
37
43
  Technology Stack table for `Container`/`ContainerDb` nodes.
38
- - **Data Model (erDiagram)** — Session 5's Domain Model / Entity Register
39
- table (D-16: entity, key attributes, relationships, owner module).
44
+ - **Data Model (erDiagram)** — `.planning/discovery/_entities.md` (entities
45
+ with attributes, relationships with cardinality, lifecycles —
46
+ `references/discovery-data-model.md`); an engagement without that file
47
+ falls back to Session 5's Domain Model / Entity Register table (D-16).
48
+ - **Processes** — `.planning/discovery/_processes.md` § Flows and § Steps.
40
49
  - **ADRs** — Session 5's Architecture Decision Records table
41
50
  (`ADR ID | Title | Context | Decision | Consequences | Status`).
42
51
 
@@ -47,15 +56,19 @@ Never invent facts that are not present in the session content. If a Session
47
56
  ## Path safety (extends T-04-03)
48
57
 
49
58
  The same discipline `discovery-sprint.md` already applies to
50
- `.planning/discovery/` writes applies here to `docs/architecture/` writes:
59
+ `.planning/discovery/` writes applies here to `docs/architecture/` and
60
+ `docs/processes/` writes:
51
61
 
52
- - All write targets MUST be relative paths under `docs/architecture/`
53
- (`docs/architecture/architecture.md`, `docs/architecture/adr/NNNN-title.md`).
62
+ - All write targets MUST be relative paths under `docs/architecture/` or
63
+ `docs/processes/` (`docs/architecture/architecture.md`,
64
+ `docs/architecture/adr/NNNN-title.md`, `docs/processes/MP-nn.md`).
54
65
  - Never write to an absolute path.
55
66
  - Never write to a path containing `..`.
56
- - The only read target for this step is `.planning/discovery/session-05.md`
67
+ - The only read targets for this step are `.planning/discovery/session-05.md`,
68
+ `.planning/discovery/_entities.md`, `.planning/discovery/_processes.md` and
69
+ `.planning/discovery/_integrations.md`
57
70
  (plus the already-loaded synthesis context) — never read or write outside
58
- `docs/architecture/` and `.planning/discovery/`.
71
+ `docs/architecture/`, `docs/processes/` and `.planning/discovery/`.
59
72
 
60
73
  ## Idempotent overwrite handling
61
74
 
@@ -96,12 +109,13 @@ that were not stated during Discovery.
96
109
  ### Section 2: Context
97
110
 
98
111
  One paragraph of prose describing the system's boundary and the actors that
99
- interact with it, followed by a Mermaid `C4Context` block built from Session
100
- 5's Integration Points Map and Session 8's Integrations table. Map each
101
- external system in Session 8 to a `System_Ext` node, the product itself to a
102
- `System` node, and each user-facing actor from Session 5/Session 1 to a
103
- `Person` node. Connect them with `Rel` lines carrying the protocol from
104
- Session 8's table where known.
112
+ interact with it, followed by a Mermaid `C4Context` block built from
113
+ `.planning/discovery/_integrations.md` § Interfaces (falling back to Session 5's
114
+ Integration Points Map and Session 8's Integration Design Register when the
115
+ register does not exist). Map each `IF-` row to a `System_Ext` node, the product
116
+ itself to a `System` node, and each user-facing actor from Session 5/Session 1 to
117
+ a `Person` node. Connect them with `Rel` lines carrying the row's `Protocol`
118
+ where known, pointing in its `Direction`.
105
119
 
106
120
  Example shape (fill every placeholder from actual captured facts — never
107
121
  leave a literal `[System Name]` placeholder in the generated output):
@@ -138,16 +152,33 @@ C4Container
138
152
  ### Section 4: Data Model
139
153
 
140
154
  One paragraph of prose summarizing the domain model, followed by a Mermaid
141
- `erDiagram` block built directly from Session 5's Domain Model / Entity
142
- Register table (D-16). Emit one entity per register row and one relationship
143
- line per captured relationship; use the register's stated cardinality where
144
- given, otherwise default to the most conservative reading (`||--o{`) and
145
- note the assumption in prose.
155
+ `erDiagram` block built directly from `.planning/discovery/_entities.md`:
156
+ one entity block per `## Entities` row, holding its `## Attributes` rows as
157
+ `type name` lines (a `PK` comment on the identifier), and one relationship
158
+ line per `## Relationships` row with the **cardinality copied verbatim**
159
+ (unescape the table's `\|` to `|`). **There is no default cardinality.** A
160
+ relationship the artifact does not state is not drawn; `entity-check` has
161
+ already refused a malformed one, so every line here is one Discovery
162
+ recorded.
163
+
164
+ When `_entities.md` does not exist (an engagement that predates it), build the
165
+ block from Session 5's Domain Model / Entity Register table (D-16) under the
166
+ same rule: a relationship whose cardinality the register does not state is
167
+ listed in prose as `[not captured in Discovery]`, never drawn with a guessed
168
+ cardinality.
146
169
 
147
170
  Example shape (fill every placeholder from actual captured facts):
148
171
 
149
172
  ```mermaid
150
173
  erDiagram
174
+ ORDER {
175
+ guid id PK
176
+ string reference
177
+ }
178
+ LINE_ITEM {
179
+ guid id PK
180
+ int quantity
181
+ }
151
182
  ORDER ||--|{ LINE_ITEM : contains
152
183
  CUSTOMER ||--o{ ORDER : places
153
184
  ```
@@ -222,19 +253,38 @@ captured), skip `docs/architecture/adr/` entirely rather than generating
222
253
  empty placeholder files, and note the gap in `architecture.md`'s
223
254
  Introduction & Goals section.
224
255
 
256
+ ## Generating `docs/processes/MP-nn.md`
257
+
258
+ One file per `## To-be` row of `.planning/discovery/_processes.md`, named by
259
+ its ID (`docs/processes/MP-01.md`), holding in this order: a `# MP-nn — <Main
260
+ process>` title; one line naming the as-is processes it replaces (`Replaces:
261
+ PRC-02, PRC-03` or `Replaces: new`), the trigger, the end state and the
262
+ primary actor from the To-be row; the swimlane `mermaid` block from § Flows,
263
+ verbatim; the step matrix from § Steps, verbatim, with its `Exception` and
264
+ `Requirements` columns. Nothing is summarised or re-drawn: the file is the
265
+ artifact's rows, exported where the client can read them. Skip the whole
266
+ section when `_processes.md` does not exist; a main process without a flow or
267
+ a matrix has already failed `process-check` at the handoff gate.
268
+
269
+ Idempotency: a `docs/processes/MP-nn.md` that already exists is overwritten
270
+ only after the same confirmation the architecture document asks for above —
271
+ the file is a rendering of the artifact, so the artifact is the thing to edit.
272
+
225
273
  ## Completing the step
226
274
 
227
- 1. Create `docs/architecture/` and `docs/architecture/adr/` directories as
228
- needed (they do not exist in a fresh client project).
275
+ 1. Create `docs/architecture/`, `docs/architecture/adr/` and
276
+ `docs/processes/` directories as needed (they do not exist in a fresh
277
+ client project).
229
278
  2. Write `docs/architecture/architecture.md` per the section instructions
230
279
  above, applying the idempotent replace-or-append rule.
231
280
  3. Write one `docs/architecture/adr/NNNN-title.md` per Session 5 ADR row,
232
- skipping any that already exist (idempotent).
281
+ skipping any that already exist (idempotent), and one
282
+ `docs/processes/MP-nn.md` per main process.
233
283
  4. Commit the generated files. This step is the SOLE committer of
234
- `docs/architecture/` — `discovery-to-build.md` Step 5h does not commit
235
- these files itself, so this block inlines the canonical `pp_run`
236
- resolver unconditionally, exactly as every other workflow file does.
237
- The resolver is idempotent, so redefining `pp_run` when a caller has
284
+ `docs/architecture/` and `docs/processes/` — `discovery-to-build.md` Step
285
+ 5h does not commit these files itself, so this block inlines the canonical
286
+ `pp_run` resolver unconditionally, exactly as every other workflow file
287
+ does. The resolver is idempotent, so redefining `pp_run` when a caller has
238
288
  already defined it is harmless:
239
289
 
240
290
  ```bash
@@ -243,7 +293,8 @@ _PP_SHIM_NAME="pp-tools.cjs"; _pp_root() { ( for _v in $(env | sed -n 's/^\(GIT_
243
293
  [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
244
294
  FILES="docs/architecture/architecture.md"
245
295
  ls docs/architecture/adr/*.md >/dev/null 2>&1 && FILES="$FILES docs/architecture/adr/*.md"
246
- pp_run commit "docs: generate architect-grade handoff (arc42-lite architecture + ADRs)" --files $FILES
296
+ ls docs/processes/*.md >/dev/null 2>&1 && FILES="$FILES docs/processes/*.md"
297
+ pp_run commit "docs: generate architect-grade handoff (arc42-lite architecture, ADRs, processes)" --files $FILES
247
298
  ```
248
299
 
249
300
  5. Return control to `discovery-to-build.md`'s Step 5h caller — this step
@@ -3,11 +3,13 @@
3
3
  > **Lazily-loaded.** Read this file from `pp-core/workflows/discovery-to-build.md` at the start of
4
4
  > Step 2, before the completion check. It is not `@`-imported. Run the gates in order; a stop in any
5
5
  > of them ends the handoff. They are the only hard blocks in the workflow — every other check in
6
- > Step 2 is a confirmation prompt.
6
+ > Step 2 is a confirmation prompt. Four gates: the screen-inventory contract, the element sweep,
7
+ > the artifact gates (data model, processes, rules, stories, phase plan, roles, integrations,
8
+ > migration, deviations) and the signed charter.
7
9
 
8
10
  **Screen-inventory contract gate (D-53)**
9
11
 
10
- This is the one gate in this workflow that hard-blocks; every other check in Step 2 is a
12
+ This gate hard-blocks; every other check in Step 2 is a
11
13
  confirmation prompt, deliberately. A percentage-based visual gate over a curated list cannot
12
14
  detect an omission — a surface dropped from the list is dropped from the denominator too — and
13
15
  this handoff is the last moment such an omission is still free to fix.
@@ -62,9 +64,115 @@ receives screens with fields, columns and actions that no requirement or decisio
62
64
 
63
65
  The check ran in the first fence above.
64
66
 
65
- **If `SWEEP_STATUS` is 0:** The gates pass. Return to Step 2 of `discovery-to-build.md`.
67
+ **If `SWEEP_STATUS` is 0:** Continue with the artifact gates below.
68
+
69
+ **Artifact gates (data model, processes, rules, stories, phase plan, roles, integrations, migration, deviations)**
70
+
71
+ The build's planner reads `_entities.md`, `_processes.md`, `_rules.md`, `_stories.md`, `_roles.md`,
72
+ `_integrations.md` and `_migration.md` by requirement ID, Step 5f copies `_phases.md` into ROADMAP.md
73
+ verbatim, and `pp-vault-review` reads `_deviations.md` for the deviations on file. A pending `—` cell,
74
+ an uncited step, interface or migration row, an MVP requirement with no story or no phase, or a
75
+ hard-to-reverse deviation nobody has approved at this point is a fact the build would have to invent,
76
+ so the same checks that only report at Sessions 8, 11 and 13 hard-block here with their strict flags.
77
+
78
+ ```bash
79
+ pp_run query discovery.entity-check --require-complete
80
+ ENTITY_STATUS=$?
81
+ echo "ENTITY_STATUS=$ENTITY_STATUS"
82
+ pp_run query discovery.process-check --require-cited
83
+ PROCESS_STATUS=$?
84
+ echo "PROCESS_STATUS=$PROCESS_STATUS"
85
+ pp_run query discovery.rules-check
86
+ RULES_STATUS=$?
87
+ echo "RULES_STATUS=$RULES_STATUS"
88
+ pp_run query discovery.stories-check
89
+ STORIES_STATUS=$?
90
+ echo "STORIES_STATUS=$STORIES_STATUS"
91
+ pp_run query discovery.phases-check
92
+ PHASES_STATUS=$?
93
+ echo "PHASES_STATUS=$PHASES_STATUS"
94
+ pp_run query discovery.roles-check
95
+ ROLES_STATUS=$?
96
+ echo "ROLES_STATUS=$ROLES_STATUS"
97
+ pp_run query discovery.integrations-check --require-cited
98
+ INTEGRATIONS_STATUS=$?
99
+ echo "INTEGRATIONS_STATUS=$INTEGRATIONS_STATUS"
100
+ pp_run query discovery.migration-check --require-cited
101
+ MIGRATION_STATUS=$?
102
+ echo "MIGRATION_STATUS=$MIGRATION_STATUS"
103
+ pp_run query discovery.deviations-check --require-approved
104
+ DEVIATIONS_STATUS=$?
105
+ echo "DEVIATIONS_STATUS=$DEVIATIONS_STATUS"
106
+ pp_run query discovery.session-check --all
107
+ SESSION_STATUS=$?
108
+ echo "SESSION_STATUS=$SESSION_STATUS"
109
+ ```
110
+
111
+ **If all ten are 0:** Continue with the charter gate below. An artifact that does not exist exits
112
+ 0 by itself (an engagement that predates it), so every pre-existing engagement is unaffected.
113
+
114
+ **If any is non-zero:** Stop with no option to proceed. Report the fault list the check printed,
115
+ verbatim — `incomplete_cell` and `attributes_missing` mean Session 5 or 6 did not finish the data
116
+ model; `uncited_step` means Step 5D did not back-fill a step; `mvp_requirement_without_story` means
117
+ Step 5E skipped a requirement; `mvp_requirement_unplanned` means Session 11's Closing Step left a
118
+ requirement out of the Phase Plan; `uncited_interface`, `step_integration_unlinked` and
119
+ `uncited_migration` mean Session 8 did not finish `_integrations.md` or `_migration.md`;
120
+ `hard_deviation_unapproved` means a hard-to-reverse deviation still waits for its architect — get the
121
+ signature and set the row `Approved` with its decision, or set it `Rejected` and rework;
122
+ `empty_section` and `missing_section` mean a session closed without its Notes Template output — fill
123
+ the named section in that session file, or write `None identified in Discovery.` under its title
124
+ (`references/discovery-session-output.md`); anything else
125
+ is a malformed artifact (vocabularies in `references/discovery-data-model.md`,
126
+ `references/discovery-processes.md`, `references/discovery-build-consumption.md`,
127
+ `references/discovery-access.md`, `references/discovery-integrations.md` and
128
+ `references/discovery-standards.md`). Fix the artifact, re-run its check, then re-run
129
+ `/pp-discovery-to-build`. Neither `--skip-validation` nor `--unsigned` covers these gates.
66
130
 
67
131
  **If `SWEEP_STATUS` is non-zero:** Stop with no option to proceed. Report the fault list the check
68
132
  printed, verbatim, and tell the user to finish the sweep with `/pp-discovery prototype` Step 8, then
69
133
  re-run `/pp-discovery-to-build`. `--skip-validation` does not cover this gate. Without a prototype
70
134
  the check exits 0 by itself.
135
+
136
+ **Signed-charter gate**
137
+
138
+ The Project Charter (`docs/discovery/PROJECT-CHARTER.md`) is what the sponsor signed. A build that
139
+ starts on a `Draft`, a `For sign-off` or a `Rejected` charter builds something nobody agreed to, so
140
+ the handoff requires `Signed` or `Signed with conditions`. Two checks, run separately so a malformed
141
+ charter and an unsigned one are told apart: the structural check never yields to a flag; the signature
142
+ requirement yields to `--unsigned`, which records the gap instead of waiting.
143
+
144
+ ```bash
145
+ if [ -f docs/discovery/PROJECT-CHARTER.md ]; then
146
+ pp_run query discovery.charter-check
147
+ CHARTER_STRUCT=$?
148
+ pp_run query discovery.charter-check --require-signed >/dev/null 2>&1
149
+ CHARTER_SIGNED=$?
150
+ CHARTER_STATE=$(sed -n 's/^status: *//p' docs/discovery/PROJECT-CHARTER.md | head -1)
151
+ else
152
+ CHARTER_STRUCT=absent
153
+ CHARTER_SIGNED=absent
154
+ CHARTER_STATE=none
155
+ fi
156
+ echo "CHARTER_STRUCT=$CHARTER_STRUCT"
157
+ echo "CHARTER_SIGNED=$CHARTER_SIGNED"
158
+ echo "CHARTER_STATE=$CHARTER_STATE"
159
+ ```
160
+
161
+ **If `CHARTER_STRUCT` is 0 and `CHARTER_SIGNED` is 0:** The gates pass. Return to Step 2 of
162
+ `discovery-to-build.md`.
163
+
164
+ **If `CHARTER_STRUCT` is a non-zero number:** Stop with no option to proceed. Report the fault list the
165
+ check printed, verbatim: the charter has structural faults (a section missing, an ID nothing minted, a
166
+ Go / No-Go table that differs from Session 13's, a must-resolve item not listed as a condition — the
167
+ vocabulary is `references/discovery-charter.md`). Neither `--skip-validation` nor `--unsigned` covers
168
+ this arm: a malformed charter is not an unsigned one. Fix it with `/pp-discovery charter`, then re-run.
169
+
170
+ **If `CHARTER_STRUCT` is 0 and `CHARTER_SIGNED` is non-zero, or both are `absent`:**
171
+
172
+ - **Without `--unsigned`:** Stop with no option to proceed. Say which it is — `status: {CHARTER_STATE}`
173
+ or no charter at all — and that `/pp-discovery charter` records the signatures (`/pp-discovery 13`
174
+ drafts the charter when none exists). Re-run `/pp-discovery-to-build` once the status reads `Signed`
175
+ or `Signed with conditions`.
176
+ - **With `--unsigned`:** Continue, and carry `CHARTER_STATE` forward: Step 5d adds the Key Decisions
177
+ row that records the build started on an unsigned charter, Step 5g lists it under Blockers/Concerns,
178
+ and Step 8 prints it. The flag records a gap; it does not make the charter signed.
@@ -15,13 +15,15 @@ Discovery outputs are the source of truth for business decisions and requirement
15
15
 
16
16
  | Topic | File | Use When |
17
17
  |-------|------|----------|
18
- | All decisions (accumulated) | `.planning/discovery/_context.md` | Understanding why a decision was made |
18
+ | All decisions | the **Key Decisions** table of each `.planning/discovery/session-NN.md` (`D-<ss>-<n>`) | Understanding why a decision was made |
19
19
  | pp-core handoff synthesis | `.planning/discovery/_pp-handoff.md` | Complete structured summary of all sessions |
20
20
  | Business requirements | `.planning/discovery/session-03.md` | Detailed EPICs, user stories, acceptance criteria |
21
21
  | Architecture decisions | `.planning/discovery/session-05.md` | Tech stack rationale, ADRs, component design |
22
22
  | Security requirements | `.planning/discovery/session-06.md` | Compliance, encryption, audit requirements |
23
- | Role definitions | `.planning/discovery/session-07.md` | RBAC model, permissions, identity provider |
24
- | Integration specs | `.planning/discovery/session-08.md` | External system interfaces, protocols, data flows |
23
+ | Role definitions | `.planning/discovery/_roles.md` | Roles, permissions per entity, screens per role (Session 7 holds the identity provider) |
24
+ | Integration specs | `.planning/discovery/_integrations.md` | Interfaces, contracts, error handling (Session 8 holds the sync approach) |
25
+ | Migration | `.planning/discovery/_migration.md` | Source systems, entities moved, cut-over, reconciliation |
26
+ | Deviations from standards | `.planning/discovery/_deviations.md` | Every agreed departure from a vault standard, with approver and status |
25
27
  | QA strategy | `.planning/discovery/session-09.md` | Test types, coverage targets, quality gates |
26
28
  | Release plan | `.planning/discovery/session-11.md` | Sprint plan, milestones, build order |
27
29
  | Interactive prototype | `.planning/discovery/prototype/` | Visual reference for UI implementation |
@@ -30,7 +32,7 @@ Discovery outputs are the source of truth for business decisions and requirement
30
32
 
31
33
  - **During discuss phases:** Reference specific sessions when answering gray-area questions
32
34
  - **During research:** Check Discovery sessions before external research — many answers are already there
33
- - **During planning:** Use requirement IDs from Discovery (FR-xxx, US-xxx) in plan references
35
+ - **During planning:** Use requirement IDs as Discovery minted them (`<PREFIX>-nn`, `N-nn`, `E-nn`, `US-nn`) in plan references
34
36
  - **During verification:** Trace completed work back to Discovery requirements
35
37
  ```
36
38
 
@@ -42,12 +44,13 @@ Discovery outputs are the source of truth for business decisions and requirement
42
44
  This project has a completed Discovery Sprint in `.planning/discovery/`. pp-core agents should:
43
45
 
44
46
  1. **Check Discovery before asking the user** — most business and architecture decisions are already documented
45
- 2. **Reference `.planning/discovery/_context.md`** for accumulated cross-session decisions
47
+ 2. **Reference the sessions' Key Decisions tables** (`D-<ss>-<n>`) for cross-session decisions — the original line carries any amendment
46
48
  3. **Reference `.planning/discovery/_pp-handoff.md`** for the structured synthesis used to initialize pp-core
47
- 4. **Use original requirement IDs** (FR-xxx, NFR-xxx, US-xxx, EPIC-xxx) from Discovery in plans and commits
48
- 5. **Reference specific session files** when a phase involves topics covered in that session:
49
- - Auth/roles → Session 7 (`.planning/discovery/session-07.md`)
50
- - Integrations → Session 8 (`.planning/discovery/session-08.md`)
49
+ 4. **Cite IDs as Discovery minted them** — `<PREFIX>-nn`/`N-nn`/`T-nn` requirements from `.planning/discovery/_requirements.md`, `E-nn` EPICs and `US-nn` stories from Session 3 (`references/discovery-id-conventions.md`) — in plans and commits; never invent `FR-`/`NFR-`/`EPIC-` IDs
50
+ 5. **Read the registers before the session files** — `_requirements.md` (with acceptance criteria) and `_screens.md` are the canonical artifacts; a session file is the facilitation record behind them. Open a session file only when a phase involves a topic no register covers yet:
51
+ - Auth/roles → `.planning/discovery/_roles.md` (identity provider: Session 7, `.planning/discovery/session-07.md`)
52
+ - Integrations → `.planning/discovery/_integrations.md`; migration → `.planning/discovery/_migration.md` (sync approach: Session 8, `.planning/discovery/session-08.md`)
53
+ - Deviations from the client's standards → `.planning/discovery/_deviations.md`
51
54
  - UI/UX → Session 4 (`.planning/discovery/session-04.md`) + `.planning/discovery/prototype/`
52
55
  - Security → Session 6 (`.planning/discovery/session-06.md`)
53
56
  - Testing → Session 9 (`.planning/discovery/session-09.md`)