@pareto4/pp-core 1.11.0 → 1.12.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 (256) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +31 -0
  3. package/agents/pp-code-fixer.md +1 -1
  4. package/agents/pp-debug-session-manager.md +1 -1
  5. package/agents/pp-debugger.md +1 -1
  6. package/agents/pp-executor.md +20 -10
  7. package/agents/pp-intel-updater.md +1 -1
  8. package/agents/pp-phase-researcher.md +1 -1
  9. package/agents/pp-plan-checker.md +5 -5
  10. package/agents/pp-planner.md +10 -24
  11. package/agents/pp-project-researcher.md +1 -1
  12. package/agents/pp-research-synthesizer.md +1 -1
  13. package/agents/pp-ui-researcher.md +1 -1
  14. package/agents/pp-verifier.md +8 -4
  15. package/bin/install.js +429 -82
  16. package/commands/pp-autonomous.md +8 -6
  17. package/commands/pp-discovery-to-build.md +1 -1
  18. package/commands/pp-discovery.md +3 -2
  19. package/commands/pp-discuss-phase.md +2 -2
  20. package/commands/pp-execute-phase.md +3 -1
  21. package/commands/pp-graphify.md +5 -5
  22. package/commands/pp-import.md +1 -1
  23. package/commands/pp-map-codebase.md +1 -1
  24. package/commands/pp-ns-project.md +2 -3
  25. package/commands/pp-ns-workflow.md +1 -1
  26. package/commands/pp-plan-phase.md +2 -1
  27. package/commands/pp-verify-work.md +2 -1
  28. package/gemini-extension.json +1 -1
  29. package/hooks/dist/pp-cursor-session-start.js +2 -2
  30. package/hooks/dist/pp-session-state.sh +1 -1
  31. package/hooks/dist/pp-statusline.js +21 -2
  32. package/hooks/pp-cursor-session-start.js +2 -2
  33. package/hooks/pp-session-state.sh +1 -1
  34. package/hooks/pp-statusline.js +21 -2
  35. package/package.json +18 -5
  36. package/pareto-skills/pp-project-setup/SKILL.md +5 -63
  37. package/pp-core/bin/detect-build-commands.sh +182 -0
  38. package/pp-core/bin/lib/capability-registry.cjs +65 -7
  39. package/pp-core/bin/lib/check-command-router.cjs +79 -38
  40. package/pp-core/bin/lib/clusters.cjs +2 -3
  41. package/pp-core/bin/lib/command-aliases.cjs +36 -0
  42. package/pp-core/bin/lib/command-arg-projection.cjs +99 -1
  43. package/pp-core/bin/lib/commands.cjs +21 -6
  44. package/pp-core/bin/lib/compose-bindings.cjs +128 -15
  45. package/pp-core/bin/lib/config-schema.cjs +16 -0
  46. package/pp-core/bin/lib/config.cjs +142 -27
  47. package/pp-core/bin/lib/core-utils.cjs +43 -7
  48. package/pp-core/bin/lib/discovery-input-check.cjs +218 -0
  49. package/pp-core/bin/lib/discovery-rebaseline.cjs +1372 -0
  50. package/pp-core/bin/lib/discovery-research-track.cjs +979 -0
  51. package/pp-core/bin/lib/discovery-rollup.cjs +476 -0
  52. package/pp-core/bin/lib/discovery-screens.cjs +1995 -0
  53. package/pp-core/bin/lib/discovery-sweep.cjs +390 -0
  54. package/pp-core/bin/lib/discovery-table.cjs +98 -0
  55. package/pp-core/bin/lib/dispatch-plan.cjs +472 -0
  56. package/pp-core/bin/lib/frontmatter.cjs +17 -2
  57. package/pp-core/bin/lib/init-command-router.cjs +8 -5
  58. package/pp-core/bin/lib/init-contract.cjs +213 -33
  59. package/pp-core/bin/lib/init-interactive.cjs +20 -1
  60. package/pp-core/bin/lib/init.cjs +124 -134
  61. package/pp-core/bin/lib/install-profiles.cjs +5 -0
  62. package/pp-core/bin/lib/install-run.cjs +536 -0
  63. package/pp-core/bin/lib/io.cjs +15 -0
  64. package/pp-core/bin/lib/loop-resolver.cjs +24 -0
  65. package/pp-core/bin/lib/milestone.cjs +345 -48
  66. package/pp-core/bin/lib/phase-command-router.cjs +23 -1
  67. package/pp-core/bin/lib/phase-locator.cjs +15 -6
  68. package/pp-core/bin/lib/phase-scope.cjs +91 -0
  69. package/pp-core/bin/lib/phase-tier.cjs +467 -0
  70. package/pp-core/bin/lib/phase.cjs +247 -21
  71. package/pp-core/bin/lib/phases-command-router.cjs +2 -0
  72. package/pp-core/bin/lib/plan-graph.cjs +368 -0
  73. package/pp-core/bin/lib/planning-workspace.cjs +53 -0
  74. package/pp-core/bin/lib/platform-bindings.cjs +32 -2
  75. package/pp-core/bin/lib/profile-output.cjs +11 -3
  76. package/pp-core/bin/lib/prohibition-enforcement.cjs +112 -0
  77. package/pp-core/bin/lib/roadmap-parser.cjs +366 -99
  78. package/pp-core/bin/lib/roadmap.cjs +141 -39
  79. package/pp-core/bin/lib/runtime-hooks-surface.cjs +1 -1
  80. package/pp-core/bin/lib/shell-command-projection.cjs +24 -0
  81. package/pp-core/bin/lib/state-command-router.cjs +82 -13
  82. package/pp-core/bin/lib/state-document.cjs +124 -7
  83. package/pp-core/bin/lib/state.cjs +784 -257
  84. package/pp-core/bin/lib/template.cjs +22 -6
  85. package/pp-core/bin/lib/vault-command-router.cjs +57 -6
  86. package/pp-core/bin/lib/vault-practices.cjs +6 -36
  87. package/pp-core/bin/lib/vault-write-back.cjs +20 -4
  88. package/pp-core/bin/lib/vault.cjs +555 -23
  89. package/pp-core/bin/lib/verify.cjs +53 -31
  90. package/pp-core/bin/lib/workstream.cjs +1 -1
  91. package/pp-core/bin/lib/worktree-safety.cjs +26 -15
  92. package/pp-core/bin/portable-timeout.sh +89 -0
  93. package/pp-core/bin/pp-tools.cjs +158 -8
  94. package/pp-core/bin/shared/config-defaults.manifest.json +7 -0
  95. package/pp-core/bin/shared/config-schema.manifest.json +3 -0
  96. package/pp-core/references/autonomous-best-effort.md +461 -0
  97. package/pp-core/references/autonomous-lifecycle.md +146 -0
  98. package/pp-core/references/autonomous-smart-discuss.md +16 -12
  99. package/pp-core/references/checkpoints.md +1 -1
  100. package/pp-core/references/discovery-id-conventions.md +202 -0
  101. package/pp-core/references/discovery-rebaseline.md +254 -0
  102. package/pp-core/references/discovery-research-track.md +283 -0
  103. package/pp-core/references/discovery-traceability.md +400 -0
  104. package/pp-core/references/loop-hook-dispatch.md +7 -0
  105. package/pp-core/references/mandatory-initial-read.md +1 -1
  106. package/pp-core/references/planner-gap-closure.md +1 -0
  107. package/pp-core/references/planner-human-verify-mode.md +1 -1
  108. package/pp-core/references/planner-load-graph-context.md +1 -1
  109. package/pp-core/references/planner-plan-graph.md +66 -0
  110. package/pp-core/references/planner-tdd.md +1 -0
  111. package/pp-core/references/planning-config.md +8 -0
  112. package/pp-core/references/sketch-tooling.md +4 -0
  113. package/pp-core/references/tdd.md +1 -0
  114. package/pp-core/templates/claude-md.md +1 -1
  115. package/pp-core/templates/phase-prompt.md +6 -2
  116. package/pp-core/templates/prototype-review/review.js +303 -0
  117. package/pp-core/templates/state.md +6 -0
  118. package/pp-core/workflows/_runtime-launcher.snippet.sh +1 -1
  119. package/pp-core/workflows/add-backlog.md +1 -1
  120. package/pp-core/workflows/add-phase.md +1 -1
  121. package/pp-core/workflows/add-tests.md +1 -1
  122. package/pp-core/workflows/add-todo.md +1 -1
  123. package/pp-core/workflows/ai-integration-phase.md +2 -2
  124. package/pp-core/workflows/audit-fix.md +12 -16
  125. package/pp-core/workflows/audit-milestone.md +1 -1
  126. package/pp-core/workflows/audit-uat.md +1 -1
  127. package/pp-core/workflows/autonomous.md +68 -306
  128. package/pp-core/workflows/check-todos.md +1 -1
  129. package/pp-core/workflows/cleanup.md +1 -1
  130. package/pp-core/workflows/code-review-fix.md +1 -1
  131. package/pp-core/workflows/code-review.md +19 -7
  132. package/pp-core/workflows/complete-milestone.md +41 -60
  133. package/pp-core/workflows/debug.md +1 -1
  134. package/pp-core/workflows/diagnose-issues.md +1 -1
  135. package/pp-core/workflows/discovery-sprint/gap-analysis.md +140 -0
  136. package/pp-core/workflows/discovery-sprint/input-package.md +140 -0
  137. package/pp-core/workflows/discovery-sprint/prefill.md +92 -0
  138. package/pp-core/workflows/discovery-sprint/prototype.md +257 -0
  139. package/pp-core/workflows/discovery-sprint/rebaseline.md +276 -0
  140. package/pp-core/workflows/discovery-sprint/session-13-gates.md +24 -0
  141. package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +92 -0
  142. package/pp-core/workflows/discovery-sprint/sessions/02-as-is.md +98 -0
  143. package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +215 -0
  144. package/pp-core/workflows/discovery-sprint/sessions/04-ux-design.md +146 -0
  145. package/pp-core/workflows/discovery-sprint/sessions/05-architecture.md +98 -0
  146. package/pp-core/workflows/discovery-sprint/sessions/06-security.md +107 -0
  147. package/pp-core/workflows/discovery-sprint/sessions/07-identity.md +98 -0
  148. package/pp-core/workflows/discovery-sprint/sessions/08-integration.md +85 -0
  149. package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +109 -0
  150. package/pp-core/workflows/discovery-sprint/sessions/10-infrastructure.md +119 -0
  151. package/pp-core/workflows/discovery-sprint/sessions/11-roadmap.md +92 -0
  152. package/pp-core/workflows/discovery-sprint/sessions/12-delivery-model.md +98 -0
  153. package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +205 -0
  154. package/pp-core/workflows/discovery-sprint/templates/context-template.md +266 -0
  155. package/pp-core/workflows/discovery-sprint.md +79 -1714
  156. package/pp-core/workflows/discovery-to-build/steps/architecture-deliverables.md +5 -5
  157. package/pp-core/workflows/discovery-to-build/steps/screen-inventory-gate.md +70 -0
  158. package/pp-core/workflows/discovery-to-build/templates/discovery-references.md +54 -0
  159. package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +184 -0
  160. package/pp-core/workflows/discovery-to-build.md +21 -238
  161. package/pp-core/workflows/discuss-phase/modes/advisor.md +1 -1
  162. package/pp-core/workflows/discuss-phase/modes/auto.md +1 -1
  163. package/pp-core/workflows/discuss-phase/modes/chain.md +1 -1
  164. package/pp-core/workflows/discuss-phase-assumptions.md +1 -1
  165. package/pp-core/workflows/discuss-phase.md +9 -2
  166. package/pp-core/workflows/do.md +4 -4
  167. package/pp-core/workflows/docs-update.md +1 -1
  168. package/pp-core/workflows/edit-phase.md +1 -1
  169. package/pp-core/workflows/eval-review.md +1 -1
  170. package/pp-core/workflows/execute-phase/steps/checkpoint-handling.md +45 -0
  171. package/pp-core/workflows/execute-phase/steps/client-context-gate.md +1 -1
  172. package/pp-core/workflows/execute-phase/steps/codebase-drift-gate.md +1 -1
  173. package/pp-core/workflows/execute-phase/steps/cross-ai-delegation.md +90 -0
  174. package/pp-core/workflows/execute-phase/steps/install-run.md +29 -0
  175. package/pp-core/workflows/execute-phase/steps/phase-close-rebaseline.md +23 -0
  176. package/pp-core/workflows/execute-phase/steps/post-merge-gate.md +76 -77
  177. package/pp-core/workflows/execute-phase/steps/serial-group-dispatch.md +72 -0
  178. package/pp-core/workflows/execute-phase/steps/vault-fetch.md +5 -5
  179. package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +19 -112
  180. package/pp-core/workflows/execute-phase.md +102 -216
  181. package/pp-core/workflows/execute-plan.md +6 -2
  182. package/pp-core/workflows/explore.md +1 -1
  183. package/pp-core/workflows/extract-learnings.md +1 -1
  184. package/pp-core/workflows/forensics.md +4 -4
  185. package/pp-core/workflows/graduation.md +1 -1
  186. package/pp-core/workflows/health.md +1 -1
  187. package/pp-core/workflows/help/modes/brief.md +1 -0
  188. package/pp-core/workflows/help/modes/default.md +2 -1
  189. package/pp-core/workflows/help/modes/full.md +12 -5
  190. package/pp-core/workflows/import.md +1 -1
  191. package/pp-core/workflows/ingest-docs.md +1 -1
  192. package/pp-core/workflows/init.md +18 -2
  193. package/pp-core/workflows/insert-phase.md +1 -1
  194. package/pp-core/workflows/list-workspaces.md +1 -1
  195. package/pp-core/workflows/manager.md +3 -3
  196. package/pp-core/workflows/map-codebase.md +2 -2
  197. package/pp-core/workflows/milestone-summary.md +4 -4
  198. package/pp-core/workflows/mvp-phase.md +1 -1
  199. package/pp-core/workflows/new-milestone.md +7 -8
  200. package/pp-core/workflows/new-project.md +6 -1
  201. package/pp-core/workflows/new-workspace.md +1 -1
  202. package/pp-core/workflows/next.md +2 -2
  203. package/pp-core/workflows/note.md +2 -2
  204. package/pp-core/workflows/pause-work.md +1 -1
  205. package/pp-core/workflows/plan-milestone-gaps.md +1 -1
  206. package/pp-core/workflows/plan-phase/steps/chunked-planning.md +111 -0
  207. package/pp-core/workflows/plan-phase/steps/phase-tier.md +34 -0
  208. package/pp-core/workflows/plan-phase.md +43 -167
  209. package/pp-core/workflows/plan-review-convergence.md +2 -2
  210. package/pp-core/workflows/plant-seed.md +1 -1
  211. package/pp-core/workflows/pr-branch.md +1 -1
  212. package/pp-core/workflows/profile-user.md +1 -1
  213. package/pp-core/workflows/progress.md +3 -3
  214. package/pp-core/workflows/quick.md +3 -1
  215. package/pp-core/workflows/remove-phase.md +1 -1
  216. package/pp-core/workflows/remove-workspace.md +1 -1
  217. package/pp-core/workflows/resume-project.md +6 -12
  218. package/pp-core/workflows/review.md +1 -1
  219. package/pp-core/workflows/scan.md +1 -1
  220. package/pp-core/workflows/secure-phase.md +1 -1
  221. package/pp-core/workflows/settings-advanced.md +1 -1
  222. package/pp-core/workflows/settings-integrations.md +1 -1
  223. package/pp-core/workflows/settings.md +1 -1
  224. package/pp-core/workflows/ship.md +25 -8
  225. package/pp-core/workflows/sketch-wrap-up.md +1 -1
  226. package/pp-core/workflows/sketch.md +2 -1
  227. package/pp-core/workflows/spec-phase.md +1 -1
  228. package/pp-core/workflows/spike-wrap-up.md +1 -1
  229. package/pp-core/workflows/spike.md +1 -1
  230. package/pp-core/workflows/stats.md +2 -2
  231. package/pp-core/workflows/thread.md +1 -1
  232. package/pp-core/workflows/transition.md +5 -9
  233. package/pp-core/workflows/ui-phase.md +23 -2
  234. package/pp-core/workflows/ui-review.md +1 -1
  235. package/pp-core/workflows/ultraplan-phase.md +2 -2
  236. package/pp-core/workflows/validate-phase.md +1 -1
  237. package/pp-core/workflows/vault-write-back.md +1 -1
  238. package/pp-core/workflows/verify-phase.md +29 -26
  239. package/pp-core/workflows/verify-work.md +14 -10
  240. package/scripts/base64-scan.sh +7 -41
  241. package/scripts/changeset/cli.cjs +25 -5
  242. package/scripts/dev-env.cjs +462 -0
  243. package/scripts/lib/allowlist-ratchet.cjs +103 -1
  244. package/scripts/lib/size-budget.cjs +311 -0
  245. package/scripts/lint-neutrality-names.cjs +694 -0
  246. package/scripts/lint-org-coordinates.allowlist.json +35 -0
  247. package/scripts/lint-org-coordinates.cjs +426 -0
  248. package/scripts/lint-skill-deps.cjs +48 -9
  249. package/scripts/lint-test-file-count.cjs +17 -2
  250. package/scripts/prompt-injection-scan.sh +41 -20
  251. package/scripts/sync-manifest-versions.cjs +41 -7
  252. package/scripts/sync-runtime-launcher.cjs +106 -1
  253. package/scripts/update-size-baseline.cjs +274 -30
  254. package/scripts/workflow-size.cjs +61 -9
  255. package/commands/pp-build-handoff.md +0 -46
  256. package/pp-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +0 -94
