@pareto4/pp-core 1.12.0 → 1.13.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 (81) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/pp-code-reviewer.md +1 -1
  3. package/agents/pp-executor.md +2 -13
  4. package/agents/pp-planner.md +1 -1
  5. package/agents/pp-vault-reviewer.md +51 -0
  6. package/commands/pp-ns-review.md +2 -1
  7. package/commands/pp-vault-review.md +33 -0
  8. package/gemini-extension.json +1 -1
  9. package/package.json +1 -1
  10. package/pp-core/bin/lib/capability-activation.cjs +19 -9
  11. package/pp-core/bin/lib/capability-registry.cjs +200 -10
  12. package/pp-core/bin/lib/check-command-router.cjs +1242 -37
  13. package/pp-core/bin/lib/clusters.cjs +1 -0
  14. package/pp-core/bin/lib/command-aliases.cjs +7 -0
  15. package/pp-core/bin/lib/compose-bindings.cjs +41 -27
  16. package/pp-core/bin/lib/config-loader.cjs +151 -8
  17. package/pp-core/bin/lib/decisions.cjs +104 -27
  18. package/pp-core/bin/lib/dispatch-plan.cjs +12 -1
  19. package/pp-core/bin/lib/frontmatter.cjs +37 -0
  20. package/pp-core/bin/lib/git-base-branch.cjs +136 -10
  21. package/pp-core/bin/lib/init-contract.cjs +180 -66
  22. package/pp-core/bin/lib/init-interactive.cjs +4 -20
  23. package/pp-core/bin/lib/loop-gates.cjs +213 -0
  24. package/pp-core/bin/lib/loop-resolver.cjs +111 -35
  25. package/pp-core/bin/lib/org-profile.cjs +218 -44
  26. package/pp-core/bin/lib/phase-command-router.cjs +7 -1
  27. package/pp-core/bin/lib/phase-manifest.cjs +527 -0
  28. package/pp-core/bin/lib/phase-tier.cjs +15 -2
  29. package/pp-core/bin/lib/phase.cjs +51 -1
  30. package/pp-core/bin/lib/vault-audit.cjs +2070 -0
  31. package/pp-core/bin/lib/vault-command-router.cjs +460 -1
  32. package/pp-core/bin/lib/vault-practices.cjs +1142 -104
  33. package/pp-core/bin/lib/vault-review.cjs +2359 -0
  34. package/pp-core/bin/lib/vault-trace.cjs +2831 -0
  35. package/pp-core/bin/lib/vault-update.cjs +266 -0
  36. package/pp-core/bin/lib/vault-write-back.cjs +19 -0
  37. package/pp-core/bin/lib/vault.cjs +313 -11
  38. package/pp-core/bin/pp-tools.cjs +30 -13
  39. package/pp-core/bin/shared/model-catalog.json +2 -1
  40. package/pp-core/references/executor-vault-trace.md +47 -0
  41. package/pp-core/references/loop-hook-dispatch.md +20 -2
  42. package/pp-core/references/planner-vault-practices.md +46 -1
  43. package/pp-core/references/planning-config.md +1 -1
  44. package/pp-core/templates/practices/README.md +140 -11
  45. package/pp-core/templates/project-charter.md +226 -0
  46. package/pp-core/workflows/add-tests.md +4 -0
  47. package/pp-core/workflows/audit-fix.md +2 -0
  48. package/pp-core/workflows/audit-milestone.md +1 -1
  49. package/pp-core/workflows/autonomous.md +3 -3
  50. package/pp-core/workflows/check-todos.md +1 -1
  51. package/pp-core/workflows/code-review-fix.md +3 -1
  52. package/pp-core/workflows/code-review.md +1 -1
  53. package/pp-core/workflows/debug.md +4 -0
  54. package/pp-core/workflows/discovery-sprint/prefill.md +9 -0
  55. package/pp-core/workflows/discovery-sprint/prototype.md +2 -1
  56. package/pp-core/workflows/discovery-sprint/vault-fetch.md +37 -0
  57. package/pp-core/workflows/discovery-sprint.md +1 -1
  58. package/pp-core/workflows/discovery-to-build.md +1 -1
  59. package/pp-core/workflows/discuss-phase.md +2 -2
  60. package/pp-core/workflows/execute-phase/steps/serial-group-dispatch.md +1 -0
  61. package/pp-core/workflows/execute-phase/steps/vault-door-gate.md +19 -0
  62. package/pp-core/workflows/execute-phase/steps/vault-fetch.md +1 -1
  63. package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +10 -8
  64. package/pp-core/workflows/execute-phase.md +29 -12
  65. package/pp-core/workflows/execute-plan.md +4 -0
  66. package/pp-core/workflows/fast.md +4 -0
  67. package/pp-core/workflows/help/modes/full.md +3 -2
  68. package/pp-core/workflows/init.md +2 -2
  69. package/pp-core/workflows/new-project.md +1 -1
  70. package/pp-core/workflows/plan-phase/steps/phase-tier.md +9 -0
  71. package/pp-core/workflows/plan-phase.md +13 -10
  72. package/pp-core/workflows/quick.md +5 -1
  73. package/pp-core/workflows/secure-phase.md +1 -1
  74. package/pp-core/workflows/ship.md +7 -3
  75. package/pp-core/workflows/undo.md +1 -1
  76. package/pp-core/workflows/validate-phase.md +5 -1
  77. package/pp-core/workflows/vault-review.md +65 -0
  78. package/pp-core/workflows/verify-work.md +6 -3
  79. package/scripts/gen-capability-registry.cjs +11 -0
  80. package/scripts/lint-test-file-count.allowlist.json +10 -1
  81. package/scripts/prompt-injection-scan.sh +2 -0
