@pareto4/pp-core 1.18.0 → 1.20.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 (194) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/pp-code-fixer.md +9 -5
  3. package/agents/pp-code-reviewer.md +1 -0
  4. package/agents/pp-codebase-mapper.md +3 -0
  5. package/agents/pp-debugger.md +3 -2
  6. package/agents/pp-executor.md +16 -7
  7. package/agents/pp-integration-checker.md +1 -0
  8. package/agents/pp-phase-researcher.md +13 -1
  9. package/agents/pp-plan-checker.md +3 -0
  10. package/agents/pp-planner.md +20 -1
  11. package/agents/pp-research-synthesizer.md +1 -1
  12. package/agents/pp-ui-auditor.md +1 -0
  13. package/agents/pp-ui-researcher.md +3 -1
  14. package/agents/pp-vault-reviewer.md +2 -0
  15. package/agents/pp-verifier.md +22 -10
  16. package/commands/pp-add-tests.md +1 -1
  17. package/commands/pp-debug.md +1 -0
  18. package/commands/pp-discovery.md +3 -2
  19. package/commands/pp-init.md +4 -3
  20. package/commands/pp-quick.md +3 -0
  21. package/commands/pp-review-backlog.md +2 -1
  22. package/gemini-extension.json +1 -1
  23. package/package.json +6 -3
  24. package/pareto-skills/_shared/pp-claude-md-protocol.md +1 -1
  25. package/pareto-skills/pp-project-setup/SKILL.md +18 -343
  26. package/pp-core/bin/lib/capability-registry.cjs +3 -3
  27. package/pp-core/bin/lib/check-command-router.cjs +60 -20
  28. package/pp-core/bin/lib/commands.cjs +79 -4
  29. package/pp-core/bin/lib/compose-bindings.cjs +97 -14
  30. package/pp-core/bin/lib/discovery-access.cjs +276 -0
  31. package/pp-core/bin/lib/discovery-charter.cjs +664 -0
  32. package/pp-core/bin/lib/discovery-deviations.cjs +264 -0
  33. package/pp-core/bin/lib/discovery-entities.cjs +323 -0
  34. package/pp-core/bin/lib/discovery-for-phase.cjs +628 -0
  35. package/pp-core/bin/lib/discovery-integrations.cjs +286 -0
  36. package/pp-core/bin/lib/discovery-migration.cjs +246 -0
  37. package/pp-core/bin/lib/discovery-phases.cjs +233 -0
  38. package/pp-core/bin/lib/discovery-processes.cjs +355 -0
  39. package/pp-core/bin/lib/discovery-research-track.cjs +5 -4
  40. package/pp-core/bin/lib/discovery-rollup.cjs +12 -8
  41. package/pp-core/bin/lib/discovery-rules.cjs +216 -0
  42. package/pp-core/bin/lib/discovery-screens.cjs +21 -3
  43. package/pp-core/bin/lib/discovery-session-check.cjs +264 -0
  44. package/pp-core/bin/lib/discovery-stories.cjs +273 -0
  45. package/pp-core/bin/lib/discovery-sweep.cjs +13 -4
  46. package/pp-core/bin/lib/discovery-table.cjs +55 -0
  47. package/pp-core/bin/lib/discovery-vault-check.cjs +37 -3
  48. package/pp-core/bin/lib/init-contract.cjs +48 -7
  49. package/pp-core/bin/lib/io.cjs +22 -0
  50. package/pp-core/bin/lib/vault-coordinates.cjs +1 -1
  51. package/pp-core/bin/lib/vault-index.cjs +18 -5
  52. package/pp-core/bin/lib/vault-standards-review.cjs +50 -2
  53. package/pp-core/bin/lib/vault-update.cjs +4 -0
  54. package/pp-core/bin/lib/vault.cjs +2 -2
  55. package/pp-core/bin/pp-tools.cjs +153 -5
  56. package/pp-core/org-profile.json +1 -1
  57. package/pp-core/references/autonomous-best-effort.md +3 -2
  58. package/pp-core/references/autonomous-lifecycle.md +1 -0
  59. package/pp-core/references/autonomous-smart-discuss.md +5 -1
  60. package/pp-core/references/discovery-access.md +112 -0
  61. package/pp-core/references/discovery-build-consumption.md +256 -0
  62. package/pp-core/references/discovery-charter.md +127 -0
  63. package/pp-core/references/discovery-data-model.md +145 -0
  64. package/pp-core/references/discovery-id-conventions.md +77 -8
  65. package/pp-core/references/discovery-integrations.md +151 -0
  66. package/pp-core/references/discovery-processes.md +190 -0
  67. package/pp-core/references/discovery-rebaseline.md +2 -2
  68. package/pp-core/references/discovery-research-track.md +5 -6
  69. package/pp-core/references/discovery-session-output.md +70 -0
  70. package/pp-core/references/discovery-standards.md +107 -0
  71. package/pp-core/references/discovery-traceability.md +2 -2
  72. package/pp-core/references/execute-mvp-tdd.md +3 -3
  73. package/pp-core/references/git-integration.md +57 -33
  74. package/pp-core/references/git-planning-commit.md +31 -9
  75. package/pp-core/references/phase-argument-parsing.md +1 -0
  76. package/pp-core/references/planner-discovery-extract.md +35 -0
  77. package/pp-core/references/planner-gap-closure.md +1 -0
  78. package/pp-core/references/planner-revision.md +3 -1
  79. package/pp-core/references/planner-tdd.md +4 -4
  80. package/pp-core/references/planning-config.md +3 -3
  81. package/pp-core/references/shell-portability.md +28 -0
  82. package/pp-core/references/tdd.md +20 -16
  83. package/pp-core/references/verifier-discovery-conformance.md +36 -0
  84. package/pp-core/references/worktree-path-safety.md +1 -0
  85. package/pp-core/templates/milestone.md +5 -5
  86. package/pp-core/templates/project-charter.md +161 -100
  87. package/pp-core/templates/project.md +3 -3
  88. package/pp-core/templates/requirements.md +18 -0
  89. package/pp-core/templates/verification-report.md +16 -0
  90. package/pp-core/workflows/add-backlog.md +1 -1
  91. package/pp-core/workflows/add-tests.md +5 -2
  92. package/pp-core/workflows/add-todo.md +3 -1
  93. package/pp-core/workflows/ai-integration-phase.md +2 -1
  94. package/pp-core/workflows/audit-fix.md +4 -3
  95. package/pp-core/workflows/audit-milestone.md +1 -0
  96. package/pp-core/workflows/autonomous.md +6 -0
  97. package/pp-core/workflows/check-todos.md +2 -1
  98. package/pp-core/workflows/cleanup.md +3 -1
  99. package/pp-core/workflows/code-review-fix.md +12 -5
  100. package/pp-core/workflows/code-review.md +15 -1
  101. package/pp-core/workflows/complete-milestone.md +13 -3
  102. package/pp-core/workflows/debug.md +2 -0
  103. package/pp-core/workflows/diagnose-issues.md +1 -1
  104. package/pp-core/workflows/discovery-sprint/charter.md +114 -0
  105. package/pp-core/workflows/discovery-sprint/prefill.md +1 -1
  106. package/pp-core/workflows/discovery-sprint/prototype.md +4 -4
  107. package/pp-core/workflows/discovery-sprint/session-13-gates.md +11 -1
  108. package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +54 -7
  109. package/pp-core/workflows/discovery-sprint/sessions/02-as-is.md +31 -7
  110. package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +64 -37
  111. package/pp-core/workflows/discovery-sprint/sessions/04-ux-design.md +12 -3
  112. package/pp-core/workflows/discovery-sprint/sessions/05-architecture.md +45 -22
  113. package/pp-core/workflows/discovery-sprint/sessions/06-security.md +30 -15
  114. package/pp-core/workflows/discovery-sprint/sessions/07-identity.md +43 -25
  115. package/pp-core/workflows/discovery-sprint/sessions/08-integration.md +63 -24
  116. package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +28 -13
  117. package/pp-core/workflows/discovery-sprint/sessions/10-infrastructure.md +35 -16
  118. package/pp-core/workflows/discovery-sprint/sessions/11-roadmap.md +32 -8
  119. package/pp-core/workflows/discovery-sprint/sessions/12-delivery-model.md +21 -18
  120. package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +29 -12
  121. package/pp-core/workflows/discovery-sprint/vault-context.md +14 -3
  122. package/pp-core/workflows/discovery-sprint.md +23 -23
  123. package/pp-core/workflows/discovery-to-build/steps/architecture-deliverables.md +81 -29
  124. package/pp-core/workflows/discovery-to-build/steps/{screen-inventory-gate.md → handoff-gates.md} +111 -3
  125. package/pp-core/workflows/discovery-to-build/templates/discovery-references.md +12 -9
  126. package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +27 -26
  127. package/pp-core/workflows/discovery-to-build.md +70 -34
  128. package/pp-core/workflows/discuss-phase/discovery.md +83 -0
  129. package/pp-core/workflows/discuss-phase/templates/context.md +4 -0
  130. package/pp-core/workflows/discuss-phase-assumptions.md +5 -3
  131. package/pp-core/workflows/discuss-phase.md +18 -10
  132. package/pp-core/workflows/docs-update.md +1 -0
  133. package/pp-core/workflows/eval-review.md +2 -1
  134. package/pp-core/workflows/execute-phase/steps/check-query-gate.md +7 -6
  135. package/pp-core/workflows/execute-phase/steps/cross-ai-delegation.md +1 -0
  136. package/pp-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +1 -0
  137. package/pp-core/workflows/execute-phase/steps/vault-fetch.md +12 -0
  138. package/pp-core/workflows/execute-phase.md +19 -7
  139. package/pp-core/workflows/execute-plan.md +18 -7
  140. package/pp-core/workflows/explore.md +1 -1
  141. package/pp-core/workflows/forensics.md +4 -2
  142. package/pp-core/workflows/health.md +1 -0
  143. package/pp-core/workflows/import.md +2 -1
  144. package/pp-core/workflows/ingest-docs.md +1 -0
  145. package/pp-core/workflows/init/steps/client-context-capture.md +1 -0
  146. package/pp-core/workflows/init/steps/github-provisioning.md +145 -0
  147. package/pp-core/workflows/init/steps/gitlab-provisioning.md +18 -4
  148. package/pp-core/workflows/init/steps/reachability-outcome.md +3 -1
  149. package/pp-core/workflows/init.md +56 -66
  150. package/pp-core/workflows/map-codebase.md +5 -1
  151. package/pp-core/workflows/milestone-summary.md +2 -1
  152. package/pp-core/workflows/mvp-phase.md +1 -0
  153. package/pp-core/workflows/new-milestone.md +9 -5
  154. package/pp-core/workflows/new-project.md +12 -11
  155. package/pp-core/workflows/new-workspace.md +1 -0
  156. package/pp-core/workflows/next.md +2 -1
  157. package/pp-core/workflows/pause-work.md +6 -4
  158. package/pp-core/workflows/plan-milestone-gaps.md +3 -1
  159. package/pp-core/workflows/plan-phase/steps/chunked-planning.md +1 -1
  160. package/pp-core/workflows/plan-phase/steps/discovery-extract.md +41 -0
  161. package/pp-core/workflows/plan-phase.md +36 -16
  162. package/pp-core/workflows/plan-review-convergence.md +2 -0
  163. package/pp-core/workflows/plant-seed.md +4 -2
  164. package/pp-core/workflows/pr-branch.md +2 -0
  165. package/pp-core/workflows/progress.md +5 -0
  166. package/pp-core/workflows/quick.md +11 -4
  167. package/pp-core/workflows/reapply-patches.md +3 -0
  168. package/pp-core/workflows/remove-phase.md +1 -1
  169. package/pp-core/workflows/resume-project.md +3 -0
  170. package/pp-core/workflows/review.md +7 -1
  171. package/pp-core/workflows/secure-phase.md +2 -1
  172. package/pp-core/workflows/session-report.md +1 -0
  173. package/pp-core/workflows/ship.md +8 -1
  174. package/pp-core/workflows/sketch-wrap-up.md +1 -1
  175. package/pp-core/workflows/sketch.md +3 -2
  176. package/pp-core/workflows/spec-phase.md +2 -1
  177. package/pp-core/workflows/spike-wrap-up.md +1 -1
  178. package/pp-core/workflows/spike.md +4 -3
  179. package/pp-core/workflows/sync-skills.md +5 -2
  180. package/pp-core/workflows/thread.md +3 -2
  181. package/pp-core/workflows/transition.md +6 -0
  182. package/pp-core/workflows/ui-phase.md +3 -1
  183. package/pp-core/workflows/ui-review.md +2 -1
  184. package/pp-core/workflows/ultraplan-phase.md +1 -0
  185. package/pp-core/workflows/undo.md +14 -10
  186. package/pp-core/workflows/update.md +5 -0
  187. package/pp-core/workflows/validate-phase.md +6 -3
  188. package/pp-core/workflows/vault-review.md +7 -1
  189. package/pp-core/workflows/vault-write-back.md +5 -0
  190. package/pp-core/workflows/verify-phase.md +5 -0
  191. package/pp-core/workflows/verify-work.md +8 -1
  192. package/scripts/prompt-injection-scan.sh +1 -1
  193. package/scripts/sync-runtime-launcher.cjs +115 -5
  194. package/pp-core/workflows/discovery-sprint/templates/context-template.md +0 -266
