@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
@@ -1,6 +1,6 @@
1
1
  <purpose>
2
2
 
3
- Drive milestone phases autonomously — all remaining phases, a range via `--from N`/`--to N`, or a single phase via `--only N`. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. When `--converge` or `--cross-ai` is set, route the planning step through plan-review convergence before execution. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
3
+ Drive one phase autonomously — by default the next incomplete phase; a range via `--from N`/`--to N`; a named phase via `--only N`. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. When `--converge` or `--cross-ai` is set, route the planning step through plan-review convergence before execution. Best-effort by default: at every decision point it takes the recommended option, appends it to `{padded}-AUTONOMOUS-REPORT.md` and continues; `--supervised` restores the prompts. Hard stops (blocking gates, human-action checkpoints, anything outward) remain — `pp-core/references/autonomous-best-effort.md`. Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
4
4
 
5
5
  </purpose>
6
6
 
@@ -16,7 +16,7 @@ Read all files referenced by the invoking prompt's execution_context before star
16
16
 
17
17
  ## 1. Initialize
18
18
 
19
- Parse `$ARGUMENTS` for `--from N`, `--to N`, `--only N`, `--interactive`, `--converge`/`--cross-ai`, reviewer selector flags, and `--max-cycles N`:
19
+ Parse `$ARGUMENTS` for `--from N`, `--to N`, `--only N`, `--interactive`, `--supervised`, `--converge`/`--cross-ai`, reviewer selector flags, and `--max-cycles N`:
20
20
 
21
21
  ```bash
22
22
  FROM_PHASE=""
@@ -40,6 +40,11 @@ if echo "$ARGUMENTS" | grep -q '\-\-interactive'; then
40
40
  INTERACTIVE="true"
41
41
  fi
42
42
 
43
+ SUPERVISED=""
44
+ if echo "$ARGUMENTS" | grep -q '\-\-supervised'; then SUPERVISED="true"; fi
45
+ UNATTENDED_ARG=""
46
+ if [ -z "$SUPERVISED" ]; then UNATTENDED_ARG=" --unattended"; fi
47
+
43
48
  PLAN_STRATEGY="local"
44
49
  if echo "$ARGUMENTS" | grep -qE '(^|[[:space:]])\-\-(converge|cross-ai)([[:space:]]|$)'; then
45
50
  PLAN_STRATEGY="converge"
@@ -59,16 +64,16 @@ if echo "$ARGUMENTS" | grep -qE '\-\-max-cycles\s+[0-9]+'; then
59
64
  fi
60
65
  ```
61
66
 
62
- When `--only` is set, also set `FROM_PHASE` to the same value so existing filter logic applies.
63
-
64
67
  When `--interactive` is set, discuss runs inline with questions (not auto-answered). On runtimes where a backgrounded agent can spawn subagents, plan and execute are dispatched as background agents — keeping the main context lean (only discuss conversations accumulate) and enabling overlap. On Claude Code, where a backgrounded agent cannot nest subagents, plan and execute run inline to preserve worktree isolation and independent verification, so they run sequentially and their work accumulates in the main context. Either way, user input is preserved on all design decisions.
65
68
 
66
69
  When `PLAN_STRATEGY=converge`, the planning step MUST invoke the plan-review convergence workflow instead of `pp-plan-phase`. `--cross-ai` is an alias for `--converge`. Forward `CONVERGENCE_ARGS` exactly as parsed so reviewer flags and `--max-cycles N` retain the same meaning as they have on `/pp:plan-review-convergence`.
67
70
 
71
+ With `--supervised` every prompt appears as before; otherwise each decision is best-effort and recorded (reference § Rules). `--interactive` only moves discuss inline.
72
+
68
73
  Bootstrap via milestone-level init:
69
74
 
70
75
  ```bash
71
- _PP_SHIM_NAME="pp-tools.cjs"; _PP_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; PP_TOOLS="${_PP_RUNTIME_ROOT}/pp-core/bin/${_PP_SHIM_NAME}"; if [ -f "$PP_TOOLS" ]; then pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; elif command -v pp-tools >/dev/null 2>&1; then PP_TOOLS="$(command -v pp-tools)"; pp_run() { "$PP_TOOLS" "$@"; }; elif [ -f "$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}" ]; then PP_TOOLS="$HOME/.claude/pp-core/bin/${_PP_SHIM_NAME}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$PP_TOOLS" "$@"; }; 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}"; pp_run() { node "$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
76
+ _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
72
77
  INIT=$(pp_run query init.milestone-op)
73
78
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
74
79
  ```