@@ -53,7 +53,7 @@ Applies at the `write_phase_prompt` step.
53
53
 
54
54
  **Vault practices block (only when the vault-practices capability is active):** This whole subsection applies ONLY when the injected `plan:pre -> into: planner` fragment for vault-practices is present in your context — i.e. `vault.enabled` AND `vault.practices_enabled` are both true for this project. When that fragment is absent, do nothing described here: write no `<vault_practices>` block at all, and this PLAN.md stays byte-identical to a plan produced without the capability.
55
55
 
56
- When the fragment IS present: for EACH plan, after that plan's `files_modified` list is finalized and BEFORE calling Write on that plan's PLAN.md, run `pp-tools vault practices match <files_modified...> --block` as an ordinary Bash action against that plan's own files — this call happens in-turn, mid-planning, not before planning starts (the CLI genuinely cannot run any earlier, since `files_modified` does not exist yet at `plan:pre` time).
56
+ When the fragment IS present: for EACH plan, after that plan's `files_modified` list is finalized and BEFORE calling Write on that plan's PLAN.md, run `pp_run vault practices match <files_modified...> --block` as an ordinary Bash action against that plan's own files — this call happens in-turn, mid-planning, not before planning starts (the CLI genuinely cannot run any earlier, since `files_modified` does not exist yet at `plan:pre` time).
57
57
 
58
58
  **Embed that command's output VERBATIM as the plan's `<vault_practices>` block — byte for byte, from `<vault_practices>` to `</vault_practices>`.** Do not rename a field, re-order an entry, add or move a fence marker, re-wrap, summarise, or omit anything. The CLI already emits the finished block in the exact shape `docs/practices-format.md` defines: the opening notice, the scoped and global groups, the documented field names, and the whole-entry external-content fencing. It ALWAYS includes every practice the matcher returns with `scope: global`, labeled global — that is now guaranteed by the command rather than left to a plan-time judgement call (D-03), and it is never yours to drop one. It also emits the correct degraded one-line state on its own when there is nothing to show, so the block is never silently absent.
59
59
 
@@ -65,3 +65,48 @@ Write the block using exactly one of these three degraded one-line states — ve
65
65
  - Matcher ran, zero matched AND zero global practices returned: `Practices checked — none apply to this plan's files.` (D-13)
66
66
  - Matcher ran, no practices directory found in any fetched vault tier: `Practices checked — none found in the vault.` (D-14)
67
67
  - The matcher CLI call itself failed: planning continues regardless — this is advisory, not a blocker, mirroring the vault fetch step's own skip-on-error discipline — and the block carries `Practices could not be checked: <reason>.` (D-15)
