@pareto4/pp-core 1.21.1 → 1.23.1

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 (136) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/bin/install.js +205 -28
  3. package/commands/pp-help.md +2 -1
  4. package/gemini-extension.json +1 -1
  5. package/hooks/dist/pp-check-update-worker.js +1 -1
  6. package/hooks/dist/pp-context-monitor.js +3 -3
  7. package/hooks/dist/pp-statusline.js +88 -14
  8. package/hooks/dist/pp-update-banner.js +44 -4
  9. package/hooks/dist/pp-workflow-guard.js +3 -3
  10. package/hooks/pp-check-update-worker.js +1 -1
  11. package/hooks/pp-context-monitor.js +3 -3
  12. package/hooks/pp-statusline.js +88 -14
  13. package/hooks/pp-update-banner.js +44 -4
  14. package/hooks/pp-workflow-guard.js +3 -3
  15. package/package.json +2 -2
  16. package/pp-core/bin/lib/audience-command.cjs +271 -0
  17. package/pp-core/bin/lib/audience.cjs +293 -0
  18. package/pp-core/bin/lib/commands.cjs +26 -17
  19. package/pp-core/bin/lib/discovery-charter.cjs +13 -1
  20. package/pp-core/bin/lib/discovery-flow-page.cjs +191 -0
  21. package/pp-core/bin/lib/discovery-for-phase.cjs +33 -5
  22. package/pp-core/bin/lib/discovery-input-check.cjs +11 -11
  23. package/pp-core/bin/lib/discovery-processes.cjs +97 -4
  24. package/pp-core/bin/lib/discovery-session-check.cjs +7 -7
  25. package/pp-core/bin/lib/discovery-status.cjs +419 -0
  26. package/pp-core/bin/lib/discovery-stories.cjs +36 -5
  27. package/pp-core/bin/lib/discovery-tests.cjs +398 -0
  28. package/pp-core/bin/lib/explain-command.cjs +48 -0
  29. package/pp-core/bin/lib/gate-card.cjs +97 -0
  30. package/pp-core/bin/lib/hook-messages.cjs +132 -0
  31. package/pp-core/bin/lib/init-contract.cjs +116 -76
  32. package/pp-core/bin/lib/init-interactive.cjs +110 -49
  33. package/pp-core/bin/lib/init.cjs +44 -3
  34. package/pp-core/bin/lib/io.cjs +38 -0
  35. package/pp-core/bin/lib/message-labels.cjs +75 -0
  36. package/pp-core/bin/lib/messages/core.cjs +20 -0
  37. package/pp-core/bin/lib/messages/discovery.cjs +267 -0
  38. package/pp-core/bin/lib/messages/gate.cjs +257 -0
  39. package/pp-core/bin/lib/messages/hook.cjs +114 -0
  40. package/pp-core/bin/lib/messages/init.cjs +513 -0
  41. package/pp-core/bin/lib/messages/progress.cjs +110 -0
  42. package/pp-core/bin/lib/messages.cjs +208 -0
  43. package/pp-core/bin/lib/vault-command-router.cjs +16 -3
  44. package/pp-core/bin/lib/violation-render.cjs +78 -0
  45. package/pp-core/bin/pp-tools.cjs +92 -23
  46. package/pp-core/bin/shared/config-schema.manifest.json +1 -0
  47. package/pp-core/references/audience-moments.md +119 -0
  48. package/pp-core/references/audience.md +114 -0
  49. package/pp-core/references/discovery-build-consumption.md +5 -2
  50. package/pp-core/references/discovery-charter.md +2 -2
  51. package/pp-core/references/discovery-id-conventions.md +1 -1
  52. package/pp-core/references/discovery-processes.md +31 -7
  53. package/pp-core/references/discovery-session-output.md +1 -1
  54. package/pp-core/references/discovery-tests.md +186 -0
  55. package/pp-core/templates/project-charter.md +3 -4
  56. package/pp-core/workflows/add-phase.md +2 -0
  57. package/pp-core/workflows/add-tests.md +2 -0
  58. package/pp-core/workflows/add-todo.md +2 -0
  59. package/pp-core/workflows/ai-integration-phase.md +2 -0
  60. package/pp-core/workflows/audit-milestone.md +2 -0
  61. package/pp-core/workflows/autonomous.md +2 -0
  62. package/pp-core/workflows/check-todos.md +2 -0
  63. package/pp-core/workflows/code-review-fix.md +2 -0
  64. package/pp-core/workflows/code-review.md +2 -0
  65. package/pp-core/workflows/complete-milestone.md +10 -1
  66. package/pp-core/workflows/discovery-sprint/charter.md +3 -2
  67. package/pp-core/workflows/discovery-sprint/prefill.md +3 -0
  68. package/pp-core/workflows/discovery-sprint/prototype.md +14 -0
  69. package/pp-core/workflows/discovery-sprint/session-13-gates.md +2 -0
  70. package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +4 -1
  71. package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +135 -76
  72. package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +94 -64
  73. package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +3 -2
  74. package/pp-core/workflows/discovery-sprint/vault-context.md +15 -0
  75. package/pp-core/workflows/discovery-sprint.md +16 -2
  76. package/pp-core/workflows/discovery-to-build/steps/handoff-gates.md +16 -9
  77. package/pp-core/workflows/discovery-to-build/templates/discovery-references.md +1 -1
  78. package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +9 -1
  79. package/pp-core/workflows/discovery-to-build.md +10 -4
  80. package/pp-core/workflows/discuss-phase/discovery.md +2 -2
  81. package/pp-core/workflows/discuss-phase-assumptions.md +2 -0
  82. package/pp-core/workflows/discuss-phase.md +1 -1
  83. package/pp-core/workflows/edit-phase.md +2 -0
  84. package/pp-core/workflows/eval-review.md +2 -0
  85. package/pp-core/workflows/execute-phase/steps/check-query-gate.md +25 -1
  86. package/pp-core/workflows/execute-phase/steps/vault-fetch.md +1 -0
  87. package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +2 -0
  88. package/pp-core/workflows/execute-phase.md +1 -1
  89. package/pp-core/workflows/execute-plan.md +2 -0
  90. package/pp-core/workflows/extract-learnings.md +2 -0
  91. package/pp-core/workflows/help/modes/business.md +56 -0
  92. package/pp-core/workflows/help.md +12 -2
  93. package/pp-core/workflows/import.md +10 -1
  94. package/pp-core/workflows/ingest-docs.md +2 -0
  95. package/pp-core/workflows/init.md +17 -1
  96. package/pp-core/workflows/insert-phase.md +2 -0
  97. package/pp-core/workflows/list-workspaces.md +2 -0
  98. package/pp-core/workflows/manager.md +2 -0
  99. package/pp-core/workflows/map-codebase.md +2 -0
  100. package/pp-core/workflows/milestone-summary.md +2 -0
  101. package/pp-core/workflows/new-milestone.md +10 -1
  102. package/pp-core/workflows/new-project.md +12 -2
  103. package/pp-core/workflows/new-workspace.md +2 -0
  104. package/pp-core/workflows/next.md +8 -0
  105. package/pp-core/workflows/plan-milestone-gaps.md +10 -1
  106. package/pp-core/workflows/plan-phase.md +2 -1
  107. package/pp-core/workflows/plan-review-convergence.md +1 -1
  108. package/pp-core/workflows/progress.md +10 -0
  109. package/pp-core/workflows/quick.md +11 -1
  110. package/pp-core/workflows/remove-phase.md +2 -0
  111. package/pp-core/workflows/remove-workspace.md +2 -0
  112. package/pp-core/workflows/resume-project.md +25 -0
  113. package/pp-core/workflows/review.md +2 -0
  114. package/pp-core/workflows/scan.md +2 -0
  115. package/pp-core/workflows/secure-phase.md +2 -0
  116. package/pp-core/workflows/settings.md +41 -0
  117. package/pp-core/workflows/ship.md +2 -0
  118. package/pp-core/workflows/spec-phase.md +1 -1
  119. package/pp-core/workflows/ui-phase.md +2 -0
  120. package/pp-core/workflows/ui-review.md +2 -0
  121. package/pp-core/workflows/ultraplan-phase.md +2 -0
  122. package/pp-core/workflows/validate-phase.md +2 -0
  123. package/pp-core/workflows/vault-review.md +2 -0
  124. package/pp-core/workflows/verify-phase.md +2 -0
  125. package/pp-core/workflows/verify-work.md +2 -0
  126. package/scripts/affected-tests-lib.cjs +26 -12
  127. package/scripts/ci-release-only.cjs +158 -0
  128. package/scripts/live-runs/driver.cjs +326 -0
  129. package/scripts/live-runs/run.cjs +906 -0
  130. package/scripts/live-runs/scenarios.cjs +326 -0
  131. package/scripts/live-runs/scratch-project.cjs +132 -0
  132. package/scripts/live-runs/scrub.cjs +291 -0
  133. package/scripts/live-runs/turn-guard.cjs +107 -0
  134. package/scripts/live-runs/walk-setup.cjs +198 -0
  135. package/scripts/run-tests.cjs +151 -132
  136. package/scripts/test-env.cjs +64 -0