@@ -0,0 +1,114 @@
1
+ # Discovery Charter — Draft, Finish, Redraft, Export
2
+
3
+ > **Lazy-loaded.** Read from `sessions/13-wrap-up.md` Step 0.5 (§ Draft), from Session 13's Closing
4
+ > Step (§ Finish), and from `workflows/discovery-sprint.md` when invoked as `/pp-discovery charter`
5
+ > (§ Redraft). The main workflow's init block has already resolved `PP_TOOLS` and defined `pp_run`.
6
+
7
+ The charter is `docs/discovery/PROJECT-CHARTER.md` — client-visible, like `docs/architecture/`. Its
8
+ template is `${PP_TOOLS%/bin/pp-tools.cjs}/templates/project-charter.md`; the parser contract, the
9
+ heading keys and their translations are `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-charter.md`.
10
+ Read both before writing. Write targets are `docs/discovery/PROJECT-CHARTER.md`, `.docx` and `.pdf`
11
+ only — relative paths, never `..`, never an absolute path, never anything under `.planning/`.
12
+
13
+ The session files and the registers under `.planning/discovery/` are the source of truth; the charter
14
+ condenses them and invents nothing. A value Discovery did not settle reads
15
+ `Not decided in Discovery — OI-n` and that item stands in § 15.
16
+
17
+ ## Language
18
+
19
+ Resolve once, record in the frontmatter `language` field:
20
+
21
+ 1. Session 1 § Sprint Logistics, row **Charter language** (a BCP-47 code: `nl`, `en`, `nl-BE`).
22
+ 2. Else `pp_run query config-get discovery.language --default "" --raw`.
23
+ 3. Else the language the sprint was facilitated in (Flow 2 Step 5).
24
+
25
+ Render headings, labels and prose in that language — the reference carries the English and Dutch
26
+ headings; translate others yourself. Never translate the `<!-- charter:<key> -->` comments, the
27
+ frontmatter field names and values, or an enum cell (`Green / Amber / Red`, `Approve / Approve with
28
+ conditions / Reject`, `Yes / No`). Column order is fixed.
29
+
30
+ ## Draft (Session 13 Step 0.5)
31
+
32
+ Runs after the cross-reference (Step 0f) and before the topics, so topic 2 reviews a real document.
33
+
34
+ 1. If `docs/discovery/PROJECT-CHARTER.md` already exists, this is not a first draft: go to § Redraft.
35
+ 2. Resolve the language (§ Language).
36
+ 3. Read the sources the template's source map names: `.planning/discovery/session-01.md` …
37
+ `session-13.md`, `_progress.md`, `_requirements.md`, `_screens.md`, `_feedback.md`, `_research.md`,
38
+ `_deviations.md`, `prototype/README.md` — skipping any that does not exist. Spawn an Explore agent
39
+ to extract the named Notes Template tables from the session files in parallel when one is
40
+ available; read the registers yourself, in full.
41
+ 4. Run `pp_run query discovery.rollup .planning/discovery/_requirements.md` for the counts line: one
42
+ `<PREFIX>- <n>` per registered prefix counting `MVP` and `Later` rows, then `Dropped <n>`, joined
43
+ with ` · `. Skip the line's counts when `_requirements.md` does not exist.
44
+ 5. Write the file from the fenced template, verbatim in shape: every section, every key comment, every
45
+ table in order. Fill the frontmatter (`project`, `client`, today's `date`, the `language` code,
46
+ `discovery_sessions_completed` from `_progress.md`, `version: 1.0`, `status: Draft`,
47
+ `go_no_go: Pending`) and the document-control table. Fill each section from its source rows only,
48
+ keeping every ID exactly as minted. Leave § 17's status cells empty and § 15 empty — topics 3 and 4
49
+ record them — and fill § 16 with what is already known: `⚠️ CONDITIONAL` sections (from each
50
+ session's `conditional:` frontmatter), open `Gates-MVP` rows of `_research.md`, and every
51
+ `Dropped (D-ss-n)` requirement. A section with nothing to report keeps its empty table and says
52
+ `None identified in Discovery.` in the sprint language. **Redo of Session 13:** when `session-13.md`
53
+ already carries a filled Go / No-Go Assessment and Open Items Register from an earlier run, copy them
54
+ now as § Finish steps 1–2 describe — the check compares against them once the overall cell is
55
+ filled, and an empty § 17 would then be a fault, not a draft.
56
+ 6. Run `pp_run query discovery.charter-check`. Non-zero: fix every fault it names and re-run until it
57
+ exits 0 — `unknown_id` means a cell cites an ID nothing minted; `counts_mismatch` means the § 3 line
58
+ disagrees with the roll-up. The draft is not finished while the check is red.
59
+ 7. Report in one block: the path, the language, the sections that read `None identified`, the number of
60
+ IDs the check resolved. Then return to `sessions/13-wrap-up.md` Step 5: topic 2 walks this document.
61
+
62
+ ## Finish (Session 13 Closing Step)
63
+
64
+ Runs after Flow 2 Step 7 and before Step 8, every time Session 13 completes, including a redo.
65
+
66
+ 1. Copy Session 13's **Go / No-Go Assessment** into § 17 as recorded — eight rows in order, status cells
67
+ verbatim — and set the frontmatter `go_no_go` to the overall recommendation. Every condition
68
+ attached to a `Go with conditions` becomes a § 16 row (Kind: Go condition); an Amber row under a
69
+ plain `Go` is not a condition and stays an open item.
70
+ 2. Copy the **Open Items Register** into § 15 row for row, in the charter's six columns (`Source
71
+ Session` and `Priority` stay in the register). Every row whose *Must Resolve Before Build?*
72
+ starts with `Yes` and whose Status is not `Closed`, `Resolved` or `Done` becomes a § 16 row (Kind:
73
+ Must resolve before build) citing its `OI-` ID.
74
+ 3. Add Session 13's scope-, architecture-, cost- or timeline-changing decisions to § 18.
75
+ 4. Set `status: For sign-off` and today's `date`; set the § 20 row for the current version to
76
+ `For sign-off` with that date.
77
+ 5. Run `pp_run query discovery.charter-check`. It must exit 0; fix and re-run until it does.
78
+ 6. Run § Export.
79
+ 7. Commit the markdown and whichever exports exist:
80
+ `pp_run commit "docs(discovery): project charter for sign-off" --files docs/discovery/PROJECT-CHARTER.md docs/discovery/PROJECT-CHARTER.docx docs/discovery/PROJECT-CHARTER.pdf`
81
+ (drop a path that was not written).
82
+ 8. Tell the user what happens next, in two lines: signatures are recorded in § 19 and the status
83
+ follows them (`/pp-discovery charter` does it); `/pp-discovery-to-build` requires `Signed` or
84
+ `Signed with conditions`, and `--unsigned` records the gap instead of waiting.
85
+
86
+ ## Redraft (`/pp-discovery charter`, and any change after `For sign-off`)
87
+
88
+ 1. Read the charter. Ask what changed (`AskUserQuestion`; **text mode fallback:** numbered list):
89
+ 1) Signatures collected / 2) A decision changed a recorded fact / 3) A correction to the text.
90
+ 2. **Signatures:** fill the § 19 `Decision`, `Conditions`, `Date` cells as given; set `status` from the
91
+ rows — `Signed` when every row approves, `Signed with conditions` when any row approves with
92
+ conditions, `Rejected` when any row rejects. Add a § 20 row with the **same** version, the new
93
+ status and `Signatures recorded` as the change. The version signed is the version that was
94
+ circulated; nothing else moves.
95
+ 3. **A changed fact or a correction:** bump the minor version (`1.0` → `1.1`), set `status: Draft`,
96
+ add a § 20 row naming the `D-<ss>-<n>` that caused the change (or `—` for a wording fix), edit the
97
+ affected rows from their sources, and go back through § Finish steps 4–8 when the text is agreed.
98
+ A changed fact is first changed where it was recorded — the session table or the register — with
99
+ the back-amend rule (Flow 2 Step 6); the charter follows the source, never the other way round.
100
+ 4. Run `pp_run query discovery.charter-check` (exit 0 required), then § Export, then commit as in
101
+ § Finish step 7 with the message `docs(discovery): project charter v<version> <status>`.
102
+
103
+ ## Export
104
+
105
+ The markdown is the source; `docs/discovery/PROJECT-CHARTER.docx` and `docs/discovery/PROJECT-CHARTER.pdf`
106
+ are renderings, regenerated every time the markdown changes and never edited by hand or read back.
107
+
108
+ 1. Invoke the `pareto-brand` skill for the document styling rules, then the `docx` skill to render
109
+ `docs/discovery/PROJECT-CHARTER.docx` from the markdown — same sections, same order, the key
110
+ comments omitted — then the `pdf` skill for `docs/discovery/PROJECT-CHARTER.pdf` from the same
111
+ content. The runtime may list these skills under a namespace (for example `anthropic-skills:docx`);
112
+ use the name it lists.
113
+ 2. When a skill is not installed, say so once, write `export: skipped (<skill> unavailable)` into the
114
+ Change cell of the current § 20 row, and continue. A missing renderer never blocks the sprint.
@@ -33,7 +33,7 @@ alongside the mapped input documents.
33
33
  to pre-fill from without a mapped package.
34
34
  2. The target session file `.planning/discovery/session-NN.md` must exist; if
35
35
  absent, create it from its session template exactly as Flow 2 Step 1 of the
36
- main workflow does (including `_progress.md` / `_context.md` bootstrap when
36
+ main workflow does (including the `_progress.md` bootstrap when
37
37
  this is the first-ever session artifact).
38
38
  3. The session's current status must be `Not Started`. Never pre-fill a session
39
39
  that is `In Progress` or `Completed` — live answers outrank paper answers.
@@ -8,7 +8,7 @@
8
8
  > prototype only when new functional requirements have been found; Sessions 5–13 are technical and
9
9
  > never trigger an update on their own. It writes only
10
10
  > under `.planning/discovery/prototype/`, plus a round in `.planning/discovery/_feedback.md` and
11
- > the prototype lines of `.planning/discovery/_context.md`.
11
+ > the decisions it produced in Session 4's **Key Decisions**.
12
12
 
13
13
  ## Step 0: Vault Context
14
14
 
@@ -237,9 +237,9 @@ when requirements changed, the roll-up `--check`. All must exit 0.
237
237
 
238
238
  ## Step 9: Record and summarise
239
239
 
240
- Fill the **Prototype** lines under Session 4's outputs in `.planning/discovery/_context.md`: the
241
- round, the flows validated, the rows processed, the elements swept and the decisions they produced.
242
- Then show:
240
+ Record each decision the round produced as a `D-04-<n>` row of `.planning/discovery/session-04.md`
241
+ **Key Decisions**; the round itself — flows validated, rows processed, elements swept — is already
242
+ in `_feedback.md` and `_sweep.md`. Then show:
243
243
 
244
244
  ```
245
245
  Prototype — Round <k> — Complete
@@ -19,7 +19,17 @@ documented absent-artifact arm — before the cross-reference analysis begins.
19
19
 
20
20
  **Element-sweep gate:** run `pp_run query discovery.element-sweep --check`. Exit 0 → proceed. Non-zero → a functional prototype element has no id, a tag names an unknown requirement, or `_sweep.md` leaves an element of the current pages undecided, decides one twice, or cites a reference that does not fit its outcome — finish the sweep with `/pp-discovery prototype` Step 8 and re-run. Without a prototype the check exits 0 by itself.
21
21
 
22
- **Vault-context gate (PBI 75336):** for each of sessions 1–12 whose `.planning/discovery/session-NN.md` carries a `## Vault Context` section, run `pp_run query discovery.vault-check <N>`. Exit 0 → proceed. Non-zero → the record names no index, a line is not one `` - `<path>` — <why> `` entry, or a selected vault document is neither cited `[vault: <path>]` in the notes nor marked `— not used: <reason>`: fix that session's record or notes and re-run. A session with no `## Vault Context` section ran without the vault and is skipped.
22
+ **Vault-context gate (PBI 75336):** for each of sessions 1–12 whose `.planning/discovery/session-NN.md` carries a `## Vault Context` section, run `pp_run query discovery.vault-check <N>`. Exit 0 → proceed. Non-zero → the record names no index, a line is not one `` - `<path>` — <why> `` entry, a selected vault document is neither cited `[vault: <path>]` in the notes nor marked `— not used: <reason>`, or a document the vault's `INDEX.md` marks `[cross-cutting]` has no record line: fix that session's record or notes and re-run. A session with no `## Vault Context` section ran without the vault and is skipped.
23
+
24
+ **Artifact gates (data model, processes, rules):** run `pp_run query discovery.entity-check`, `pp_run query discovery.process-check` and `pp_run query discovery.rules-check`. Each exits 0 → proceed. Non-zero → a section or table header is off the template, an entity name is not one PascalCase token or is repeated, a lifecycle flag or classification is outside its vocabulary, a relationship end, attribute heading, lifecycle row or step-matrix data object names an entity the data model does not have, a cardinality is not Mermaid's, a `PRC-`/`MP-`/`BR-` ID is malformed, repeated or leaves a hole, a `Replaces` cell names an as-is process that does not exist, a main process has no swimlane or no step matrix, a flow has no `subgraph`, an actor is neither a Session 2 persona nor `System`, a data object is not `Name [C/R/U/D]`, a cited requirement does not exist, a rule names no layer, no requirement or an unknown entity or process — fix the named rows in the artifact and re-run. These gates report: a pending `—` cell and an uncited step are not faults here; the handoff adds `--require-complete` and `--require-cited` and hard-blocks on them. An artifact that does not exist exits 0 by itself. Fault vocabularies: `references/discovery-data-model.md`, `references/discovery-processes.md`.
25
+
26
+ **Standards-first gates (roles, integrations, migration, deviations):** run `pp_run query discovery.roles-check`, `pp_run query discovery.integrations-check`, `pp_run query discovery.migration-check` and `pp_run query discovery.deviations-check`. Each exits 0 → proceed. Non-zero → a section or table header is off the template, a role is listed twice or is neither a Session 2 persona, a step-matrix actor nor `System`, a permission or screen row names an unknown role, entity, screen or requirement, an operation is not a lowercase verb, an `IF-`/`MG-`/`DEV-` ID is malformed, repeated or leaves a hole, a direction, required flag, reversibility or status is outside its vocabulary, a contract or error row names an interface that does not exist, a step matrix cites an `IF-` the register lacks, a migration source is not in the Systems Landscape, a deviation cites no `[vault: <path>]` or one the cache does not hold, names an approver the Session 1 Approval Matrix lacks, or is approved or rejected without a decision — fix the named rows in the artifact and re-run. These gates report: an uncited interface or migration row and a hard deviation still `Proposed` are not faults here; the handoff adds `--require-cited` and `--require-approved` and hard-blocks on them. An artifact that does not exist exits 0 by itself. Fault vocabularies: `references/discovery-access.md`, `references/discovery-integrations.md`, `references/discovery-standards.md`.
27
+
28
+ **Session-output gate (review F-6):** run `pp_run query discovery.session-check --all`. Exit 0 → proceed. Non-zero → a Notes Template section of a completed session is missing, repeated, off its template columns or empty: fill it in that session file from the session's notes, or write `None identified in Discovery.` under its title, then re-run (`references/discovery-session-output.md`). A session whose `completeness_score` reads 100 while this gate names it empty was scored on the conversation, not the output — correct the score.
29
+
30
+ **Build-consumption gates (stories, phase plan, extract):** run `pp_run query discovery.stories-check`, `pp_run query discovery.phases-check` and `pp_run query discovery.for-phase 1 --markdown >/dev/null`. Each exits 0 → proceed. Non-zero → a `US-` or phase number is malformed, repeated or leaves a hole, a story names no `E-nn` EPIC, cites no requirement or one that does not exist, has an empty story or acceptance-criteria cell or a source step that is neither `—` nor an existing `MP-nn #k`, an MVP domain requirement has no story, a phase has no goal, no success criteria or no requirement, plans a dropped requirement or one another phase also plans, depends on a later or missing phase, an MVP requirement belongs to no phase, or an artifact the extract reads has a section or header off its template — fix the named rows and re-run. These gates report; the handoff hard-blocks on `stories-check` and `phases-check`. An artifact that does not exist exits 0 by itself; the extract smoke renders empty, exit 0, when no phase plan or roadmap names Phase 1. Fault vocabulary: `references/discovery-build-consumption.md`.
31
+
32
+ **Charter gate (reporting — runs after Step 0.5 and again in the Closing Step, not before 0a):** run `pp_run query discovery.charter-check`. Exit 0 → proceed. Non-zero → the frontmatter misses a field or has a value outside its enum, a `<!-- charter:<key> -->` section is missing, repeated, out of order or unknown, a table cell cites an ID no session table or register minted, the § 3 counts line disagrees with the roll-up, a `Dropped` requirement or a must-resolve open item is not listed under § 16, the § 17 table differs from this session's Go / No-Go Assessment, a § 19 decision is outside its vocabulary or disagrees with `status`, or § 20 does not end at the frontmatter version — fix the named items in `docs/discovery/PROJECT-CHARTER.md` (or the source they copy) and re-run. Before Step 0.5 the file does not exist and `charter_missing` is the cue to draft it, not a fault. The gate never asks for a signature: `--require-signed` belongs to `/pp-discovery-to-build`, where an unsigned charter hard-blocks unless `--unsigned` records the gap. Fault vocabulary: `references/discovery-charter.md`.
23
33
 
24
34
  **The screen-traceability gate reports open feedback; it never blocks on it (D-53, first arm).** A round whose `Processing` cells all read `Open` exits 0 and the open count is reported as outstanding work — exactly as an open `Gates-MVP` research item exits 0 under D-43. It fails only on structural faults. The hard block on those same structural faults lives at `/pp-discovery-to-build`, not here (D-53, second arm): the handoff into build is the last moment an uncovered MVP requirement or an unclassified surface is still free to fix. Open feedback is still closed before Session 13 completes, by the `--require-processed` check in Flow 2 Step 7, and the handoff refuses it too.
25
35
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  ### Session 1: Discovery Sprint Kick-off
7
7
 
8
- **Goal:** Align all participants on the Discovery Sprint purpose, establish project context, confirm business vision, identify stakeholders, and agree on the discovery approach, ground rules, and logistics.
8
+ **Goal:** Align all participants on the Discovery Sprint purpose, establish project context, confirm business vision, identify stakeholders and who approves what, and agree on the discovery approach, ground rules, and logistics.
9
9
 
10
10
  **What We Cover:**
11
11
 
@@ -29,9 +29,10 @@
29
29
 
30
30
  4. **Discovery Sprint approach and logistics**
31
31
  *Why it matters: sets expectations so the remaining 12 sessions run smoothly without renegotiating format each time. Skip when: the team has already run a Discovery Sprint together before and knows the cadence.*
32
- - Walk through the 13-session agenda and expected outputs
32
+ - Walk through the 13-session agenda and expected outputs, including the cross-reference that closes Session 8 and the one that opens Session 13
33
33
  - What is the preferred meeting cadence and format (in-person, remote, hybrid)?
34
34
  - How will decisions be documented and communicated?
35
+ - What is the team shape for the sprint and the build: a full delivery team, a small team, or one person working with an AI assistant? Session 12 builds the delivery model on this answer.
35
36
 
36
37
  5. **Ground rules and ways of working**
37
38
  *Why it matters: prevents disagreements from derailing later sessions once real tradeoffs surface. Skip when: the team already has an established working agreement from a prior engagement.*
@@ -44,16 +45,28 @@
44
45
  - Are there hard deadlines (regulatory, contractual, market)?
45
46
  - What budget constraints exist? [needs-business-input]
46
47
  - Are there technology mandates or restrictions?
48
+ - Does the client vault or the client mandate a platform: cloud provider, CI/CD, observability? Record the mandate as a Key Decisions row `D-01-<n>`, citing `[vault: <path>]` when the vault states it. Sessions 5, 6 and 10 fill their tables against this decision; with no mandate, record that the platform is open.
47
49
 
48
50
  7. **Requirement ID prefixes and decision-ID conventions**
49
51
  *Why it matters: every requirement, decision, and action across all 13 sessions cites these IDs — chosen once here, never renumbered. Skip when: never — mandatory.*
50
52
  - Propose a prefix set derived from the stakeholder domains just mapped in topic 3: one prefix per stakeholder domain, plus `N-` (non-functional) and `T-` (technical) defaults; the user confirms or adjusts (D-09)
51
53
  - Create `.planning/discovery/_requirements.md` from the bootstrap template in the pp-core reference `references/discovery-id-conventions.md` — locate it under the installed pp-core root (`${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-id-conventions.md`) and Read it lazily; never `@`-import it. Fill the Prefix Registry header table with the confirmed set (the registry and the requirements table travel in one file — D-10)
52
- - Never register a reserved prefix: the proposed set must not include `D-`, `A-`, `SP-`, `DG-`, `RS-` or `SCR-` — they are owned by other ID families, and a row claiming one makes `discovery rollup --check` report `reserved_prefix` (D-44)
54
+ - Never register a reserved prefix: the proposed set must not include `D-`, `A-`, `SP-`, `DG-`, `RS-`, `SCR-`, `PRC-`, `MP-`, `BR-`, `IF-`, `MG-` or `DEV-` — they are owned by other ID families, and a row claiming one makes `discovery rollup --check` report `reserved_prefix` (D-44). Avoid the session-table row prefixes that reference lists too (`C-`, `R-`, `E-`, …), so a citation never reads two ways
53
55
  - Decisions are cited inline as `D-<ss>-<n>` per that same reference; record the chosen prefix set as a Key Decisions row in the Session 1 notes
54
56
 
57
+ 8. **Approval routes**
58
+ *Why it matters: Sessions 5–7 sign architecture and security deviations; an approval route found only later means those signatures were given by people who could not give them. Skip when: never — "no formal route" is itself an answer to record.*
59
+ - Which approvals will this project need: scope, budget, architecture, security deviations, data protection, go-live?
60
+ - Who gives each approval, and who is consulted or informed?
61
+ - When the client vault is bound, sweep it for approval rules: every document that says who must approve what. Record each route in the **Approval Matrix** with its `[vault: <path>]` citation.
62
+ - Where no route exists for an approval the sprint will need, who approves it? Record the answer as `D-01-<n>`.
63
+
55
64
  **Notes Template:**
56
65
 
66
+ **Background**
67
+
68
+ The business problem or opportunity, what was tried before and with what result, and the documents handed over, cited by accession number (`[NN]`).
69
+
57
70
  **Stakeholder Register**
58
71
 
59
72
  | Name | Role | Organization | Interest Area | Decision Authority | Availability |
@@ -70,21 +83,55 @@
70
83
  | Success criteria (12-month) | |
71
84
  | Key business drivers | |
72
85
 
86
+ **Sprint Logistics**
87
+
88
+ | Aspect | Agreement |
89
+ |--------|-----------|
90
+ | Session cadence and format | |
91
+ | Team shape | |
92
+ | Decision recording and communication | |
93
+ | Charter language | |
94
+
95
+ **Charter language** is a BCP-47 code (`nl`, `en`, `nl-BE`): the Project Charter Session 13 drafts is rendered in it (`references/discovery-charter.md` § Language resolution). Leave it empty to fall back to `discovery.language` in `.planning/config.json`, else the facilitation language.
96
+
97
+ **Working Agreement**
98
+
99
+ | Aspect | Agreement |
100
+ |--------|-----------|
101
+ | Disagreements and competing priorities | |
102
+ | Escalation path for blockers | |
103
+ | Collaboration tools | |
104
+
73
105
  **Constraints and Risks Register**
74
106
 
75
107
  | ID | Type | Description | Impact (H/M/L) | Mitigation | Owner |
76
108
  |----|------|-------------|-----------------|------------|-------|
77
- | C1 | Constraint | | | | |
78
- | R1 | Risk | | | | |
109
+ | CON-01 | Constraint | | | | |
110
+ | R-01 | Risk | | | | |
111
+
112
+ Session 11's **Risk Register** continues the `R-` sequence; a risk raised here keeps its ID there.
113
+
114
+ **Approval Matrix**
115
+
116
+ | Approval | Approver | Consulted | Source | Decision |
117
+ |----------|----------|-----------|--------|----------|
118
+ | Scope change | | | | |
119
+ | Budget | | | | |
120
+ | Architecture deviation | | | | |
121
+ | Security deviation | | | | |
122
+ | Data protection | | | | |
123
+ | Go-live | | | | |
124
+
125
+ **Source** is a `[vault: <path>]` citation or `room`. **Decision** is `—` or the `D-01-<n>` that set a route the vault does not give. The **Approver** column is the approver source for `.planning/discovery/_deviations.md`: `deviations-check` refuses a deviation whose approver this matrix does not name (`references/discovery-standards.md`), so name the architect who signs architecture and security deviations here, spelled as the deviation rows will spell it.
79
126
 
80
127
  **Key Decisions**
81
128
 
82
- | # | Decision | Rationale | Owner | Date |
129
+ | ID | Decision | Rationale | Owner | Date |
83
130
  |---|----------|-----------|-------|------|
84
131
  | | | | | |
85
132
 
86
133
  **Action Items**
87
134
 
88
- | # | Action | Owner | Due Date | Status |
135
+ | ID | Action | Owner | Due Date | Status |
89
136
  |---|--------|-------|----------|--------|
90
137
  | | | | | |
@@ -5,7 +5,7 @@
5
5
 
6
6
  ### Session 2: Business Process Mapping (As-Is)
7
7
 
8
- **Goal:** Document current-state business processes, identify pain points and inefficiencies, define user personas, map the existing systems landscape, and understand current data flows.
8
+ **Goal:** Document current-state business processes, identify pain points and inefficiencies, define user personas, map the existing systems landscape, understand current data flows, and record which data the new solution has to take over.
9
9
 
10
10
  **What We Cover:**
11
11
 
@@ -16,6 +16,7 @@
16
16
  - Who is involved at each step and what is their role?
17
17
  - What is the average time to complete each process?
18
18
  - Are there seasonal or volume-based variations?
19
+ - Record each process as a `PRC-` row of `.planning/discovery/_processes.md` § As-is — the canonical process register (`references/discovery-processes.md`); the **Process Inventory** below only summarises it
19
20
 
20
21
  2. **Pain points and inefficiencies**
21
22
  *Why it matters: pain points become the EPICs and priorities validated in Session 3. Skip when: the initiative isn't process-improvement driven (e.g. a pure greenfield product).*
@@ -40,7 +41,8 @@
40
41
 
41
42
  5. **Data flows and information architecture**
42
43
  *Why it matters: existing data flows inform the target data model and Session 5's integration map. Skip when: greenfield build with no legacy data to trace.*
43
- - What are the key data entities (customer, order, product, invoice)?
44
+ - What are the key data entities (customer, order, product, invoice)? Each becomes a row of `.planning/discovery/_entities.md` § Entities — the canonical data model (`references/discovery-data-model.md`) — named, never numbered, with Identifier, Classification and Retention `—` until Sessions 5 and 6 fill them
45
+ - Which word does the client use for each entity, and which other words were heard for the same thing? One `_glossary.md` row per concept, synonyms under `Do not use`
44
46
  - How does data flow between systems today?
45
47
  - Are there batch processes, real-time integrations, or manual transfers?
46
48
  - What data quality issues exist?
@@ -51,13 +53,25 @@
51
53
  - What audit trails or reporting obligations exist?
52
54
  - Are there data residency or retention requirements?
53
55
 
56
+ 7. **Data to migrate**
57
+ *Why it matters: data the new solution takes over from an existing system is a build phase of its own, with a cut-over nobody can improvise; naming it now lets Session 8 design the move and Session 11 plan it. Skip when: greenfield build — no existing data moves.*
58
+ - Which of the systems in the landscape hold data the new solution must take over, and which data stays behind or is archived?
59
+ - For each: which entities, roughly how many records, and how clean is the data today?
60
+ - Record one `MG-<nn>` row per source system and entity set in `.planning/discovery/_migration.md` § Migration — create the file from the template in `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-integrations.md` § `_migration.md` on first need; `Source system` is spelled as the **Systems Landscape** spells it, `Entity` as `_entities.md` does, `Mapping`, `Cut-over`, `Reconciliation` and `Requirements` stay `—` for Session 8. Run `pp_run query discovery.migration-check` — exit 0, or fix the rows it names.
61
+
54
62
  **Notes Template:**
55
63
 
64
+ > **Artifacts this session creates (first run only):** copy the bootstrap templates verbatim, replacing `[PROJECT_NAME]` — `.planning/discovery/_processes.md` and `.planning/discovery/_glossary.md` from `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-processes.md`, `.planning/discovery/_entities.md` from `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-data-model.md`, and — only when topic 7 finds data to move — `.planning/discovery/_migration.md` from `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-integrations.md`. They are the canonical registers; the tables below summarise or point at them and are never the place a fact is first written.
65
+
56
66
  **Process Inventory**
57
67
 
58
- | Process ID | Process Name | Owner | Trigger | End State | Frequency | Avg Duration | Criticality |
59
- |------------|-------------|-------|---------|-----------|-----------|--------------|-------------|
60
- | P-01 | | | | | | | |
68
+ The canonical rows live in `.planning/discovery/_processes.md` § As-is: `| ID | Process | Owner | Trigger | End state | Frequency | Avg duration | Criticality |`, one `PRC-<nn>` row per process in the order they were discussed. This table is a reading summary — one row per process, never the place a fact is first written:
69
+
70
+ | Process ID | Process Name | What the register row does not hold |
71
+ |------------|-------------|-------------------------------------|
72
+ | PRC-01 | | |
73
+
74
+ **Process ID** is `PRC-<nn>`, a reserved prefix, so a process never shares an ID with a requirement.
61
75
 
62
76
  **Pain Points Register**
63
77
 
@@ -83,14 +97,24 @@
83
97
  |--------|-----------------|-----------|-----------|--------|----------------|
84
98
  | | | | | | |
85
99
 
100
+ Every **Entity** named here is also a row of `.planning/discovery/_entities.md` § Entities, spelled the same (one PascalCase token, `Task`, `AuditEntry`), Source `S2`, pending cells `—`. This map keeps the as-is facts the data model does not hold (system of record, flows, volume, quality); the data model keeps everything the build needs. Close the session with `pp_run query discovery.entity-check` — exit 0, or fix the rows it names.
101
+
102
+ **Data to Migrate**
103
+
104
+ The canonical rows live in `.planning/discovery/_migration.md` § Migration (`MG-<nn>`, one per source system and entity set — `references/discovery-integrations.md`). This table is a reading summary; write `None identified in Discovery.` under it when nothing moves:
105
+
106
+ | Migration ID | Source system | What moves |
107
+ |--------------|---------------|------------|
108
+ | MG-01 | | |
109
+
86
110
  **Key Decisions**
87
111
 
88
- | # | Decision | Rationale | Owner | Date |
112
+ | ID | Decision | Rationale | Owner | Date |
89
113
  |---|----------|-----------|-------|------|
90
114
  | | | | | |
91
115
 
92
116
  **Action Items**
93
117
 
94
- | # | Action | Owner | Due Date | Status |
118
+ | ID | Action | Owner | Due Date | Status |
95
119
  |---|--------|-------|----------|--------|
96
120
  | | | | | |
@@ -18,6 +18,7 @@ This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at t
18
18
  - How will we measure success? What KPIs will be tracked?
19
19
  - What is the expected ROI or business case?
20
20
  - Are there specific targets (e.g., reduce processing time by 50%)?
21
+ - **Glossary sweep:** for every concept named so far — entities, roles, statuses, documents — confirm the one term the requirements will use and add or complete its `.planning/discovery/_glossary.md` row (definition, synonyms under `Do not use`, source). A term with two spellings is a Session 13 cross-reference finding
21
22
 
22
23
  2. **MVP scope definition**
23
24
  *Why it matters: the MVP boundary drives Session 11's build order and the go-live target date. Skip when: scope is fixed by contract and non-negotiable.*
@@ -41,7 +42,7 @@ This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at t
41
42
  5. **Functional requirements** (derived from step matrices)
42
43
  *Why it matters: functional requirements are the direct input to architecture (Session 5) and QA planning (Session 9). Skip when: requirements are already captured in a separate BRD to reference.*
43
44
  - What specific functions must the system perform?
44
- - What calculations, transformations, or business logic are required?
45
+ - What calculations, transformations, or business logic are required? Every validation, calculation or invariant becomes a `BR-` row of `.planning/discovery/_rules.md` (Step 5D′), applied to an entity or a process, checked in a named layer, citing the requirements it realises
45
46
  - What reporting or analytics capabilities are needed?
46
47
 
47
48
  6. **Non-functional requirements**
@@ -55,17 +56,15 @@ This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at t
55
56
 
56
57
  **Main Process Register** (populated via process-first decomposition Step 5A)
57
58
 
58
- | MP ID | Main Process | Trigger | End State | Primary Actor | Related EPICs |
59
- |-------|--------------|---------|-----------|---------------|---------------|
60
- | MP-01 | | | | | |
59
+ The canonical rows live in `.planning/discovery/_processes.md` § To-be: `| ID | Main process | Replaces | Trigger | End state | Primary actor | EPICs |`, one `MP-<nn>` row per main process, **Replaces** naming the `PRC-` rows it transforms or `new`. Record here only the summary line `N main processes (MP-01 … MP-NN)` and the orphan as-is processes no main process replaces.
61
60
 
62
61
  **Sub-Process Flows** (populated via Step 5B)
63
62
 
64
- One Mermaid flowchart block per accepted sub-process decomposition.
63
+ One swimlane per main process in `.planning/discovery/_processes.md` § Flows — a Mermaid `flowchart` with one `subgraph` per actor. Record here only which flows the user changed and why.
65
64
 
66
65
  **Step Matrices** (populated via Step 5C)
67
66
 
68
- One step matrix per sub-process; Requirements column back-filled at Step 5D.
67
+ One step matrix per main process in `.planning/discovery/_processes.md` § Steps, with the **Exception** column; sub-process boundaries are rows, or one combined matrix per main process when its sub-processes are step-sized (Step 5C); Requirements column back-filled at Step 5D. Record here only what the matrices cannot hold.
69
68
 
70
69
  **Business Objectives**
71
70
 
@@ -89,20 +88,20 @@ Orphan-requirement and uncovered-step flags only — the canonical requirements
89
88
  |---------|-----------|-------------|----------------|--------|----------------|
90
89
  | E-01 | | | | | |
91
90
 
92
- **User Stories**
91
+ **User Stories** (populated via Step 5E)
93
92
 
94
- | Story ID | EPIC | User Story | Acceptance Criteria | MoSCoW | Source Step |
95
- |----------|------|------------|---------------------|--------|-------------|
96
- | US-01 | | | | | |
93
+ One row per story in `.planning/discovery/_stories.md` § Stories — `ID | EPIC | Requirements | Story | Acceptance criteria | Source step` (`references/discovery-build-consumption.md`); the build's verifier reads the acceptance criteria from there. Record here only what the register cannot hold.
97
94
 
98
95
  **Non-Functional Requirements**
99
96
 
100
97
  | ID | Category | Requirement | Target / Threshold | MoSCoW |
101
98
  |----|----------|-------------|-------------------|--------|
102
- | NFR-01 | Performance | | | |
103
- | NFR-02 | Availability | | | |
104
- | NFR-03 | Scalability | | | |
105
- | NFR-04 | Accessibility | | | |
99
+ | | Performance | | | |
100
+ | | Availability | | | |
101
+ | | Scalability | | | |
102
+ | | Accessibility | | | |
103
+
104
+ **ID** is the requirement's `N-<nn>` row in `_requirements.md`, minted at Step 5D like every other requirement — never a separate `NFR-` sequence.
106
105
 
107
106
  **Prototype Validation Plan** (populated via Step 5G)
108
107
 
@@ -110,13 +109,13 @@ Flows to be clickable, personas covered, and per-flow definition of "validated".
110
109
 
111
110
  **Key Decisions**
112
111
 
113
- | # | Decision | Rationale | Owner | Date |
112
+ | ID | Decision | Rationale | Owner | Date |
114
113
  |---|----------|-----------|-------|------|
115
114
  | | | | | |
116
115
 
117
116
  **Action Items**
118
117
 
119
- | # | Action | Owner | Due Date | Status |
118
+ | ID | Action | Owner | Due Date | Status |
120
119
  |---|--------|-------|----------|--------|
121
120
  | | | | | |
122
121
 
@@ -129,51 +128,57 @@ The agent proposes the process landscape from Session 2 outputs; the user valida
129
128
 
130
129
  ### Step 5A: Propose Main Processes
131
130
 
132
- Read `.planning/discovery/session-02.md` and `.planning/discovery/_context.md`. Propose the main business processes for the to-be state:
131
+ Read `.planning/discovery/session-02.md` (its Notes Template sections) and `.planning/discovery/_processes.md`. Propose the main business processes for the to-be state:
133
132
 
134
133
  ```
135
134
  Based on Session 2, I'm proposing these main processes for the to-be state:
136
135
 
137
- | MP ID | Main Process | Trigger | End State | Primary Actor | Rationale (from S2) |
138
- |-------|--------------|---------|-----------|---------------|---------------------|
139
- | MP-01 | ... | ... | ... | ... | ... |
136
+ | MP ID | Main Process | Replaces (PRC-nn or new) | Trigger | End State | Primary Actor | Rationale (from S2) |
137
+ |-------|--------------|--------------------------|---------|-----------|---------------|---------------------|
138
+ | MP-01 | ... | ... | ... | ... | ... | ... |
140
139
 
141
140
  Validate: accept / edit / add / drop. Then we'll decompose each into sub-processes.
142
141
  ```
143
142
 
144
- Iterate until the user accepts the main-process list, then fill the section titled exactly **Main Process Register** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
143
+ Iterate until the user accepts the main-process list, then write one `MP-<nn>` row per main process to `.planning/discovery/_processes.md` § To-be — **Replaces** is the comma list of `PRC-` rows from § As-is this main process transforms, or `new` — and fill the section titled exactly **Main Process Register** in `.planning/discovery/session-03.md` with the summary line — edit in place; never append a new heading. `_processes.md` was created by Session 2; if it does not exist, create it from the template in `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-processes.md` first.
145
144
 
146
145
  **Text mode fallback:** present numbered options: 1) Accept all / 2) Edit specific process / 3) Add process / 4) Drop process.
