@pareto4/pp-core 1.11.1 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +31 -0
- package/agents/pp-code-fixer.md +1 -1
- package/agents/pp-debug-session-manager.md +1 -1
- package/agents/pp-debugger.md +1 -1
- package/agents/pp-executor.md +20 -10
- package/agents/pp-intel-updater.md +1 -1
- package/agents/pp-phase-researcher.md +1 -1
- package/agents/pp-plan-checker.md +5 -5
- package/agents/pp-planner.md +10 -24
- package/agents/pp-project-researcher.md +1 -1
- package/agents/pp-research-synthesizer.md +1 -1
- package/agents/pp-ui-researcher.md +1 -1
- package/agents/pp-verifier.md +8 -4
- package/bin/install.js +429 -82
- package/commands/pp-autonomous.md +8 -6
- package/commands/pp-discovery-to-build.md +1 -1
- package/commands/pp-discovery.md +3 -2
- package/commands/pp-discuss-phase.md +2 -2
- package/commands/pp-execute-phase.md +3 -1
- package/commands/pp-graphify.md +5 -5
- package/commands/pp-import.md +1 -1
- package/commands/pp-map-codebase.md +1 -1
- package/commands/pp-ns-project.md +2 -3
- package/commands/pp-ns-workflow.md +1 -1
- package/commands/pp-plan-phase.md +2 -1
- package/commands/pp-verify-work.md +2 -1
- package/gemini-extension.json +1 -1
- package/hooks/dist/pp-cursor-session-start.js +2 -2
- package/hooks/dist/pp-session-state.sh +1 -1
- package/hooks/dist/pp-statusline.js +21 -2
- package/hooks/pp-cursor-session-start.js +2 -2
- package/hooks/pp-session-state.sh +1 -1
- package/hooks/pp-statusline.js +21 -2
- package/package.json +18 -5
- package/pareto-skills/pp-project-setup/SKILL.md +5 -63
- package/pp-core/bin/detect-build-commands.sh +182 -0
- package/pp-core/bin/lib/capability-activation.cjs +19 -9
- package/pp-core/bin/lib/capability-registry.cjs +65 -7
- package/pp-core/bin/lib/check-command-router.cjs +79 -38
- package/pp-core/bin/lib/clusters.cjs +2 -3
- package/pp-core/bin/lib/command-aliases.cjs +36 -0
- package/pp-core/bin/lib/command-arg-projection.cjs +99 -1
- package/pp-core/bin/lib/commands.cjs +21 -6
- package/pp-core/bin/lib/compose-bindings.cjs +70 -6
- package/pp-core/bin/lib/config-loader.cjs +151 -8
- package/pp-core/bin/lib/config-schema.cjs +16 -0
- package/pp-core/bin/lib/config.cjs +142 -27
- package/pp-core/bin/lib/core-utils.cjs +43 -7
- package/pp-core/bin/lib/discovery-input-check.cjs +218 -0
- package/pp-core/bin/lib/discovery-rebaseline.cjs +1372 -0
- package/pp-core/bin/lib/discovery-research-track.cjs +979 -0
- package/pp-core/bin/lib/discovery-rollup.cjs +476 -0
- package/pp-core/bin/lib/discovery-screens.cjs +1995 -0
- package/pp-core/bin/lib/discovery-sweep.cjs +390 -0
- package/pp-core/bin/lib/discovery-table.cjs +98 -0
- package/pp-core/bin/lib/dispatch-plan.cjs +472 -0
- package/pp-core/bin/lib/frontmatter.cjs +17 -2
- package/pp-core/bin/lib/init-command-router.cjs +8 -5
- package/pp-core/bin/lib/init-contract.cjs +93 -4
- package/pp-core/bin/lib/init.cjs +124 -134
- package/pp-core/bin/lib/install-profiles.cjs +5 -0
- package/pp-core/bin/lib/install-run.cjs +536 -0
- package/pp-core/bin/lib/io.cjs +15 -0
- package/pp-core/bin/lib/loop-resolver.cjs +40 -2
- package/pp-core/bin/lib/milestone.cjs +345 -48
- package/pp-core/bin/lib/phase-command-router.cjs +23 -1
- package/pp-core/bin/lib/phase-locator.cjs +15 -6
- package/pp-core/bin/lib/phase-scope.cjs +91 -0
- package/pp-core/bin/lib/phase-tier.cjs +467 -0
- package/pp-core/bin/lib/phase.cjs +247 -21
- package/pp-core/bin/lib/phases-command-router.cjs +2 -0
- package/pp-core/bin/lib/plan-graph.cjs +368 -0
- package/pp-core/bin/lib/planning-workspace.cjs +53 -0
- package/pp-core/bin/lib/platform-bindings.cjs +32 -2
- package/pp-core/bin/lib/profile-output.cjs +11 -3
- package/pp-core/bin/lib/prohibition-enforcement.cjs +112 -0
- package/pp-core/bin/lib/roadmap-parser.cjs +366 -99
- package/pp-core/bin/lib/roadmap.cjs +141 -39
- package/pp-core/bin/lib/runtime-hooks-surface.cjs +1 -1
- package/pp-core/bin/lib/shell-command-projection.cjs +24 -0
- package/pp-core/bin/lib/state-command-router.cjs +82 -13
- package/pp-core/bin/lib/state-document.cjs +124 -7
- package/pp-core/bin/lib/state.cjs +784 -257
- package/pp-core/bin/lib/template.cjs +22 -6
- package/pp-core/bin/lib/vault-command-router.cjs +57 -6
- package/pp-core/bin/lib/vault-practices.cjs +6 -36
- package/pp-core/bin/lib/vault-write-back.cjs +20 -4
- package/pp-core/bin/lib/vault.cjs +592 -23
- package/pp-core/bin/lib/verify.cjs +53 -31
- package/pp-core/bin/lib/workstream.cjs +1 -1
- package/pp-core/bin/lib/worktree-safety.cjs +26 -15
- package/pp-core/bin/portable-timeout.sh +89 -0
- package/pp-core/bin/pp-tools.cjs +149 -9
- package/pp-core/bin/shared/config-defaults.manifest.json +7 -0
- package/pp-core/bin/shared/config-schema.manifest.json +3 -0
- package/pp-core/references/autonomous-best-effort.md +461 -0
- package/pp-core/references/autonomous-lifecycle.md +146 -0
- package/pp-core/references/autonomous-smart-discuss.md +16 -12
- package/pp-core/references/checkpoints.md +1 -1
- package/pp-core/references/discovery-id-conventions.md +202 -0
- package/pp-core/references/discovery-rebaseline.md +254 -0
- package/pp-core/references/discovery-research-track.md +283 -0
- package/pp-core/references/discovery-traceability.md +400 -0
- package/pp-core/references/loop-hook-dispatch.md +14 -0
- package/pp-core/references/mandatory-initial-read.md +1 -1
- package/pp-core/references/planner-gap-closure.md +1 -0
- package/pp-core/references/planner-human-verify-mode.md +1 -1
- package/pp-core/references/planner-load-graph-context.md +1 -1
- package/pp-core/references/planner-plan-graph.md +66 -0
- package/pp-core/references/planner-tdd.md +1 -0
- package/pp-core/references/planning-config.md +8 -0
- package/pp-core/references/sketch-tooling.md +4 -0
- package/pp-core/references/tdd.md +1 -0
- package/pp-core/templates/claude-md.md +1 -1
- package/pp-core/templates/phase-prompt.md +6 -2
- package/pp-core/templates/prototype-review/review.js +303 -0
- package/pp-core/templates/state.md +6 -0
- package/pp-core/workflows/_runtime-launcher.snippet.sh +1 -1
- package/pp-core/workflows/add-backlog.md +1 -1
- package/pp-core/workflows/add-phase.md +1 -1
- package/pp-core/workflows/add-tests.md +1 -1
- package/pp-core/workflows/add-todo.md +1 -1
- package/pp-core/workflows/ai-integration-phase.md +2 -2
- package/pp-core/workflows/audit-fix.md +12 -16
- package/pp-core/workflows/audit-milestone.md +2 -2
- package/pp-core/workflows/audit-uat.md +1 -1
- package/pp-core/workflows/autonomous.md +68 -306
- package/pp-core/workflows/check-todos.md +1 -1
- package/pp-core/workflows/cleanup.md +1 -1
- package/pp-core/workflows/code-review-fix.md +2 -2
- package/pp-core/workflows/code-review.md +20 -8
- package/pp-core/workflows/complete-milestone.md +41 -60
- package/pp-core/workflows/debug.md +1 -1
- package/pp-core/workflows/diagnose-issues.md +1 -1
- package/pp-core/workflows/discovery-sprint/gap-analysis.md +140 -0
- package/pp-core/workflows/discovery-sprint/input-package.md +140 -0
- package/pp-core/workflows/discovery-sprint/prefill.md +92 -0
- package/pp-core/workflows/discovery-sprint/prototype.md +257 -0
- package/pp-core/workflows/discovery-sprint/rebaseline.md +276 -0
- package/pp-core/workflows/discovery-sprint/session-13-gates.md +24 -0
- package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +92 -0
- package/pp-core/workflows/discovery-sprint/sessions/02-as-is.md +98 -0
- package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +215 -0
- package/pp-core/workflows/discovery-sprint/sessions/04-ux-design.md +146 -0
- package/pp-core/workflows/discovery-sprint/sessions/05-architecture.md +98 -0
- package/pp-core/workflows/discovery-sprint/sessions/06-security.md +107 -0
- package/pp-core/workflows/discovery-sprint/sessions/07-identity.md +98 -0
- package/pp-core/workflows/discovery-sprint/sessions/08-integration.md +85 -0
- package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +109 -0
- package/pp-core/workflows/discovery-sprint/sessions/10-infrastructure.md +119 -0
- package/pp-core/workflows/discovery-sprint/sessions/11-roadmap.md +92 -0
- package/pp-core/workflows/discovery-sprint/sessions/12-delivery-model.md +98 -0
- package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +205 -0
- package/pp-core/workflows/discovery-sprint/templates/context-template.md +266 -0
- package/pp-core/workflows/discovery-sprint.md +79 -1714
- package/pp-core/workflows/discovery-to-build/steps/architecture-deliverables.md +5 -5
- package/pp-core/workflows/discovery-to-build/steps/screen-inventory-gate.md +70 -0
- package/pp-core/workflows/discovery-to-build/templates/discovery-references.md +54 -0
- package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +184 -0
- package/pp-core/workflows/discovery-to-build.md +21 -238
- package/pp-core/workflows/discuss-phase/modes/advisor.md +1 -1
- package/pp-core/workflows/discuss-phase/modes/auto.md +1 -1
- package/pp-core/workflows/discuss-phase/modes/chain.md +1 -1
- package/pp-core/workflows/discuss-phase-assumptions.md +1 -1
- package/pp-core/workflows/discuss-phase.md +11 -4
- package/pp-core/workflows/do.md +4 -4
- package/pp-core/workflows/docs-update.md +1 -1
- package/pp-core/workflows/edit-phase.md +1 -1
- package/pp-core/workflows/eval-review.md +1 -1
- package/pp-core/workflows/execute-phase/steps/checkpoint-handling.md +45 -0
- package/pp-core/workflows/execute-phase/steps/client-context-gate.md +1 -1
- package/pp-core/workflows/execute-phase/steps/codebase-drift-gate.md +1 -1
- package/pp-core/workflows/execute-phase/steps/cross-ai-delegation.md +90 -0
- package/pp-core/workflows/execute-phase/steps/install-run.md +29 -0
- package/pp-core/workflows/execute-phase/steps/phase-close-rebaseline.md +23 -0
- package/pp-core/workflows/execute-phase/steps/post-merge-gate.md +76 -77
- package/pp-core/workflows/execute-phase/steps/serial-group-dispatch.md +72 -0
- package/pp-core/workflows/execute-phase/steps/vault-fetch.md +5 -5
- package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +19 -112
- package/pp-core/workflows/execute-phase.md +104 -218
- package/pp-core/workflows/execute-plan.md +6 -2
- package/pp-core/workflows/explore.md +1 -1
- package/pp-core/workflows/extract-learnings.md +1 -1
- package/pp-core/workflows/forensics.md +4 -4
- package/pp-core/workflows/graduation.md +1 -1
- package/pp-core/workflows/health.md +1 -1
- package/pp-core/workflows/help/modes/brief.md +1 -0
- package/pp-core/workflows/help/modes/default.md +2 -1
- package/pp-core/workflows/help/modes/full.md +12 -5
- package/pp-core/workflows/import.md +1 -1
- package/pp-core/workflows/ingest-docs.md +1 -1
- package/pp-core/workflows/init.md +18 -2
- package/pp-core/workflows/insert-phase.md +1 -1
- package/pp-core/workflows/list-workspaces.md +1 -1
- package/pp-core/workflows/manager.md +3 -3
- package/pp-core/workflows/map-codebase.md +2 -2
- package/pp-core/workflows/milestone-summary.md +4 -4
- package/pp-core/workflows/mvp-phase.md +1 -1
- package/pp-core/workflows/new-milestone.md +7 -8
- package/pp-core/workflows/new-project.md +6 -1
- package/pp-core/workflows/new-workspace.md +1 -1
- package/pp-core/workflows/next.md +2 -2
- package/pp-core/workflows/note.md +2 -2
- package/pp-core/workflows/pause-work.md +1 -1
- package/pp-core/workflows/plan-milestone-gaps.md +1 -1
- package/pp-core/workflows/plan-phase/steps/chunked-planning.md +111 -0
- package/pp-core/workflows/plan-phase/steps/phase-tier.md +34 -0
- package/pp-core/workflows/plan-phase.md +43 -167
- package/pp-core/workflows/plan-review-convergence.md +2 -2
- package/pp-core/workflows/plant-seed.md +1 -1
- package/pp-core/workflows/pr-branch.md +1 -1
- package/pp-core/workflows/profile-user.md +1 -1
- package/pp-core/workflows/progress.md +3 -3
- package/pp-core/workflows/quick.md +4 -2
- package/pp-core/workflows/remove-phase.md +1 -1
- package/pp-core/workflows/remove-workspace.md +1 -1
- package/pp-core/workflows/resume-project.md +6 -12
- package/pp-core/workflows/review.md +1 -1
- package/pp-core/workflows/scan.md +1 -1
- package/pp-core/workflows/secure-phase.md +2 -2
- package/pp-core/workflows/settings-advanced.md +1 -1
- package/pp-core/workflows/settings-integrations.md +1 -1
- package/pp-core/workflows/settings.md +1 -1
- package/pp-core/workflows/ship.md +26 -9
- package/pp-core/workflows/sketch-wrap-up.md +1 -1
- package/pp-core/workflows/sketch.md +2 -1
- package/pp-core/workflows/spec-phase.md +1 -1
- package/pp-core/workflows/spike-wrap-up.md +1 -1
- package/pp-core/workflows/spike.md +1 -1
- package/pp-core/workflows/stats.md +2 -2
- package/pp-core/workflows/thread.md +1 -1
- package/pp-core/workflows/transition.md +5 -9
- package/pp-core/workflows/ui-phase.md +23 -2
- package/pp-core/workflows/ui-review.md +1 -1
- package/pp-core/workflows/ultraplan-phase.md +2 -2
- package/pp-core/workflows/validate-phase.md +2 -2
- package/pp-core/workflows/vault-write-back.md +1 -1
- package/pp-core/workflows/verify-phase.md +29 -26
- package/pp-core/workflows/verify-work.md +14 -10
- package/scripts/base64-scan.sh +7 -41
- package/scripts/changeset/cli.cjs +25 -5
- package/scripts/dev-env.cjs +462 -0
- package/scripts/lib/allowlist-ratchet.cjs +103 -1
- package/scripts/lib/size-budget.cjs +311 -0
- package/scripts/lint-neutrality-names.cjs +694 -0
- package/scripts/lint-org-coordinates.allowlist.json +35 -0
- package/scripts/lint-org-coordinates.cjs +426 -0
- package/scripts/lint-skill-deps.cjs +48 -9
- package/scripts/lint-test-file-count.cjs +17 -2
- package/scripts/prompt-injection-scan.sh +41 -20
- package/scripts/sync-manifest-versions.cjs +41 -7
- package/scripts/sync-runtime-launcher.cjs +106 -1
- package/scripts/update-size-baseline.cjs +274 -30
- package/scripts/workflow-size.cjs +61 -9
- package/commands/pp-build-handoff.md +0 -46
- package/pp-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +0 -94
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
# Autonomous — Best-Effort Rules
|
|
2
|
+
|
|
3
|
+
This file is Read at the start of EVERY phase (`autonomous.md` §3, first line) and again at §6, so
|
|
4
|
+
context compaction cannot erode the rules below. It contains bare `pp_run` calls and relies on the
|
|
5
|
+
caller's launcher — it carries no preamble of its own.
|
|
6
|
+
|
|
7
|
+
Mode model:
|
|
8
|
+
|
|
9
|
+
- **Default — best-effort.** At every decision point take the recommended option, record it in the
|
|
10
|
+
phase's report (§ Recording) at the moment it is taken, and continue.
|
|
11
|
+
- **`--supervised`** — every prompt is restored. The menus live in § Supervised menus, including the
|
|
12
|
+
`--text` numbered-list variant.
|
|
13
|
+
- **`--interactive`** — discuss runs inline (`pp-discuss-phase`). Orthogonal to the other two: it
|
|
14
|
+
never restores plan/execute prompts on its own; combine it with `--supervised` for that.
|
|
15
|
+
|
|
16
|
+
Autonomous passes ` --unattended` (leading space, held in `UNATTENDED_ARG`) to `pp-plan-phase` and
|
|
17
|
+
`pp-execute-phase` unless `--supervised` is set, and never `--auto`: plan-phase §15 would
|
|
18
|
+
auto-advance into a second execute-phase.
|
|
19
|
+
|
|
20
|
+
## Hard stops
|
|
21
|
+
|
|
22
|
+
These stop the run in every mode. Best-effort never answers them.
|
|
23
|
+
|
|
24
|
+
- Blocking capability `check.query` gates (`blocking: true` and `block: true`) — the host workflow
|
|
25
|
+
HALTs, which ends the run like an `exit 1`; unchanged.
|
|
26
|
+
- `human-action` checkpoints (auth/credentials) in execute-phase.
|
|
27
|
+
- Any checkpoint with `gate="blocking-human"` — package legitimacy (`agents/pp-executor.md`,
|
|
28
|
+
`agents/pp-planner.md`: never auto-approvable). Presented to the user under `UNATTENDED` and
|
|
29
|
+
`AUTO_MODE` alike; never deferred. The executor carries the attribute into its return as
|
|
30
|
+
`**Gate:** blocking-human`, which is what U-E1 keys on — a planner-inserted checkpoint is
|
|
31
|
+
recognised through that line, not through its prose.
|
|
32
|
+
- A planner `## CHECKPOINT REACHED` (U-P4) and a researcher `## RESEARCH BLOCKED` (U-P14).
|
|
33
|
+
- The client-vault and client-context **`confirmed` acknowledgements** —
|
|
34
|
+
`execute-phase/steps/vault-load-gate.md` (plan:pre and execute:pre; its `AUTO_MODE` reads only
|
|
35
|
+
`--auto`/`--chain`, so `--unattended` does not surface-and-continue) and
|
|
36
|
+
`execute-phase/steps/client-context-gate.md`. They are governance gates: best-effort never types
|
|
37
|
+
`confirmed` for the operator, in any mode.
|
|
38
|
+
- A worktree base/HEAD mismatch (`FATAL:` / exit 42) and a partial-execution recovery choice
|
|
39
|
+
(commits without a SUMMARY) in execute-phase — both fail closed and need the operator.
|
|
40
|
+
- A `.continue-here.md` blocking anti-pattern that cannot be answered from context.
|
|
41
|
+
- Anything outward — push, PR, deploy.
|
|
42
|
+
- Lifecycle audit/complete/cleanup never runs from a single-phase run.
|
|
43
|
+
- A `human_needed` verification is never flipped to `passed` by autonomous.
|
|
44
|
+
|
|
45
|
+
## Recording
|
|
46
|
+
|
|
47
|
+
Each phase has one report, next to its artifacts:
|
|
48
|
+
|
|
49
|
+
`REPORT="${PHASE_DIR}/$(basename "$PHASE_DIR" | cut -d- -f1)-AUTONOMOUS-REPORT.md"`
|
|
50
|
+
|
|
51
|
+
(the padded phase is the basename's first dash-segment, so `02.1-slug` gives `02.1`). Each entry
|
|
52
|
+
carries Point, Options, Choice, Why, Reverse and a UTC timestamp. Append AT THE MOMENT the decision
|
|
53
|
+
is taken, before continuing. Values are passed only as `%s` arguments, never interpolated into the
|
|
54
|
+
format string — phase names and gap text are untrusted.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# snippet: report-append
|
|
58
|
+
# expects REPORT, PHASE_NUM, POINT, OPTIONS, CHOICE, WHY, REVERSE
|
|
59
|
+
if [ ! -f "$REPORT" ]; then
|
|
60
|
+
printf '# Phase %s — Autonomous Report\n\nRun started: %s\nMode: best-effort\n\n' \
|
|
61
|
+
"$PHASE_NUM" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$REPORT"
|
|
62
|
+
fi
|
|
63
|
+
N=$(( $(grep -c '^## Decision ' "$REPORT" 2>/dev/null || true) + 1 ))
|
|
64
|
+
printf '## Decision %s — %s\n\n- **Point:** %s\n- **Options:** %s\n- **Choice:** %s\n- **Why:** %s\n- **Reverse:** %s\n- **At:** %s\n\n' \
|
|
65
|
+
"$N" "$POINT" "$POINT" "$OPTIONS" "$CHOICE" "$WHY" "$REVERSE" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$REPORT"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The counter uses `|| true`, not `|| echo 0`: on a header-only report `grep -c` already prints `0`
|
|
69
|
+
and exits 1, so `echo 0` would yield `0\n0` and the arithmetic dies (bash: `syntax error in
|
|
70
|
+
expression`; zsh: `bad math expression`). Header-only → 1, one entry → 2, missing file → 1 in both
|
|
71
|
+
shells.
|
|
72
|
+
|
|
73
|
+
**Phase exit** — `autonomous.md` §3d ends every branch here (passed, human_needed, gaps_found,
|
|
74
|
+
and an A-4 stop before its banner), so the `handled=` line and the report commit can never be
|
|
75
|
+
skipped by a branch that "continues". `OUTCOME` ∈ passed | human_needed | gaps_found | blocked;
|
|
76
|
+
`pp_run query commit` honours `commit_docs`.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# snippet: phase-exit
|
|
80
|
+
# expects RUN_STATE, PHASE_NUM, PHASE_DIR, REPORT, OUTCOME; pp_run from the caller's launcher
|
|
81
|
+
grep -q "^handled=${PHASE_NUM}:" "$RUN_STATE" 2>/dev/null ||
|
|
82
|
+
printf 'handled=%s:%s\n' "$PHASE_NUM" "$OUTCOME" >> "$RUN_STATE"
|
|
83
|
+
PADDED_PHASE=$(basename "$PHASE_DIR" | cut -d- -f1)
|
|
84
|
+
if [ -f "$REPORT" ]; then
|
|
85
|
+
pp_run query commit "docs(${PADDED_PHASE}): autonomous report" --files "$REPORT"
|
|
86
|
+
fi
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Run state
|
|
90
|
+
|
|
91
|
+
`.autonomous-run` lives next to the resolved STATE.md, so it is workstream-aware:
|
|
92
|
+
|
|
93
|
+
`RUN_STATE="$(dirname "$(pp_run query init.phase-op "$FIRST_PHASE" --pick state_path)")/.autonomous-run"`
|
|
94
|
+
|
|
95
|
+
`FIRST_PHASE` is the lowest selected phase number. `--pick state_path` prints
|
|
96
|
+
`.planning/workstreams/<ws>/STATE.md` on a partitioned project and `.planning/STATE.md` on a flat
|
|
97
|
+
one, for any phase number. The file is plain `key=value` lines — `started=`, `args=`, `from=`,
|
|
98
|
+
`to=`, `only=`, `supervised=`, `strategy=` — written fresh at every run start. During the run,
|
|
99
|
+
append `handled=<phase>:<outcome>` (outcome ∈ passed | human_needed | gaps_found | blocked |
|
|
100
|
+
skipped) with `printf 'handled=%s:%s\n' "$PHASE_NUM" "$OUTCOME" >> "$RUN_STATE"`, and
|
|
101
|
+
`retry=<phase>:<step>:1` the same way. Never commit this file.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# snippet: run-state-write
|
|
105
|
+
# expects RUN_STATE, ARGUMENTS, FROM_PHASE, TO_PHASE, ONLY_PHASE, SUPERVISED, PLAN_STRATEGY
|
|
106
|
+
printf 'started=%s\nargs=%s\nfrom=%s\nto=%s\nonly=%s\nsupervised=%s\nstrategy=%s\n' \
|
|
107
|
+
"$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$ARGUMENTS" "$FROM_PHASE" "$TO_PHASE" "$ONLY_PHASE" \
|
|
108
|
+
"$SUPERVISED" "$PLAN_STRATEGY" > "$RUN_STATE"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# snippet: run-state-read
|
|
113
|
+
# expects RUN_STATE, PHASE_NUM, STEP
|
|
114
|
+
HANDLED=$(grep '^handled=' "$RUN_STATE" 2>/dev/null | cut -d= -f2 | cut -d: -f1 | tr '\n' ' ')
|
|
115
|
+
RETRIES=$(grep -c "^retry=${PHASE_NUM}:${STEP}:" "$RUN_STATE" 2>/dev/null || true)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`grep -c` exits 1 on zero matches, hence `|| true`: `RETRIES` is `0` on no match and EMPTY only when
|
|
119
|
+
the file is missing — treat empty as 0 (verified in bash and zsh).
|
|
120
|
+
|
|
121
|
+
**Iterate rule (review defect 6a):** a phase whose number appears in `HANDLED` is excluded from
|
|
122
|
+
re-selection. A deferred or blocked phase stays incomplete on disk, so without this it would be
|
|
123
|
+
picked again on the next pass.
|
|
124
|
+
|
|
125
|
+
## Rules — autonomous.md
|
|
126
|
+
|
|
127
|
+
### A-1 Smart discuss
|
|
128
|
+
|
|
129
|
+
Display every grey-area table exactly as before. Accept all ✅ Recommended answers; no
|
|
130
|
+
AskUserQuestion. One report entry per area. CONTEXT.md carries
|
|
131
|
+
`**Mode:** Autonomous best-effort — grey areas auto-decided; see {REPORT basename}` under
|
|
132
|
+
`**Status:**`, and every accepted bullet ends with ` *(auto-decided; alternatives: {alt1}; {alt2})*`.
|
|
133
|
+
Infrastructure detection and Sub-steps 1–3 and 5 are unchanged.
|
|
134
|
+
|
|
135
|
+
Record: Point `Smart discuss — Grey Area M/N: {name}`; Options = the table's questions with the
|
|
136
|
+
recommended answer and alternatives; Choice = recommended; Why = the rationale column; Reverse =
|
|
137
|
+
`edit ${CONTEXT_PATH} and re-run /pp:plan-phase ${PHASE_NUM}`.
|
|
138
|
+
|
|
139
|
+
Supervised: the per-area prompts in `autonomous-smart-discuss.md` Sub-step 4 (§ Supervised menus).
|
|
140
|
+
|
|
141
|
+
### A-2 human_needed
|
|
142
|
+
|
|
143
|
+
Read the human_verification items and display them. Record, then display exactly:
|
|
144
|
+
|
|
145
|
+
`Phase ${PHASE_NUM} ⏭ Human validation deferred — phase stays incomplete (never marked passed); finish with /pp:verify-work ${PHASE_NUM}`
|
|
146
|
+
|
|
147
|
+
Set `OUTCOME=human_needed` and go to §3d exit (`phase-exit` appends `handled=` and commits the report). Autonomous NEVER
|
|
148
|
+
edits VERIFICATION.md and never writes a `passed` status anywhere for a human_needed phase.
|
|
149
|
+
|
|
150
|
+
Record: Point `Verification human_needed — {count} item(s)`; Options
|
|
151
|
+
`Validate now / Continue without validation`; Choice `deferred`; Why
|
|
152
|
+
`an unattended run cannot perform manual verification`; Reverse `/pp:verify-work ${PHASE_NUM}`.
|
|
153
|
+
|
|
154
|
+
Supervised: the two-step menu in § Supervised menus.
|
|
155
|
+
|
|
156
|
+
### A-3 gaps_found
|
|
157
|
+
|
|
158
|
+
Display the score. Make ONE automatic closure attempt — the two Skill calls stay in `autonomous.md`,
|
|
159
|
+
both with `${UNATTENDED_ARG}` — then re-read the status with `verification.status`:
|
|
160
|
+
|
|
161
|
+
- `passed` → Record the attempt (Choice `gap closure run once — resolved`) and continue.
|
|
162
|
+
- `human_needed` → rule A-2.
|
|
163
|
+
- still `gaps_found` → Record (Choice `continue with gaps deferred`; Reverse
|
|
164
|
+
`/pp:plan-phase ${PHASE_NUM} --gaps` then `/pp:execute-phase ${PHASE_NUM}`), display exactly
|
|
165
|
+
`Phase ${PHASE_NUM} ⏭ Gaps deferred — phase stays incomplete`, set `OUTCOME=gaps_found`, go to
|
|
166
|
+
§3d exit.
|
|
167
|
+
|
|
168
|
+
Closure planning that produces no plans → rule A-4 (step `gap-closure`).
|
|
169
|
+
|
|
170
|
+
Record: Point `Verification gaps_found — score {N}/{M}`; Options
|
|
171
|
+
`Run gap closure / Continue without fixing / Stop autonomous mode`; Why
|
|
172
|
+
`one bounded closure attempt, then continue — the phase stays incomplete`.
|
|
173
|
+
|
|
174
|
+
Supervised: the three-option menu and the "Gaps persist" follow-up in § Supervised menus.
|
|
175
|
+
|
|
176
|
+
### A-4 Blocker
|
|
177
|
+
|
|
178
|
+
`{step}` ∈ discuss | plan | execute | gap-closure | verification. Set `STEP` and run
|
|
179
|
+
`run-state-read`:
|
|
180
|
+
|
|
181
|
+
1. `RETRIES` empty or `0` → append `retry=${PHASE_NUM}:${step}:1`, display
|
|
182
|
+
`↻ Retrying ${step} for phase ${PHASE_NUM} (1 of 1)`, re-run the failed step.
|
|
183
|
+
2. Otherwise → Record, set `OUTCOME=blocked` and run `phase-exit`, print the STOPPED banner (§ Supervised
|
|
184
|
+
menus, verbatim, including its `Resume with: /pp:autonomous …` line) and the end-of-run summary,
|
|
185
|
+
then exit. The run stops — a later phase is never built on one that failed.
|
|
186
|
+
|
|
187
|
+
Record: Point `Blocker — {description}`; Options `Fix and retry / Skip this phase / Stop`; Choice
|
|
188
|
+
`stopped after one retry`; Why `the single retry did not clear it`; Reverse = the resume command
|
|
189
|
+
from the STOPPED banner.
|
|
190
|
+
|
|
191
|
+
Supervised: the three-option menu verbatim (§ Supervised menus).
|
|
192
|
+
|
|
193
|
+
### A-5 Waiting on the operator (no-argument runs only)
|
|
194
|
+
|
|
195
|
+
After the default selection, before any work:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
PD=$(pp_run query init.phase-op "$ONLY_PHASE" --pick phase_dir)
|
|
199
|
+
[ -n "$PD" ] && WAIT=$(pp_run query verification.status "$PD" --pick status 2>/dev/null)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
If `WAIT` is `human_needed` or `gaps_found`, print:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
Phase ${ONLY_PHASE} is waiting on you — verification status: ${WAIT}.
|
|
206
|
+
Finish it with: /pp:verify-work ${ONLY_PHASE}
|
|
207
|
+
Or run the next phase instead: /pp:autonomous --only ${NEXT}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
(the last line only when a later incomplete phase `NEXT` exists) and exit 0 without writing run state
|
|
211
|
+
or a report entry — nothing was decided. The phase is not re-run.
|
|
212
|
+
|
|
213
|
+
Supervised: same stop (it is not a prompt).
|
|
214
|
+
|
|
215
|
+
### A-7 Run end — never claim completion for a deferred phase
|
|
216
|
+
|
|
217
|
+
A phase handled this run with any outcome other than `passed` stays incomplete on disk, and the
|
|
218
|
+
iterate exclusion (§ Run state) drops it from selection. So "no selectable phase remains" does NOT
|
|
219
|
+
mean "all phases complete". Before any end banner, compute the deferred set:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# snippet: run-end
|
|
223
|
+
# expects RUN_STATE
|
|
224
|
+
DEFERRED=$(grep '^handled=' "$RUN_STATE" 2>/dev/null | grep -v ':passed$' | cut -d= -f2 | cut -d: -f1 | tr '\n' ' ')
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
- `DEFERRED` non-empty → print the end-of-run summary, then one line per deferred phase:
|
|
228
|
+
`Phase N — {outcome}: finish with /pp:verify-work N` (blocked: the resume command). Exit. Never
|
|
229
|
+
enter the milestone lifecycle and never print "All phases complete"; the `--to` REACHED banner
|
|
230
|
+
adds its `Deferred (not complete)` line.
|
|
231
|
+
- `DEFERRED` empty → the normal end (lifecycle, or the single-phase banner).
|
|
232
|
+
|
|
233
|
+
A `--only`/no-argument run whose phase was deferred prints the single-phase banner with
|
|
234
|
+
`DEFERRED ⏭` in place of `COMPLETE ✓` (`autonomous-lifecycle.md`).
|
|
235
|
+
|
|
236
|
+
Supervised: same rule — it is a report, not a prompt.
|
|
237
|
+
|
|
238
|
+
### A-6 Lifecycle — deliberately NOT converted
|
|
239
|
+
|
|
240
|
+
The audit gaps / tech-debt prompts and cleanup's own confirmation in `autonomous-lifecycle.md` stay
|
|
241
|
+
interactive in every mode. They are milestone-level and destructive, and unreachable from a
|
|
242
|
+
single-phase run.
|
|
243
|
+
|
|
244
|
+
Supervised: unchanged.
|
|
245
|
+
|
|
246
|
+
## Rules — nested sites (plan-phase.md, execute-phase.md)
|
|
247
|
+
|
|
248
|
+
The host workflows receive `--unattended` from autonomous and carry a one-line `U-Pn` / `U-En`
|
|
249
|
+
marker at each prompt site. At a marked site, apply the row below instead of prompting.
|
|
250
|
+
|
|
251
|
+
| Rule | Host site | Best-effort action | Bound | Record (Point → Choice; Reverse) |
|
|
252
|
+
|------|-----------|--------------------|-------|----------------------------------|
|
|
253
|
+
| U-P1 | plan-phase §4 no CONTEXT.md | Continue without context (defensive — autonomous writes CONTEXT.md first) | — | No context → Continue without context; `/pp:discuss-phase N` |
|
|
254
|
+
| U-P2 | plan-phase §5.1 research | Behave as `--auto`: research when `research_enabled`, else skip | — | none (config-driven) |
|
|
255
|
+
| U-P3 | plan-phase §9 `PLANNING INCONCLUSIVE` | Retry once, then exit without plans (autonomous A-4 takes over) | once | Planning inconclusive → retried once; `/pp:plan-phase N` |
|
|
256
|
+
| U-P4 | plan-phase §9 `CHECKPOINT REACHED` | Hard stop — present to user | — | none (hard stop) |
|
|
257
|
+
| U-P5 | plan-phase §9a planner filesystem fallback | Accept plans on disk | — | Planner fallback → accepted plans on disk; `/pp:plan-phase N` |
|
|
258
|
+
| U-P6 | plan-phase §9b phase split | Proceed anyway (never `/pp:phase --insert` — it mutates ROADMAP structure) | — | Phase split suggested → proceeded anyway; `/pp:phase --insert` |
|
|
259
|
+
| U-P7 | plan-phase §9c source-audit gaps | Add plan once, then Defer, written to CONTEXT.md `## Deferred Ideas` as `auto-deferred by unattended run — not developer-confirmed` | once | Source-audit gap → added plan / deferred; `/pp:plan-phase N` |
|
|
260
|
+
| U-P8 | plan-phase §11 thinking partner | Apply the recommendation | — | Thinking partner → applied; revert the revision |
|
|
261
|
+
| U-P9 | plan-phase §11a checker fallback | Retry checker once, then Accept verification | once | Checker fallback → retried / accepted; `/pp:plan-phase N` |
|
|
262
|
+
| U-P10 | plan-phase §12 max iterations | Force proceed; record the remaining issue list | — | Max iterations → force proceeded (issues listed); `/pp:plan-phase N` |
|
|
263
|
+
| U-P11 | plan-phase §13 requirements coverage | Re-plan once, then Proceed anyway | once | Requirements coverage → re-planned / proceeded; `/pp:plan-phase N` |
|
|
264
|
+
| U-P12 | plan-phase §13a decision coverage | Re-plan once, then Proceed anyway (the workflow already records the override in STATE.md) | once | Decision coverage → re-planned / proceeded; `/pp:plan-phase N` |
|
|
265
|
+
| U-E1 | execute-phase checkpoint_handling | human-action, or `**Gate:** blocking-human` in the executor's return (`gate="blocking-human"` / a `Package` what-built are the pre-`Gate:` fallback): hard stop, present to user; other human-verify: continuation with `{user_response}` = `DEFERRED — not verified by a human (unattended run); record this checkpoint as not done in the SUMMARY and continue`, log `⏭ Checkpoint deferred (recorded, not approved)`; decision: the option marked recommended, else the first | — | Checkpoint → deferred / auto-selected; `/pp:verify-work N` |
|
|
266
|
+
| U-E2 | execute-phase post-merge test failure | Fix now once, then Continue | once | Post-merge tests failed → fixed once / continued; `/pp:execute-phase N` |
|
|
267
|
+
| U-E3 | execute-phase §7.1 quota exceeded | Option 3 — abort, report partial state (an unattended run cannot wait) | — | Quota exceeded → aborted; re-run after reset |
|
|
268
|
+
| U-E4 | execute-phase §7.3 unknown failure Continue/Stop | Stop (cascade risk) — autonomous A-4 retries once | — | Unknown failure → stopped; `/pp:execute-phase N` |
|
|
269
|
+
| U-E5 | execute-phase §7b cross-plan wiring gap | Investigate + fix once, then continue | once | Wiring gap → fixed once / continued; `/pp:verify-work N` |
|
|
270
|
+
| U-E6 | execute-phase cross-phase regression | Option 1 once, then option 2 | once | Regression → option 1 / option 2; `/pp:execute-phase N` |
|
|
271
|
+
| U-P13 | plan-phase §6 existing plans | `--gaps`: Add more plans (gap closure adds plans). Otherwise keep the existing plans and end planning — never Replan from scratch | — | Existing plans → added / kept; `/pp:plan-phase N` (choose Replan) |
|
|
272
|
+
| U-P14 | plan-phase §5 `RESEARCH BLOCKED` | Hard stop — the missing context is the operator's | — | none (hard stop) |
|
|
273
|
+
| U-P15 | plan-phase/steps/chunked-planning.md outline failure | Retry outline once, then Stop (autonomous A-4 takes over) | once | Outline failed → retried; `/pp:plan-phase N` |
|
|
274
|
+
| U-P16 | plan-phase §12 revision-loop stall | Proceed anyway; record the remaining issue list (never Adjust approach — it opens a discussion) | — | Stall → proceeded (issues listed); `/pp:plan-phase N` |
|
|
275
|
+
| U-E7 | execute-phase executor stall | Kill and retry once in a fresh worktree; a second stall → Stop. Never switch to inline execution | once | Stall → retried / stopped; `/pp:execute-phase N` |
|
|
276
|
+
| U-E8 | execute-phase/steps/cross-ai-delegation.md failure | Retry once, then abort (never fall back silently to the local executor) | once | Cross-AI failure → retried / aborted; `/pp:execute-phase N` |
|
|
277
|
+
| U-E9 | execute-phase `human_needed` result | Present the items and the `/pp:verify-work` command, do not wait for an acknowledgement, return to the caller (A-2 records it) | — | recorded by A-2 |
|
|
278
|
+
|
|
279
|
+
Hosts derive `REPORT` with the § Recording one-liner from their own `PHASE_DIR` and append with the
|
|
280
|
+
`report-append` snippet. "Once" bounds inside a host are per invocation.
|
|
281
|
+
|
|
282
|
+
## Prompt-site inventory (sweep)
|
|
283
|
+
|
|
284
|
+
Every prompt reachable from an unattended run, classified. Swept on 2026-09-29 by grepping
|
|
285
|
+
`AskUserQuestion`, `Enter number`, `Offer`, `Options:`, `ask`, `confirmed` and `CHECKPOINT` across the
|
|
286
|
+
two hosts, every file under `execute-phase/steps/` and `plan-phase/steps/`, the Skills autonomous
|
|
287
|
+
calls (`pp-ui-phase`, `pp-code-review`, `pp-ui-review`) and the agents on the path (`pp-planner`,
|
|
288
|
+
`pp-phase-researcher`, `pp-executor`, `pp-verifier`).
|
|
289
|
+
|
|
290
|
+
| Site | Class |
|
|
291
|
+
|------|-------|
|
|
292
|
+
| plan-phase §4, §5.1, §9 inconclusive, §9a, §9b, §9c, §11, §11a, §12, §13, §13a, §6, §12 stall | converted — U-P1…U-P3, U-P5…U-P13, U-P16 |
|
|
293
|
+
| plan-phase/steps/chunked-planning.md outline failure | converted — U-P15 |
|
|
294
|
+
| plan-phase §9 planner `CHECKPOINT REACHED`; §5 `RESEARCH BLOCKED` | hard stop — U-P4, U-P14 |
|
|
295
|
+
| execute-phase post-merge failure, quota, unknown failure, wiring gap, regression, stall, `human_needed` | converted — U-E2…U-E7, U-E9 |
|
|
296
|
+
| execute-phase checkpoint_handling (executor `human-verify` / `decision`) | converted — U-E1 |
|
|
297
|
+
| execute-phase checkpoint_handling (`human-action`, `gate="blocking-human"`) | hard stop — U-E1 |
|
|
298
|
+
| execute-phase/steps/cross-ai-delegation.md failure | converted — U-E8 |
|
|
299
|
+
| execute-phase/steps/vault-load-gate.md, client-context-gate.md `confirmed` | hard stop (governance) |
|
|
300
|
+
| execute-phase / plan-phase blocking capability `check.query` gates (`blocking: true`, `block: true`) | hard stop (HALT) |
|
|
301
|
+
| execute-phase/steps/worktree-recovery-policy.md exit 42; execute-phase partial-execution recovery | hard stop (fail closed) |
|
|
302
|
+
| execute-phase `state_exists` false; `--interactive` per-plan menu | unreachable — autonomous requires STATE.md and never passes `--interactive` to execute-phase |
|
|
303
|
+
| post-merge-gate | build-failure "Fix now / Continue" (step 5.8) — this is the U-E2 site: fix once, then continue and record |
|
|
304
|
+
| codebase-drift-gate, serial-group-dispatch, vault-fetch | no prompt (non-blocking) |
|
|
305
|
+
| `pp-code-review --fix --auto` (3c.5) | no prompt |
|
|
306
|
+
| **`pp-ui-phase`** (§3a.5): step 9 max-revision choice, and its `pp-ui-researcher` design questions | **remaining stop** — ui-phase has no non-interactive flag; filed as deferred |
|
|
307
|
+
| **`pp-ui-review`** (§3d.5): "UI-REVIEW.md already exists" | **remaining stop** (only on a re-run) — no non-interactive flag; filed as deferred |
|
|
308
|
+
| agents: `pp-planner` / `pp-phase-researcher` / `pp-executor` / `pp-verifier` returns | routed through the host sites above; `pp-executor`'s own auto-approve under `workflow.auto_advance` is filed as deferred (not reached — autonomous sets neither auto flag) |
|
|
309
|
+
|
|
310
|
+
Sweep result: no reachable prompt is unclassified. The two remaining stops (ui-phase, ui-review)
|
|
311
|
+
are the only prompts an unattended run can still hit that are neither converted nor a deliberate
|
|
312
|
+
hard stop.
|
|
313
|
+
|
|
314
|
+
## Supervised menus
|
|
315
|
+
|
|
316
|
+
Used only when `SUPERVISED` is set. Every label below is exactly the pre-best-effort text.
|
|
317
|
+
|
|
318
|
+
**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.
|
|
319
|
+
|
|
320
|
+
### human_needed
|
|
321
|
+
|
|
322
|
+
Display the items, then ask user via AskUserQuestion:
|
|
323
|
+
- **question:** "Phase ${PHASE_NUM} has items needing manual verification. Validate now or continue to next phase?"
|
|
324
|
+
- **options:** "Validate now" / "Continue without validation"
|
|
325
|
+
|
|
326
|
+
On **"Validate now"**: Present the specific items from VERIFICATION.md's human_verification section. After user reviews, ask:
|
|
327
|
+
- **question:** "Validation result?"
|
|
328
|
+
- **options:** "All good — continue" / "Found issues"
|
|
329
|
+
|
|
330
|
+
On "All good — continue": Display `Phase ${PHASE_NUM} ✅ Human validation passed` and proceed to iterate step.
|
|
331
|
+
|
|
332
|
+
On "Found issues": Go to handle_blocker with the user's reported issues as the description.
|
|
333
|
+
|
|
334
|
+
On **"Continue without validation"**: Display `Phase ${PHASE_NUM} ⏭ Human validation deferred` and proceed to iterate step.
|
|
335
|
+
|
|
336
|
+
### gaps_found
|
|
337
|
+
|
|
338
|
+
Ask user via AskUserQuestion:
|
|
339
|
+
- **question:** "Gaps found in phase ${PHASE_NUM}. How to proceed?"
|
|
340
|
+
- **options:** "Run gap closure" / "Continue without fixing" / "Stop autonomous mode"
|
|
341
|
+
|
|
342
|
+
On **"Run gap closure"**: run the closure cycle in `autonomous.md` §3d (limit: 1 attempt), then re-read the status.
|
|
343
|
+
|
|
344
|
+
If still `gaps_found` after this retry: Display "Gaps persist after closure attempt." and ask via AskUserQuestion:
|
|
345
|
+
- **question:** "Gap closure did not fully resolve issues. How to proceed?"
|
|
346
|
+
- **options:** "Continue anyway" / "Stop autonomous mode"
|
|
347
|
+
|
|
348
|
+
On "Continue anyway": Proceed to iterate step.
|
|
349
|
+
On "Stop autonomous mode": Go to handle_blocker.
|
|
350
|
+
|
|
351
|
+
This limits gap closure to 1 automatic retry to prevent infinite loops.
|
|
352
|
+
|
|
353
|
+
On **"Continue without fixing"**: Display `Phase ${PHASE_NUM} ⏭ Gaps deferred` and proceed to iterate step.
|
|
354
|
+
|
|
355
|
+
On **"Stop autonomous mode"**: Go to handle_blocker with "User stopped — gaps remain in phase ${PHASE_NUM}".
|
|
356
|
+
|
|
357
|
+
### Blocker (§6)
|
|
358
|
+
|
|
359
|
+
When any phase operation fails or a blocker is detected, present 3 options via AskUserQuestion:
|
|
360
|
+
|
|
361
|
+
**Prompt:** "Phase {N} ({Name}) encountered an issue: {description}"
|
|
362
|
+
|
|
363
|
+
**Options:**
|
|
364
|
+
1. **"Fix and retry"** — Re-run the failed step (discuss, plan, or execute) for this phase
|
|
365
|
+
2. **"Skip this phase"** — Mark phase as skipped, continue to the next incomplete phase
|
|
366
|
+
3. **"Stop autonomous mode"** — Display summary of progress so far and exit cleanly
|
|
367
|
+
|
|
368
|
+
**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.
|
|
369
|
+
|
|
370
|
+
**On "Skip this phase":** Log `Phase {N} ⏭ {Name} — Skipped by user` and proceed to iterate.
|
|
371
|
+
|
|
372
|
+
**On "Stop autonomous mode":** Display progress summary:
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
376
|
+
pp-core ► AUTONOMOUS ▸ STOPPED
|
|
377
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
378
|
+
|
|
379
|
+
Completed: {list of completed phases}
|
|
380
|
+
Skipped: {list of skipped phases}
|
|
381
|
+
Remaining: {list of remaining phases}
|
|
382
|
+
|
|
383
|
+
Resume with: /pp:autonomous ${ONLY_PHASE ? "--only " + ONLY_PHASE : "--from " + next_phase}${TO_PHASE ? " --to " + TO_PHASE : ""}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## End-of-run summary
|
|
387
|
+
|
|
388
|
+
For each phase handled this run (the `handled=` lines in `$RUN_STATE`, or `ONLY_PHASE`): if its
|
|
389
|
+
report exists, print
|
|
390
|
+
|
|
391
|
+
`Decisions taken on your behalf — phase N: K (see {REPORT})`
|
|
392
|
+
|
|
393
|
+
where K = `grep -c '^## Decision ' "$REPORT"`, then one line per entry,
|
|
394
|
+
`- {Point} → {Choice} (reverse: {Reverse})`, read from the file. No report → print nothing for that
|
|
395
|
+
phase. Printed by the lifecycle single-phase banner, the STOPPED banner and the lifecycle 5d banner.
|
|
396
|
+
|
|
397
|
+
## Minimal CONTEXT.md (skip_discuss)
|
|
398
|
+
|
|
399
|
+
Used by `autonomous.md` §3a when `workflow.skip_discuss` is true. Get phase details:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
DETAIL=$(pp_run query roadmap.get-phase ${PHASE_NUM})
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Extract `goal` and `requirements` from JSON. Write `${phase_dir}/${padded_phase}-CONTEXT.md` with:
|
|
406
|
+
|
|
407
|
+
```markdown
|
|
408
|
+
# Phase {PHASE_NUM}: {Phase Name} - Context
|
|
409
|
+
|
|
410
|
+
**Gathered:** {date}
|
|
411
|
+
**Status:** Ready for planning
|
|
412
|
+
**Mode:** Auto-generated (discuss skipped via workflow.skip_discuss)
|
|
413
|
+
|
|
414
|
+
<domain>
|
|
415
|
+
## Phase Boundary
|
|
416
|
+
|
|
417
|
+
{goal from ROADMAP phase description}
|
|
418
|
+
|
|
419
|
+
</domain>
|
|
420
|
+
|
|
421
|
+
<decisions>
|
|
422
|
+
## Implementation Decisions
|
|
423
|
+
|
|
424
|
+
### Claude's Discretion
|
|
425
|
+
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.
|
|
426
|
+
|
|
427
|
+
</decisions>
|
|
428
|
+
|
|
429
|
+
<code_context>
|
|
430
|
+
## Existing Code Insights
|
|
431
|
+
|
|
432
|
+
Codebase context will be gathered during plan-phase research.
|
|
433
|
+
|
|
434
|
+
</code_context>
|
|
435
|
+
|
|
436
|
+
<specifics>
|
|
437
|
+
## Specific Ideas
|
|
438
|
+
|
|
439
|
+
No specific requirements — discuss phase skipped. Refer to ROADMAP phase description and success criteria.
|
|
440
|
+
|
|
441
|
+
</specifics>
|
|
442
|
+
|
|
443
|
+
<deferred>
|
|
444
|
+
## Deferred Ideas
|
|
445
|
+
|
|
446
|
+
None — discuss phase skipped.
|
|
447
|
+
|
|
448
|
+
</deferred>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Commit the minimal context:
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
pp_run query commit "docs(${padded_phase}): auto-generated context (discuss skipped)" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Banner math
|
|
458
|
+
|
|
459
|
+
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).
|
|
460
|
+
|
|
461
|
+
**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".
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Autonomous — Milestone Lifecycle (§5)
|
|
2
|
+
|
|
3
|
+
Extracted from `pp-core/workflows/autonomous.md` to keep that file under the
|
|
4
|
+
Claude Code 10K-token Read limit (#2196), the same reason `smart_discuss` lives
|
|
5
|
+
in `autonomous-lifecycle.md`'s sibling `autonomous-smart-discuss.md`.
|
|
6
|
+
|
|
7
|
+
This file contains NO `pp_run` invocations, so it needs no launcher preamble —
|
|
8
|
+
it is prose plus `Skill(...)` dispatches. Read it and follow it exactly when
|
|
9
|
+
`## 5. Lifecycle` is reached in `autonomous.md`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Lifecycle
|
|
14
|
+
|
|
15
|
+
The audit/cleanup prompts below are deliberately not converted to best-effort (rule A-6).
|
|
16
|
+
|
|
17
|
+
**If `ONLY_PHASE` is set:** Skip lifecycle. A single phase does not trigger audit/complete/cleanup. Run `run-end` (rule A-7 in `autonomous-best-effort.md`); if the phase is in `DEFERRED`, the banner reads `DEFERRED ⏭` instead of `COMPLETE ✓` and `{outcome} — finish with /pp:verify-work ${ONLY_PHASE}` instead of `Done`. Display:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
pp-core ► AUTONOMOUS ▸ PHASE ${ONLY_PHASE} COMPLETE ✓
|
|
22
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
23
|
+
|
|
24
|
+
Phase ${ONLY_PHASE}: ${PHASE_NAME} — Done
|
|
25
|
+
Mode: Single phase
|
|
26
|
+
|
|
27
|
+
Next: /pp:autonomous (runs the next incomplete phase) — lifecycle (audit → complete → cleanup) runs only when a --from/--to run finishes the last phase, or via /pp:audit-milestone and /pp:complete-milestone.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Print the end-of-run summary (reference § End-of-run summary), then exit cleanly.
|
|
31
|
+
|
|
32
|
+
**If `TO_PHASE` is set and a fresh `pp_run query roadmap.analyze` still lists any phase with `disk_status != "complete"` or `roadmap_complete == false`:** the `--to` run stopped before the milestone's end. Skip lifecycle — never print "All phases complete". Print the end-of-run summary (reference § End-of-run summary) with `Remaining: {those phases}` and `Next: /pp:autonomous --from {first of them}`, then exit cleanly.
|
|
33
|
+
|
|
34
|
+
**Otherwise:** Only when `run-end` (rule A-7) leaves `DEFERRED` empty AND no incomplete phase remains in the milestone — a deferred phase is not complete, so autonomous.md §4 exits before this point — run the milestone lifecycle sequence: audit → complete → cleanup.
|
|
35
|
+
|
|
36
|
+
Display lifecycle transition banner:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
40
|
+
pp-core ► AUTONOMOUS ▸ LIFECYCLE
|
|
41
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
42
|
+
|
|
43
|
+
All phases complete → Starting lifecycle: audit → complete → cleanup
|
|
44
|
+
Milestone: {milestone_version} — {milestone_name}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**5a. Audit**
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Skill(skill="pp-audit-milestone")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
After audit completes, detect the result:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
AUDIT_FILE=".planning/v${milestone_version}-MILESTONE-AUDIT.md"
|
|
57
|
+
AUDIT_STATUS=$(grep "^status:" "${AUDIT_FILE}" 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**If AUDIT_STATUS is empty** (no audit file or no status field):
|
|
61
|
+
|
|
62
|
+
Go to handle_blocker: "Audit did not produce results — audit file missing or malformed."
|
|
63
|
+
|
|
64
|
+
**If `passed`:**
|
|
65
|
+
|
|
66
|
+
Display:
|
|
67
|
+
```
|
|
68
|
+
Audit ✅ passed — proceeding to complete milestone
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Proceed to 5b (no user pause — per CTRL-01).
|
|
72
|
+
|
|
73
|
+
**If `gaps_found`:**
|
|
74
|
+
|
|
75
|
+
Read the gaps summary from the audit file. Display:
|
|
76
|
+
```
|
|
77
|
+
⚠ Audit: Gaps Found
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Ask user via AskUserQuestion:
|
|
81
|
+
- **question:** "Milestone audit found gaps. How to proceed?"
|
|
82
|
+
- **options:** "Continue anyway — accept gaps" / "Stop — fix gaps manually"
|
|
83
|
+
|
|
84
|
+
On **"Continue anyway"**: Display `Audit ⏭ Gaps accepted — proceeding to complete milestone` and proceed to 5b.
|
|
85
|
+
|
|
86
|
+
On **"Stop"**: Go to handle_blocker with "User stopped — audit gaps remain. Run /pp:audit-milestone to review, then /pp:complete-milestone when ready."
|
|
87
|
+
|
|
88
|
+
**If `tech_debt`:**
|
|
89
|
+
|
|
90
|
+
Read the tech debt summary from the audit file. Display:
|
|
91
|
+
```
|
|
92
|
+
⚠ Audit: Tech Debt Identified
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Show the summary, then ask user via AskUserQuestion:
|
|
96
|
+
- **question:** "Milestone audit found tech debt. How to proceed?"
|
|
97
|
+
- **options:** "Continue with tech debt" / "Stop — address debt first"
|
|
98
|
+
|
|
99
|
+
On **"Continue with tech debt"**: Display `Audit ⏭ Tech debt acknowledged — proceeding to complete milestone` and proceed to 5b.
|
|
100
|
+
|
|
101
|
+
On **"Stop"**: Go to handle_blocker with "User stopped — tech debt to address. Run /pp:audit-milestone to review details."
|
|
102
|
+
|
|
103
|
+
**5b. Complete Milestone**
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Skill(skill="pp-complete-milestone", args="${milestone_version}")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
After complete-milestone returns, verify it produced output:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ls .planning/milestones/v${milestone_version}-ROADMAP.md 2>/dev/null || true
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If the archive file does not exist, go to handle_blocker: "Complete milestone did not produce expected archive files."
|
|
116
|
+
|
|
117
|
+
**5c. Cleanup**
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Skill(skill="pp-cleanup")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
**5d. Final Completion**
|
|
126
|
+
|
|
127
|
+
Display final completion banner:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
131
|
+
pp-core ► AUTONOMOUS ▸ COMPLETE 🎉
|
|
132
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
133
|
+
|
|
134
|
+
Milestone: {milestone_version} — {milestone_name}
|
|
135
|
+
Status: Complete ✅
|
|
136
|
+
Lifecycle: audit ✅ → complete ✅ → cleanup ✅
|
|
137
|
+
|
|
138
|
+
Ship it! 🚀
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Print the end-of-run summary (`pp-core/references/autonomous-best-effort.md` § End-of-run summary).
|
|
142
|
+
|
|
143
|
+
</step>
|
|
144
|
+
|
|
145
|
+
<step name="handle_blocker">
|
|
146
|
+
|