pi-plans 0.6.0 → 0.7.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 (109) hide show
  1. package/CONTRIBUTING.md +3 -3
  2. package/README.md +39 -37
  3. package/agents/reviewer.md +12 -3
  4. package/index.ts +42 -35
  5. package/package.json +1 -1
  6. package/references/pi-planning-workflow.md +44 -60
  7. package/references/plan-artifact-template.md +71 -60
  8. package/references/state-and-config.md +59 -43
  9. package/scripts/bench/pi-adapter/pi_plans_bench.py +33 -22
  10. package/scripts/bench/pi-adapter/rpc_driver.mjs +4 -4
  11. package/scripts/run-tests.ts +12 -1
  12. package/scripts/validate.ts +20 -9
  13. package/skills/debug-and-plan/SKILL.md +3 -3
  14. package/skills/plan-big/SKILL.md +3 -3
  15. package/skills/plan-normal/SKILL.md +3 -3
  16. package/skills/plan-small/SKILL.md +4 -4
  17. package/skills/plan-with-refs/SKILL.md +6 -6
  18. package/skills/planning/SKILL.md +1 -1
  19. package/src/ask-form.ts +4 -4
  20. package/src/auditor.ts +126 -0
  21. package/src/auto-approve.ts +1 -1
  22. package/src/autocomplete.ts +19 -17
  23. package/src/code-graph/commands.ts +2 -2
  24. package/src/code-graph/community.ts +1 -1
  25. package/src/code-graph/paths.ts +1 -1
  26. package/src/code-graph/watch.ts +2 -2
  27. package/src/compaction.ts +3 -3
  28. package/src/config-command.ts +146 -73
  29. package/src/dashboard.ts +257 -0
  30. package/src/exec.ts +692 -919
  31. package/src/global-state.ts +304 -0
  32. package/src/guard.ts +18 -19
  33. package/src/messaging.ts +44 -0
  34. package/src/plan.ts +421 -112
  35. package/src/query-hook.ts +4 -4
  36. package/src/refine-prompts.ts +12 -70
  37. package/src/refine-ui-helpers.ts +24 -5
  38. package/src/refine-ui-state.ts +1 -1
  39. package/src/refine-ui.ts +1 -1
  40. package/src/resume-command.ts +34 -128
  41. package/src/role-panels.ts +542 -0
  42. package/src/run-context.ts +3 -10
  43. package/src/state.ts +272 -72
  44. package/src/subagent.ts +19 -29
  45. package/src/task-tool.ts +100 -0
  46. package/src/tasks.ts +189 -0
  47. package/src/thinking-levels.ts +67 -0
  48. package/src/ui-language.ts +3 -54
  49. package/src/workflow-state.ts +63 -58
  50. package/tests/analyze-refs.test.ts +35 -18
  51. package/tests/ask-choice-schema.test.ts +0 -12
  52. package/tests/ask-choice.test.ts +2 -49
  53. package/tests/ask-form-tool.test.ts +4 -5
  54. package/tests/ask-form.test.ts +2 -2
  55. package/tests/auditor.test.ts +111 -0
  56. package/tests/auto-approve.test.ts +7 -10
  57. package/tests/autocomplete.test.ts +8 -11
  58. package/tests/code-graph-apply-action.test.ts +2 -2
  59. package/tests/code-graph-commands.test.ts +2 -2
  60. package/tests/code-graph-index.test.ts +2 -2
  61. package/tests/code-graph-loop.e2e.test.ts +1 -1
  62. package/tests/code-graph-mutations.test.ts +1 -1
  63. package/tests/code-graph-rollback.test.ts +1 -1
  64. package/tests/code-graph-v05.test.ts +2 -2
  65. package/tests/compaction.test.ts +1 -1
  66. package/tests/config-command.test.ts +103 -100
  67. package/tests/dashboard.test.ts +268 -0
  68. package/tests/exec-lifecycle.test.ts +181 -115
  69. package/tests/exec-panel-lifecycle.test.ts +106 -251
  70. package/tests/exec.test.ts +617 -1706
  71. package/tests/execute-plan.test.ts +44 -19
  72. package/tests/extension-load.test.ts +48 -0
  73. package/tests/global-state.test.ts +371 -0
  74. package/tests/graph-aware-file-tools.test.ts +5 -5
  75. package/tests/guard.test.ts +1 -1
  76. package/tests/multi-run.test.ts +3 -103
  77. package/tests/plan.test.ts +139 -62
  78. package/tests/plans.test.ts +7 -79
  79. package/tests/refine-prompts.test.ts +20 -71
  80. package/tests/refine-resume.test.ts +27 -22
  81. package/tests/refine-ui.test.ts +6 -15
  82. package/tests/resume-lifecycle.test.ts +37 -22
  83. package/tests/resume.test.ts +33 -81
  84. package/tests/role-panels.test.ts +391 -0
  85. package/tests/run-context.test.ts +1 -1
  86. package/tests/run-ownership.test.ts +1 -1
  87. package/tests/stale-ctx.test.ts +218 -0
  88. package/tests/state.test.ts +151 -32
  89. package/tests/subagent-thinking.test.ts +65 -0
  90. package/tests/subagent-usage.test.ts +1 -1
  91. package/tests/task-tool.test.ts +61 -0
  92. package/tests/thinking-levels.test.ts +77 -0
  93. package/tests/ui-language.test.ts +2 -17
  94. package/tests/workflow-state.test.ts +17 -99
  95. package/tools/analyze-refs.ts +67 -32
  96. package/tools/ask-choice.ts +7 -53
  97. package/tools/code-graph.ts +2 -2
  98. package/tools/execute-plan.ts +48 -99
  99. package/tools/graph-aware-file-tools.ts +4 -10
  100. package/tools/plans.ts +40 -66
  101. package/tools/refine.ts +101 -164
  102. package/agents/criticizer.md +0 -18
  103. package/agents/executor.md +0 -26
  104. package/scripts/bench/pi-adapter/__pycache__/pi_plans_bench.cpython-312.pyc +0 -0
  105. package/src/panel.ts +0 -473
  106. package/src/termination-prompt.ts +0 -73
  107. package/tests/goal-wait.test.ts +0 -269
  108. package/tests/panel-i-zero.test.ts +0 -420
  109. package/tests/panel.test.ts +0 -355
package/CONTRIBUTING.md CHANGED
@@ -28,15 +28,15 @@ pi-plans/
28
28
  │ └── code-graph/ # SQLite schema/store, parsers, indexer, summary, materialize
29
29
  ├── skills/ # Planning router plus five specialist planning skills
30
30
  ├── references/ # Shared workflow, state/config, plan template (normative)