68
+
69
+ ### Frontmatter trace ledger — after the plan graph, then fill
70
+
71
+ **When:** last. Write the plans, run `pp_run query phase-plan-index "$PHASE"`, write back each plan's
72
+ computed `wave` / `serial_group`, and apply any `merge_candidates` merge FIRST (`planner-plan-graph.md`).
73
+ A merge changes a plan's `files_modified` and its identifier, and the ledger's subject list and practice
74
+ set are derived from exactly those, so a ledger written before the plan graph settled describes a
75
+ different plan. Only then, for each final plan, re-run the `--block` match if its `files_modified`
76
+ changed, and add the ledger.
77
+
78
+ **What to run:** `pp_run vault trace scaffold --stage plan --plan <plan-id> <files_modified...>`. Put the
79
+ returned block in that plan's **frontmatter**, under its top-level `vault:` key, exactly as emitted —
80
+ after `title:`, `wave`, `serial_group` and `chain_reason`, the same verbatim discipline the body block
81
+ gets. A later `pp_run frontmatter set` on the plan keeps the ledger's lines as they are.
82
+
83
+ **The `<plan-id>` is not free-form.** The plan identifier must be the plan's phase-and-number identifier, exactly the prefix of its artifact filename (for example 04-02), not a bare plan number, a task label or a slug. The command refuses any other shape outright rather than emitting a block you would have to redo.
84
+
85
+ **What you fill, and only this:** per practice entry, the `status`, a one-line `reason`, and `tasks` —
86
+ the task ids in this plan the practice is expected to govern. **The pin and the practice list are not
87
+ yours to write.** Never type a `ref`, a `resolvedSha` or a digest, and never re-derive, re-order or trim
88
+ the practice list: those are the fields the command exists to produce.
89
+
90
+ **The three status words** are the existing vocabulary and are never re-coined:
91
+ - `applied` — the practice governs the work and will be followed.
92
+ - `not-applicable` — the practice was considered and ruled out for this plan.
93
+ - `deviated` — the practice loses to something that outranks it, and the `reason` says to what.
94
+
95
+ **A ruled-out practice gets a line, not silence.** A practice you considered and set aside is recorded
96
+ `not-applicable` **with its reason**. That auditable ruled-out set is the point of the ledger: an
97
+ omitted entry and a never-considered one look the same to every later reader.
98
+
99
+ **The ledger and the body block have different jobs.** The `vault:` ledger is the **audit record**: our
100
+ keys, our values, one bounded client-authored token (the practice `id`), and **no client prose** — YAML
101
+ has no fence, so practice text copied into frontmatter has left the fence. The `<vault_practices>` body
102
+ block is the **reference content** the executor re-anchors against per task; it **keeps its fences**.
103
+
104
+ **Degraded or absent vault:** the ledger is still obtained and embedded, carrying the degraded state and
105
+ its reason — a degraded run must leave an artifact that says so, not one indistinguishable from a
106
+ project that was never vault-enabled. The three degraded one-line states above still govern the body
107
+ block. The `override` field is always `null`; it is never yours to write.
108
+
109
+ **Re-run rule:** if a plan-checker revision or `plan_bounce` later changes that plan's `files_modified`,
110
+ re-run the scaffold and replace the block, exactly as the body block is re-run.
111
+
112
+ **Shape:** `docs/vault-trace-format.md` is the contract for the block's fields — read the shape there.
@@ -277,7 +277,7 @@ Set via `workflow.*` namespace in config.json (e.g., `"workflow": { "research":
277
277
 
278
278
  ### Phase Fields
279
279
 
280
- Set via `phase.*` namespace in config.json. The tier is a preset over the eight `workflow.*` gate booleans (`research`, `pattern_mapper`, `plan_check`, `verifier`, `nyquist_validation`, `code_review`, `post_planning_gaps`, `security_enforcement`); an explicit `false` for one of them still wins.
280
+ Set via `phase.*` namespace in config.json. The tier is a preset over the nine `workflow.*` gate booleans (`research`, `pattern_mapper`, `plan_check`, `verifier`, `nyquist_validation`, `code_review`, `post_planning_gaps`, `security_enforcement`, `vault_review`); an explicit `false` for one of them still wins.
281
281
 
282
282
  | Key | Type | Default | Allowed Values | Description |
283
283
  |-----|------|---------|----------------|-------------|
@@ -21,14 +21,23 @@ folder and has two parts:
21
21
  frontmatter. This is what a person (or an AI agent quoting the practice
22
22
  back to a person) reads.
23
23
 
24
- A malformed practice file is never treated as a fatal error. If a file is
25
- missing a required field, or a field has an unrecognized value, it is simply
24
+ When practices are gathered for planning, a malformed file is not fatal. If a
25
+ file is missing a required field, or a field has an unrecognized value, it is
26
26
  skipped with a plain-English warning explaining what was wrong — the rest of
27
- your practices still load normally.
27
+ your practices still load normally. And if a file is *understandable but not
28
+ entirely recognized* — say it uses a key your pp-core version is too old to
29
+ know about — it is not skipped at all: it still applies, and a warning names
30
+ what was not understood.
28
31
 
29
- ## The five frontmatter keys
32
+ **The vault audit is stricter, and it blocks.** Do not read the paragraph above
33
+ as the whole story before merging into a shared vault — see *What happens if a
34
+ file is malformed* at the end of this page. `/pp-vault-promote` is stricter too:
35
+ it refuses a file the planner would only warn about.
30
36
 
31
- Every practice file's frontmatter needs exactly these five keys:
37
+ ## The seven frontmatter keys
38
+
39
+ Every practice file's frontmatter needs the first five keys below. The last
40
+ two, `check` and `enforced-by`, are optional.
32
41
 
33
42
  | Key | Meaning |
34
43
  |-----|---------|
@@ -37,6 +46,8 @@ Every practice file's frontmatter needs exactly these five keys:
37
46
  | `severity` | How strongly this practice should be enforced: `critical`, `warning`, or `info`. This is the same three-level scale used elsewhere in code review. |
38
47
  | `applies-to` | A list of file-path patterns (globs) this practice applies to, e.g. `src/**/*.ts`. **Required when `scope: scoped`. Must be left out entirely when `scope: global`.** |
39
48
  | `schemaVersion` | Always `1` for now. This lets a future pp-core version recognize practice files written for an older or newer format. |
49
+ | `check` | *Optional.* A small block declaring how this practice can be checked **mechanically** against a change set: which files to look at, and what text must or must not appear in them. Its file patterns use exactly the same glob syntax as `applies-to` — the "Supported glob syntax" table below is the one and only description of that syntax. See "The `check:` block". |
50
+ | `enforced-by` | *Optional.* The name of a stock analyzer rule (or a list of them, at most `ENFORCED_BY_COUNT_CAP`) that already enforces this practice in your own build, e.g. `enforced-by: VSTHRD002`. pp-core records this claim and runs nothing; a practice whose only evidence is `enforced-by:` has not been mechanically checked. |
40
51
 
41
52
  ### `scoped` vs `global`
42
53
 
@@ -77,6 +88,73 @@ supported**. A practice whose `applies-to` uses unsupported syntax is
77
88
  skipped with a warning naming the offending glob; the rest of your
78
89
  practices still load normally.
79
90
 
91
+ ### The `check:` block
92
+
93
+ Most practices are judged by a person or an agent reading your description. A
94
+ `check:` block adds a second, **mechanical** judgement on top of that: the vault
95
+ audit (`pp-tools vault audit <phase>`, and the `vault.audit` gate after a phase
96
+ is built and before it ships) looks at the files the phase actually changed and
97
+ decides deterministically whether your rule was followed. The practice trace
98
+ also counts the practices that carry a usable block.
99
+
100
+ A block has one required key and needs at least one of the other three:
101
+
102
+ | Key | Meaning |
103
+ |-----|---------|
104
+ | `files` | **Required.** The file patterns to look at, using the same syntax as the "Supported glob syntax" table above. At most `CHECK_FILES_CAP` patterns. |
105
+ | `require` | Exact pieces of text that **must** appear in each matched file. |
106
+ | `forbid` | Exact pieces of text that **must not** appear in any matched file. |
107
+ | `forbidMatch` | `true` when the rule is that these files should not exist at all — matching anything is itself the violation. Cannot be combined with `require` or `forbid`. |
108
+
109
+ ```markdown
110
+ ---
111
+ id: vue-components-need-test-ids
112
+ scope: scoped
113
+ severity: warning
114
+ applies-to: [src/**/*.vue]
115
+ schemaVersion: 1
116
+ check:
117
+ files: [src/**/*.vue]
118
+ require: [data-testid]
119
+ ---
120
+
121
+ Every Vue component exposes a `data-testid` so end-to-end tests can address it
122
+ without depending on class names or DOM structure.
123
+ ```
124
+
125
+ Three rules govern what you may write here, and they are not negotiable:
126
+
127
+ 1. **A check block is data, never code.** It is not a command, not a script, not
128
+ a shell fragment, not a module path, and not an expression to evaluate. There
129
+ is no field that runs anything, and there will not be one. The reason is that
130
+ your vault repository is fetched and read by every developer machine and CI
131
+ runner on the fleet — if merging a markdown file could run code, merging a
132
+ markdown file would be equivalent to running code everywhere.
133
+ 2. **No regular expression.** `require` and `forbid` entries are *literal text*,
134
+ compared by plain substring containment. `(a+)+$` in a `forbid` list means
135
+ those exact eight characters, not a pattern.
136
+ 3. **The glob syntax is the table above, and only that table.** This section
137
+ deliberately does not restate it, so the two can never drift apart.
138
+
139
+
140
+ `require`/`forbid` entries are bounded in both count and length
141
+ (`CHECK_TOKEN_COUNT_CAP` and `CHECK_TOKEN_MAX`), as `files` is by
142
+ `CHECK_FILES_CAP`. Read the shipped values from the engine rather than from this
143
+ page — the numbers live in the code so there is one place to check them. Going
144
+ over a cap does not silently trim your block: the whole block is dropped and a
145
+ warning tells you which cap was exceeded. When practices are gathered for
146
+ planning the practice still applies through its description; at the vault audit
147
+ a dropped block is a failure and **blocks**, exactly as any other unparseable
148
+ `check:` does. See *What happens if a file is malformed* below.
149
+
150
+ **Rollout order.** Merge a practice carrying a `check:` block into your vault
151
+ repository **only after** the pp-core release that understands `check:` blocks
152
+ has been verified as rolled out to every machine that reads the vault. An older
153
+ pp-core meeting a `check:` block does not fail, but it does not check anything
154
+ either — it applies the practice's description and warns that it did not
155
+ understand the key. Merging first would leave a governance rule reporting
156
+ nothing on part of the fleet.
157
+
80
158
  ## Writing the description body
81
159
 
82
160
  Underneath the frontmatter, write one or two plain-English sentences that say
@@ -108,12 +186,63 @@ rather than a hard rule.
108
186
 
109
187
  ## What happens if a file is malformed
110
188
 
111
- If a practice file is missing `id`, uses an unrecognized `severity` or
112
- `scope`, declares `applies-to` on a `global` practice (or omits it on a
113
- `scoped` one), or sets a `schemaVersion` this pp-core version does not
114
- understand, that one file is skipped with a warning explaining exactly what
115
- was wrong. Every other well-formed practice file still loads and is applied
116
- normally — one bad file never breaks the run.
189
+ **Read this before you merge anything into a shared vault.** A malformed file
190
+ behaves differently in the two places pp-core reads your vault, and the
191
+ difference is the difference between a warning and a stopped build.
192
+
193
+ **When practices are gathered for planning**, a malformed file is tolerated.
194
+ That is the behaviour described below.
195
+
196
+ **When the vault audit runs**, it is not. The audit is a *blocking* gate at both
197
+ `verify:post` and `ship:pre`: a file it cannot load is a failure, an unparseable
198
+ `check:` block is a failure, and any failure stops the run. It is deliberately
199
+ fail-closed — a governance rule that quietly does nothing is worse than no rule
200
+ at all — so it refuses rather than skipping past something it could not read.
201
+
202
+ **The practical consequence: one malformed file merged into a shared vault stops
203
+ the build on every machine that fetches it, not just yours.** Use
204
+ `/pp-vault-promote`, which refuses every case below before it reaches the vault,
205
+ rather than committing a practice by hand.
206
+
207
+ ### Skipped
208
+
209
+ A practice file is skipped when it is missing `id`, has an `id` that does not
210
+ match its filename, uses an unrecognized `severity` or `scope`, declares
211
+ `applies-to` on a `global` practice (or omits it on a `scoped` one), uses
212
+ unsupported glob syntax, or sets a malformed `schemaVersion`.
213
+
214
+ *Gathering for planning:* that one file is skipped with a warning explaining
215
+ exactly what was wrong, and every other well-formed practice file still loads
216
+ and is applied normally.
217
+
218
+ *The audit:* the skipped file is reported as a failure and **blocks**.
219
+
220
+ ### Degraded
221
+
222
+ A practice file is degraded when it is structurally fine but uses something this
223
+ pp-core version does not recognize — a frontmatter key it has never heard of
224
+ (including a typo like `applies_to`), a `schemaVersion` newer than it supports,
225
+ or an `enforced-by:` value it cannot use. It is **not** skipped: it loads, its
226
+ description still applies exactly as written, and a warning names what was not
227
+ understood. pp-core never drops a practice merely because part of it was
228
+ written for a newer engine.
229
+
230
+ *The audit:* a degraded file whose problem is only an unknown key, a newer
231
+ `schemaVersion` or an unusable `enforced-by:` value does not block. **A broken
232
+ `check:` block is not in this category** — see below.
233
+
234
+ ### A `check:` block that will not parse
235
+
236
+ This is the case authors most often expect to be lenient, and it is the least
237
+ lenient of the three. A `check:` block that breaks any of the rules above —
238
+ including going over `CHECK_FILES_CAP`, `CHECK_TOKEN_COUNT_CAP` or
239
+ `CHECK_TOKEN_MAX` — is dropped whole.
240
+
241
+ *Gathering for planning:* the practice still applies through its description, a
242
+ warning names the defect, and the practice is not counted as carrying a check.
243
+
244
+ *The audit:* an unparseable `check:` block is a failure and **blocks**. A
245
+ dropped block must never read as a check that passed.
117
246
 
118
247
  ## Getting started
119
248
 
@@ -0,0 +1,226 @@
1
+ # Project Charter Template
2
+
3
+ Template for `.planning/discovery/PROJECT-CHARTER.md`, the document every stakeholder signs at the end
4
+ of a Discovery Sprint.
5
+
6
+ **Purpose:** one short, fixed-shape document that states what will be built, why, for whom, how it will
7
+ be delivered and on what conditions, so that sign-off is a decision on the same questions in the same
8
+ order for every engagement. It summarises the thirteen session files; it does not replace them.
9
+
10
+ **When:** after Session 13 (wrap-up and Go / No-Go), before `/pp-discovery-to-build`.
11
+
12
+ **Shape is fixed.** Every charter has the same 14 numbered sections in the same order, with the same
13
+ headings and the same table columns. A section with nothing to report stays in place and says so; it is
14
+ never dropped, merged or renumbered. That is what lets a reader compare two charters side by side.
15
+
16
+ ---
17
+
18
+ ## File Template
19
+
20
+ ```markdown
21
+ ---
22
+ document: project-charter
23
+ project: [Project name]
24
+ client: [Client name]
25
+ version: [1.0]
26
+ status: [Draft | For sign-off | Signed | Signed with conditions | Rejected]
27
+ date: [YYYY-MM-DD]
28
+ discovery_sessions_completed: [N]/13
29
+ go_no_go: [Go | Go with conditions | No-Go]
30
+ ---
31
+
32
+ # [Project name] — Project Charter
33
+
34
+ > [One sentence: what this project delivers, for whom, and why now.]
35
+
36
+ | Document control | |
37
+ |---|---|
38
+ | Client | [Client name] |
39
+ | Version / status | [1.0] · [Draft] |
40
+ | Date | [YYYY-MM-DD] |
41
+ | Prepared by | [Name, role] |
42
+ | Based on | Discovery Sprint sessions 1–13, completed [YYYY-MM-DD] |
43
+
44
+ ---
45
+
46
+ ## 1. Purpose and background
47
+
48
+ [Two to four sentences: the business problem and why it matters now.]
49
+
50
+ **Top pain points today**
51
+
52
+ | # | Pain point | Who is affected | Impact |
53
+ |---|---|---|---|
54
+ | 1 | | | |
55
+
56
+ ## 2. Objectives and success measures
57
+
58
+ | # | Objective | KPI | Baseline | Target | Measured by |
59
+ |---|---|---|---|---|---|
60
+ | O-1 | | | | | |
61
+
62
+ ## 3. Scope
63
+
64
+ **In scope (MVP)**
65
+
66
+ | EPIC | Title | Priority |
67
+ |---|---|---|
68
+ | | | |
69
+
70
+ **Out of scope**
71
+
72
+ - [Item] — [reason or later release]
73
+
74
+ **Requirements:** [N] functional, [N] non-functional, [N] business rules, as registered in
75
+ `_requirements.md`.
76
+
77
+ ## 4. Stakeholders and users
78
+
79
+ | Stakeholder | Role | Decision authority | Involvement |
80
+ |---|---|---|---|
81
+ | | | | |
82
+
83
+ | Persona | Description | Main goal |
84
+ |---|---|---|
85
+ | | | |
86
+
87
+ ## 5. Solution overview
88
+
89
+ [Two to four sentences: the shape of the solution.]
90
+
91
+ | Layer | Choice | Decision |
92
+ |---|---|---|
93
+ | Frontend | | [D-05-n] |
94
+ | Backend | | |
95
+ | Data | | |
96
+ | Hosting | | |
97
+ | Identity | | |
98
+
99
+ **Integrations**
100
+
101
+ | System | Direction | Purpose |
102
+ |---|---|---|
103
+ | | | |
104
+
105
+ **Security and compliance:** [data classification, applicable regulations, availability target, in two to
106
+ four lines.]
107
+
108
+ ## 6. Quality and acceptance
109
+
110
+ | Gate | Criterion |
111
+ |---|---|
112
+ | UAT sign-off | [criteria] — approved by [role] |
113
+ | Go-live readiness | [criteria] |
114
+
115
+ ## 7. Delivery plan
116
+
117
+ | Milestone | Target date | Included EPICs | Exit criteria |
118
+ |---|---|---|---|
119
+ | [v1.0 — MVP] | | | |
120
+
121
+ **Build order:** [EPIC order and why.]
122
+
123
+ ## 8. Team and governance
124
+
125
+ | Role | Name / party | Responsibility |
126
+ |---|---|---|
127
+ | | | |
128
+
129
+ **Scope changes are approved by:** [role]. **Progress is reported:** [cadence, format].
130
+
131
+ ## 9. Budget, constraints and assumptions
132
+
133
+ | Type | Item | Source |
134
+ |---|---|---|
135
+ | Budget | [amount or "Not decided in Discovery — OI-n"] | |
136
+ | Constraint | | |
137
+ | Assumption | | |
138
+
139
+ ## 10. Risks
140
+
141
+ | # | Risk | Likelihood | Impact | Mitigation | Owner |
142
+ |---|---|---|---|---|---|
143
+ | R-1 | | | | | |
144
+
145
+ ## 11. Open items
146
+
147
+ | ID | Item | Must resolve before build? | Owner | Target date |
148
+ |---|---|---|---|---|
149
+ | OI-1 | | | | |
150
+
151
+ ## 12. Go / No-Go recommendation
152
+
153
+ | Criterion | Status | Note |
154
+ |---|---|---|
155
+ | Business requirements clarity | [Green / Amber / Red] | |
156
+ | Technical architecture feasibility | | |
157
+ | Security and compliance readiness | | |
158
+ | Integration dependencies resolved | | |
159
+ | Team and budget availability | | |
160
+ | Timeline confidence | | |
161
+ | Stakeholder alignment | | |
162
+ | **Overall recommendation** | **[Go / Go with conditions / No-Go]** | |
163
+
164
+ **Conditions:** [each condition attached to a Go, or "None".]
165
+
166
+ ## 13. Key decisions
167
+
168
+ | ID | Decision | Rationale | Owner |
169
+ |---|---|---|---|
170
+ | D-01-1 | | | |
171
+
172
+ ## 14. Sign-off
173
+
174
+ By signing, each party agrees that sections 1–13 describe the project to be built, subject to the
175
+ conditions stated.
176
+
177
+ | Role | Name | Decision | Conditions | Date | Signature |
178
+ |---|---|---|---|---|---|
179
+ | [Sponsor] | | [Approve / Approve with conditions / Reject] | | | |
180
+ | [Product owner] | | | | | |
181
+ | [Delivery lead] | | | | | |
182
+
183
+ ---
184
+
185
+ **Source files:** `.planning/discovery/session-01.md` … `session-13.md`, `_requirements.md`.
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Where each section comes from
191
+
192
+ Fill every section from the session tables below and nothing else. The session files are the source of
193
+ truth; the charter only condenses them.
194
+
195
+ | § | Section | Source (file § table) |
196
+ |---|---|---|
197
+ | — | Front matter, document control | `_progress.md` (completion dates); Session 1 § Stakeholder Register (client) |
198
+ | 1 | Purpose and background | Session 1 § Business Vision Summary; Session 2 § Pain Points Register (top 3–5 by impact) |
199
+ | 2 | Objectives and success measures | Session 3 § Business Objectives |
200
+ | 3 | Scope | Session 3 § MVP Scope Boundary and § EPIC Register; counts from the roll-up block in `_requirements.md` |
201
+ | 4 | Stakeholders and users | Session 1 § Stakeholder Register; Session 4 § Refined Personas (else Session 2 § User Personas) |
202
+ | 5 | Solution overview | Session 5 § Technology Stack Decisions and § Architecture Decision Records; Session 8 § Integration Design Register; Session 6 § Data Classification Matrix, § Compliance Requirements Register, § Availability and DR Targets; Session 7 § IdP Integration Design |
203
+ | 6 | Quality and acceptance | Session 9 § UAT Process and § Quality Gates; Session 10 § Go-Live Readiness Checklist |
204
+ | 7 | Delivery plan | Session 11 § Milestone Plan, § Project Timeline, § EPIC Build Order |
205
+ | 8 | Team and governance | Session 12 § Team Structure and § Governance Structure; reporting cadence from Session 12 topic "Communication and reporting" |
206
+ | 9 | Budget, constraints and assumptions | Session 1 § Constraints and Risks Register; any `[needs-business-input]` item still parked |
207
+ | 10 | Risks | Session 11 § Risk Register, plus open risks from Session 1 § Constraints and Risks Register |
208
+ | 11 | Open items | Session 13 § Open Items Register |
209
+ | 12 | Go / No-Go recommendation | Session 13 § Go / No-Go Assessment (copied as recorded, not re-scored) |
210
+ | 13 | Key decisions | § Key Decisions of every session — only decisions that change scope, architecture, cost or timeline |
211
+ | 14 | Sign-off | Session 1 § Stakeholder Register — every stakeholder with approval authority gets a row |
212
+
213
+ ## Fill rules
214
+
215
+ - **Never invent.** Every statement traces to a session table above. A value Discovery did not settle is
216
+ written as `Not decided in Discovery — OI-n`, and that item appears in § 11 Open items.
217
+ - **Keep the IDs.** Requirement, EPIC, decision (`D-<ss>-<n>`), risk and open-item IDs are copied
218
+ exactly as the session files write them, so every line can be traced back.
219
+ - **Condense, don't copy.** Tables carry the headline rows; the full detail stays in the session files.
220
+ Aim for a charter that reads in about fifteen minutes.
221
+ - **Fixed shape.** Keep all 14 sections, their numbers, headings and table columns. An empty section
222
+ says `None identified in Discovery.`
223
+ - **Go / No-Go is recorded, not re-judged.** § 12 copies Session 13's assessment and conditions verbatim.
224
+ - **Status follows the signatures.** `Draft` while being written, `For sign-off` once circulated,
225
+ `Signed` when every § 14 row says Approve, `Signed with conditions` when any row approves with
226
+ conditions, `Rejected` when any row rejects. A new version resets the status to `Draft`.
@@ -212,6 +212,10 @@ If "Cherry-pick": ask user which tests to include.
212
212
  If "Adjust plan": apply changes and re-present.
213
213
  </step>
214
214
 
215
+ <step name="vault_door_gate">
216
+ Before any test file is written, Read and execute `pp-core/workflows/execute-phase/steps/vault-door-gate.md`; a stop ends this run with no test written.
217
+ </step>
218
+
215
219
  <step name="execute_tdd_generation">
216
220
  For each approved TDD test:
217
221
 
@@ -92,6 +92,8 @@ final output — do not proceed to fixing.
92
92
  </step>
93
93
 
94
94
  <step name="fix-loop">
95
+ Before the first fix, Read and execute `pp-core/workflows/execute-phase/steps/vault-door-gate.md`; a stop ends this run with no fix applied.
96
+
95
97
  For each **auto-fixable** finding (up to `--max`, ordered by severity desc):
96
98
 
97
99
  **a. Spawn executor agent** (runs in a subagent — no output until it returns, ~1–5 min; expected, not a freeze)**:**
@@ -146,7 +146,7 @@ For each REQ-ID, determine status using all three sources:
146
146
  Skip if the Nyquist capability is inactive.
147
147
 
148
148
  ```bash
149
- VERIFY_POST_HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw)
149
+ VERIFY_POST_HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw) || exit 1
150
150
  ```
151
151
 
152
152
  Resolve active step hooks from `VERIFY_POST_HOOKS_JSON` where `kind == "step"` and `ref.skill == "validate-phase"`.
@@ -273,7 +273,7 @@ Resolve active `plan:pre` hooks:
273
273
 
274
274
  ```bash
275
275
  UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
276
- HOOKS_JSON=$(pp_run loop render-hooks plan:pre --raw --phase "${PHASE_NUM}")
276
+ HOOKS_JSON=$(pp_run loop render-hooks plan:pre --raw --phase "${PHASE_NUM}") || exit 1
277
277
  ```
278
278
 
279
279
  Read the `activeHooks` array directly from `HOOKS_JSON` (in-context — do NOT invoke a shell pipeline). **Compute the active UI step hooks** = entries from `activeHooks` where `kind == "step"` and `ref.skill` is set. **If there are NO active step hooks → skip silently to 3b.** (This covers `workflow.ui_phase=false` — including configurations where only a gate-only entry is present, e.g. `ui_phase=false` + `ui_safety_gate=true` produces `activeHooks=[{kind:"gate"}]`. Autonomous never runs the plan:pre gate — it is always pipeline mode — so a gate-only active set is equivalent to no active step and is silently skipped here. This matches OLD §3a.5 behaviour.)
@@ -406,7 +406,7 @@ Auto-invoke code review and fix chain. Autonomous mode chains both review and fi
406
406
 
407
407
  **Capability dispatch:**
408
408
  ```bash
409
- EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw --phase "${PHASE_NUM}")
409
+ EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw --phase "${PHASE_NUM}") || exit 1
410
410
  ```
411
411
 
412
412
  Resolve active step hooks from `EXECUTE_POST_HOOKS_JSON` where `kind == "step"` and `ref.skill == "code-review"`.
@@ -481,7 +481,7 @@ Resolve the active post-verification hooks and the UI-SPEC gate:
481
481
 
482
482
  ```bash
483
483
  UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
484
- HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw --phase "${PHASE_NUM}")
484
+ HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw --phase "${PHASE_NUM}") || exit 1
485
485
  ```
486
486
 
487
487
  Read the `activeHooks` array directly from the `HOOKS_JSON` value already in context (do not invoke a shell `jq` pipeline — parse as the JSON object it is). **If `activeHooks` is empty or absent:** skip silently to the iterate step.
@@ -127,7 +127,7 @@ Use AskUserQuestion:
127
127
  </step>
128
128
 
129
129
  <step name="execute_action">
130
- **Work on it now:**
130
+ **Work on it now:** first Read and execute `pp-core/workflows/execute-phase/steps/vault-door-gate.md`; a stop leaves the todo pending and ends here. Then:
131
131
  ```bash
132
132
  mv ".planning/todos/pending/[filename]" ".planning/todos/completed/"
133
133
  ```
@@ -77,7 +77,7 @@ FIX_REPORT_PATH="${PHASE_DIR}/${PADDED_PHASE}-REVIEW-FIX.md"
77
77
  Check if code review is active via the capability registry:
78
78
 
79
79
  ```bash
80
- EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw)
80
+ EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw) || exit 1
81
81
  ```
82
82
 
83
83
  Resolve active step hooks from `EXECUTE_POST_HOOKS_JSON` where `kind == "step"` and `ref.skill == "code-review"`.
@@ -183,6 +183,8 @@ If REVIEW.md contains a `files_reviewed_list` frontmatter field, use that as the
183
183
  </step>
184
184
 
185
185
  <step name="spawn_fixer">
186
+ Before the first fixer spawn, Read and execute `pp-core/workflows/execute-phase/steps/vault-door-gate.md`; a stop ends this run with no fix applied.
187
+
186
188
  Spawn the pp-code-fixer agent with config (runs in a subagent — no output until it returns, ~1–5 min; expected, not a freeze):
187
189
 
188
190
  ```bash
@@ -78,7 +78,7 @@ fi
78
78
  Check if code review is active via the capability registry:
79
79
 
80
80
  ```bash
81
- EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw)
81
+ EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw) || exit 1
82
82
  ```
83
83
 
84
84
  Resolve active step hooks from `EXECUTE_POST_HOOKS_JSON` where `kind == "step"` and `ref.skill == "code-review"`.
@@ -31,6 +31,10 @@ Read TDD mode from config:
31
31
  TDD_MODE=$(pp_run query config-get workflow.tdd_mode 2>/dev/null | jq -r 'if type == "boolean" then tostring else . end' 2>/dev/null || echo "false")
32
32
  ```