147
146
 
148
147
  ### Step 5B: Decompose into Sub-Processes (per main process)
149
148
 
150
- For each accepted main process, propose 3–8 sub-processes and emit a Mermaid flowchart:
149
+ For each accepted main process, propose 3–8 sub-processes and emit a **swimlane**: a Mermaid `flowchart` with one `subgraph` per actor (a Session 2 persona or `System`), so the lane says who does each step:
151
150
 
152
151
  ```mermaid
153
- flowchart TD
154
- Start([Trigger]) --> SP1[Sub-process 1]
155
- SP1 --> D1{Decision}
156
- D1 -->|Yes| SP2[Sub-process 2]
157
- D1 -->|No| SP1_alt[Alternative path]
152
+ flowchart LR
153
+ subgraph Team member
154
+ SP1[Sub-process 1] --> D1{Decision}
155
+ D1 -->|No| SP1_alt[Alternative path]
156
+ end
157
+ subgraph System
158
+ SP2[Sub-process 2]
159
+ end
160
+ D1 -->|Yes| SP2
158
161
  SP2 --> End([End state])
159
162
  ```
160
163
 
161
- Present to the user and iterate until accepted, then fill the section titled exactly **Sub-Process Flows** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
164
+ Present to the user and iterate until accepted, then write it under `### MP-<nn> — <name>` in `.planning/discovery/_processes.md` § Flows, and fill the section titled exactly **Sub-Process Flows** in `.planning/discovery/session-03.md` with what changed — edit in place; never append a new heading. A flowchart without a `subgraph` is refused by `process-check`.
162
165
 