@@ -25,6 +25,8 @@ INIT=$(pp_run query init.plan-phase "$PHASE")
25
25
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
26
26
  ```
27
27
 
28
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
29
+
28
30
  Parse JSON for: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_context`, `has_research`, `commit_docs`.
29
31
 
30
32
  **File paths:** `state_path`, `roadmap_path`, `requirements_path`, `context_path`.
@@ -22,6 +22,8 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
22
22
  AGENT_SKILLS_CHECKER=$(pp_run query agent-skills pp-integration-checker)
23
23
  ```
24
24
 
25
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
26
+
25
27
  Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`.
26
28
 
27
29
  Resolve integration checker model:
@@ -81,6 +81,8 @@ INIT=$(pp_run query init.milestone-op)
81
81
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
82
82
  ```
83
83
 
84
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
85
+
84
86
  If `PLAN_STRATEGY` is `converge`, fail fast unless the existing convergence feature gate is enabled:
85
87
 
86
88
  ```bash
@@ -17,6 +17,8 @@ INIT=$(pp_run query init.todos)
17
17
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
18
18
  ```
19
19
 
20
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
21
+
20
22
  Extract from init JSON: `todo_count`, `todos`, `pending_dir`.
21
23
 
22
24
  If `todo_count` is 0:
@@ -25,6 +25,8 @@ AGENT_SKILLS_FIXER=$(pp_run query agent-skills pp-code-fixer)
25
25
  AGENT_SKILLS_REVIEWER=$(pp_run query agent-skills pp-code-reviewer)
26
26
  ```