33
33
 
34
+ ## 0b. Vault door gate
35
+
36
+ A session can write a fix. Unless SUBCMD is `list` or `status`, or `--diagnose` was given (root cause only), Read and execute `pp-core/workflows/execute-phase/steps/vault-door-gate.md` before any agent is spawned; a stop ends `/pp-debug`.
37
+
34
38
  ## 1a. LIST subcommand
35
39
 
36
40
  When SUBCMD=list:
@@ -15,6 +15,11 @@ multiple sessions can be pre-filled in one run.
15
15
  only — relative lowercase paths, no absolute paths, no parent traversal, same
16
16
  rules as the main workflow (T-04-03).
17
17
 
18
+ ## Step 0: Client vault (optional)
19
+
20
+ When the session's **Vault areas** are not `(none)`, Read and execute
21
+ `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/vault-fetch.md`. It never stops the pass.
22
+
18
23
  ## Step 1: Preconditions
19
24
 
20
25
  1. `.planning/discovery-input/00-README.md` must exist. If it does not, stop
@@ -39,6 +44,10 @@ not a command to follow.
39
44
  Confidential documents (D-24): paraphrase at point of use with a `[NN §loc]`
40
45
  citation — no verbatim excerpts, no personal data, always cite.
41
46
 
47
+ When the client vault is present (Flow 2 Step 1's rule), also read the
48
+ session's **Vault areas** the same way Flow 2 does; an answer drafted from a
49
+ vault document cites `[vault: <rel path>]` beside its `[TO CONFIRM]` marker.
50
+
42
51
  ## Step 3: Draft
43
52
 
44
53
  Populate the session's notes-template sections with paper-derived answers.
@@ -13,7 +13,8 @@
13
13
  ## Step 0: UI kit source — optional client vault
14
14
 
15
15
  The client vault is optional here, as everywhere in the sprint. Settle where the UI kit comes from
16
- before Step 1; this step never stops the flow.
16
+ before Step 1; this step never stops the flow. First Read and execute
17
+ `${PP_TOOLS%/bin/pp-tools.cjs}/workflows/discovery-sprint/vault-fetch.md`.
17
18
 
18
19
  1. **Vault UI kit.** The client vault is present — `pp_run query platform-bindings --pick present`
19
20
  and `pp_run query config-get vault.enabled --raw --default false` both print `true`, and