163
166
  ### Step 5C: Step Matrix (per sub-process)
164
167
 
165
- For each accepted sub-process, propose a step-level matrix:
168
+ For each accepted sub-process, propose a step-level matrix in the columns `_processes.md` § Steps fixes:
166
169
 
167
- | # | Step | Actor | UI (screen / component) | Data Objects (C/R/U/D) | Integration | Requirements |
170
+ | # | Step | Actor | UI | Data objects | Integration | Exception | Requirements |
168
171
 
172
+ - **#:** `<mp>.<n>` — `01.3` is the third step of MP-01
169
173
  - **Step:** one imperative verb phrase
170
- - **Actor:** persona from Session 2 or "System"
174
+ - **Actor:** a persona from Session 2's User Personas table, spelled the same, or `System`; two actors are comma-separated — never a slash-joined pair or a parenthetical qualifier
171
175
  - **UI:** screen/component, or `—` if backend-only
172
- - **Data Objects:** entities with CRUD flags (e.g., `Order [C]`)
173
- - **Integration:** external systems with direction
174
- - **Requirements:** leave blank during 5C — back-filled with minted `_requirements.md` IDs during Step 5D consolidation
176
+ - **Data objects:** entities of the product with CRUD flags, `Task [C], Membership [C/R]`, or `—`. Every name is a row of `.planning/discovery/_entities.md` § Entities; add a missing entity there now (Source `S3`, pending cells `—`) — `entity-check` refuses a data object that is not an entity. A file, a pull request or another system's document is not a data object: it goes in **Integration** or the step text
177
+ - **Integration:** external systems with direction, or `—`
178
+ - **Exception:** what happens when the step cannot complete — the error path the build must handle — or `—` when the step cannot fail
179
+ - **Requirements:** `—` during 5C — back-filled with minted `_requirements.md` IDs during Step 5D consolidation
175
180
 