31
- ├── agents/ # reviewer.md / criticizer.md subagent prompts (read-only)
31
+ ├── agents/ # reviewer.md subagent prompt (read-only; ref-analyst.md for reference analysis)
32
32
  ├── scripts/ # validate.ts (structure + package artifact guard), run-tests.ts
33
33
  └── tests/ # node:test suite
34
34
  ```
35
35
 
36
36
  `npm run validate` enforces several invariants, so keep them intact:
37
37
 
38
- - every directory under `skills/` has a `SKILL.md` with frontmatter (`name` matching the directory, routing language in `description`) and the required phrases (`ask_choice`, `refine`, `.git/pi_plans`, ...)
39
- - the `reviewer` and `criticizer` agent prompts declare read-only tools and state the read-only contract
38
+ - every directory under `skills/` has a `SKILL.md` with frontmatter (`name` matching the directory, routing language in `description`) and the required phrases (`ask_choice`, `refine`, `.git/pi-plans`, ...)
39
+ - the `reviewer` agent prompt declares read-only tools and states the read-only contract
40
40
  - the npm artifact stays code-sized: no `scripts/bench/vendor|results` entries, unpacked < 5 MiB, packed < 3 MiB, and key entries present
41
41
  - `package.json` metadata (license, `pi-package` keyword, engines, scripts, required `files`) stays as asserted
42
42
 
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  ---
24
24
 
25
- A rough change request becomes a versioned Markdown plan instead of a surprise diff. The agent inspects your repository read-only, asks scoped planning questions one at a time, and stores every answer in a per-run ledger. Reviewer and criticizer subagents refine the plan until it converges — and only after you explicitly approve the handoff does the extension enter a tracked execution loop that injects the remaining verifier checklist every turn and lifts the write guard. Nothing outside planning artifacts is writable until that approval.
25
+ A rough change request becomes a versioned Markdown plan instead of a surprise diff. The agent inspects your repository read-only, asks scoped planning questions one at a time, and stores every answer in a per-run ledger. Reviewer subagents refine the plan (findings plus questions) until it converges — and only after you explicitly approve the handoff does the extension enter a task-tree execution loop that injects the current wave and remaining tasks every turn, tracks progress through the `plans_update_task` tool, gates completion on an independent audit, and lifts the write guard. Nothing outside planning artifacts is writable until that approval.
26
26
 
27
27
  ## Benchmarked: 6× more tasks solved
28
28
 
@@ -62,29 +62,31 @@ at <b>7.6× fewer tokens per solved task</b>.
62
62
  language + docs location (once per workspace)
63
63
  |
64
64
  planning questions, one ask_choice at a time | write guard ON
65
- | | only .git/pi_plans/,
65
+ | | only .git/pi-plans/,
66
66
  v | run artifacts, cache
67
- PLAN_vN.md + Verifier Checklist | are writable
67
+ PLAN_vN.md (## Tasks + ## Verification
68
+ Checks) | are writable
68
69
  ^ |
69
70
  | refine rounds |
70
71
  +----------------+
71
- reviewer (x1..x3) -> criticizer -> revise
72
+ reviewer (x1..x3): findings + questions
72
73
  |
73
74
  v
74
75
  explicit approval (never auto-completed)
75
76
  |
76
77
  =============================================== write guard OFF
77
78
  |
78
- tracked execution loop
79
+ task-tree execution loop
79
80
  fused AGENTS.md × Ponytail executor rules
80
- checklist injected each turn, [DONE:VC-xxx]
81
- markers tracked via bottom status bar
81
+ current wave + tasks injected each turn,
82
+ plans_update_task reports status + evidence,
83
+ completion auditor verifies every check
82
84
  |
83
85
  v
84
86
  run status: done
85
87
  ```
86
88
 
87
- Every plan version carries stable IDs (`I-###`, `VC-###`) that never get recycled across revisions, so acceptance criteria survive refinement rounds intact.
89
+ Every plan version carries stable IDs (`Task-N`, `VC-###`) that never get recycled across revisions, so the task tree and verification checks survive refinement rounds intact.
88
90
 
89
91
  ## Quick start
90
92
 
@@ -102,12 +104,12 @@ Then describe a change from any repository:
102
104
  You: Create a plan to split the execution loop into smaller modules.
103
105
 
104
106
  Pi: Which planning docs location should this workspace use?
105
- 1. ./docs/pi-plans (recommended)
106
- 2. ./.git/pi_plans/plans
107
+ 1. ./.git/pi-plans/plans (recommended)
108
+ 2. ./docs/pi-plans
107
109
  3. Other
108
110
  4. Auto-complete
109
111
 
110
- Pi: Wrote ./docs/pi-plans/2026-08-26-split-execution-loop/PLAN_v1.md
112
+ Pi: Wrote ./.git/pi-plans/plans/2026-08-26-split-execution-loop/PLAN_v1.md
111
113
  Example verifier item:
112
114
  - [ ] `VC-001` covers `I-001`; pass condition: `npm test` passes;
113
115
  evidence: test output; metric: zero failing tests.
@@ -121,26 +123,26 @@ Pi: Accept the plan and execute it now?
121
123
  You: 1 — accept and execute.
122
124
  ```
123
125
 
124
- Planning artifacts live under `./docs/pi-plans/YYYY-MM-DD-<topic>/` by default (public, committed). Prefer `.git/pi_plans/plans` if you want them private to the repository.
126
+ Planning artifacts live under `./.git/pi-plans/plans/YYYY-MM-DD-<topic>/` by default — private to the repository, never tracked, never published. Choose `./docs/pi-plans` instead if you want the plans public and committed alongside the code.
125
127
 
126
128
  ## What it does
127
129
 
128
130
  | Capability | In short |
129
131
  |---|---|
130
132
  | Planning router + five specialist skills | Start with `/skill:planning` to route to the narrowest matching specialist (`plan-small` → `plan-big`, `debug-and-plan`, `plan-with-refs`) |
131
- | Choice prompts | `ask_choice`: recommended option first, answers auto-recorded per run; every option you author states its advantage and its drawback as `✓ <advantage> / ✗ <drawback>` in the configured language, so the user can weigh each option before answering; choosing Auto-complete enables recommendation-only answers for later eligible questions in the current planning run, with `/plans-autocomplete-stop` available to take back control. After execution completes, the continuation prompt enters goal-running mode by default: it asks only for the implementation-review loop's termination condition and then keeps refining until the loop ends or the cap is reached. |
132
- | Refinement rounds | Read-only reviewer/criticizer Pi subagents consolidate findings into the next plan version; delegated runs have standalone `Reviewer`/`Criticizer` progress overlays that close before the tool result returns; `analyze_refs` shows the same kind of overlay titled `Refs` while per-reference analysis subagents run |
133
- | Workspace state | Config, runs, decisions, refs, and subagent ledgers in `.git/pi_plans/` (git common dir) |
133
+ | Choice prompts | `ask_choice`: recommended option first, answers auto-recorded per run; every option you author states its advantage and its drawback as `✓ <advantage> / ✗ <drawback>` in the configured language, so the user can weigh each option before answering; choosing Auto-complete enables recommendation-only answers for later eligible questions in the current planning run, with `/plans-autocomplete-stop` available to take back control. |
134
+ | Refinement rounds | Read-only reviewer Pi subagents return findings (`F-###`) and up to five questions (`Q-1..Q-5`) in one round; the main agent asks every question with `ask_choice` and records the answers before revising. Delegated runs have a standalone `Reviewer` progress overlay; `analyze_refs` shows the same kind of overlay titled `Refs` while per-reference analysis subagents run |
135
+ | Workspace state | Config, runs, decisions, refs, and subagent ledgers in `.git/pi-plans/` (git common dir) |
134
136
  | VCC compact | Active planning/execution compaction uses deterministic, no-LLM VCC-style summaries when Pi core emits manual `/compact`, threshold, or overflow events. Summaries use five bracket sections plus a brief transcript, keep a smart recent tail, support `keep:N`, and write VCC details/stats without adding `/pi-vcc` commands. |