27
27
 
28
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
29
+
28
30
  Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
29
31
 
30
32
  **Input sanitization (defense-in-depth):**
@@ -27,6 +27,8 @@ AGENT_SKILLS_REVIEWER=$(pp_run query agent-skills pp-code-reviewer)
27
27
  echo "pp-core engine: ${PP_TOOLS} (VERSION: $(cat "${PP_TOOLS%/bin/*}/VERSION" 2>/dev/null || echo 'no VERSION file - running from a source tree'))"
28
28
  ```
29
29
 
30
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
31
+
30
32
  Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
31
33
 
32
34
  **Input sanitization (defense-in-depth):**
@@ -41,11 +41,17 @@ When a milestone completes:
41
41
 
42
42
  <process>
43
43
 
44
+ ```bash
45
+ _PP_SHIM_NAME="pp-tools.cjs"; _pp_root() { ( for _v in $(env | sed -n 's/^\(GIT_[A-Za-z0-9_]*\)=.*/\1/p'); do unset "$_v"; done; _c=$(git rev-parse --git-common-dir 2>/dev/null); if [ "${_c##*/}" = .git ] && cd "$_c/.." 2>/dev/null; then pwd -P; else git rev-parse --show-toplevel 2>/dev/null || pwd; fi ); }; pp_run() { case "$PP_TOOLS" in *.cjs) node "$PP_TOOLS" "$@";; *) "$PP_TOOLS" "$@";; esac; }; _PP_RUNTIME_ROOT="${RUNTIME_DIR:-$(_pp_root)}"; PP_TOOLS="${_PP_RUNTIME_ROOT}/pp-core/bin/${_PP_SHIM_NAME}"; if [ -f "$PP_TOOLS" ]; then :; elif [ -f "${_PP_RUNTIME_ROOT}/.claude/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${_PP_RUNTIME_ROOT}/.claude/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${_PP_RUNTIME_ROOT}/.codex/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${_PP_RUNTIME_ROOT}/.codex/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${HERMES_HOME:-$HOME/.hermes}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CODEX_HOME:-$HOME/.codex}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CODEX_HOME:-$HOME/.codex}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/pp-core/bin/${_PP_SHIM_NAME}"; elif command -v pp-tools >/dev/null 2>&1; then PP_TOOLS="$(command -v pp-tools)"; else echo "ERROR: pp-tools.cjs not found at $PP_TOOLS and pp-tools is not on PATH. Run: npx -y @pareto4/pp-core@latest --claude --local" >&2; exit 1; fi; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${PP_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${PP_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
46
+ pp_run query audience fields
47
+ ```
48
+
49
+ **Audience, before any question:** run the block above. If it prints `pp-tools.cjs not found`, show that error and stop. If it exits non-zero for any other reason, tell the person the audience setting could not be read (show the error) and continue; if it prints JSON, apply the **Audience** line below to it now.
50
+
44
51
  <step name="pre_close_artifact_audit">
45
52
  Before proceeding with milestone close, run the comprehensive open artifact audit.
46
53
 
47
54
  ```bash
48
- _PP_SHIM_NAME="pp-tools.cjs"; _pp_root() { ( for _v in $(env | sed -n 's/^\(GIT_[A-Za-z0-9_]*\)=.*/\1/p'); do unset "$_v"; done; _c=$(git rev-parse --git-common-dir 2>/dev/null); if [ "${_c##*/}" = .git ] && cd "$_c/.." 2>/dev/null; then pwd -P; else git rev-parse --show-toplevel 2>/dev/null || pwd; fi ); }; pp_run() { case "$PP_TOOLS" in *.cjs) node "$PP_TOOLS" "$@";; *) "$PP_TOOLS" "$@";; esac; }; _PP_RUNTIME_ROOT="${RUNTIME_DIR:-$(_pp_root)}"; PP_TOOLS="${_PP_RUNTIME_ROOT}/pp-core/bin/${_PP_SHIM_NAME}"; if [ -f "$PP_TOOLS" ]; then :; elif [ -f "${_PP_RUNTIME_ROOT}/.claude/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${_PP_RUNTIME_ROOT}/.claude/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${_PP_RUNTIME_ROOT}/.codex/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${_PP_RUNTIME_ROOT}/.codex/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${HERMES_HOME:-$HOME/.hermes}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CODEX_HOME:-$HOME/.codex}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CODEX_HOME:-$HOME/.codex}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/pp-core/bin/${_PP_SHIM_NAME}"; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/pp-core/bin/${_PP_SHIM_NAME}"; elif command -v pp-tools >/dev/null 2>&1; then PP_TOOLS="$(command -v pp-tools)"; else echo "ERROR: pp-tools.cjs not found at $PP_TOOLS and pp-tools is not on PATH. Run: npx -y @pareto4/pp-core@latest --claude --local" >&2; exit 1; fi; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${PP_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${PP_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
49
55
  pp_run query audit-open
50
56
  ```
51
57
 
@@ -590,10 +596,13 @@ Check branching strategy and offer merge options.
590
596
  Use `init milestone-op` for context, or load config directly:
591
597
 
592
598
  ```bash
599
+ command -v pp_run >/dev/null 2>&1 || { echo "ERROR: pp_run is not on PATH; prepend the resolver line from the top block to this block and run it again" >&2; exit 1; }
593
600
  INIT=$(pp_run query init.execute-phase "1")
594
601
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
595
602
  ```
596
603
 
604
+ **Audience:** if `audience` is set, Read and follow `{audience_ref}`. Reply in any `response_language` and pass it to subagents; code and paths stay as is.
605
+
597
606
  Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_template`, and `commit_docs` from init JSON.
598
607
 
599
608
  Detect base branch:
@@ -20,7 +20,7 @@ Resolve once, record in the frontmatter `language` field:
20
20
 
21
21
  1. Session 1 § Sprint Logistics, row **Charter language** (a BCP-47 code: `nl`, `en`, `nl-BE`).
22
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).
23
+ 3. Else English (`en`). A Dutch conversation does not make the charter Dutch; only rung 1 or 2 does.
24
24
 