176
- Present one sub-process matrix at a time. After validation, fill the section titled exactly **Step Matrices** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
181
+ Present one sub-process matrix at a time. When a main process's sub-processes are step-sized — each one or two steps — propose one combined matrix for the main process instead, with a **Sub-process** column after `#` only when the user wants the boundary visible; the user may still ask for one matrix per sub-process. Either way the rows are written under `### MP-<nn> — <name>` in `.planning/discovery/_processes.md` § Steps — one matrix per main process, sub-process boundaries as rows. After validation, fill the section titled exactly **Step Matrices** in `.planning/discovery/session-03.md` with what the matrices cannot hold — edit in place; never append a new heading.
177
182
 
178
183
  ### Step 5D: Consolidate Requirements
179
184
 
@@ -192,7 +197,19 @@ Add one row per requirement to the `## Requirements` table — the canonical tab
192
197
 
193
198
  **No ⚠️ markers in requirement cells (D-46):** never place a `⚠️ CONDITIONAL —` marker inside a `_requirements.md` cell — that grammar is closed and fail-loud, so a marker there is already a `rollup --check` parse error. Express a research-dependent requirement the other way round: an `_research.md` row citing it in `Gates what?`.
194
199
 
195
- Back-fill the Requirements column of each Step 5C matrix in `session-03.md` with the minted IDs.
200
+ Back-fill the Requirements column of each Step 5C matrix in `.planning/discovery/_processes.md` § Steps with the minted IDs, then run `pp_run query discovery.process-check --require-cited` — exit 0, or a step still cites nothing (`uncited_step`) or cites an ID that does not exist.
201
+
202
+ ### Step 5D′: Business Rules
203
+
204
+ Walk the step matrices once more for what the system must *enforce* rather than *do*: a validation ("a title is required"), a calculation ("the total is the sum of the lines"), an invariant ("exactly one Lead per team"). Mint one `BR-<nn>` row per rule in `.planning/discovery/_rules.md` (template and grammar: `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-processes.md` § `_rules.md`; create the file from the template when it does not exist):
205
+
206
+ | ID | Rule | Applies to | Checked at | Requirements | Source |
207
+
208
+ - **Applies to:** the entity names (as `_entities.md` spells them) or `MP-`/`PRC-` IDs the rule governs
209
+ - **Checked at:** the layers that enforce it — `UI`, `service`, `DB` — the vault's rule that a check has a named owner
210
+ - **Requirements:** the `_requirements.md` IDs the rule realises; a rule nothing requires is a question for the user, not a row
211
+
212
+ Then run `pp_run query discovery.rules-check` — exit 0, or fix the rows it names.
196
213
 