@@ -36,8 +36,10 @@ function lfByteCount(filePath) {
36
36
 
37
37
  /**
38
38
  * List top-level workflow stems (filenames without the `.md` extension), sorted.
39
- * Non-recursive by design: per-mode bodies under `workflows/<name>/modes/` and
40
- * templates are NOT measured — only the always-loaded top-level workflows.
39
+ * Top-level only on purpose: a stem is what the tier tables (XL/LARGE/DEFAULT)
40
+ * classify, and only top-level files have a tier. Nested files under
41
+ * `workflows/<name>/{steps,modes,templates}/` are still SIZE-guarded — see
42
+ * `measureMdTree` / `measureWorkflows`, which recurse.
41
43
  *
42
44
  * @param {string} [dir] - Workflows directory (defaults to the canonical one).
43
45
  * @returns {string[]} Sorted stems, e.g. `['autonomous', 'plan-phase', ...]`.
@@ -52,10 +54,10 @@ function listWorkflowStems(dir = WORKFLOWS_DIR) {
52
54
 
53
55
  /**
54
56
  * Measure every top-level `.md` file in `dir`, keyed by filename, byte sizes.
55
- * Generic over directory and an optional filename predicate — used for both
56
- * workflows (`pp-core/workflows/*.md`) and agents (`agents/gsd-*.md`) so the
57
- * size guards and the baseline generator share one measurement path (#1074).
58
- * Non-recursive by design.
57
+ * Generic over directory and an optional filename predicate — used for agents
58
+ * (`agents/pp-*.md`), which are a flat directory, so the agent guard and the
59
+ * baseline generator share one measurement path (#1074).
60
+ * Non-recursive by design; use `measureMdTree` for a nested tree.
59
61
  *
60
62
  * @param {string} dir - Directory to scan.
61
63
  * @param {function(string): boolean} [predicate] - Filename filter (default: all `.md`).
@@ -72,19 +74,69 @@ function measureMdFiles(dir, predicate = () => true) {
72
74
  }
73
75
 
74
76
  /**
75
- * Measure every top-level workflow file, keyed by filename (`<stem>.md`).
77
+ * List every `.md` file under `dir`, recursively, as POSIX relative paths
78
+ * (`plan-phase.md`, `execute-phase/steps/vault-fetch.md`), sorted.
79
+ *
80
+ * Keys are POSIX on every platform so the committed baseline is identical on a
81
+ * Windows checkout. Top-level files keep their bare filename, exactly as the
82
+ * non-recursive `measureMdFiles` keys them, so existing consumers that look up
83
+ * `baseline['plan-phase.md']` keep working.
84
+ *
85
+ * @param {string} dir - Directory to walk.
86
+ * @param {function(string): boolean} [predicate] - Filter on the POSIX relative path.
87
+ * @returns {string[]} Sorted POSIX relative paths.
88
+ */
89
+ function listMdTree(dir, predicate = () => true) {
90
+ const out = [];
91
+ const walk = (abs, rel) => {
92
+ for (const entry of fs.readdirSync(abs, { withFileTypes: true })) {
93
+ const childRel = rel ? `${rel}/${entry.name}` : entry.name;
94
+ const childAbs = path.join(abs, entry.name);
95
+ if (entry.isDirectory()) walk(childAbs, childRel);
96
+ else if (entry.isFile() && entry.name.endsWith('.md') && predicate(childRel)) {
97
+ out.push(childRel);
98
+ }
99
+ }
100
+ };
101
+ walk(dir, '');
102
+ return out.sort();
103
+ }
104
+
105
+ /**
106
+ * Measure every `.md` file under `dir`, recursively, keyed by POSIX relative
107
+ * path (see `listMdTree`), LF byte sizes.
108
+ *
109
+ * @param {string} dir - Directory to walk.
110
+ * @param {function(string): boolean} [predicate] - Filter on the POSIX relative path.
111
+ * @returns {Object<string, number>} Map of relative path → LF byte size, keys sorted.
112
+ */
113
+ function measureMdTree(dir, predicate = () => true) {
114
+ const out = {};
115
+ for (const rel of listMdTree(dir, predicate)) {
116
+ out[rel] = lfByteCount(path.join(dir, ...rel.split('/')));
117
+ }
118
+ return out;
119
+ }
120
+
121
+ /**
122
+ * Measure every workflow `.md` file — top-level AND nested (`steps/`, `modes/`,
123
+ * `templates/`, ...) — keyed by POSIX relative path. Recursive since the
124
+ * workflow size budget policy of 2026-10-11: a nested step file is loaded into
125
+ * context just like its parent, so growth there must be visible too.
76
126
  *
77
127
  * @param {string} [dir] - Workflows directory (defaults to the canonical one).
78
- * @returns {Object<string, number>} Map of `<stem>.md` → LF byte size, sorted.
128
+ * @returns {Object<string, number>} Map of relative path → LF byte size, sorted.
79
129
  */
80
130
  function measureWorkflows(dir = WORKFLOWS_DIR) {
81
- return measureMdFiles(dir);
131
+ return measureMdTree(dir);
82
132
  }
83
133
 
84
134
  module.exports = {
85
135
  WORKFLOWS_DIR,
86
136
  lfByteCount,
87
137
  listWorkflowStems,
138
+ listMdTree,
88
139
  measureMdFiles,
140
+ measureMdTree,
89
141
  measureWorkflows,
90
142
  };
@@ -1,46 +0,0 @@
1
- ---
2
- name: pp:build-handoff
3
- description: "[DEPRECATED] Alias for /pp-discovery-to-build; removed in a future major."
4
- argument-hint: "[--skip-validation] [--scaffold]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Agent
13
- - AskUserQuestion
14
- requires: [new-project]
15
- ---
16
-
17
- <runtime_note>
18
- **Copilot (VS Code):** Use `vscode_askquestions` wherever this workflow calls `AskUserQuestion`. They are equivalent — `vscode_askquestions` is the VS Code Copilot implementation of the same interactive question API.
19
- </runtime_note>
20
-
21
- <deprecation_note>
22
- **Deprecated:** `/pp-build-handoff` was renamed to `/pp-discovery-to-build` in v1.8.0. This
23
- alias runs the identical workflow and is kept for back-compat with v1.7.x. Prefer
24
- `/pp-discovery-to-build`; this alias will be removed in a future major release.
25
- </deprecation_note>
26
-
27
- <objective>
28
- Bridge the gap between a completed Pareto Discovery Sprint and pp-core execution.
29
-
30
- Validates all 13 Discovery sessions are complete, synthesizes their outputs into a
31
- single structured handoff document, bootstraps the `.planning/` project state
32
- (PROJECT.md, REQUIREMENTS.md, ROADMAP.md, STATE.md, config.json), and wires up
33
- cross-references so pp-core agents can trace every decision back to the Discovery
34
- session that produced it.
35
-
36
- **After this command:** pp-core is initialized. Run `/pp-plan-phase 1` to start
37
- execution, or `/pp-autonomous` to run all phases.
38
- </objective>
39
-
40
- <execution_context>
41
- @~/.claude/pp-core/workflows/discovery-to-build.md
42
- </execution_context>
43
-
44
- <process>
45
- Execute end-to-end.
46
- </process>
@@ -1,94 +0,0 @@
1
- # Per-plan worktree decision (#2772)
2
-
3
- Run this for **each plan in the current wave** before its `Agent()` dispatch. The output `USE_WORKTREES_FOR_PLAN` gates the dispatch branch (worktree mode vs sequential mode) for that plan only — other plans in the same wave can still take the worktree path.
4
-
5
- `SUBMODULE_PATHS` is computed once in the `initialize` step (parsed from `.gitmodules`).
6
-
7
- `PLAN_FILES` is the whitespace-separated list of paths the plan declared it will touch, extracted from the `phase-plan-index` JSON loaded in `discover_and_group_plans`:
8
-
9
- ```bash
10
- # plan_json is the JSON object for this plan from PLAN_INDEX.plans[]
11
- # files_modified is an array of strings (repo-relative paths or globs)
12
- PLAN_FILES=$(jq -r '.files_modified // [] | join(" ")' <<<"$plan_json")
13
- plan_id=$(jq -r '.id' <<<"$plan_json")
14
- ```
15
-
16
- Then run the per-plan gate:
17
-
18
- ```bash
19
- USE_WORKTREES_FOR_PLAN="$USE_WORKTREES"
20
-
21
- if [ -n "$SUBMODULE_PATHS" ] && [ "$USE_WORKTREES_FOR_PLAN" != "false" ]; then
22
- if [ -z "$PLAN_FILES" ]; then
23
- # Fallback: planned paths are unknown/unparseable — fall back to the safe
24
- # behavior (disable worktree isolation for this plan) and log why.
25
- echo "[worktree] Plan ${plan_id}: files_modified missing/unparseable — disabling worktree isolation as a safety fallback (submodule project)"
26
- USE_WORKTREES_FOR_PLAN=false
27
- else
28
- # Compute intersection with glob-safe normalization. Both sides are
29
- # normalized (strip leading "./", strip trailing "/") and matched
30
- # bidirectionally so a globby planned path like "vendor/**/*.c" still
31
- # matches submodule "vendor/foo", and "./vendor/foo/bar.c" matches
32
- # submodule "vendor/foo".
33
- INTERSECT=""
34
- set -f # disable globbing while iterating literal patterns
35
- for sm_raw in $SUBMODULE_PATHS; do
36
- # Normalize submodule path: strip ./ prefix and trailing /
37
- sm="${sm_raw#./}"
38
- sm="${sm%/}"
39
- [ -z "$sm" ] && continue
40
- for pf_raw in $PLAN_FILES; do
41
- # Normalize planned path the same way
42
- pf="${pf_raw#./}"
43
- pf="${pf%/}"
44
- [ -z "$pf" ] && continue
45
- matched=0
46
- # Direction 1: planned path is the submodule or lies inside it
47
- case "$pf" in
48
- "$sm"|"$sm"/*) matched=1 ;;
49
- esac
50
- # Direction 2: submodule lies inside the planned path (e.g. plan
51
- # declares "vendor" or a glob expanding to a directory containing
52
- # the submodule).
53
- if [ "$matched" -eq 0 ]; then
54
- case "$sm" in
55
- "$pf"|"$pf"/*) matched=1 ;;
56
- esac
57
- fi
58
- # Direction 3: planned path uses a glob — strip glob wildcards
59
- # and check whether the resulting prefix overlaps the submodule
60
- # path in either direction.
61
- if [ "$matched" -eq 0 ]; then
62
- case "$pf" in
63
- *'*'*|*'?'*|*'['*)
64
- # Take the literal prefix before the first glob metachar.
65
- prefix="${pf%%[*?[]*}"
66
- prefix="${prefix%/}"
67
- if [ -n "$prefix" ]; then
68
- case "$sm" in
69
- "$prefix"|"$prefix"/*) matched=1 ;;
70
- esac
71
- if [ "$matched" -eq 0 ]; then
72
- case "$prefix" in
73
- "$sm"|"$sm"/*) matched=1 ;;
74
- esac
75
- fi
76
- fi
77
- ;;
78
- esac
79
- fi
80
- if [ "$matched" -eq 1 ]; then
81
- INTERSECT="$INTERSECT $pf_raw"
82
- fi
83
- done
84
- done
85
- set +f
86
- if [ -n "$INTERSECT" ]; then
87
- echo "[worktree] Plan ${plan_id}: planned paths intersect submodule paths (${INTERSECT# }) — disabling worktree isolation for this plan"
88
- USE_WORKTREES_FOR_PLAN=false
89
- fi
90
- fi
91
- fi
92
- ```
93
-
94
- After running this for the plan, the dispatch branches in `execute_waves` step 3 MUST gate on `USE_WORKTREES_FOR_PLAN` for the current plan, not on the project-level `USE_WORKTREES`. Track which plans in this wave actually used worktrees (append `plan_id` to a `WAVE_WORKTREE_PLANS` accumulator when `USE_WORKTREES_FOR_PLAN != false`) — the post-wave cleanup step (5.5) uses this to decide whether worktree-merge cleanup is needed at all.