25
25
  Render headings, labels and prose in that language — the reference carries the English and Dutch
26
26
  headings; translate others yourself. Never translate the `<!-- charter:<key> -->` comments, the
@@ -49,7 +49,7 @@ Runs after the cross-reference (Step 0f) and before the topics, so topic 2 revie
49
49
  record them — and fill § 16 with what is already known: `⚠️ CONDITIONAL` sections (from each
50
50
  session's `conditional:` frontmatter), open `Gates-MVP` rows of `_research.md`, and every
51
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`
52
+ `None identified in Discovery.` in the charter language. **Redo of Session 13:** when `session-13.md`
53
53
  already carries a filled Go / No-Go Assessment and Open Items Register from an earlier run, copy them
54
54
  now as § Finish steps 1–2 describe — the check compares against them once the overall cell is
55
55
  filled, and an empty § 17 would then be a fault, not a draft.
@@ -112,3 +112,4 @@ are renderings, regenerated every time the markdown changes and never edited by
112
112
  use the name it lists.
113
113
  2. When a skill is not installed, say so once, write `export: skipped (<skill> unavailable)` into the
114
114
  Change cell of the current § 20 row, and continue. A missing renderer never blocks the sprint.
115
+ 3. **What the rendering shows (every audience, D-13).** The .docx and .pdf differ from the markdown in three places, at render time only: the requirement counts line (the one carrying `<!-- charter:counts -->`) is written in words — "<n> <area> requirements" per registered prefix, using the area names from the prefix registry, then "<n> dropped" — never the prefix codes; the `**Source files:**` footer is left out; every open item ID `OI-<n>` is written "open item <n>". The markdown keeps all three as they are, because `charter-check` reads them; never edit the markdown to match the rendering.
@@ -93,6 +93,9 @@ Offer to pre-fill the next session mapped in the README (`AskUserQuestion`;
93
93
  **text mode fallback:** numbered list — 1) Pre-fill session M next / 2) Done
94
94
  for now). When done, tell the user that each pre-filled session is run live
95
95
  later as a confirmation walk (`/pp-discovery N`), and stop.
96
+ For a business user (D-14), close with this instead:
97
+
98
+ Business form: "I prepared session {N} from your documents. It still needs you: type `/pp-discovery {N}` and we will go through the answers together."
96
99
 
97
100
  Before drafting session M, re-enter § 4 of `vault-context.md` with `SESSION_ARG`
98
101
  set to M — the guards, the fetch and the gate already ran once for this
@@ -253,3 +253,17 @@ Gaps: <untagged elements / styling gaps, or "none">
253
253
  Next recommended session: Session 5 — Application & Integration Architecture
254
254
  Run /pp-discovery 5 to continue.
255
255
  ```
256
+
257
+ For a business user (D-14), show this instead — no paths and no element counts:
258
+
259
+ Business form:
260
+
261
+ ```
262
+ Prototype — round <k> done
263
+
264
+ Built: <n> screens and <m> clickable flows
265
+ On screen: <r> of the <t> planned requirements (<x> not yet)
266
+ Your feedback: <y> changes to requirements, <z> screen decisions
267
+
268
+ Next: session 5, how the application connects to other systems. Type /pp-discovery 5 to continue.
269
+ ```
@@ -25,6 +25,8 @@ documented absent-artifact arm — before the cross-reference analysis begins.
25
25
 
26
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
27
 
28
+ **Test-register gate (Session 9):** run `pp_run query discovery.tests-check`. Exit 0 → proceed. Non-zero → a section or table header of `_tests.md` is off the template, a main process of `_processes.md` § To-be has no risk row or two, a rating is outside `high`/`medium`/`low`, a risk does not follow from its impact and likelihood by the matrix, a high-risk process has no end-to-end test and no `D-09-<n>` saying why, an end-to-end row names no role, an unknown role or no test data, a focus-area subject is malformed, repeated or unknown to its source, a story of `_stories.md` has no acceptance row or two, a `Testable` cell is outside `yes`/`amended (D-09-<n>)`/`open (A-09-<n>)`, or a cited requirement does not exist — fix the named rows and re-run. The gate reports: an `open` story and a focus area without requirements are not faults here; the handoff adds `--require-complete` and hard-blocks on them, so close their actions before the charter is signed. An artifact that does not exist exits 0 by itself. Fault vocabulary: `references/discovery-tests.md`.
29
+
28
30
  **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
31
 
30
32
  **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`.
@@ -52,6 +52,9 @@
52
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)
53
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)
54
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
55
+ - For a business user (`audience` is `business`, D-14): choose the prefix set yourself from topic 3's stakeholder domains plus the two defaults and check it against the reserved list above without showing that list, the check command or its code. Ask only:
56
+ Business form: "I will number the requirements by area: {areas}, plus quality needs and technical needs. Does that split work for you?"
57
+ Record the confirmed set exactly as the bullets above say.
55
58
  - 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
56
59
 
57
60
  8. **Approval routes**
@@ -92,7 +95,7 @@ The business problem or opportunity, what was tried before and with what result,
92
95
  | Decision recording and communication | |
93
96
  | Charter language | |
94
97
 
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.
98
+ **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 English.
96
99
 
97
100
  **Working Agreement**
98
101
 
@@ -5,47 +5,49 @@
5
5
 
6
6
  ### Session 3: Business Requirements & Future State (To-Be)
7
7
 
8
- **Goal:** Define target-state business objectives, establish MVP scope, identify EPICs and user stories, and capture functional and non-functional requirements using a process-first decomposition approach.
8
+ **Goal:** Agree what the application is for, identify every process it supports, refine each process step by step — sub-processes, a swimlane diagram iterated with the room, a step matrix — until the processes cover the whole application, then derive the requirements, business rules and user stories from those steps.
9
9
 
10
10
  **Special Protocol — Process-First (required for Session 3):**
11
- This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at the end of this file). The agent proposes the main-process landscape derived from Session 2 outputs; the user validates; then sub-processes are decomposed with step matrices; requirements are derived from validated steps (not collected from a blank template).
11
+ This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at the end of this file). It starts from the application's goal, inventories every process the application supports, and refines one process at a time; requirements and stories are derived from validated steps (not collected from a blank template).
12
12
 
13
13
  **What We Cover:**
14
14
 
15
- 1. **Business objectives and success metrics**
16
- *Why it matters: gives the roadmap (Session 11) and go/no-go (Session 13) an objective yardstick. Skip when: objectives were already locked in Session 1's business vision.*
17
- - What are the measurable business outcomes this initiative must achieve?
18
- - How will we measure success? What KPIs will be tracked?
19
- - What is the expected ROI or business case?
20
- - Are there specific targets (e.g., reduce processing time by 50%)?
15
+ 1. **Application goal and business objectives**
16
+ *Why it matters: the goal is the yardstick for the process inventory — a process that serves no part of it is out of scope, a part of it no process serves is a gap. Skip when: never; with Session 1's vision on file this is a confirmation.*
17
+ - In one or two sentences: what is this application for, and for whom?
18
+ - What are the measurable business outcomes it must achieve, and how will we measure them (KPIs, targets)?
21
19
  - **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
22
20
 
23
- 2. **MVP scope definition**
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.*
25
- - What is the minimum set of capabilities needed to deliver value?
26
- - What can be deferred to a later release without jeopardizing the business case?
27
- - How do we differentiate "must-have" from "nice-to-have"?
28
- - What is the target go-live date for MVP? [needs-business-input]
21
+ 2. **Process inventory — every process the application supports**
22
+ *Why it matters: what is not in a process is not in the stories, the requirements, the tests or the build. The inventory is complete when every user, every piece of data and every connection has a process that handles it. Skip when: never.*
23
+ - Starting from the goal and Session 2's as-is processes: which business processes does the application run?
24
+ - Then sweep for the processes a business view forgets: user and role management, onboarding and set-up, configuration and reference data, notifications, scheduled and batch jobs, reporting and exports, archiving and deletion, incoming and outgoing integrations.
25
+ - Check coverage: does every persona have a process, does every entity have a process that creates it and one that ends its life, does every external system have a process that uses it?
29
26
 
30
- 3. **EPICs and high-level features** (derived from process decomposition)
31
- *Why it matters: EPICs are the units Session 11 sequences into sprints. Skip when: derived directly from Session 2 pain points with no new discussion needed.*
32
- - What are the major feature areas (EPICs) that compose the solution?
33
- - How do EPICs relate to the pain points identified in Session 2?
34
- - What is the relative priority of each EPIC?
27
+ 3. **Process refinement — one process at a time**
28
+ *Why it matters: a process the room has walked step by step, on a diagram, is a process the build can implement and the testers can test end to end. Skip when: never — every main process is refined.*
29
+ - Which sub-processes does it consist of, and which steps make up each one?
30
+ - Who does each step — which persona, or the system? What happens when a step cannot complete?
31
+ - Walk the swimlane diagram with the room and change it until they recognise their work in it.
35
32
 
36
- 4. **User stories and acceptance criteria** (derived from step matrices)
37
- *Why it matters: acceptance criteria are what QA (Session 9) and UAT (Session 13) will test against. Skip when: only doing high-level EPIC planning this round, not story-level detail.*
38
- - For highest-priority EPICs, what are the key user stories?
39
- - What does "done" look like for each story (acceptance criteria)?
40
- - Are there edge cases or exception flows to account for?
41
-
42
- 5. **Functional requirements** (derived from step matrices)
33
+ 4. **Functional requirements and business rules** (derived from the step matrices)
43
34
  *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.*
44
- - What specific functions must the system perform?
35
+ - What specific functions must the system perform at each step?
45
36
  - 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
46
37
  - What reporting or analytics capabilities are needed?
47
38
 
48
- 6. **Non-functional requirements**
39
+ 5. **EPICs, user stories and acceptance criteria** (derived from the steps)
40
+ *Why it matters: every story is tied to the step it came from and every step a person performs has a story, so the stories cover the processes; acceptance criteria are what QA (Session 9) and UAT (Session 13) test against. Skip when: only doing high-level EPIC planning this round, not story-level detail.*
41
+ - For each step a persona performs: what does that person want, and what do they observe when it is done?
42
+ - Are there edge cases or exception flows (the matrix's `Exception` column) that need their own criteria?
43
+
44
+ 6. **MVP scope definition**
45
+ *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.*
46
+ - Which processes, sub-processes and steps are needed to deliver value first?
47
+ - What can be deferred to a later release without jeopardizing the business case?
48
+ - What is the target go-live date for MVP? [needs-business-input]
49
+
50
+ 7. **Non-functional requirements**
49
51
  *Why it matters: NFRs drive infrastructure sizing (Session 10) and architecture tradeoffs (Session 5). Skip when: standard defaults apply and the client has no unusual NFR targets.*
50
52
  - What are the performance expectations (response time, throughput)?
51
53
  - What availability and uptime targets apply (e.g., 99.9%)?
@@ -54,17 +56,29 @@ This session uses the **Session 3: Process-First Protocol** (Steps 5A–5G, at t
54
56
 
55
57
  **Notes Template:**
56
58
 
57
- **Main Process Register** (populated via process-first decomposition Step 5A)
59
+ **Application Goal**
60
+
61
+ The goal statement as the room agreed it, in one or two sentences, and where it differs from Session 1's business vision.
62
+
63
+ **Main Process Register** (populated via the process inventory, Step 5B)
58
64
 
59
65
  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.
60
66
 
61
- **Sub-Process Flows** (populated via Step 5B)
67
+ **Process Coverage** (populated via Step 5B, re-checked at Step 5F)
68
+
69
+ | Dimension | Item | Covered by | Notes |
70
+ |-----------|------|------------|-------|
71
+ | | | | |
62
72
 
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.
73
+ One row per persona, entity, external system and scheduled job the sweep looked at: **Dimension** is `Persona`, `Entity`, `Integration` or `Scheduled job`; **Covered by** is the `MP-nn` (or `MP-nn.k`) that handles it, or `gap — D-03-<n>` when the room decided it is out of scope.
74
+
75
+ **Sub-Process Flows** (populated via Step 5C)
76
+
77
+ One swimlane per main process in `.planning/discovery/_processes.md` § Flows — a Mermaid `flowchart` with one `subgraph` per actor and every step node labelled with its `#`; its sub-processes in § Sub-processes. Record here only which flows the room changed during the iterations, and why.
64
78
 
65
79
  **Step Matrices** (populated via Step 5C)
66
80
 
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.
81
+ One combined matrix per main process in `.planning/discovery/_processes.md` § Steps, with the **Exception** column; the § Sub-processes table groups its rows, every row in exactly one sub-process (Step 5C); Requirements column back-filled at Step 5D. Record here only what the matrices cannot hold.
68
82
 
69
83
  **Business Objectives**
70
84
 
@@ -90,7 +104,7 @@ Orphan-requirement and uncovered-step flags only — the canonical requirements
90
104
 
91
105
  **User Stories** (populated via Step 5E)
92
106
 
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.
107
+ One row per story in `.planning/discovery/_stories.md` § Stories — `ID | EPIC | Requirements | Story | Acceptance criteria | Source step` (`references/discovery-build-consumption.md`), every story tied to its source step and every persona step covered by a story; the build's verifier reads the acceptance criteria from there. Record here only what the register cannot hold.
94
108
 
95
109
  **Non-Functional Requirements**
96
110
 
@@ -124,61 +138,101 @@ Flows to be clickable, personas covered, and per-flow definition of "validated".
124
138
  ## Session 3: Process-First Protocol
125
139
 
126
140
  **This protocol replaces the generic Step 5 topic loop for Session 3 only.**
127
- The agent proposes the process landscape from Session 2 outputs; the user validates; requirements are derived from validated process steps (not collected separately).
141
+ Goal first, then the full process inventory, then one process at a time — sub-processes, swimlane, step matrix — until the processes cover the application; requirements, rules and stories are derived from the validated steps (not collected separately). `_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. If it has no `## Sub-processes` section (an engagement that predates it), add the section with its table header between `## To-be` and `## Flows` now.
128
142
 
129
- ### Step 5A: Propose Main Processes
143
+ ### Step 5A: Application Goal and Objectives
130
144
 
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:
145
+ Read Session 1's business vision and Session 2's pain points. Propose the application goal in one or two sentences — what the application is for and for whom — and the business objectives with a measurable KPI each:
132
146
 
133
147
  ```
134
- Based on Session 2, I'm proposing these main processes for the to-be state:
148
+ Based on Sessions 1 and 2, I propose this goal for the application:
149
+
150
+ <goal statement>
135
151
 
136
- | MP ID | Main Process | Replaces (PRC-nn or new) | Trigger | End State | Primary Actor | Rationale (from S2) |
137
- |-------|--------------|--------------------------|---------|-----------|---------------|---------------------|
138
- | MP-01 | ... | ... | ... | ... | ... | ... |
152
+ | ID | Objective | Success Metric / KPI | Target Value | Priority |
153
+ |----|-----------|---------------------|--------------|----------|
154
+ | BO-01 | ... | ... | ... | ... |
139
155
 
140
- Validate: accept / edit / add / drop. Then we'll decompose each into sub-processes.
156
+ Validate: accept / edit. The process inventory is measured against this goal.
141
157
  ```
142
158
 
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.
159
+ Iterate until the room accepts both, then fill the section titled exactly **Application Goal** and the section titled exactly **Business Objectives** in `.planning/discovery/session-03.md` — edit in place; never append a new heading. Run the glossary sweep (topic 1) before moving on.
144
160
 
145
- **Text mode fallback:** present numbered options: 1) Accept all / 2) Edit specific process / 3) Add process / 4) Drop process.
161
+ ### Step 5B: Process Inventory
162
+
163
+ Read `.planning/discovery/session-02.md` (its Notes Template sections), `.planning/discovery/_processes.md` § As-is and `.planning/discovery/_entities.md`. Propose **every** main process the application supports — the business processes that replace Session 2's as-is processes, and the supporting processes a business view forgets:
164
+
165
+ - user and role management, onboarding and set-up;
166
+ - configuration and reference data;
167
+ - notifications and reminders;
168
+ - scheduled and batch jobs (`System` as primary actor);
169
+ - reporting, exports and audits;
170
+ - archiving, retention and deletion;
171
+ - every incoming and outgoing exchange with another system.
146
172
 