135
- | Visible Refiner overlay | Delegated reviewer/criticizer subagents surface as a named public overlay in the TUI — one `Reviewer`/`Criticizer` panel with per-lane tool progress, full streaming transcript with follow-bottom scroll, Tab-pane focus, retention until the user presses `Esc` after completion, and clean cancelled/timed-out vs completed states. `reviewers: 3` renders three equal-height panes inside the same overlay |
136
- | Tracked execution | Checklist injected each turn; `[DONE:VC-xxx]` markers drive completion; implementation items report progress with `[I-xxx:implemented]` / `[I-xxx:validating]` markers; the bottom status bar shows lifecycle, `x/y` progress, elapsed time, and input/output token usage in real time |
137
+ | Visible Refiner overlay | Delegated reviewer subagents surface as a named public overlay in the TUI — one `Reviewer` panel with per-lane tool progress, full streaming transcript with follow-bottom scroll, Tab-pane focus, retention until the user presses `Esc` after completion, and clean cancelled/timed-out vs completed states. `reviewers: 3` renders three equal-height panes inside the same overlay |
138
+ | Tracked execution | The current wave and remaining tasks are injected each turn; task progress is reported exclusively through the `plans_update_task` tool (status + evidence / skipReason, audit-only rollback); the task dashboard shows the tree live (compact aboveEditor widget, Ctrl+Shift+T expanded view with ✓/▸/~/· markers, width-adaptive); a stall watchdog pauses after three settled rounds without task-state change; the status bar shows lifecycle, `x/y` task progress, elapsed time, and token usage in real time |
137
139
  | Multi-run workdirs (0.6.0) | Several pi sessions can plan concurrently in one workdir: the run registry derives from `runs/` (no shared pointer to race), each session binds to its run, and same-topic runs get suffixed artifact dirs. `/plans-abandon`, `/plans-execute`, and `/resume-plans` are binding-first and open a descriptive run-picker form when more than one candidate exists; `/plans` lists all runs (newest first, bound run marked) |
138
- | Goal-wait continuation | In TUI/RPC, only a fully settled agent with unpassed VCs and no pending input or compaction gets one hidden wake carrying the latest checklist. Tool turns never queue reminders or consume guard rounds. The status bar shows progress; 3 no-progress cycles or 6 waiting cycles pause continuation. User interruption and final model errors also pause it. Only genuine user input or `/plans-execute` resumes; extension messages cannot. Print/JSON single-shot sessions track progress without automatic wakes. `/plans-stop` terminates execution |
139
- | Execution handoff | The accepted plan resumes in the current session (recommended) or, after the runtime question, on a **delegated executor subagent** running a different model: ≥3 switch targets (session-visible models + registry, deduped), one child for the whole plan with native write tools, `Executor` overlay progress, parent-side `[DONE:VC-xxx]` tracking, Esc//`/plans-stop` → stopped (resumable), and a configurable timeout (`executor_timeout_minutes`, default 60). Auto-approve/no-UI skips the question (current session, `[auto-approve]` recorded) |
140
- | Execution-phase compaction | Pi core owns scheduling; pi-plans maps the active plan path, current `I-###`, implementation IDs, and remaining `VC-###` checklist into the VCC sections. The old current-I proactive trigger and model-generated summary path are removed. |
140
+ | Completion auditor | When every task reaches a terminal state, an independent read-only auditor verifies each `VC-###` check against the worktree; failed checks roll their covered tasks (children cascade, skipped reopen) back to pending and inject the audit report; three failed rounds pause for the user — auto-approve/headless terminates as `stopped` instead of hanging. Checks with all-skipped coverage pass; checks covering no task never audit |
141
+ | Execution handoff | The accepted plan executes in the current session after explicit approval (never auto-completed); legacy `I-###` plans parse through the compatibility mapping with an upgrade notice; 0.6.0 in-flight runs resume compatibly (delegated-executor orphans re-approve, paused executions rebuild from the task tree) |
142
+ | Execution-phase compaction | Pi core owns scheduling; pi-plans maps the active plan path, current task, task ids, and remaining `VC-###` checks into the VCC sections. Proactive triggers and model-generated summary paths are removed. |
141
143
  | Planning-phase compaction | During `run.status=planning` with no active execution, pi-plans maps active run, artifact directory, latest plan path from session entries, and observed current-I markers into the VCC sections. Without an active planning run, compaction returns to Pi core. Additionally, creating a new run (`plans start-run`) proactively requests one pre-plan VCC compaction and resumes planning with a hidden message (default on; `prePlanCompact:false` disables). |
142
144
  | Efficient executor prompt | Each turn, the executor is steered by a fused rule set — Marcos Hernanz's AGENTS.md principles × Ponytail minimalism: layered growth, simplest implementation, long-term architecture (no stopgaps), library discipline — so plans finish in fewer tokens and fewer detours |
143
- | Write guard | `edit`/`write` blocked outside planning artifacts while a run is active; delegated executor children (and `PI_PLANS_RUN_ID`-pinned children) are exempt so a foreign session's planning run can never block an executing child; graph-aware file tools fall back to native writes for executor children |
145
+ | Write guard | `edit`/`write` blocked outside planning artifacts while a planning run is active in the workdir; the guard prefers the session-bound run and lists the allowed roots on refusal |
144
146
 
145
147
  ## Interface overview
146
148
 