197
214
  **Roll-up (REQM-04):** after filling rows, run `pp_run query discovery.rollup .planning/discovery/_requirements.md` and replace the content between the `<!-- rollup:auto -->` markers verbatim with the emitted `table`. Never hand-write or hand-edit totals — the block is machine-owned and Session 13's `--check` gate fails on drift.
198
215
 
@@ -202,7 +219,17 @@ Full grammar reference: pp-core `references/discovery-id-conventions.md` (Read l
202
219
 
203
220
  ### Step 5E: EPICs and User Stories
204
221
 
205
- Group sub-processes into EPICs (one EPIC = one main process). Derive user stories from step-matrix rows where the actor is a persona. Link stories to source steps via `source_step` field. Then fill the section titled exactly **EPIC Register** and fill the section titled exactly **User Stories** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
222
+ Group sub-processes into EPICs (one EPIC = one main process). Fill the section titled exactly **EPIC Register** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
223
+
224
+ Derive user stories from step-matrix rows where the actor is a persona and mint one `US-<nn>` row per story in `.planning/discovery/_stories.md` § Stories (template and grammar: `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-build-consumption.md` § `_stories.md`; create the file from the template when it does not exist):
225
+
226
+ | ID | EPIC | Requirements | Story | Acceptance criteria | Source step |
227
+
228
+ - **Requirements:** the `_requirements.md` IDs the story realises — every `MVP` requirement that a persona-actor step cites needs at least one story (`System`-only and `N-`/`T-` rows do not)
229
+ - **Acceptance criteria:** what the user observes when the story is done, written out — never a pointer such as `As in F-01`; the build's verifier reads this cell verbatim as the UAT
230
+ - **Source step:** the matrix rows the story came from, as `MP-nn #<cell>` with the `#` cell copied verbatim (`MP-05 #05.1`), comma-separated when a story spans two steps, or `—`
231
+
232
+ Then run `pp_run query discovery.stories-check` — exit 0, or fix the rows it names (`mvp_requirement_without_story` names a requirement no story covers). Then fill the section titled exactly **User Stories** in `.planning/discovery/session-03.md` with only what the register cannot hold — edit in place; never append a new heading.
206
233
 
207
234
  ### Step 5F: Business Objectives and KPIs
208
235
 
@@ -96,7 +96,7 @@ Read every frontend standard that passes these checks, also one the session's ow
96
96
  | Loading / empty / error states | | | |
97
97
  | Accessibility standard | | | |
98
98
 
99
- **Standard** is a frontend standard's `[vault: <rel path>]` citation, or `not in vault`. **Deviation** is `none` or one line. **Decision** is `—` or the `D-04-<n>` that records the deviation or the decision taken for an uncovered area.
99
+ **Standard** is a frontend standard's `[vault: <rel path>]` citation, or `not in vault`. **Deviation** is `none`, or the `DEV-<nn>` of the row the deviation gets in `.planning/discovery/_deviations.md` (template and grammar: `${PP_TOOLS%/bin/pp-tools.cjs}/references/discovery-standards.md`; create the file on first need). **Decision** is `—` or the `D-04-<n>` that records the deviation or the decision taken for an uncovered area.
100
100
 
101
101
  **Refined Personas**
102
102
 
@@ -120,15 +120,24 @@ Read every frontend standard that passes these checks, also one the session's ow
120
120
  | Primary | | | | |
121
121
  | Secondary | | | | |
122
122
 
123
+ **Content and Communication**
124
+
125
+ | Aspect | Decision | Notes |
126
+ |--------|----------|-------|
127
+ | Tone of voice | | |
128
+ | Notifications and alerts | | |
129
+ | Tooltips, help text and inline guidance | | |
130
+ | Languages | | |
131
+
123
132
  **Key Decisions**
124
133
 
125
- | # | Decision | Rationale | Owner | Date |
134
+ | ID | Decision | Rationale | Owner | Date |
126
135
  |---|----------|-----------|-------|------|
127
136
  | | | | | |
128
137
 
129
138
  **Action Items**
130
139
 
131
- | # | Action | Owner | Due Date | Status |
140
+ | ID | Action | Owner | Due Date | Status |
132
141
  |---|--------|-------|----------|--------|
133
142
  | | | | | |
134
143