147
- ### Step 5B: Decompose into Sub-Processes (per main process)
148
-
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:
150
-
151
- ```mermaid
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
161
- SP2 --> End([End state])
162
173
  ```
174
+ For the goal "<goal>", I'm proposing these main processes:
175
+
176
+ | MP ID | Main Process | Replaces (PRC-nn or new) | Trigger | End State | Primary Actor | Serves (goal / BO-nn) |
177
+ |-------|--------------|--------------------------|---------|-----------|---------------|-----------------------|
178
+ | MP-01 | ... | ... | ... | ... | ... | ... |
163
179
 
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`.
180
+ Validate: accept / edit / add / drop.
181
+ ```
165
182
 
166
- ### Step 5C: Step Matrix (per sub-process)
183
+ Then run the **coverage sweep** with the room and fill the section titled exactly **Process Coverage** in `.planning/discovery/session-03.md` — one row per item, edit in place; never append a new heading:
167
184
 
168
- For each accepted sub-process, propose a step-level matrix in the columns `_processes.md` § Steps fixes:
185
+ - every persona of Session 2's User Personas table has at least one process;
186
+ - every entity of `_entities.md` has a process that creates it and one that ends its life (closes, archives or deletes it);
187
+ - every external system of Session 2's Systems Landscape that stays has a process that uses it;
188
+ - every recurring job the business mentioned has a process.
169
189
 