@@ -111,7 +116,9 @@ Display startup banner:
111
116
  If `ONLY_PHASE` is set, display: `Single phase mode: Phase ${ONLY_PHASE}`
112
117
  Else if `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
113
118
  If `TO_PHASE` is set, display: `Stopping after phase ${TO_PHASE}`
119
+ Else (none of the three): display `Mode: next incomplete phase only (default) — pass --from/--to for a range`
114
120
  If `INTERACTIVE` is set, display: `Mode: Interactive (discuss inline, plan+execute in background)`
121
+ If `SUPERVISED` is set, display `Mode: Supervised (prompts restored)`; else `Decisions: best-effort — recorded per phase in {padded}-AUTONOMOUS-REPORT.md`
115
122
  If `PLAN_STRATEGY` is `converge`, display: `Planning: Plan-review convergence enabled`
116
123
 
117
124
  </step>
@@ -166,18 +173,18 @@ Exit cleanly.
166
173
 
167
174
  Exit cleanly.
168
175
 
169
- **Display phase plan:**
176
+ **Default — single phase:** If `FROM_PHASE`, `TO_PHASE` and `ONLY_PHASE` are all empty, set `ONLY_PHASE` to the `number` of the first remaining phase and keep only that phase — from here on this is the `--only N` path. Then apply rule A-5 (waiting on the operator) from the reference:
170
177
 
178
+ ```bash
179
+ PD=$(pp_run query init.phase-op "$ONLY_PHASE" --pick phase_dir)
180
+ [ -n "$PD" ] && WAIT=$(pp_run query verification.status "$PD" --pick status 2>/dev/null)
171
181
  ```
172
- ## Phase Plan
173
182
 
174
- | # | Phase | Status |
175
- |---|-------|--------|
176
- | 5 | Skill Scaffolding & Phase Discovery | In Progress |
177
- | 6 | Smart Discuss | Not Started |
178
- | 7 | Auto-Chain Refinements | Not Started |
179
- | 8 | Lifecycle Orchestration | Not Started |
180
- ```
183
+ If `WAIT` is `human_needed` or `gaps_found`: print `Phase ${ONLY_PHASE} is waiting on you — verification status: ${WAIT}.`, ` Finish it with: /pp:verify-work ${ONLY_PHASE}` and, when a later incomplete phase `NEXT` exists, ` Or run the next phase instead: /pp:autonomous --only ${NEXT}`; exit 0.
184
+
185
+ Set `FIRST_PHASE` to the first remaining phase's number, derive `RUN_STATE` per reference § Run state and write it with `run-state-write`.
186
+
187
+ **Display phase plan:** a `## Phase Plan` table with columns `# | Phase | Status` (In Progress / Not Started), one row per selected phase.
181
188
 
182
189
  **Fetch details for each phase:**
183
190
 
@@ -193,6 +200,8 @@ Extract `phase_name`, `goal`, `success_criteria` from each. Store for use in exe
193
200
 
194
201
  ## 3. Execute Phase
195
202
 
203
+ **Before anything else for this phase:** Read `pp-core/references/autonomous-best-effort.md` (again — every phase), then set `REPORT` per its § Recording.
204
+
196
205
  For the current phase, display the progress banner:
197
206
 
198
207
  ```
@@ -201,9 +210,7 @@ For the current phase, display the progress banner:
201
210
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
202
211
  ```
203
212
 
204
- Where N = current phase number (from the ROADMAP, e.g., 63), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 67). **Important:** T must be `phase_count` (the total number of phases in this milestone), NOT the count of remaining/incomplete phases. When phases are numbered 61-67, T=7 and the banner should read `Phase 63/7` (phase 63, 7 total in milestone), not `Phase 63/3` (which would confuse 3 remaining with 3 total). P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
205
-
206
- **Alternative display when phase numbers exceed total** (e.g., multi-milestone projects where phases are numbered globally): If N > T (phase number exceeds milestone phase count), use the format `Phase {N} ({position}/{T})` where `position` is the 1-based index of this phase among incomplete phases being processed. This prevents confusing displays like "Phase 63/5".
213
+ Banner math (N, T, P and the N > T fallback): reference § Banner math.
207
214
 
208
215
  **3a. Smart Discuss**
209
216
 