@@ -148,16 +150,16 @@ Planning artifacts live under `./docs/pi-plans/YYYY-MM-DD-<topic>/` by default (
148
150
  |---|---|
149
151
  | `plans` | State CLI: `init`, `show`, `set-language`, `set-artifact-root`, `set-refs-root`, `set-role`, `start-run`, `set-status`, `record-decision`, `record-ref`, `record-subagent`, `record-checkpoint` (state-machine-validated workflow transitions) |
150
152
  | `ask_choice` | Numbered choice prompt; `autoComplete: false` for the merged accept/execute question and external-state questions |
151
- | `refine` | Reviewer/criticizer round via standalone read-only subagents (`--mode json -p --no-session --tools read,grep,find,ls`, plus `code_graph` for both roles when the workspace has the code graph enabled); `target: "plan"` (default) reviews the plan, `target: "implementation"` reviews the implemented worktree against the plan; delegated TUI runs show one `Reviewer`/`Criticizer` overlay (78% width × 78% height, top-center, ≥72 cols) with per-lane transcript, follow-bottom scroll, Tab focus, and retention until `Esc`; `reviewers: 3` renders three equal-height panes; enforces role/model confirmation gates |
152
- | `analyze_refs` | plan-with-refs reference analysis: one independent read-only subagent per downloaded reference (cwd = the ref directory), reusing the reviewer role gates and the concurrent overlay (titled `Refs`); batches of at most 3 lanes run sequentially; returns structured per-reference sections for `REF_ANALYSIS.md` |
153
- | `execute_plan` | Execution handoff: re-confirms with the user, asks the runtime (current session vs switch model → delegated executor), and enters extension-managed execution mode; picks the run via a descriptive form when several planned runs coexist |
153
+ | `refine` | Reviewer round via standalone read-only subagents (`--mode json -p --no-session --tools read,grep,find,ls`, plus `code_graph` when the workspace has the code graph enabled): findings (`F-###`) and up to five questions (`Q-1..Q-5`) per lane; the caller must ask every question with `ask_choice` and record answers before revising; delegated TUI runs show one `Reviewer` overlay (78% width × 78% height, top-center, ≥72 cols) with per-lane transcript, follow-bottom scroll, Tab focus, and retention until `Esc`; `reviewers: 3` renders three equal-height panes; enforces the reviewer gates — first use pops native model + effort panels in TUI (menus on RPC, text guidance headless), persisted to the global reviewer config |
154
+ | `analyze_refs` | plan-with-refs reference analysis: one independent read-only subagent per downloaded reference (cwd = the ref directory), reusing the reviewer model confirmation from the global config (the mode is not consulted — analysis always spawns) and the concurrent overlay (titled `Refs`); batches of at most 3 lanes run sequentially; returns structured per-reference sections for `REF_ANALYSIS.md` |
155
+ | `execute_plan` | Execution handoff: re-confirms with the user (never auto-completed) and enters task-tree execution mode (`plans_update_task` progress, dashboard, completion auditor); legacy `I-###` plans parse through the compatibility mapping with an upgrade notice; picks the run via a descriptive form when several planned runs coexist |
154
156
  | `/plans` | Show config, all runs (newest first, bound run marked, cap 50), and execution progress |
155
- | `/config-pi-plans` | Re-ask workspace defaults for language, artifact root, refs root, code graph, reviewer mode/model, and criticizer mode/model |
156
- | `/resume-plans` | Resume a run in the CURRENT session across restarts: unfinished planning (pending question + answered decisions), reviewing (round/lane state, successful outputs reused), execution (approval digest + HEAD + verified VCs), and implementation review (termination condition + round count). Binding-first: the session-bound resumable run resumes directly; a unique candidate goes direct; multiple candidates get a descriptive chooser. Linked worktrees share candidates; a cross-worktree resume confirms, copies artifacts without overwriting, and resets approval + VC validity (the termination condition survives, rounds restart at 0). An unchanged plan digest with a changed HEAD keeps the authorization but re-verifies old VCs first. Busy sessions and runs actively owned by a live process only notify — no queueing, no takeover. Interactive (TUI/RPC) only |
157
- | `/plans-execute [plan.md]` | Resume a paused active execution without losing verified progress; otherwise enter the explicit execution handoff (run-picker form when several planned runs coexist; runtime question: current session or switch model) |
157
+ | `/config-pi-plans` | Re-ask workspace defaults for language, artifact root, refs root, and code graph, plus the reviewer mode/model (keep/change menu; native model + effort panels on change in TUI; current-session skips the model step) |
158
+ | `/resume-plans` | Resume a run in the CURRENT session across restarts: unfinished planning (pending question + answered decisions), reviewing (round/lane state, successful outputs reused), and execution (approval digest + HEAD + recorded task progress; 0.6.0 delegated-executor orphans re-approve, legacy implementation-review phases map to done). Binding-first: the session-bound resumable run resumes directly; a unique candidate goes direct; multiple candidates get a descriptive chooser. Linked worktrees share candidates; a cross-worktree resume confirms, copies artifacts without overwriting, and resets approval + task progress. An unchanged plan digest with a changed HEAD keeps the authorization but re-opens closed tasks. Busy sessions and actively owned runs only notify — no queueing, no takeover. Interactive (TUI/RPC) only |
159
+ | `/plans-execute [plan.md]` | Resume a paused active execution without losing task progress; otherwise enter the explicit execution handoff (run-picker form when several planned runs coexist; legacy plans get an upgrade notice) |
158
160
  | `/update-plan [plan.md] [reason…]` | Interrupt-and-refine: stops execution (if any), returns the run to planning, and directs the agent to revise the plan into `PLAN_vN+1.md` while preserving verified work |
159
161
  | `/plans-autocomplete-stop` | Stop the current run's Auto-complete mode and return later planning questions to normal interaction |
160
- | `/init-graph` | Build the code graph: tree-sitter function index + cross-file call/import edges (EXTRACTED vs INFERRED confidence) + label-propagation communities; writes `.git/pi_plans/graph/GRAPH_REPORT.md` (subsystems, god nodes, edge stats). Full rebuilds never touch files with staged edits (fail-closed pending guard) |
162
+ | `/init-graph` | Build the code graph: tree-sitter function index + cross-file call/import edges (EXTRACTED vs INFERRED confidence) + label-propagation communities; writes `.git/pi-plans/graph/GRAPH_REPORT.md` (subsystems, god nodes, edge stats). Full rebuilds never touch files with staged edits (fail-closed pending guard) |
161
163
  | `/update-graph` | Incrementally reindex changed files (shared path used by apply/final-commit triggers and the watcher) |
162
164
  | `/apply-graph` | Materialize DB-first staged edits to the worktree; auto-reindexes the materialized set afterward |
163
165
  | `/graph-status` `/graph-drift` | Graph inventory and DB↔source convergence |
@@ -177,11 +179,11 @@ Pi core remains the owner of compaction scheduling: manual `/compact`, threshold
177
179
  - **Manual matrix.** Plain `/compact` and `/compact keep:N` compact and show stats without continuing. `/compact <text>` and `/compact keep:N <text>` compact, then send the text once as the follow-up prompt. Internal pi-plans compaction markers are never reused as user follow-up prompts.
178
180
  - **Fallbacks and stats.** Unsafe manual/threshold cuts cancel with a warning; overflow or retrying unsafe cuts return control to Pi core. Successful VCC compactions notify with kept-tail and summarized-message stats. Threshold/overflow compactions may queue one hidden continuation only when the running Pi version still needs it and `continueAfterThresholdCompact` is enabled.
179
181
  - **Pre-plan compaction.** When `plans start-run` creates a new planning run, pi-plans proactively requests one VCC compaction (internal hint `pi-plans planning pre-plan compact`) right after the run is created and before the first planning question, then resumes the planning turn with a hidden message — so each new plan starts on a lean context (LLM reasoning degrades with longer input). Small sessions, already-compacted sessions, and failures skip silently and still resume. `prePlanCompact:false` in the repo-private config restores the old behavior.
180
- - **Repo-private config.** Defaults are scaffolded in `.git/pi_plans/pi-vcc-config.json` under the resolved git common dir: `overrideDefaultCompaction:true`, `smartKeepTail:true`, `continueAfterThresholdCompact:true`, `prePlanCompact:true`, `debug:false`. Global pi-vcc config and `PI_VCC_CONFIG_PATH` are intentionally ignored.
182
+ - **Repo-private config.** Defaults are scaffolded in `.git/pi-plans/pi-vcc-config.json` under the resolved git common dir: `overrideDefaultCompaction:true`, `smartKeepTail:true`, `continueAfterThresholdCompact:true`, `prePlanCompact:true`, `debug:false`. Global pi-vcc config and `PI_VCC_CONFIG_PATH` are intentionally ignored.
181
183
 
182
184
  ## Visible Refiner overlay
183
185
 
184
- Delegated `refine` rounds (reviewer or criticizer) and `analyze_refs` rounds (titled `Refs`) show their progress directly inside the Pi TUI instead of disappearing into the child process's terminal. The overlay is a public, named panel so users always know who is doing what:
186
+ Delegated `refine` rounds (reviewer) and `analyze_refs` rounds (titled `Refs`) show their progress directly inside the Pi TUI instead of disappearing into the child process's terminal. The overlay is a public, named panel so users always know who is doing what:
185
187
 
186
188
  - **Pi-btw-aligned geometry.** Each round uses `width: "78%"`, `minWidth: 72`, `maxHeight: "78%"`, `anchor: "top-center"`, and `{ top: 1, left: 2, right: 2 }` margins (no dependency on `pi-btw`; the renderer is built on Pi's public `pi-tui` primitives).
187
189
  - **Complete streaming transcript.** Assistant text, thinking blocks, tool calls, tool results, and stderr are merged per turn/content block into lane entries without overlay-facing truncation; only the viewport slices them. Final `message_end` / `tool_execution_end` overwrite the live snapshot with the authoritative content.
@@ -216,8 +218,8 @@ Invoked via `resources_discover`, callable as `/skill:<name>`, directly as `/<na
216
218
  | Skill | Use it when |
217
219
  |---|---|
218
220
  | [`planning`](skills/planning/SKILL.md) | General router; selects the narrowest specialist skill before planning starts |
219
- | [`plan-small`](skills/plan-small/SKILL.md) | Small scoped change; 1–3 questions; one criticizer round |
220
- | [`plan-normal`](skills/plan-normal/SKILL.md) | Broad or risky change; 5–10 questions; reviewer + criticizer rounds |
221
+ | [`plan-small`](skills/plan-small/SKILL.md) | Small scoped change; 1–3 questions; one reviewer round |
222
+ | [`plan-normal`](skills/plan-normal/SKILL.md) | Broad or risky change; 5–10 questions; reviewer rounds |
221
223
  | [`plan-big`](skills/plan-big/SKILL.md) | Open-ended/high-risk effort; 10+ questions; three concurrent reviewers |
222
224
  | [`debug-and-plan`](skills/debug-and-plan/SKILL.md) | Bug, CI failure, regression, incident — diagnose before planning |
223
225
  | [`plan-with-refs`](skills/plan-with-refs/SKILL.md) | External references must be analyzed before planning — repos, papers (arXiv), engineering blogs, and docs sites all count; theoretical references are equal citizens. plan-normal/plan-big may optionally cite 1–2 search-found references without downloading |
@@ -277,16 +279,16 @@ pi-plans/
277
279
  │ └── code-graph/ # SQLite schema/store, parsers, indexer, summary, materialize
278
280
  ├── skills/ # The planning router plus five specialist planning skills
279
281
  ├── references/ # Shared workflow, state/config, plan template (normative)
280
- ├── agents/ # reviewer.md / criticizer.md subagent prompts
282
+ ├── agents/ # reviewer.md subagent prompt (ref-analyst.md for reference analysis)
281
283
  ├── scripts/validate.ts # Structure + package artifact guard
282
284
  └── tests/ # node:test suite (state, guard, plan parsing, execution, refine progress, code-graph)
283
285
  ```
284
286
 
285
287
  ## Safety model
286
288
 
287
- Before the approved handoff the workflow writes only `.git/pi_plans/` state, the run's artifact directory, `~/.cache/pi-plans/`, and the configured refs root (set via `plans set-refs-root` or `/config-pi-plans`; the recommended `.git/pi-plans/refs/` lives inside the git dir and needs no extra guard) — the extension blocks `edit`/`write` elsewhere while a run is `planning`/`accepted` (bash stays discipline-bound: inspection, `git init`, downloads into the cache). Reviewer/criticizer/ref-analyst subagents run with read-only tools. `Auto-complete` may answer planning and refinement questions only; it is never offered for execution, installs, publishing, deployment, merge, push, or credential use, and non-interactive sessions stop instead of auto-approving those.
289
+ Before the approved handoff the workflow writes only `.git/pi-plans/` state, the run's artifact directory, `~/.cache/pi-plans/`, and the configured refs root (set via `plans set-refs-root` or `/config-pi-plans`; the recommended `.git/pi-plans/refs/` lives inside the git dir and needs no extra guard) — the extension blocks `edit`/`write` elsewhere while a run is `planning`/`accepted` (bash stays discipline-bound: inspection, `git init`, downloads into the cache). Reviewer/ref-analyst subagents run with read-only tools. `Auto-complete` may answer planning and refinement questions only; it is never offered for execution, installs, publishing, deployment, merge, push, or credential use, and non-interactive sessions stop instead of auto-approving those.
288
290
 
289
- Delegated executor children (0.6.0) write natively with the approval already recorded — the planning guard no-ops for `PI_PLANS_EXECUTOR=1` children and honors a `PI_PLANS_RUN_ID` pin, so another session's concurrent planning run can never block an executing child; graph-aware file tools bypass DB-first staging for executor children so edits always land on disk. The child inherits pi's project-trust model (built-in write tools are always available; pi has no permission popups) and never loads run bookkeeping beyond its pinned id. `ask_choice` refuses to run inside an executor child (no interactive user — decide autonomously).
291
+ Read-only reviewer and ref-analyst subagents run with pinned tool lists (`read, grep, find, ls` plus `code_graph` when enabled) and inherit pi's project-trust model without any write capability; the completion auditor runs the same read-only profile. Execution itself happens in the approved session, never in an unsupervised child.
290
292
 
291
293
  ## Verification
292
294
 
@@ -308,11 +310,11 @@ The plan is the contract. Refinement converges on scope while nothing is writabl
308
310
 
309
311
  **What can Auto-complete decide on my behalf?**
310
312
 
311
- Planning and refinement choices only (the recommended option). Choosing Auto-complete enables the recommended answer for later eligible planning questions in the current run and the extension continues the planning turn when the model stops early. Use `/plans-autocomplete-stop` to take back control. It is never offered for execution approval, installs, publishing, deployment, merge, push, or credentials — those questions stop and wait for you. After execution completes, interactive sessions enter goal-running review mode automatically and ask only for the implementation-review loop's termination condition; the loop then continues until that condition or the 5-round cap. Headless sessions stay silent.
313
+ Planning and refinement choices only (the recommended option). Choosing Auto-complete enables the recommended answer for later eligible planning questions in the current run and the extension continues the planning turn when the model stops early. Use `/plans-autocomplete-stop` to take back control. It is never offered for execution approval, installs, publishing, deployment, merge, push, or credentials — those questions stop and wait for you. After execution completes, the independent completion auditor verifies every check; interactive sessions pause for review if the audit exhausts its three rounds, while headless runs terminate bounded instead of hanging.
312
314
 
313
315
  **Where does all the state live?**
314
316
 
315
- Preferences and run ledgers in `.git/pi_plans/` inside your workspace's git directory (never tracked, never published); plan artifacts under the configured artifact root (default `./docs/pi-plans/`); reference downloads under the configured refs root — asked once per workspace (recommended `.git/pi-plans/refs/`), changeable via `plans set-refs-root` or `/config-pi-plans`.
317
+ Workspace preferences and run ledgers in `.git/pi-plans/` inside your workspace's git directory (never tracked, never published); the reviewer role in the global config `~/.pi/pi-plans/config.json` (override with `PI_PLANS_GLOBAL_DIR`) — confirmed once, shared across every workspace; plan artifacts under the configured artifact root (default `./.git/pi-plans/plans/`, also private — pick `./docs/pi-plans` for public committed plans); reference downloads under the configured refs root — asked once per workspace (recommended `.git/pi-plans/refs/`), changeable via `plans set-refs-root` or `/config-pi-plans`.
316
318
 
317
319
  **How is this different from just prompting an AI to make changes?**
318
320
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pi-plans-reviewer
3
- description: Read-only plan reviewer for pi-plans refinement rounds; verifies plan claims against the repository.
3
+ description: Read-only plan reviewer for pi-plans refinement rounds; verifies plan claims against the repository and surfaces the questions only the user can settle.
4
4
  tools: read, grep, find, ls
5
5
  ---
6
6
 
@@ -12,9 +12,18 @@ Rules:
12
12
  - Verify the plan's claims against the actual repository using your read tools before judging them.
13
13
  - Every finding needs evidence: a repo path, a command, or an external citation. No evidence, no finding.
14
14
  - You are evidence, not authority: state what you verified, not what you assume.
15
+ - Criticize like a criticizer: when a trade-off, an undetermined semantic, or an accept/reject call genuinely needs the user's decision, raise it as a question instead of burying it in a finding.
15
16
 
16
- Output findings as Markdown, highest severity first, in this shape per finding:
17
+ Output Markdown with exactly two top-level parts, in this order:
18
+
19
+ ## Findings
20
+
21
+ Highest severity first, in this shape per finding:
17
22
 
18
23
  - `F-###` — severity: high | medium | low; affected plan IDs; evidence: <repo path/command or source>; impact: <what breaks>; recommended fix: <concrete change>; suggested disposition: accept | reject | needs-discussion.
19
24
 
20
- Surface at most five high-priority findings first; list lower-severity findings after them. If the plan holds up, say so explicitly and list what you checked.
25
+ Surface at most five high-priority findings first; list lower-severity findings after them. Write "None." when there are none. If the plan holds up, say so explicitly and list what you checked.
26
+
27
+ ## Questions
28
+
29
+ At most five numbered questions (`Q-1`, `Q-2`, …) that must be answered by the user before the plan can be safely revised. Each question: one line of why it matters, phrased so a user with repo access can answer concretely. Never rhetorical; never questions the repository already answers. Stop earlier if nothing genuinely needs the user.
package/index.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * pi-plans — human-in-the-loop planning for the Pi coding agent.
3
3
  *
4
- * Researched, refined Markdown plans before any code changes. The five
4
+ * Researched, refined Markdown plans before any code changes. The six
5
5
  * planning skills are contributed via resources_discover; the extension
6
6
  * provides the supporting machinery:
7
7
  *
8
- * - `plans` tool — workspace state (config, runs, ledgers) in .git/pi_plans/
8
+ * - `plans` tool — workspace state (config, runs, ledgers) in .git/pi-plans/
9
9
  * - `ask_choice` tool — the choice-prompt contract (Other / Auto-complete rules)
10
- * - `refine` tool — reviewer/criticizer rounds via read-only pi subagents
10
+ * - `refine` tool — reviewer rounds (findings + questions) via read-only pi subagents
11
11
  * - `execute_plan` — execution handoff into the tracked execution loop
12
12
  * - write guard — planning runs may only write planning artifacts
13
- * - execution loop — checklist injection, [DONE:VC-xxx] tracking, progress status
13
+ * - execution loop — task-tree injection, plans_update_task tracking, dashboard, audit
14
14
  */
15
15
 
16
16
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
@@ -44,7 +44,7 @@ import {
44
44
  requestPlanningCompaction,
45
45
  restoreFromSession,
46
46
  stopExecution,
47
- abortDelegatedExecutor,
47
+ toggleDashboardExpanded,
48
48
  updateStatusWidget,
49
49
  shouldTriggerPlanningCompaction,
50
50
  } from "./src/exec.ts";
@@ -82,9 +82,12 @@ import { abandonCandidates, resolveCommandRun } from "./src/run-picker.ts";
82
82
  import { applyPlanWritten, mutateCheckpoint, planIdentityOf } from "./src/workflow-state.ts";
83
83
  import { registerAskChoiceTool } from "./tools/ask-choice.ts";
84
84
  import { executeCommand, registerExecutePlanTool } from "./tools/execute-plan.ts";
85
+ import { registerTaskStatusTool } from "./src/task-tool.ts";
86
+ import { flattenTaskViews, taskIsTerminal, taskProgress } from "./src/tasks.ts";
85
87
  import { registerPlansTool } from "./tools/plans.ts";
86
88
  import { registerRefineTool } from "./tools/refine.ts";
87
89
  import { registerAnalyzeRefsTool } from "./tools/analyze-refs.ts";
90
+ import { messaging, setMessagingApi } from "./src/messaging.ts";
88
91
 
89
92
  const baseDir = dirname(fileURLToPath(import.meta.url));
90
93
 
@@ -127,11 +130,17 @@ function hasActivePlanningWorkflow(ctx: Parameters<typeof updateStatusWidget>[0]
127
130
  }
128
131
 
129
132
  export default function piPlansExtension(pi: ExtensionAPI): void {
133
+ setMessagingApi(pi);
130
134
  registerPlansTool(pi);
131
135
  registerAskChoiceTool(pi);
132
136
  registerRefineTool(pi, baseDir);
133
137
  registerAnalyzeRefsTool(pi, baseDir);
134
138
  registerExecutePlanTool(pi);
139
+ registerTaskStatusTool(pi);
140
+ pi.registerShortcut("ctrl+shift+t", {
141
+ description: "Expand/collapse the pi-plans task dashboard",
142
+ handler: (ctx) => toggleDashboardExpanded(ctx),
143
+ });
135
144
  registerQueryInterviewHooks(pi, hasActivePlanningWorkflow);
136
145
  registerCodeGraphTool(pi);
137
146
  registerGraphAwareFileTools(pi);
@@ -178,7 +187,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
178
187
  handler: async (args, ctx) => {
179
188
  const invocation = args.trim() ? `/skill:${name} ${args.trim()}` : `/skill:${name}`;
180
189
  try {
181
- pi.sendUserMessage(invocation, { expandPromptTemplates: true });
190
+ messaging().sendUserMessage(invocation, { expandPromptTemplates: true });
182
191
  } catch {
183
192
  ctx.ui.notify("Agent is busy; try again once the current turn finishes.", "error");
184
193
  }
@@ -208,7 +217,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
208
217
  if (active) {
209
218
  const latest = latestPlanVersion(active.artifact_dir);
210
219
  if (latest && path.resolve(ctx.cwd, rawPath) === path.resolve(ctx.cwd, latest.path)) {
211
- pi.appendEntry(PLANNING_PLAN_WRITTEN_CUSTOM_TYPE, {
220
+ messaging().appendEntry(PLANNING_PLAN_WRITTEN_CUSTOM_TYPE, {
212
221
  runId: active.run_id,
213
222
  planPath: latest.path,
214
223
  });
@@ -254,14 +263,14 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
254
263
  if (event.toolName !== "plans") return;
255
264
  if (!consumePrePlanCompactPending(ctx)) return;
256
265
  if (typeof ctx.compact !== "function") {
257
- sendPrePlanCompactResume(pi);
266
+ sendPrePlanCompactResume(ctx);
258
267
  return;
259
268
  }
260
269
  let resumed = false;
261
270
  const resumeOnce = () => {
262
271
  if (resumed) return;
263
272
  resumed = true;
264
- sendPrePlanCompactResume(pi);
273
+ sendPrePlanCompactResume(ctx);
265
274
  };
266
275
  ctx.compact({
267
276
  customInstructions: PLANNING_PREPLAN_COMPACT_HINT,
@@ -313,18 +322,18 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
313
322
 
314
323
  pi.on("session_before_compact", async (event, ctx) => {
315
324
  noteCompactionStarted(ctx, event.customInstructions);
316
- const executionResult = await handleExecutionBeforeCompact(pi, ctx, event);
325
+ const executionResult = await handleExecutionBeforeCompact(ctx, event);
317
326
  if (executionResult) return executionResult;
318
- return handlePlanningBeforeCompact(pi, ctx, event);
327
+ return handlePlanningBeforeCompact(ctx, event);
319
328
  });
320
329
  pi.on("session_compact", async (event, ctx) => {
321
- await handleExecutionCompact(pi, ctx, event);
322
- await handlePlanningCompact(pi, ctx, event);
330
+ await handleExecutionCompact(ctx, event);
331
+ await handlePlanningCompact(ctx, event);
323
332
  noteCompactionEnded(ctx, event.customInstructions);
324
333
  });
325
334
  pi.on("session_compact_failed", async (event, ctx) => {
326
- handleExecutionCompactFailed(pi, ctx, event);
327
- handlePlanningCompactFailed(pi, ctx, event);
335
+ handleExecutionCompactFailed(ctx, event);
336
+ handlePlanningCompactFailed(ctx, event);
328
337
  noteCompactionEnded(ctx, event.customInstructions);
329
338
  });
330
339
 
@@ -332,7 +341,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
332
341
  // Execution loop: inject remaining checklist each turn, track markers.
333
342
  // -----------------------------------------------------------------------
334
343
  pi.on("before_agent_start", async (_event, ctx) => {
335
- drainExecutionFlush(pi, ctx);
344
+ drainExecutionFlush(ctx);
336
345
  const content = executionContextMessage(ctx);
337
346
  if (!content) {
338
347
  if (!getExecution() && shouldTriggerPlanningCompaction(ctx)) {
@@ -372,7 +381,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
372
381
  // -----------------------------------------------------------------------
373
382
 
374
383
  pi.registerCommand("init-graph", {
375
- description: "Index the worktree into .git/pi_plans/code_graph.db. If a graph DB already exists, prompt to rebuild or sync changed paths via /update-graph; `--reindex` and non-interactive runs stay on the rebuild path.",
384
+ description: "Index the worktree into .git/pi-plans/code_graph.db. If a graph DB already exists, prompt to rebuild or sync changed paths via /update-graph; `--reindex` and non-interactive runs stay on the rebuild path.",
376
385
  handler: async (args, ctx) => {
377
386
  await initGraphCommand(args, ctx);
378
387
  },
@@ -460,15 +469,16 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
460
469
  lines.push(`State: ${resolveStateRootOrNull(ctx.cwd) ?? "(no repo)"}`);
461
470
  }
462
471
  // One-time active.json deprecation note (v0.6.0 registry migration).
463
- if (fs.existsSync(path.join(resolveStateRootOrNull(ctx.cwd) ?? ".git/pi_plans", "active.json"))) {
472
+ if (fs.existsSync(path.join(resolveStateRootOrNull(ctx.cwd) ?? ".git/pi-plans", "active.json"))) {
464
473
  lines.push("Note: active.json is deprecated — the run registry now derives from runs/*/run.json; the legacy file is ignored.");
465
474
  }
466
475
  const execution = getExecution();
467
476
  if (execution) {
468
- const done = execution.items.filter((item) => item.done).length;
469
- lines.push(`Execution: ${execution.planPath} — ${done}/${execution.items.length} verifier items done`);
470
- for (const item of execution.items) {
471
- lines.push(` ${item.done ? "☑" : "☐"} ${item.id}`);
477
+ const progress = taskProgress(execution.tasks);
478
+ const vcDone = execution.items.filter((item) => item.done).length;
479
+ lines.push(`Execution: ${execution.planPath} — tasks ${progress.done}/${progress.total} · VC ${vcDone}/${execution.items.length}`);
480
+ for (const task of flattenTaskViews(execution.tasks)) {
481
+ lines.push(` ${taskIsTerminal(task) ? (task.status === "skipped" ? "~" : "☑") : "☐"} ${task.id}`);
472
482
  }
473
483
  }
474
484
  lines.push(`Auto-complete: ${autoCompleteStatus(ctx)}`);
@@ -478,7 +488,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
478
488
  });
479
489
 
480
490
  pi.registerCommand("config-pi-plans", {
481
- description: "Re-ask and update pi-plans workspace config: language, artifact root, graph, reviewer, and criticizer defaults",
491
+ description: "Re-ask and update pi-plans workspace config: language, artifact root, graph, and reviewer defaults",
482
492
  handler: async (args, ctx) => {
483
493
  await configPiPlansCommand(args, ctx);
484
494
  },
@@ -554,7 +564,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
554
564
  `${doneIds.length}/${execution.items.length} verifier item(s) already verified; their work stays. Remaining items return to planning.`,
555
565
  );
556
566
  if (!ok) return;
557
- await stopExecution(pi, ctx, "interrupted by /update-plan");
567
+ await stopExecution(ctx, "interrupted by /update-plan");
558
568
  }
559
569
 
560
570
  // Return the run to planning so refinement rules and guards apply again.
@@ -602,7 +612,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
602
612
  "Follow the original planning-skill contract for revisions: collect needed clarifications via ask_choice (one question at a time, recorded), apply evidence-based revisions only, then ask the next merged accept/execute question (autoComplete: false — ✓ Accept & execute now / Accept, don't execute yet / another round) and call execute_plan pointing at the new version on accept.",
603
613
  );
604
614
 
605
- await pi.sendUserMessage(lines.join("\n"));
615
+ await messaging().sendUserMessage(lines.join("\n"));
606
616
  },
607
617
  });
608
618
 
@@ -613,12 +623,9 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
613
623
  ctx.ui.notify("No execution in progress.", "info");
614
624
  return;
615
625
  }
616
- const ok = await ctx.ui.confirm("Stop execution?", "Remaining verifier items will be left unfinished.");
626
+ const ok = await ctx.ui.confirm("Stop execution?", "Open tasks will be left unfinished.");
617
627
  if (!ok) return;
618
- // v0.6.0: a delegated executor child is killed via its AbortController
619
- // before the shared stop path clears the state.
620
- abortDelegatedExecutor();
621
- await stopExecution(pi, ctx, "stopped by user via /plans-stop");
628
+ await stopExecution(ctx, "stopped by user via /plans-stop");
622
629
  ctx.ui.notify("Execution stopped.", "info");
623
630
  },
624
631
  });
@@ -627,7 +634,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
627
634
  description:
628
635
  "Resume the working plan in this repository: unfinished planning / reviewing / execution / implementation review, across sessions and linked worktrees, in the current session.",
629
636
  handler: async (_args, ctx) => {
630
- await resumePlansCommand(pi, ctx, baseDir);
637
+ await resumePlansCommand(ctx, baseDir);
631
638
  },
632
639
  });
633
640
 
@@ -654,8 +661,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
654
661
  // Abandon must end execution first so the planning model is restored.
655
662
  disableAutoComplete(ctx, "run abandoned");
656
663
  if (abandoningBound && getExecution()) {
657
- abortDelegatedExecutor();
658
- await stopExecution(pi, ctx, "run abandoned via /plans-abandon");
664
+ await stopExecution(ctx, "run abandoned via /plans-abandon");
659
665
  }
660
666
  try {
661
667
  setRunStatus(ctx.cwd, chosen.run_id, "abandoned");
@@ -671,7 +677,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
671
677
  // Session lifecycle
672
678
  // -----------------------------------------------------------------------
673
679
  pi.on("session_tree", async (_event, ctx) => {
674
- await restoreFromSession(pi, ctx, ctx.sessionManager.getBranch() as unknown as Parameters<typeof restoreFromSession>[2]);
680
+ await restoreFromSession(ctx, ctx.sessionManager.getBranch() as unknown as Parameters<typeof restoreFromSession>[1]);
675
681
  restoreRunBindingFromSession(
676
682
  ctx.sessionManager,
677
683
  ctx.cwd,
@@ -679,7 +685,7 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
679
685
  );
680
686
  });
681
687
  pi.on("session_start", async (_event, ctx) => {
682
- await restoreFromSession(pi, ctx, ctx.sessionManager.getBranch() as unknown as Parameters<typeof restoreFromSession>[2]);
688
+ await restoreFromSession(ctx, ctx.sessionManager.getBranch() as unknown as Parameters<typeof restoreFromSession>[1]);
683
689
  restoreAutoCompleteFromSession(ctx, ctx.sessionManager.getEntries() as unknown as Parameters<typeof restoreAutoCompleteFromSession>[1]);
684
690
  restoreRunBindingFromSession(
685
691
  ctx.sessionManager,
@@ -688,3 +694,4 @@ export default function piPlansExtension(pi: ExtensionAPI): void {
688
694
  );
689
695
  });
690
696
  }
697
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-plans",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Human-in-the-loop planning extension for the Pi coding agent: researched, refined Markdown plans before any code changes.",
5
5
  "license": "MIT",
6
6
  "type": "module",