170
- | # | Step | Actor | UI | Data objects | Integration | Exception | Requirements |
190
+ An item no process covers is either a new main process or a decision `D-03-<n>` that it is out of scope. Iterate until the room accepts the 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. A process found later in the session is added the same way; nothing is renumbered.
171
191
 
172
- - **#:** `<mp>.<n>` — `01.3` is the third step of MP-01
173
- - **Step:** one imperative verb phrase
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
175
- - **UI:** screen/component, or `—` if backend-only
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
192
+ **Text mode fallback:** present numbered options: 1) Accept all / 2) Edit specific process / 3) Add process / 4) Drop process.
180
193
 
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.
194
+ ### Step 5C: Refine Each Process — Sub-processes, Swimlane, Steps
195
+
196
+ Take the main processes one at a time, in the order the room prefers (usually the core business process first). For each:
197
+
198
+ 1. **Sub-processes.** Propose the 2–8 sub-processes it consists of, each a named stretch of work with its own outcome (`MP-01.1 Register the request`, `MP-01.2 Approve`). Even a short process has one.
199
+ 2. **Swimlane.** Emit a Mermaid `flowchart` with one `subgraph` per actor (a Session 2 persona or `System`), so the lane says who does each step. Every step is a node whose label starts with its `#` (`01.3`); decisions and end states need none:
200
+
201
+ ```mermaid
202
+ flowchart LR
203
+ subgraph Team member
204
+ S1["01.1 Create task"] --> D1{Complete?}
205
+ D1 -->|No| S2["01.2 Add missing details"]
206
+ S2 --> D1
207
+ end
208
+ subgraph System
209
+ S3["01.3 Notify assignee"]
210
+ end
211
+ D1 -->|Yes| S3
212
+ S3 --> End([Task assigned])
213
+ ```
214
+
215
+ 3. **Show it and iterate.** Write the draft under `### MP-<nn> — <name>` in `.planning/discovery/_processes.md` § Flows at once — the register holds every round, nothing is kept in the conversation only — and let the room see it drawn:
216
+ - **Viewing.** A terminal does not draw Mermaid. Render the process with `pp_run query discovery.flow-page MP-<nn>` — it writes `.planning/discovery/_flows/MP-<nn>.html` from the register (swimlane, sub-processes, steps). When your runtime can publish an artifact (Claude Code's Artifact tool), publish that file as a private artifact and give the room the link; after every round re-run the command and publish **the same file path** again, so the link stays the same and a refresh shows the new version. The page is generated — publish it as written, never edit it. `flow-page` renders and checks nothing, so it has no Session 13 gate; `process-check` is the check. Without an artifact tool, open `_processes.md` in a Mermaid-capable viewer (VS Code with a Mermaid preview, or GitHub).
217
+ - **Consent, once per engagement.** Publishing puts the client's process on claude.ai (private to the publisher until shared). Before the first publish, ask whether that is acceptable and record the answer as a Key Decision `D-03-<n>`; if not, use the local viewer. Add `.planning/discovery/_flows/` to the project's `.gitignore` — the pages are derived.
218
+ - **Stop for review — every round.** After publishing (or, without an artifact tool, after writing the draft), **stop and end your turn**: give the link, list the sub-processes and the open questions you have about the diagram (a missing step, a lane you were unsure of, a `No` branch with no path, a step that cannot fail), and ask the room to review it. Do not write the step matrix, do not start the next process and do not propose the next round until the user answers. Their answer is the review: free text, no menu.
219
+ - **Each round.** Apply exactly what the room said — a step missing, in the wrong lane, in the wrong order, a `No` branch or a failure path — by editing the draft in place; re-render, republish to the same file path, and stop again with the same review request. Expect two or three rounds for a core process. Only an explicit acceptance ("accepted", "looks right", "next") ends the loop; then continue with the step matrix below. A flowchart without a `subgraph` is refused by `process-check`.
220
+ 4. **Step matrix.** Turn the accepted diagram into the matrix in the columns `_processes.md` § Steps fixes — one row per numbered node, written under `### MP-<nn> — <name>` in § Steps, one combined matrix per main process:
221
+
222
+ | # | Step | Actor | UI | Data objects | Integration | Exception | Requirements |
223
+
224
+ - **#:** `<mp>.<n>` — `01.3` is the third step of MP-01, the same number the diagram shows
225
+ - **Step:** one imperative verb phrase
226
+ - **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
227
+ - **UI:** screen/component, or `—` if backend-only
228
+ - **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
229
+ - **Integration:** external systems with direction, or `—`
230
+ - **Exception:** what happens when the step cannot complete — the error path the build must handle — or `—` when the step cannot fail
231
+ - **Requirements:** `—` during 5C — back-filled with minted `_requirements.md` IDs during Step 5D consolidation
232
+ 5. **Sub-process rows.** Write one row per sub-process to `.planning/discovery/_processes.md` § Sub-processes — `| MP-01.2 | Approve | 01.4, 01.5, 01.6 |` — listing its steps by `#`. Every step belongs to exactly one sub-process.
233
+ 6. **Check the process.** Run `pp_run query discovery.process-check` — exit 0, or fix what it names before the next process: `step_not_in_flow` (a matrix row the diagram does not show — add the node or drop the row), `step_without_subprocess`, `step_in_two_subprocesses`, `subprocess_without_steps`. A data object it accepts may still be refused by `entity-check`.
234
+
235
+ After the last process, fill the section titled exactly **Sub-Process Flows** and the section titled exactly **Step Matrices** in `.planning/discovery/session-03.md` with what changed during the iterations and what the matrices cannot hold — edit in place; never append a new heading.
182
236
 
183
237
  ### Step 5D: Consolidate Requirements
184
238
 
@@ -221,19 +275,24 @@ Full grammar reference: pp-core `references/discovery-id-conventions.md` (Read l
221
275
 
222
276
  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
277
 
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):
278
+ Walk the step matrices process by process and derive the user stories from the rows where the actor is a persona — every such row that realises an MVP requirement gets at least one story, and every story names the steps it came from. 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
279
 
226
280
  | ID | EPIC | Requirements | Story | Acceptance criteria | Source step |
227
281
 
228
282
  - **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
283
  - **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 `—`
284
+ - **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 — never `—`: a story no step needs points at a step the inventory missed
285
+
286
+ Then run `pp_run query discovery.stories-check` — exit 0, or fix the rows it names: `step_without_story` names a persona step no story covers, `no_source_step` a story tied to no step, `mvp_requirement_without_story` 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.
231
287
 
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.
288
+ ### Step 5F: Coverage Review
233
289
 
234
- ### Step 5F: Business Objectives and KPIs
290
+ Before closing, check that the processes cover the application and the stories cover the processes:
235
291
 
236
- Cover measurable outcomes and KPIs per main process. Link each KPI to `MP-XX` IDs. Then fill the section titled exactly **Business Objectives** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
292
+ 1. Re-read the **Process Coverage** table against the final process list: every row names a process that exists (`MP-nn` or `MP-nn.k`) or a decision. Add a row for any persona, entity or system the session introduced after Step 5B.
293
+ 2. Run `pp_run query discovery.process-check --require-cited`, `pp_run query discovery.stories-check` and `pp_run query discovery.rules-check` — each exits 0, or fix the rows they name.
294
+ 3. Read the application goal once more: is there a part of it no process serves? That is a missing process (back to Step 5B) or a decision to narrow the goal.
295
+ 4. Settle the MVP boundary (topic 6) per process and sub-process, then fill the section titled exactly **MVP Scope Boundary** in `.planning/discovery/session-03.md` — edit in place; never append a new heading.
237
296
 
238
297
  ### Step 5G: Prototype Validation Plan
239
298