@@ -235,63 +242,7 @@ SKIP_DISCUSS=$(pp_run query config-get workflow.skip_discuss 2>/dev/null || echo
235
242
  Phase ${PHASE_NUM}: Discuss skipped (workflow.skip_discuss=true) — using ROADMAP phase goal as spec.
236
243
  ```
237
244
 
238
- Write a minimal CONTEXT.md so downstream plan-phase has valid input. Get phase details:
239
-
240
- ```bash
241
- DETAIL=$(pp_run query roadmap.get-phase ${PHASE_NUM})
242
- ```
243
-
244
- Extract `goal` and `requirements` from JSON. Write `${phase_dir}/${padded_phase}-CONTEXT.md` with:
245
-
246
- ```markdown
247
- # Phase {PHASE_NUM}: {Phase Name} - Context
248
-
249
- **Gathered:** {date}
250
- **Status:** Ready for planning
251
- **Mode:** Auto-generated (discuss skipped via workflow.skip_discuss)
252
-
253
- <domain>
254
- ## Phase Boundary
255
-
256
- {goal from ROADMAP phase description}
257
-
258
- </domain>
259
-
260
- <decisions>
261
- ## Implementation Decisions
262
-
263
- ### Claude's Discretion
264
- All implementation choices are at Claude's discretion — discuss phase was skipped per user setting. Use ROADMAP phase goal, success criteria, and codebase conventions to guide decisions.
265
-
266
- </decisions>
267
-
268
- <code_context>
269
- ## Existing Code Insights
270
-
271
- Codebase context will be gathered during plan-phase research.
272
-
273
- </code_context>
274
-
275
- <specifics>
276
- ## Specific Ideas
277
-
278
- No specific requirements — discuss phase skipped. Refer to ROADMAP phase description and success criteria.
279
-
280
- </specifics>
281
-
282
- <deferred>
283
- ## Deferred Ideas
284
-
285
- None — discuss phase skipped.
286
-
287
- </deferred>
288
- ```
289
-
290
- Commit the minimal context:
291
-
292
- ```bash
293
- pp_run query commit "docs(${PADDED_PHASE}): auto-generated context (discuss skipped)" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
294
- ```
245
+ Write and commit the minimal CONTEXT.md in reference § Minimal CONTEXT.md (skip_discuss).
295
246
 
296
247
  Proceed to 3b.
297
248
 
@@ -322,7 +273,7 @@ Resolve active `plan:pre` hooks:
322
273
 
323
274
  ```bash
324
275
  UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
325
- HOOKS_JSON=$(pp_run loop render-hooks plan:pre --raw)
276
+ HOOKS_JSON=$(pp_run loop render-hooks plan:pre --raw --phase "${PHASE_NUM}")
326
277
  ```
327
278
 
328
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.)
@@ -360,7 +311,7 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
360
311
  **If `INTERACTIVE` is set:** Background dispatch is only safe where a backgrounded agent can still spawn subagents. On Claude Code a backgrounded agent has no `Agent`/`Task` tool, so the plan-checker never runs and `workflow.plan_check` silently degrades to a self-check. Resolve the runtime first:
361
312
 
362
313
  ```bash
363
- RUNTIME=$(pp_run query config-get runtime --default claude 2>/dev/null || echo "claude")
314
+ RUNTIME=$(pp_run query config-get runtime --default claude --raw 2>/dev/null || echo "claude")
364
315
  ```
365
316
 
366
317
  - **On Claude Code (`RUNTIME` is `claude`):** Run plan **inline** (do NOT background) so the plan-checker runs. The next phase's discuss does not overlap planning here — correctness over overlap.
@@ -374,7 +325,7 @@ RUNTIME=$(pp_run query config-get runtime --default claude 2>/dev/null || echo "
374
325
  - Otherwise (local planning):
375
326
 
376
327
  ```
377
- Skill(skill="pp-plan-phase", args="${PHASE_NUM}")
328
+ Skill(skill="pp-plan-phase", args="${PHASE_NUM}${UNATTENDED_ARG}")
378
329
  ```
379
330
 
380
331
  - **On other runtimes:** Dispatch plan as a background agent to keep the main context lean. While plan runs, the workflow can immediately start discussing the next phase (see step 4).
@@ -395,7 +346,7 @@ RUNTIME=$(pp_run query config-get runtime --default claude 2>/dev/null || echo "
395
346
  Agent(
396
347
  description="Plan phase ${PHASE_NUM}: ${PHASE_NAME}",
397
348
  run_in_background=true,
398
- prompt="Run plan-phase for phase ${PHASE_NUM}: Skill(skill=\"pp-plan-phase\", args=\"${PHASE_NUM}\")"
349
+ prompt="Run plan-phase for phase ${PHASE_NUM}: Skill(skill=\"pp-plan-phase\", args=\"${PHASE_NUM}${UNATTENDED_ARG}\")"
399
350
  )
400
351
  ```
401
352
 
@@ -412,7 +363,7 @@ Skill(skill="pp-plan-review-convergence", args="${PHASE_NUM} ${CONVERGENCE_ARGS}
412
363
  If `PLAN_STRATEGY=local`, run the regular planner:
413
364
 
414
365
  ```
415
- Skill(skill="pp-plan-phase", args="${PHASE_NUM}")
366
+ Skill(skill="pp-plan-phase", args="${PHASE_NUM}${UNATTENDED_ARG}")
416
367
  ```
417
368
 
418
369
  Verify plan produced output — re-run `init phase-op` and check `has_plans`. If false → go to handle_blocker: "Plan phase ${PHASE_NUM} did not produce any plans."
@@ -422,13 +373,13 @@ Verify plan produced output — re-run `init phase-op` and check `has_plans`. If
422
373
  **If `INTERACTIVE` is set:** Wait for the plan agent to complete (if not already) and verify plans exist. Background dispatch is only safe where a backgrounded agent can still spawn subagents. On Claude Code a backgrounded agent has no `Agent`/`Task` tool, so the per-plan worktree-isolated executors and the verifier never run (`workflow.use_worktrees` and `workflow.verifier` silently degrade). Resolve the runtime first:
423
374
 
424
375
  ```bash
425
- RUNTIME=$(pp_run query config-get runtime --default claude 2>/dev/null || echo "claude")
376
+ RUNTIME=$(pp_run query config-get runtime --default claude --raw 2>/dev/null || echo "claude")
426
377
  ```
427
378
 
428
379
  - **On Claude Code (`RUNTIME` is `claude`):** Run execute **inline** (do NOT background) so worktree isolation and verification run:
429
380
 
430
381
  ```
431
- Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition")
382
+ Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition${UNATTENDED_ARG}")
432
383
  ```
433
384
 
434
385
  - **On other runtimes:** Dispatch execute as a background agent:
@@ -437,7 +388,7 @@ Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition")
437
388
  Agent(
438
389
  description="Execute phase ${PHASE_NUM}: ${PHASE_NAME}",
439
390
  run_in_background=true,
440
- prompt="Run execute-phase for phase ${PHASE_NUM}: Skill(skill=\"pp-execute-phase\", args=\"${PHASE_NUM} --no-transition\")"
391
+ prompt="Run execute-phase for phase ${PHASE_NUM}: Skill(skill=\"pp-execute-phase\", args=\"${PHASE_NUM} --no-transition${UNATTENDED_ARG}\")"
441
392
  )
442
393
  ```
443
394
 
@@ -446,7 +397,7 @@ Agent(
446
397
  **If `INTERACTIVE` is NOT set (default):** Run execute inline as before.
447
398
 
448
399
  ```
449
- Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition")
400
+ Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition${UNATTENDED_ARG}")
450
401
  ```
451
402
 
452
403
  **3c.5. Code Review and Fix**
@@ -455,7 +406,7 @@ Auto-invoke code review and fix chain. Autonomous mode chains both review and fi
455
406
 
456
407
  **Capability dispatch:**
457
408
  ```bash
458
- EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw)
409
+ EXECUTE_POST_HOOKS_JSON=$(pp_run loop render-hooks execute:post --raw --phase "${PHASE_NUM}")
459
410
  ```
460
411
 
461
412
  Resolve active step hooks from `EXECUTE_POST_HOOKS_JSON` where `kind == "step"` and `ref.skill == "code-review"`.
@@ -482,18 +433,12 @@ Skill(skill="pp-code-review", args="${PHASE_NUM} --fix --auto")
482
433
  After execute-phase returns (or the execute agent completes), read the verification result:
483
434
 
484
435
  ```bash
485
- VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
436
+ VERIFY_STATUS=$(pp_run query verification.status "${PHASE_DIR}" --pick status 2>/dev/null)
486
437
  ```
487
438
 
488
- Where `PHASE_DIR` comes from the `init phase-op` call already made in step 3a. If the variable is not in scope, re-fetch:
439
+ `PHASE_DIR` is `phase_dir` from step 3a's `init phase-op` (re-run it if out of scope).
489
440
 
490
- ```bash
491
- PHASE_STATE=$(pp_run query init.phase-op ${PHASE_NUM})
492
- ```
493
-
494
- Parse `phase_dir` from the JSON.
495
-
496
- **If VERIFY_STATUS is empty** (no VERIFICATION.md or no status field):
441
+ **If VERIFY_STATUS is empty, `missing` or `unknown`** (no VERIFICATION.md or no status field):
497
442
 
498
443
  Go to handle_blocker: "Execute phase ${PHASE_NUM} did not produce verification results."
499
444
 
@@ -504,72 +449,29 @@ Display:
504
449
  Phase ${PHASE_NUM} ✅ ${PHASE_NAME} — Verification passed
505
450
  ```
506
451
 
507
- Proceed to iterate step.
508
-
509
- **If `human_needed`:**
510
-
511
- Read the human_verification section from VERIFICATION.md to get the count and items requiring manual testing.
512
-
513
-
514
- **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
515
- Display the items, then ask user via AskUserQuestion:
516
- - **question:** "Phase ${PHASE_NUM} has items needing manual verification. Validate now or continue to next phase?"
517
- - **options:** "Validate now" / "Continue without validation"
452
+ `OUTCOME=passed`; go to **3d exit**.
518
453
 
519
- On **"Validate now"**: Present the specific items from VERIFICATION.md's human_verification section. After user reviews, ask:
520
- - **question:** "Validation result?"
521
- - **options:** "All good — continue" / "Found issues"
454
+ **If `human_needed`:** rule A-2 — display the items, record, print the deferred line, `OUTCOME=human_needed`, go to **3d exit**; never flip to passed. `--supervised`: reference § Supervised menus.
522
455
 
523
- On "All good — continue": Display `Phase ${PHASE_NUM} ✅ Human validation passed` and proceed to iterate step.
456
+ **If `gaps_found`:** rule A-3 — one closure attempt:
524
457
 
525
- On "Found issues": Go to handle_blocker with the user's reported issues as the description.
526
-
527
- On **"Continue without validation"**: Display `Phase ${PHASE_NUM} ⏭ Human validation deferred` and proceed to iterate step.
528
-
529
- **If `gaps_found`:**
530
-
531
- Read gap summary from VERIFICATION.md (score and missing items). Display:
532
458
  ```
533
- ⚠ Phase ${PHASE_NUM}: ${PHASE_NAME} — Gaps Found
534
- Score: {N}/{M} must-haves verified
535
- ```
536
-
537
- Ask user via AskUserQuestion:
538
- - **question:** "Gaps found in phase ${PHASE_NUM}. How to proceed?"
539
- - **options:** "Run gap closure" / "Continue without fixing" / "Stop autonomous mode"
540
-
541
- On **"Run gap closure"**: Execute gap closure cycle (limit: 1 attempt):
542
-
543
- ```
544
- Skill(skill="pp-plan-phase", args="${PHASE_NUM} --gaps")
459
+ Skill(skill="pp-plan-phase", args="${PHASE_NUM} --gaps${UNATTENDED_ARG}")
545
460
  ```
546
461
 
547
462
  Verify gap plans were created — re-run `init phase-op ${PHASE_NUM}` and check `has_plans`. If no new gap plans → go to handle_blocker: "Gap closure planning for phase ${PHASE_NUM} did not produce plans."
548
463
 
549
- Re-execute:
550
464
  ```
551
- Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition")
465
+ Skill(skill="pp-execute-phase", args="${PHASE_NUM} --no-transition${UNATTENDED_ARG}")
552
466
  ```
553
467
 
554
- Re-read verification status:
555
468
  ```bash
556
- VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
469
+ VERIFY_STATUS=$(pp_run query verification.status "${PHASE_DIR}" --pick status 2>/dev/null)
557
470
  ```
558
471
 
559
- If `passed` or `human_needed`: Route normally (continue or ask user as above).
560
-
561
- If still `gaps_found` after this retry: Display "Gaps persist after closure attempt." and ask via AskUserQuestion:
562
- - **question:** "Gap closure did not fully resolve issues. How to proceed?"
563
- - **options:** "Continue anyway" / "Stop autonomous mode"
472
+ Route the new status through A-3 (passed → `OUTCOME=passed`; human_needed → A-2; still gaps_found → record, print the deferred line, `OUTCOME=gaps_found`), then go to **3d exit**. `--supervised`: reference § Supervised menus.
564
473
 
565
- On "Continue anyway": Proceed to iterate step.
566
- On "Stop autonomous mode": Go to handle_blocker.
567
-
568
- This limits gap closure to 1 automatic retry to prevent infinite loops.
569
-
570
- On **"Continue without fixing"**: Display `Phase ${PHASE_NUM} ⏭ Gaps deferred` and proceed to iterate step.
571
-
572
- On **"Stop autonomous mode"**: Go to handle_blocker with "User stopped — gaps remain in phase ${PHASE_NUM}".
474
+ **3d exit — every branch of 3d ends here, including an A-4 stop:** run the reference's `phase-exit` snippet (appends `handled=${PHASE_NUM}:${OUTCOME}` once, commits `$REPORT` if it exists), then continue to 3d.5 (A-4 stop: print its banner and exit).
573
475
 
574
476
  **3d.5. UI Review (Frontend Phases)**
575
477
 
@@ -579,7 +481,7 @@ Resolve the active post-verification hooks and the UI-SPEC gate:
579
481
 
580
482
  ```bash
581
483
  UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
582
- HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw)
484
+ HOOKS_JSON=$(pp_run loop render-hooks verify:post --raw --phase "${PHASE_NUM}")
583
485
  ```
584
486
 
585
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.
@@ -605,7 +507,7 @@ Display the review result summary and score from UI-REVIEW.md if produced. Conti
605
507
 
606
508
  > Full instructions are in `pp-core/references/autonomous-smart-discuss.md`. Read that file now and follow it exactly.
607
509
 
608
- Smart discuss is an autonomous-optimized variant of `pp-discuss-phase`. It proposes grey area answers in batch tables — the user accepts or overrides per area — and writes an identical CONTEXT.md to what discuss-phase produces.
510
+ Smart discuss is an autonomous-optimized variant of `pp-discuss-phase`. It proposes grey area answers in batch tables — best-effort accepts the recommended answers and records them (rule A-1); `--supervised` restores the per-area prompts — and writes an identical CONTEXT.md to what discuss-phase produces.
609
511
 
610
512
  **Inputs:** `PHASE_NUM` from execute_phase.
611
513
 
@@ -628,11 +530,12 @@ Read and execute: `$HOME/.claude/pp-core/references/autonomous-smart-discuss.md`
628
530
 
629
531
  Completed through phase ${TO_PHASE} as requested.
630
532
  Remaining phases were not executed.
533
+ Deferred (not complete): ${DEFERRED} ← if non-empty (A-7)
631
534
 
632
535
  Resume with: /pp:autonomous --from ${next_incomplete_phase}
633
536
  ```
634
537
 
635
- Proceed directly to lifecycle step (which handles partial completion — skips audit/complete/cleanup since not all phases are done). Exit cleanly.
538
+ Run `run-end` (rule A-7) first. Proceed directly to lifecycle step (which handles partial completion — skips audit/complete/cleanup since not all phases are done). Exit cleanly.
636
539
 
637
540
  **Otherwise:** After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
638
541
 
@@ -645,14 +548,15 @@ Re-filter incomplete phases using the same logic as discover_phases:
645
548
  - Apply `--from N` filter if originally provided
646
549
  - Apply `--to N` filter if originally provided
647
550
  - Sort by number ascending
551
+ - Exclude phases handled this run: run `run-state-read` and drop every number in `HANDLED` (review defect 6a — a deferred or blocked phase must not be re-selected).
648
552
 
649
- Read STATE.md fresh:
553
+ Read STATE.md fresh (workstream-aware):
650
554
 
651
555
  ```bash
652
- cat .planning/STATE.md
556
+ STATE_RAW=$(pp_run query state.load --pick state_raw 2>/dev/null)
653
557
  ```
654
558
 
655
- Check for blockers in the Blockers/Concerns section. If blockers are found, go to handle_blocker with the blocker description.
559
+ Check the Blockers/Concerns section of `$STATE_RAW`. If blockers are found, go to handle_blocker with the blocker description.
656
560
 
657
561
  If incomplete phases remain: proceed to next phase, loop back to execute_phase.
658
562
 
@@ -663,7 +567,7 @@ If incomplete phases remain: proceed to next phase, loop back to execute_phase.
663
567
 
664
568
  This means the user is always answering discuss questions (lightweight, interactive) while the heavy work (planning, code generation) runs in the background. The main context only accumulates discuss conversations — plan and execute contexts are isolated in their agents. (On Claude Code, plan and execute run inline, so they run sequentially and their work accumulates in the main context.)
665
569
 
666
- If all phases complete, proceed to lifecycle step.
570
+ If no selectable phase remains, apply rule A-7: run `run-end`; if `DEFERRED` is non-empty, print the end-of-run summary naming each deferred phase and `/pp:verify-work N`, and exit — never the lifecycle, never "All phases complete". Otherwise proceed to lifecycle step.
667
571
 
668
572
  </step>
669
573
 
@@ -671,180 +575,35 @@ If all phases complete, proceed to lifecycle step.
671
575
 
672
576
  ## 5. Lifecycle
673
577
 
674
- **If `ONLY_PHASE` is set:** Skip lifecycle. A single phase does not trigger audit/complete/cleanup. Display:
675
-
676
- ```
677
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
678
- pp-core ► AUTONOMOUS ▸ PHASE ${ONLY_PHASE} COMPLETE ✓
679
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
680
-
681
- Phase ${ONLY_PHASE}: ${PHASE_NAME} — Done
682
- Mode: Single phase (--only)
683
-
684
- Lifecycle skipped — run /pp:autonomous without --only
685
- after all phases complete to trigger audit/complete/cleanup.
686
- ```
687
-
688
- Exit cleanly.
689
-
690
- **Otherwise:** After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
691
-
692
- Display lifecycle transition banner:
693
-
694
- ```
695
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
696
- pp-core ► AUTONOMOUS ▸ LIFECYCLE
697
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
698
-
699
- All phases complete → Starting lifecycle: audit → complete → cleanup
700
- Milestone: {milestone_version} — {milestone_name}
701
- ```
702
-
703
- **5a. Audit**
704
-
705
- ```
706
- Skill(skill="pp-audit-milestone")
707
- ```
708
-
709
- After audit completes, detect the result:
710
-
711
- ```bash
712
- AUDIT_FILE=".planning/v${milestone_version}-MILESTONE-AUDIT.md"
713
- AUDIT_STATUS=$(grep "^status:" "${AUDIT_FILE}" 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
714
- ```
715
-
716
- **If AUDIT_STATUS is empty** (no audit file or no status field):
717
-
718
- Go to handle_blocker: "Audit did not produce results — audit file missing or malformed."
719
-
720
- **If `passed`:**
721
-
722
- Display:
723
- ```
724
- Audit ✅ passed — proceeding to complete milestone
725
- ```
726
-
727
- Proceed to 5b (no user pause — per CTRL-01).
728
-
729
- **If `gaps_found`:**
730
-
731
- Read the gaps summary from the audit file. Display:
732
- ```
733
- ⚠ Audit: Gaps Found
734
- ```
735
-
736
- Ask user via AskUserQuestion:
737
- - **question:** "Milestone audit found gaps. How to proceed?"
738
- - **options:** "Continue anyway — accept gaps" / "Stop — fix gaps manually"
739
-
740
- On **"Continue anyway"**: Display `Audit ⏭ Gaps accepted — proceeding to complete milestone` and proceed to 5b.
741
-
742
- On **"Stop"**: Go to handle_blocker with "User stopped — audit gaps remain. Run /pp:audit-milestone to review, then /pp:complete-milestone when ready."
743
-
744
- **If `tech_debt`:**
745
-
746
- Read the tech debt summary from the audit file. Display:
747
- ```
748
- ⚠ Audit: Tech Debt Identified
749
- ```
750
-
751
- Show the summary, then ask user via AskUserQuestion:
752
- - **question:** "Milestone audit found tech debt. How to proceed?"
753
- - **options:** "Continue with tech debt" / "Stop — address debt first"
754
-
755
- On **"Continue with tech debt"**: Display `Audit ⏭ Tech debt acknowledged — proceeding to complete milestone` and proceed to 5b.
756
-
757
- On **"Stop"**: Go to handle_blocker with "User stopped — tech debt to address. Run /pp:audit-milestone to review details."
758
-
759
- **5b. Complete Milestone**
760
-
761
- ```
762
- Skill(skill="pp-complete-milestone", args="${milestone_version}")
763
- ```
764
-
765
- After complete-milestone returns, verify it produced output:
766
-
767
- ```bash
768
- ls .planning/milestones/v${milestone_version}-ROADMAP.md 2>/dev/null || true
769
- ```
770
-
771
- If the archive file does not exist, go to handle_blocker: "Complete milestone did not produce expected archive files."
772
-
773
- **5c. Cleanup**
774
-
775
- ```
776
- Skill(skill="pp-cleanup")
777
- ```
778
-
779
- Cleanup shows its own dry-run and asks user for approval internally — this is an acceptable pause per CTRL-01 since it's an explicit decision about file deletion.
780
-
781
- **5d. Final Completion**
782
-
783
- Display final completion banner:
784
-
785
- ```
786
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
787
- pp-core ► AUTONOMOUS ▸ COMPLETE 🎉
788
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
578
+ > Full instructions are in `pp-core/references/autonomous-lifecycle.md`. Read that file now and follow it exactly.
789
579
 
790
- Milestone: {milestone_version} — {milestone_name}
791
- Status: Complete ✅
792
- Lifecycle: audit ✅ → complete ✅ → cleanup ✅
580
+ Read and execute: `$HOME/.claude/pp-core/references/autonomous-lifecycle.md`
793
581
 
794
- Ship it! 🚀
795
- ```
796
-
797
- </step>
798
-
799
- <step name="handle_blocker">
582
+ It covers the `--only` skip, the audit → complete → cleanup sequence, and the
583
+ milestone-complete banner. Return here only to proceed to §6 on a blocker.
800
584
 
801
585
  ## 6. Handle Blocker
802
586
 
803
- When any phase operation fails or a blocker is detected, present 3 options via AskUserQuestion:
804
-
805
- **Prompt:** "Phase {N} ({Name}) encountered an issue: {description}"
806
-
807
- **Options:**
808
- 1. **"Fix and retry"** — Re-run the failed step (discuss, plan, or execute) for this phase
809
- 2. **"Skip this phase"** — Mark phase as skipped, continue to the next incomplete phase
810
- 3. **"Stop autonomous mode"** — Display summary of progress so far and exit cleanly
811
-
812
- **On "Fix and retry":** Loop back to the failed step within execute_phase. If the same step fails again after retry, re-present these options.
813
-
814
- **On "Skip this phase":** Log `Phase {N} ⏭ {Name} — Skipped by user` and proceed to iterate.
815
-
816
- **On "Stop autonomous mode":** Display progress summary:
817
-
818
- ```
819
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
820
- pp-core ► AUTONOMOUS ▸ STOPPED
821
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
822
-
823
- Completed: {list of completed phases}
824
- Skipped: {list of skipped phases}
825
- Remaining: {list of remaining phases}
826
-
827
- Resume with: /pp:autonomous ${ONLY_PHASE ? "--only " + ONLY_PHASE : "--from " + next_phase}${TO_PHASE ? " --to " + TO_PHASE : ""}
828
- ```
587
+ Re-read `pp-core/references/autonomous-best-effort.md`, then apply rule A-4: best-effort retries the failed step once (counter in `$RUN_STATE`), then records the blocker, prints the STOPPED banner with the resume command and the end-of-run summary, and exits. `--supervised`: the three-option menu (Fix and retry / Skip this phase / Stop) in reference § Supervised menus.
829
588
 
830
589
  </step>
831
590
 
832
591
  </process>
833
592
 
834
593
  <success_criteria>
835
- - [ ] All incomplete phases executed in order (smart discuss → ui-phase → plan → execute → ui-review each)
836
- - [ ] Smart discuss proposes grey area answers in tables, user accepts or overrides per area
594
+ - [ ] Selected phases (default: the next one) executed in order (smart discuss → ui-phase → plan → execute → ui-review each)
595
+ - [ ] Smart discuss proposes grey area answers in tables; best-effort accepts the recommended ones and records them (`--supervised`: user accepts or overrides per area)
837
596
  - [ ] Progress banners displayed between phases
838
597
  - [ ] Execute-phase invoked with --no-transition (autonomous manages transitions)
839
598
  - [ ] Post-execution verification reads VERIFICATION.md and routes on status
840
599
  - [ ] Passed verification → automatic continue to next phase
841
- - [ ] Human-needed verification → user prompted to validate or skip
842
- - [ ] Gaps-found → user offered gap closure, continue, or stop
600
+ - [ ] Human-needed verification → deferred, recorded in the report and never marked passed; `--supervised` restores the prompt
601
+ - [ ] Gaps-found → one gap-closure attempt, then deferred and recorded; `--supervised` restores the prompt
843
602
  - [ ] Gap closure limited to 1 retry (prevents infinite loops)
844
603
  - [ ] Plan-phase and execute-phase failures route to handle_blocker
845
604
  - [ ] ROADMAP.md re-read after each phase (catches inserted phases)
846
605
  - [ ] STATE.md checked for blockers before each phase
847
- - [ ] Blockers handled via user choice (retry / skip / stop)
606
+ - [ ] Blockers → one retry, then recorded and the run stops; `--supervised` restores the prompt
848
607
  - [ ] Final completion or stop summary displayed
849
608
  - [ ] After all phases complete, lifecycle step is invoked (not manual suggestion)
850
609
  - [ ] Lifecycle transition banner displayed before audit
@@ -883,4 +642,7 @@ When any phase operation fails or a blocker is detected, present 3 options via A
883
642
  - [ ] `--converge` fails fast with enable instructions when `workflow.plan_review_convergence=false`
884
643
  - [ ] `--converge` forwards reviewer selector flags and `--max-cycles N`
885
644
  - [ ] Default autonomous planning remains `pp-plan-phase` when convergence is not requested
645
+ - [ ] No-arg run executes exactly the next incomplete phase (same path as `--only`), and stops when that phase is `human_needed`/`gaps_found`
646
+ - [ ] Every auto-decision is appended to `{padded}-AUTONOMOUS-REPORT.md` as it is made
647
+ - [ ] `--supervised` restores every prompt; otherwise `--unattended` is passed to plan-phase/execute-phase
886
648
  </success_criteria>