@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pp-core",
3
3
  "displayName": "PP Core",
4
- "version": "1.18.0",
4
+ "version": "1.20.0",
5
5
  "description": "PP Core is a meta-prompting, context engineering, and spec-driven development system for AI coding agents.",
6
6
  "author": {
7
7
  "name": "pareto4",
@@ -217,6 +217,7 @@ This agent runs as a background process that makes commits. Operating on the mai
217
217
  The cleanup tail (commit fixes -> remove worktree -> drop recovery sentinel) MUST be **transactional**: either all of (worktree, branch advance, sentinel) end in a clean state, or — if the process is interrupted (system restart, OOM kill) between the last commit and `git worktree remove` — a discoverable recovery sentinel is left behind so a future run, `/pp:resume-work`, or `/pp:progress` can complete the cleanup. The bug fixed by #2839 was that the cleanup tail was non-transactional and silently left orphan worktrees + unmerged branches with no resume marker.
218
218
 
219
219
  ```bash
220
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
220
221
  # Derive worktree path from padded_phase (parsed from config in next step,
221
222
  # but the shell snippet below is illustrative — adapt once config is parsed).
222
223
  # In practice: parse padded_phase from config first, then run:
@@ -458,18 +459,21 @@ Use `pp_run query commit` with conventional format (message first, then every st
458
459
  ```bash
459
460
  _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
460
461
  pp_run query commit \
461
- "fix({padded_phase}): {finding_id} {short_description}" \
462
+ "fix({area}): {finding_id} {short_description}" \
463
+ --phase "{padded_phase}" \
462
464
  --files \
463
465
  {all_modified_files}
464
466
  ```
465
467
 
468
+ `{area}` names the part of the codebase the fix touches (omit `({area})` when no single area fits); the phase goes in the `Phase:` trailer that `--phase` adds, never in the scope.
469
+
466
470
  Examples:
467
- - `fix(02): CR-01 fix SQL injection in auth.py`
468
- - `fix(03): WR-05 add null check before array access`
471
+ - `fix(auth): CR-01 fix SQL injection in auth.py` with trailer `Phase: 02`
472
+ - `fix(dashboard): WR-05 add null check before array access` with trailer `Phase: 03`
469
473
 
470
474
  **Multiple files:** List ALL modified files after the message (space-separated):
471
475
  ```bash
472
- pp_run query commit "fix(02): CR-01 ..." --files \
476
+ pp_run query commit "fix(auth): CR-01 ..." --phase "02" --files \
473
477
  src/api/auth.ts src/types/user.ts tests/auth.test.ts
474
478
  ```
475
479
 
@@ -656,7 +660,7 @@ Fixes are committed **per-finding**. This has operational implications:
656
660
  <success_criteria>
657
661
 
658
662
  - [ ] All in-scope findings attempted (either fixed or skipped with reason)
659
- - [ ] Each fix committed atomically with `fix({padded_phase}): {id} {description}` format
663
+ - [ ] Each fix committed atomically as `fix({area}): {id} {description}` with `--phase "{padded_phase}"` (trailer `Phase: {padded_phase}`)
660
664
  - [ ] All modified files listed after each commit message (multi-file fix support)
661
665
  - [ ] REVIEW-FIX.md created with accurate counts, status, and iteration number
662
666
  - [ ] No source files left in broken state (failed fixes rolled back via git checkout)
@@ -133,6 +133,7 @@ Do NOT invent a heuristic (e.g., HEAD~5) — silent mis-scoping is worse than fa
133
133
 
134
134
  If DIFF_BASE is set, run:
135
135
  ```bash
136
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
136
137
  git diff --name-only ${DIFF_BASE}..HEAD -- . ':!.planning/' ':!ROADMAP.md' ':!STATE.md' ':!*-SUMMARY.md' ':!*-VERIFICATION.md' ':!*-PLAN.md' ':!package-lock.json' ':!yarn.lock' ':!Gemfile.lock' ':!poetry.lock'
137
138
  ```
138
139
 
@@ -114,6 +114,7 @@ Explore the codebase thoroughly for your focus area.
114
114
 
115
115
  **For tech focus:**
116
116
  ```bash
117
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
117
118
  # Package manifests
118
119
  ls package.json requirements.txt Cargo.toml go.mod pyproject.toml 2>/dev/null
119
120
  cat package.json 2>/dev/null | head -100
@@ -128,6 +129,7 @@ grep -r "import.*stripe\|import.*supabase\|import.*aws\|import.*@" src/ --includ
128
129
 
129
130
  **For arch focus:**
130
131
  ```bash
132
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
131
133
  # Directory structure
132
134
  find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | head -50
133
135
 
@@ -140,6 +142,7 @@ grep -r "^import" src/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -10
140
142
 
141
143
  **For quality focus:**
142
144
  ```bash
145
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
143
146
  # Linting/formatting config
144
147
  ls .eslintrc* .prettierrc* eslint.config.* biome.json 2>/dev/null
145
148
  cat .prettierrc 2>/dev/null
@@ -912,6 +912,7 @@ The file IS the debugging brain.
912
912
  **First:** Check for active debug sessions.
913
913
 
914
914
  ```bash
915
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
915
916
  ls .planning/debug/*.md 2>/dev/null | grep -v resolved
916
917
  ```
917
918
 
@@ -1169,7 +1170,7 @@ Root cause: {root_cause}"
1169
1170
 
1170
1171
  Then commit planning docs via CLI (respects `commit_docs` config automatically):
1171
1172
  ```bash
1172
- pp_run query commit "docs: resolve debug {slug}" --files .planning/debug/resolved/{slug}.md
1173
+ pp_run query commit "docs(planning): resolve debug {slug}" --files .planning/debug/resolved/{slug}.md
1173
1174
  ```
1174
1175
 
1175
1176
  **Append to knowledge base:**
@@ -1200,7 +1201,7 @@ Then append the entry:
1200
1201
 
1201
1202
  Commit the knowledge base update alongside the resolved session:
1202
1203
  ```bash
1203
- pp_run query commit "docs: update debug knowledge base with {slug}" --files .planning/debug/knowledge-base.md
1204
+ pp_run query commit "docs(planning): update debug knowledge base with {slug}" --files .planning/debug/knowledge-base.md
1204
1205
  ```
1205
1206
 
1206
1207
  Report completion and offer next steps.
@@ -18,6 +18,8 @@ Spawned by `/pp:execute-phase` orchestrator.
18
18
 
19
19
  Your job: Execute the plan completely, commit each task, create SUMMARY.md, update STATE.md.
20
20
 
21
+ Shell you compose yourself may run under zsh on macOS: start every multi-line command with `[ -z "${ZSH_VERSION:-}" ] || emulate -R sh` and use no GNU-only flags (`grep -P`). Details: `~/.claude/pp-core/references/shell-portability.md`.
22
+
21
23
  @~/.claude/pp-core/references/mandatory-initial-read.md
22
24
  </role>
23
25
 
@@ -381,11 +383,11 @@ When executing task with `tdd="true"`:
381
383
 
382
384
  **1. Check test infrastructure** (if first TDD task): detect project type, install test framework if needed.
383
385
 
384
- **2. RED:** Read `<behavior>`, create test file, write failing tests, run (MUST fail), commit: `test({phase}-{plan}): add failing test for [feature]`
386
+ **2. RED:** Read `<behavior>`, create test file, write failing tests, run (MUST fail), commit: `test({area}): add failing test for [feature]` with the trailer `Phase: {phase}-{plan}`
385
387
 
386
- **3. GREEN:** Read `<implementation>`, write minimal code to pass, run (MUST pass), commit: `feat({phase}-{plan}): implement [feature]`
388
+ **3. GREEN:** Read `<implementation>`, write minimal code to pass, run (MUST pass), commit: `feat({area}): implement [feature]` with the trailer `Phase: {phase}-{plan}`
387
389
 
388
- **4. REFACTOR (if needed):** Clean up, run tests (MUST still pass), commit only if changes: `refactor({phase}-{plan}): clean up [feature]`
390
+ **4. REFACTOR (if needed):** Clean up, run tests (MUST still pass), commit only if changes: `refactor({area}): clean up [feature]` with the trailer `Phase: {phase}-{plan}`
389
391
 
390
392
  **Error handling:** RED doesn't fail ��� investigate. GREEN doesn't pass → debug/iterate. REFACTOR breaks → undo.
391
393
 
@@ -395,7 +397,7 @@ When the plan frontmatter has `type: tdd`, the entire plan follows the RED/GREEN
395
397
 
396
398
  **Fail-fast rule:** If a test passes unexpectedly during the RED phase (before any implementation), STOP. The feature may already exist or the test is not testing what you think. Investigate and fix the test before proceeding to GREEN. Do NOT skip RED by proceeding with a passing test.
397
399
 
398
- **Gate sequence validation:** After completing the plan, verify in git log:
400
+ **Gate sequence validation:** After completing the plan, verify in git log (each commit carrying the trailer `Phase: {phase}-{plan}`):
399
401
  1. A `test(...)` commit exists (RED gate)
400
402
  2. A `feat(...)` commit exists after it (GREEN gate)
401
403
  3. Optionally a `refactor(...)` commit exists after GREEN (REFACTOR gate)
@@ -442,6 +444,7 @@ A prior Bash call may have `cd`'d out of the worktree into the main repo. When t
442
444
  `[ -f .git ]` is false (main repo's `.git` is a directory), silently skipping all worktree guards.
443
445
  Capture the spawn-time toplevel via a sentinel on first commit, then verify on every subsequent commit:
444
446
  ```bash
447
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
445
448
  WT_GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
446
449
  case "$WT_GIT_DIR" in
447
450
  *.git/worktrees/*)
@@ -525,18 +528,22 @@ git add src/types/user.ts
525
528
 
526
529
  **4. Commit:**
527
530
 
531
+ The subject is `{type}({area}): {concise task description}`. `{area}` is a noun naming the part of the codebase the staged files belong to (`auth`, `billing`, `api`), picked from the files you touched; omit `({area})` when no single area fits. Never put the phase or plan number in the scope: the plan goes in the trailer `Phase: {phase}-{plan}`, the last paragraph of the message.
532
+
528
533
  **If `sub_repos` is configured (non-empty array from init context):** Use `commit-to-subrepo` to route files to their correct sub-repo:
529
534
  ```bash
530
- pp_run query commit-to-subrepo "{type}({phase}-{plan}): {concise task description}" --files file1 file2 ...
535
+ pp_run query commit-to-subrepo "{type}({area}): {concise task description}" --phase "{phase}-{plan}" --files file1 file2 ...
531
536
  ```
532
537
  Returns JSON with per-repo commit hashes: `{ committed: true, repos: { "backend": { hash: "abc", files: [...] }, ... } }`. Record all hashes for SUMMARY.
533
538
 
534
539
  **Otherwise (standard single-repo):**
535
540
  ```bash
536
- git commit -m "{type}({phase}-{plan}): {concise task description}
541
+ git commit -m "{type}({area}): {concise task description}
537
542
 
538
543
  - {key change 1}
539
544
  - {key change 2}
545
+
546
+ Phase: {phase}-{plan}
540
547
  "
541
548
  ```
542
549
 
@@ -707,6 +714,7 @@ Do NOT skip. Do NOT proceed to state updates if self-check fails.
707
714
  After SUMMARY.md, update STATE.md using `pp-tools query` state handlers (arguments by name; see `sdk/src/query/QUERY-HANDLERS.md`):
708
715
 
709
716
  ```bash
717
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
710
718
  # Advance plan counter (handles edge cases automatically)
711
719
  pp_run query state.advance-plan
712
720
 
@@ -728,6 +736,7 @@ pp_run query state.record-session \
728
736
  ```
729
737
 
730
738
  ```bash
739
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
731
740
  # Update ROADMAP.md progress for this phase (plan counts, status)
732
741
  pp_run query roadmap.update-plan-progress "${PHASE_NUMBER}"
733
742
 
@@ -757,7 +766,7 @@ pp_run query state.add-blocker --text "Blocker description"
757
766
 
758
767
  <final_commit>
759
768
  ```bash
760
- pp_run query commit "docs({phase}-{plan}): complete [plan-name] plan" --files \
769
+ pp_run query commit "docs(planning): complete [plan-name] plan" --phase "{phase}-{plan}" --files \
761
770
  .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
762
771
  ```
763
772
 
@@ -92,6 +92,7 @@ For each phase, extract what it provides and what it should consume.
92
92
  **From SUMMARYs, extract:**
93
93
 
94
94
  ```bash
95
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
95
96
  # Key exports from each phase
96
97
  for summary in .planning/phases/*/*-SUMMARY.md; do
97
98
  echo "=== $summary ==="
@@ -61,6 +61,12 @@ Before researching, discover project context:
61
61
  | `## Deferred Ideas` | Out of scope — ignore completely |
62
62
 
63
63
  If CONTEXT.md exists, it constrains your research scope. Don't explore alternatives to locked decisions.
64
+
65
+ **`{padded}-DISCOVERY-EXTRACT.md`** (if listed in your files to read) — the Discovery registers' rows
66
+ that cite this phase's requirement IDs. Required reading; Read
67
+ `pp-core/references/planner-discovery-extract.md` § Researcher and follow it. **Never open
68
+ `.planning/discovery/session-NN.md`**: the session files are the facilitation record, not a
69
+ source. Absent file → nothing here applies.
64
70
  </upstream_input>
65
71
 
66
72
  <downstream_consumer>
@@ -531,6 +537,7 @@ Also read `.planning/config.json` — include Validation Architecture section in
531
537
 
532
538
  Then read CONTEXT.md if exists:
533
539
  ```bash
540
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
534
541
  cat "$phase_dir"/*-CONTEXT.md 2>/dev/null
535
542
  ```
536
543
 
@@ -547,6 +554,10 @@ cat "$phase_dir"/*-CONTEXT.md 2>/dev/null
547
554
  - User decided "simple UI, no animations" → don't research animation libraries
548
555
  - Marked as Claude's discretion → research options and recommend
549
556
 
557
+ Then read `$phase_dir`/*-DISCOVERY-EXTRACT.md if it exists (see `<upstream_input>`): list the
558
+ entities, integrations and rules it names under `## User Constraints` as "Discovery facts (by row
559
+ ID)" so the planner sees them beside the locked decisions. Do not open any `session-NN.md`.
560
+
550
561
  ## Step 1.3: Load Graph Context
551
562
 
552
563
  Check for knowledge graph:
@@ -652,6 +663,7 @@ Plans that assume a tool is available without checking lead to silent failures a
652
663
  2. **Probe availability** for each dependency:
653
664
 
654
665
  ```bash
666
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
655
667
  # CLI tools — check if command exists and get version
656
668
  command -v $TOOL 2>/dev/null && $TOOL --version 2>/dev/null | head -1
657
669
 
@@ -781,7 +793,7 @@ Write to: `$PHASE_DIR/$PADDED_PHASE-RESEARCH.md`
781
793
  ## Step 7: Commit Research (optional)
782
794
 
783
795
  ```bash
784
- pp_run query commit "docs($PHASE): research phase domain" --files "$PHASE_DIR/$PADDED_PHASE-RESEARCH.md"
796
+ pp_run query commit "docs(planning): research phase domain" --phase "$PHASE" --files "$PHASE_DIR/$PADDED_PHASE-RESEARCH.md"
785
797
  ```
786
798
 
787
799
  ## Step 8: Return Structured Result
@@ -453,6 +453,7 @@ Skip if: `workflow.nyquist_validation` is explicitly set to `false` in config.js
453
453
  Before running checks 8a-8d, verify VALIDATION.md exists:
454
454
 
455
455
  ```bash
456
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
456
457
  ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null
457
458
  ```
458
459
 
@@ -679,6 +680,7 @@ pp_run query phase.list-artifacts "$phase_number" --type summary
679
680
  Use `pp-tools query` to validate plan structure:
680
681
 
681
682
  ```bash
683
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
682
684
  for plan in "$PHASE_DIR"/*-PLAN.md; do
683
685
  echo "=== $plan ==="
684
686
  PLAN_STRUCTURE=$(pp_run query verify.plan-structure "$plan")
@@ -764,6 +766,7 @@ Inspect `tasks` in the JSON; open the PLAN in the editor for prose-level review.
764
766
  ## Step 6: Verify Dependency Graph
765
767
 
766
768
  ```bash
769
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
767
770
  for plan in "$PHASE_DIR"/*-PLAN.md; do
768
771
  grep "depends_on:" "$plan"
769
772
  done
@@ -362,6 +362,11 @@ Output: [Artifacts created]
362
362
  Its exact shape comes from `pp_run vault standards block`, per `pp-core/references/planner-vault-standards.md`.]
363
363
  </vault_standards>
364
364
 
365
+ <discovery_extract>
366
+ [Present ONLY when a `*-DISCOVERY-EXTRACT.md` is in your files to read — omitted entirely otherwise.
367
+ The file's content verbatim, `<!-- discovery:auto -->` markers included; see <discovery_mode>.]
368
+ </discovery_extract>
369
+
365
370
  <tasks>
366
371
 
367
372
  <task type="auto">
@@ -577,6 +582,13 @@ start of execution when the injected `plan:pre -> into: planner` fragment for
577
582
  the vault capability is present in your context.
578
583
  </vault_standards_mode>
579
584
 
585
+ <discovery_mode>
586
+ See `pp-core/references/planner-discovery-extract.md`. Load this file at the
587
+ start of execution when a `*-DISCOVERY-EXTRACT.md` is listed in your files to
588
+ read: it is required reading, embedded verbatim as `<discovery_extract>`, and
589
+ you never open a `.planning/discovery/session-NN.md`.
590
+ </discovery_mode>
591
+
580
592
  <execution_flow>
581
593
 
582
594
  <step name="load_project_state" priority="first">
@@ -604,6 +616,7 @@ Check the invocation mode and load the relevant reference file:
604
616
  - If `<revision_context>` provided by orchestrator: Read `pp-core/references/planner-revision.md`
605
617
  - If `--reviews` flag present or reviews mode active: Read `pp-core/references/planner-reviews.md`
606
618
  - If the vault capability's `plan:pre` fragment is present: Read `pp-core/references/planner-vault-standards.md`
619
+ - If a `*-DISCOVERY-EXTRACT.md` is in your files to read: Read `pp-core/references/planner-discovery-extract.md`
607
620
  - If task_breakdown identifies TDD candidates or TDD mode is active: Read `pp-core/references/planner-tdd.md`
608
621
  - Standard planning mode: no additional file to read
609
622
 
@@ -615,6 +628,7 @@ instructions for operating in that mode.
615
628
  Check for codebase map:
616
629
 
617
630
  ```bash
631
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
618
632
  ls .planning/codebase/*.md 2>/dev/null
619
633
  ```
620
634
 
@@ -676,6 +690,7 @@ Select top 2-4 phases. Skip phases with no relevance signal.
676
690
 
677
691
  **Step 3 — Read full SUMMARYs for selected phases:**
678
692
  ```bash
693
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
679
694
  cat .planning/phases/{selected-phase}/*-SUMMARY.md
680
695
  ```
681
696
 
@@ -713,6 +728,7 @@ If `features.global_learnings` is `true`: run `pp-tools query learnings.query --
713
728
  Use `phase_dir` from init context (already loaded in load_project_state).
714
729
 
715
730
  ```bash
731
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
716
732
  cat "$phase_dir"/*-CONTEXT.md 2>/dev/null # From /pp:discuss-phase
717
733
  cat "$phase_dir"/*-RESEARCH.md 2>/dev/null # Research output
718
734
  cat "$phase_dir"/*-DISCOVERY.md 2>/dev/null # From mandatory discovery
@@ -809,6 +825,8 @@ Use template structure for each PLAN.md.
809
825
 
810
826
  When the fragment IS present, follow `pp-core/references/planner-vault-standards.md` in full — select documents from the INDEX, read each in full, obtain the block from `pp_run vault standards block` once `files_modified` settles, embed it verbatim after `<context>` and before `<tasks>`, fill only the reason slots, and re-run it on revision.
811
827
 
828
+ **Discovery extract block (only when a `*-DISCOVERY-EXTRACT.md` is in your files to read):** embed the file verbatim as `<discovery_extract>` after `<context>` (and after `<vault_standards>` when present), before `<tasks>`, per `<discovery_mode>`. Absent file → write no block.
829
+
812
830
  **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation.
813
831
 
814
832
  **Write contract (hard rules — must follow):**
@@ -906,7 +924,8 @@ Plans:
906
924
 
907
925
  <step name="git_commit">
908
926
  ```bash
909
- pp_run query commit "docs($PHASE): create phase plan" --files \
927
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
928
+ pp_run query commit "docs(planning): create phase plan" --phase "$PHASE" --files \
910
929
  .planning/phases/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md
911
930
  ```
912
931
  </step>
@@ -152,7 +152,7 @@ The 4 parallel researcher agents write files but do NOT commit. You commit every
152
152
 
153
153
  ```bash
154
154
  _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
155
- pp_run query commit "docs: complete project research" --files .planning/research/
155
+ pp_run query commit "docs(planning): complete project research" --files .planning/research/
156
156
  ```
157
157
 
158
158
  ## Step 8: Return Summary
@@ -79,6 +79,7 @@ If no UI-SPEC exists: audit against abstract 6-pillar standards.
79
79
  **MUST run before any screenshot capture.** Prevents binary files from reaching git history.
80
80
 
81
81
  ```bash
82
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
82
83
  # Ensure directory exists
83
84
  mkdir -p .planning/ui-reviews
84
85
 
@@ -102,6 +102,7 @@ Your UI-SPEC.md is consumed by:
102
102
  **Codebase first:** Always scan the project for existing design decisions before asking.
103
103
 
104
104
  ```bash
105
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
105
106
  # Detect design system
106
107
  ls components.json tailwind.config.* postcss.config.* 2>/dev/null
107
108
 
@@ -236,6 +237,7 @@ Read all files from `<required_reading>` block. Parse:
236
237
  ## Step 2: Scout Existing UI
237
238
 
238
239
  ```bash
240
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
239
241
  # Design system detection
240
242
  ls components.json tailwind.config.* postcss.config.* 2>/dev/null
241
243
 
@@ -287,7 +289,7 @@ This file is the canonical output of this agent. The orchestrator reads `$PHASE_
287
289
 
288
290
  ```bash
289
291
  _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
290
- pp_run query commit "docs($PHASE): UI design contract" --files "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md"
292
+ pp_run query commit "docs(planning): UI design contract" --phase "$PHASE" --files "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md"
291
293
  ```
292
294
 
293
295
  ## Step 7: Return Structured Result
@@ -56,6 +56,8 @@ Forbidden, without exception, even when a finding seems to demand it:
56
56
  **Counts, never a score.** Report counts by verdict in the exact counts line the template shows. A ratio, percentage, letter grade or compliance number is prohibited anywhere in the artifact.
57
57
 
58
58
  A document the executor marked `not read: …` is still judged against the code; record the executor's reason in the row's evidence, because a standard nobody read is worth a reader's attention.
59
+
60
+ **Deviations on file (`deviations[]` in the payload).** A Discovery Sprint records the client's agreed departures from the vault in `.planning/discovery/_deviations.md`; the CLI copies them into the payload (`pp-core/references/discovery-build-consumption.md` § `_deviations.md` read contract). Before writing `FAIL`, check the list: when a deviation whose `standard` names the document and whose `status` is `Approved` covers the clause the code breaks, the verdict is `N-A` with the reason `deviation on file: <id> (<decision>)` — the sponsor chose this departure and the document does not govern that clause here. A deviation in any other status (`Proposed`, `Rejected`, empty) leaves the `FAIL` standing; name the deviation and its status in the reason so the reader sees the gap between what was asked and what was approved. Never coin a verdict for it; `N-A` with that reason is the whole mechanism. An empty `deviations[]` changes nothing.
59
61
  </verdicts>
60
62
 
61
63
  <adversarial_stance>
@@ -14,7 +14,7 @@ color: green
14
14
  <role>
15
15
  A completed phase has been submitted for goal-backward verification. Verify that the phase goal is actually achieved in the codebase — SUMMARY.md claims are not evidence.
16
16
 
17
- Goal-backward verification. Start from what the phase SHOULD deliver, verify it actually exists and works in the codebase.
17
+ Goal-backward verification. Start from what the phase SHOULD deliver; verify it exists and works in the codebase.
18
18
 
19
19
  @~/.claude/pp-core/references/mandatory-initial-read.md
20
20
 
@@ -79,6 +79,7 @@ At verification decision points, reference calibration examples:
79
79
  ## Step 0: Check for Previous Verification
80
80
 
81
81
  ```bash
82
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
82
83
  cat "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null
83
84
  ```
84
85
 
@@ -100,6 +101,7 @@ Set `is_re_verification = false`, proceed with Step 1.
100
101
 
101
102
  ```bash
102
103
  _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
104
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
103
105
  ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
104
106
  ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
105
107
  pp_run query roadmap.get-phase "$PHASE_NUM"
@@ -123,6 +125,7 @@ Parse the `success_criteria` array from the JSON output. These are the **roadmap
123
125
  **Step 2b: Load PLAN frontmatter must-haves (if present)**
124
126
 
125
127
  ```bash
128
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
126
129
  grep -l "must_haves:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
127
130
  ```
128
131
 
@@ -185,7 +188,7 @@ For each truth, determine if codebase enables it.
185
188
  - ✗ FAILED: One or more artifacts missing, stub, or unwired
186
189
  - ? UNCERTAIN: Can't verify programmatically (needs human)
187
190
 
188
- **Behavior-dependent truths.** A truth is *behavior-dependent* when its correctness hinges on runtime behavior grep/presence checks cannot see — a **state transition** or a **cancellation / cleanup / ordering invariant** (e.g. "cancels the in-flight task and bumps the generation counter", "resets the busy flag on abort", "rolls back on failure"). For these, symbol presence + wiring is *necessary but not sufficient*: the code can be present and wired yet still leak state on the very path the invariant covers.
191
+ **Behavior-dependent truths.** A truth is *behavior-dependent* when its correctness hinges on runtime behavior grep/presence checks cannot see — a **state transition** or a **cancellation / cleanup / ordering invariant** (e.g. "cancels the in-flight task and bumps the generation counter", "rolls back on failure"). For these, symbol presence + wiring is *necessary but not sufficient*: code can be present and wired yet leak state on the very path the invariant covers.
189
192
 
190
193
  For each truth:
191
194
 
@@ -397,6 +400,7 @@ Status: WIRED (state displayed) | NOT_WIRED (state exists, not rendered)
397
400
  **6a. Extract requirement IDs from PLAN frontmatter:**
398
401
 
399
402
  ```bash
403
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
400
404
  grep -A5 "^requirements:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
401
405
  ```
402
406
 
@@ -420,11 +424,14 @@ grep -E "Phase $PHASE_NUM" .planning/REQUIREMENTS.md 2>/dev/null
420
424
 
421
425
  If REQUIREMENTS.md maps additional IDs to this phase that don't appear in ANY plan's `requirements` field, flag as **ORPHANED** — these requirements were expected but no plan claimed them. ORPHANED requirements MUST appear in the verification report.
422
426
 
427
+ **6d. Discovery conformance (R3):** if `.planning/discovery/` exists, Read and follow `~/.claude/pp-core/references/verifier-discovery-conformance.md`; a `missed` row is a gap.
428
+
423
429
  ## Step 7: Scan for Anti-Patterns
424
430
 
425
431
  Identify files modified in this phase from SUMMARY.md key-files section, or extract commits and verify:
426
432
 
427
433
  ```bash
434
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
428
435
  # Option 1: Extract from SUMMARY frontmatter
429
436
  SUMMARY_FILES=$(pp_run query summary-extract "$PHASE_DIR"/*-SUMMARY.md --fields key-files)
430
437
 
@@ -468,13 +475,14 @@ Anti-pattern scanning (Step 7) checks for code smells. Behavioral spot-checks go
468
475
 
469
476
  **When to run:** For phases that produce runnable code (APIs, CLI tools, build scripts, data pipelines). Skip for documentation-only or config-only phases.
470
477
 
471
- **Behavioral evidence for behavior-dependent truths (Step 3).** When a truth asserts a state transition or a cancellation/cleanup/ordering invariant, the single named test below is what upgrades it from ⚠️ PRESENT_BEHAVIOR_UNVERIFIED to ✓ VERIFIED. Run only the one named test that exercises the transition/invariant — never the full suite (per #25/#753). If no such test exists, leave the truth ⚠️ PRESENT_BEHAVIOR_UNVERIFIED and route it to human verification (Step 8); do not mark it VERIFIED on presence.
478
+ **Behavioral evidence for behavior-dependent truths (Step 3).** For a state transition or a cancellation/cleanup/ordering invariant, the single named test below is what upgrades the truth from ⚠️ PRESENT_BEHAVIOR_UNVERIFIED to ✓ VERIFIED. Run only that one test — never the full suite (per #25/#753). No such test → leave it ⚠️ PRESENT_BEHAVIOR_UNVERIFIED and route it to human verification (Step 8); never VERIFIED on presence.
472
479
 
473
480
  **How:**
474
481
 
475
482
  1. **Identify checkable behaviors** from must-haves truths. Select 2-4 that can be tested with a single command:
476
483
 
477
484
  ```bash
485
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
478
486
  # API endpoint returns non-empty data
479
487
  curl -s http://localhost:$PORT/api/$ENDPOINT 2>/dev/null | node -e "let b='';process.stdin.setEncoding('utf8');process.stdin.on('data',c=>b+=c);process.stdin.on('end',()=>{const d=JSON.parse(b);process.exit(Array.isArray(d)?(d.length>0?0:1):(Object.keys(d).length>0?0:1))})"
480
488
 
@@ -523,6 +531,7 @@ SUMMARY.md probe pass claims are not evidence. If a phase declares or implies pr
523
531
  **Probe discovery:**
524
532
 
525
533
  ```bash
534
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
526
535
  # Conventional project probes
527
536
  find scripts -path '*/tests/probe-*.sh' -type f 2>/dev/null | sort
528
537
 
@@ -537,6 +546,7 @@ grep -R -n -E 'probe-[^[:space:]]+\.sh|scripts/.*/tests/probe-.*\.sh' "$PHASE_DI
537
546
  3. Run each probe from the built `PROBES` list (declared + conventional) from the repository root:
538
547
 
539
548
  ```bash
549
+ [ -z "${ZSH_VERSION:-}" ] || emulate -R sh
540
550
  PP_GATE_BIN=$(printf '%s\n' "${PP_TOOLS:+${PP_TOOLS%/*}:}$PATH" | tr : '\n' | while IFS= read -r d; do if [ -r "$d/portable-timeout.sh" ]; then printf %s "$d"; break; fi; done)
541
551
  if [ ! -r "$PP_GATE_BIN/portable-timeout.sh" ]; then echo "✗ probes NEVER RAN — portable-timeout.sh not found beside pp-tools"; else . "$PP_GATE_BIN/portable-timeout.sh"; fi
542
552
  for probe in "${PROBES[@]}"; do
@@ -559,7 +569,7 @@ done
559
569
 
560
570
  **Needs human if uncertain:** Complex wiring grep can't trace, dynamic state behavior, edge cases.
561
571
 
562
- **Behavior-unverified truths (Step 3):** Every truth left ⚠️ PRESENT_BEHAVIOR_UNVERIFIED is recorded in the `behavior_unverified_items` frontmatter list (emitted whenever the count > 0, regardless of overall status, so it survives a gaps_found phase) and surfaces for human verification; when the overall status is human_needed it also appears in the human_verification section. Phrase each item around the invariant: what to trigger, what state must hold afterward, and why presence checks can't see it.
572
+ **Behavior-unverified truths (Step 3):** every ⚠️ PRESENT_BEHAVIOR_UNVERIFIED truth is recorded in the `behavior_unverified_items` frontmatter list (emitted whenever the count > 0, regardless of overall status, so it survives a gaps_found phase) and surfaces for human verification — also in the human_verification section when the status is human_needed. Phrase each item around the invariant: what to trigger, what state must hold afterward, why presence checks can't see it.
563
573
 
564
574
  **Harvest deferred items from PLAN.md (#3309 / `workflow.human_verify_mode = end-of-phase`):** Scan every PLAN file in the phase for `<verify><human-check>` blocks on `auto` tasks. These are verification items the planner deliberately deferred from `checkpoint:human-verify` to end-of-phase to avoid the executor cold-start cost. Each block has the same shape used by the planner:
565
575
 
@@ -573,7 +583,7 @@ done
573
583
  </verify>
574
584
  ```
575
585
 
576
- Merge those harvested items into the same human verification list as your own analysis. Deduplicate when the planner-deferred item and your own analysis describe the same check. The downstream `human_needed` → `{phase_num}-UAT.md` path in `workflows/execute-phase.md` is the single sink — no separate file is created.
586
+ Merge the harvested items into your own human verification list, deduplicating items that describe the same check. The downstream `human_needed` → `{phase_num}-UAT.md` path in `workflows/execute-phase.md` is the single sink — no separate file is created.
577
587
 
578
588
  **Format:**
579
589
 
@@ -589,7 +599,7 @@ Merge those harvested items into the same human verification list as your own an
589
599
 
590
600
  Classify status using this decision tree IN ORDER (most restrictive first):
591
601
 
592
- 1. IF any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, or blocker anti-pattern found:
602
+ 1. IF any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, blocker anti-pattern found, or Discovery conformance row `missed` (Step 6d):
593
603
  → **status: gaps_found**
594
604
 
595
605
  2. IF Step 8 produced ANY human verification items (section is non-empty) — this includes every ⚠️ PRESENT_BEHAVIOR_UNVERIFIED truth from Step 3:
@@ -599,11 +609,11 @@ Classify status using this decision tree IN ORDER (most restrictive first):
599
609
  3. IF all truths VERIFIED, all artifacts pass, all links WIRED, no blockers, AND no human verification items:
600
610
  → **status: passed**
601
611
 
602
- **passed is ONLY valid when the human verification section is empty.** If Step 8 produced any items — including any truth left ⚠️ PRESENT_BEHAVIOR_UNVERIFIED — the status is not `passed`: it is `human_needed`, or `gaps_found` when rule 1 also fires (the ordered tree keeps gaps_found's precedence).
612
+ **passed is ONLY valid when the human verification section is empty.** If Step 8 produced any items — including any ⚠️ PRESENT_BEHAVIOR_UNVERIFIED truth — the status is not `passed`: it is `human_needed`, or `gaps_found` when rule 1 also fires (gaps_found keeps precedence).
603
613
 
604
- **A ⚠️ PRESENT_BEHAVIOR_UNVERIFIED truth is never FAILED and never VERIFIED.** It does not trigger gaps_found (the code is present and wired) and is not counted as verified (behavior unexercised). On its own it routes to human_needed; when a higher-precedence gaps_found also applies, the status stays gaps_found and the item is preserved in the always-on `behavior_unverified_items` list so it is never lost. Either way it stays a *per-truth* state — the overall-status vocabulary is unchanged, with no new status value.
614
+ **A ⚠️ PRESENT_BEHAVIOR_UNVERIFIED truth is never FAILED and never VERIFIED.** It does not trigger gaps_found (present and wired) and is not counted as verified (behavior unexercised). Alone it routes to human_needed; under a higher-precedence gaps_found the status stays gaps_found and the item is preserved in the always-on `behavior_unverified_items` list. It stays a *per-truth* state — the overall-status vocabulary is unchanged, with no new status value.
605
615
 
606
- > **Shared status seam**: the status vocabulary (`passed`, `gaps_found`, `human_needed`) and the per-status routing (next action and next command for each value) are owned by `src/verification.cts` via `pp-tools query verification.status`. This agent is the single emitter of the frontmatter status field; consumers (ship.md, execute-phase.md) read routing from that query instead of re-deriving it.
616
+ > **Shared status seam**: the status vocabulary (`passed`, `gaps_found`, `human_needed`) and the per-status routing are owned by `src/verification.cts` via `pp-tools query verification.status`. This agent is the single emitter of the frontmatter status field; consumers (ship.md, execute-phase.md) read routing from that query instead of re-deriving it.
607
617
 
608
618
  **Score (presence- vs behavior-verified split):**
609
619
 
@@ -821,6 +831,8 @@ Only include this section if deferred items exist (from Step 9b).
821
831
  | Requirement | Source Plan | Description | Status | Evidence |
822
832
  | ----------- | ---------- | ----------- | ------ | -------- |
823
833
 
834
+ {Step 6d block, when produced: `### Discovery conformance` + the filled `<!-- discovery:conformance -->` block}
835
+
824
836
  ### Anti-Patterns Found
825
837
 
826
838
  | File | Line | Pattern | Severity | Impact |
@@ -877,7 +889,7 @@ Automated checks passed. Awaiting human verification.
877
889
 
878
890
  <critical_rules>
879
891
 
880
- **DO NOT trust SUMMARY claims.** Verify the component actually renders messages, not a placeholder.
892
+ **DO NOT trust SUMMARY claims.** Verify the component renders messages, not a placeholder.
881
893
 
882
894
  **DO NOT assume existence = implementation.** Need level 2 (substantive), level 3 (wired), and level 4 (data flowing) for artifacts that render dynamic data.
883
895
 
@@ -22,7 +22,7 @@ Generate unit and E2E tests for a completed phase, using its SUMMARY.md, CONTEXT
22
22
 
23
23
  Analyzes implementation files, classifies them into TDD (unit), E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
24
24
 
25
- Output: Test files committed with message `test(phase-{N}): add unit and E2E tests from add-tests command`
25
+ Output: Test files committed with message `test({area}): add unit and E2E tests from add-tests command` and the trailer `Phase: {N}`
26
26
  </objective>
27
27
 
28
28
  <execution_context>