@narumitw/pi-plan-mode 0.52.0 → 0.54.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.
- package/README.md +143 -72
- package/dist/chunks/{chunk-H3RGWRY7.ts → chunk-U5CQ7RQX.js} +501 -294
- package/dist/chunks/chunk-U5CQ7RQX.js.map +7 -0
- package/dist/chunks/{interactive-ui-GFNX5OF4.ts → interactive-ui-W3VYAJIQ.js} +60 -24
- package/dist/chunks/interactive-ui-W3VYAJIQ.js.map +7 -0
- package/dist/index.ts +856 -270
- package/dist/index.ts.map +3 -3
- package/package.json +5 -5
- package/src/extension-runtime.ts +0 -17
- package/src/finalization-request.ts +57 -0
- package/src/fresh-implementation.ts +73 -27
- package/src/helper-tool-visibility.ts +142 -0
- package/src/implementation-retention.ts +43 -19
- package/src/message-transform.ts +130 -6
- package/src/mode-contract.ts +93 -0
- package/src/plan-launch-menu.ts +4 -4
- package/src/plan-mode.ts +586 -190
- package/src/presentation.ts +50 -17
- package/src/prompt.ts +3 -1
- package/src/required-tools.ts +0 -4
- package/src/settings-menu.ts +67 -17
- package/src/settings.ts +21 -2
- package/src/tool-policy.ts +137 -2
- package/src/tool-selection.ts +0 -23
- package/dist/chunks/chunk-H3RGWRY7.ts.map +0 -7
- package/dist/chunks/interactive-ui-GFNX5OF4.ts.map +0 -7
package/README.md
CHANGED
|
@@ -8,18 +8,19 @@ This independently installable extension adds a Codex-like `/plan` collaboration
|
|
|
8
8
|
|
|
9
9
|
## ✨ Features
|
|
10
10
|
|
|
11
|
-
- Starts and manages Plan mode through `/plan`, `/plan
|
|
12
|
-
-
|
|
11
|
+
- Starts and manages Plan mode through `/plan`, `/plan start`, or `/plan <prompt>`.
|
|
12
|
+
- Defers Plan helper schemas until first use by default, then keeps the unlocked tool envelope stable while runtime policy blocks mutations and unsafe shell forms.
|
|
13
13
|
- Requires structured questions for important ambiguity and explicit completion for a decision-ready plan.
|
|
14
14
|
- Reviews the complete plan before implementation, export, save, continued planning, or discard.
|
|
15
15
|
- Starts implementation in the planning session or a fresh linked session with the exact approved plan.
|
|
16
16
|
- Persists Plan state and one saved plan across resume and compaction.
|
|
17
|
-
- Exposes statusline state and configurable tool
|
|
17
|
+
- Exposes statusline state and a configurable Plan tool allowlist, including reviewed native PowerShell inspection on Windows, plus export destination, plan reinjection, shortcut, and thinking level.
|
|
18
18
|
- Cooperates anonymously with Workflow Mutex Protocol v1 participants so only one agent workflow starts in a session.
|
|
19
19
|
|
|
20
20
|
## 📦 Install
|
|
21
21
|
|
|
22
22
|
This release requires Pi 0.80.6 or newer.
|
|
23
|
+
Native PowerShell tool support requires Pi 0.84.3 or newer on Windows; earlier Pi versions omit that optional tool and retain the existing Plan policy.
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
26
|
pi install npm:@narumitw/pi-plan-mode
|
|
@@ -45,6 +46,32 @@ The package declares `dist/index.ts`, so an unbuilt local checkout must run the
|
|
|
45
46
|
Run `/plan` to open the state-aware menu, then start Plan mode and ask the agent to inspect and design the change.
|
|
46
47
|
Run `/plan <prompt>` when the first planning request is already known.
|
|
47
48
|
|
|
49
|
+
## 🧱 Cache-stable mode transitions
|
|
50
|
+
|
|
51
|
+
Plan and Normal requests share one append-only conversation.
|
|
52
|
+
The extension appends one hidden, model-visible, versioned Plan contract before the first Plan prompt and one Normal contract before the first post-Plan Normal or implementation prompt.
|
|
53
|
+
Ordinary linear turns do not rewrite or duplicate these contracts.
|
|
54
|
+
**Implement here** therefore retains the Plan dialogue, structured questions, assistant tool calls, completion evidence, and `Implement the plan.` kickoff in order.
|
|
55
|
+
**Start fresh and implement** remains the explicit isolation path and transfers only the approved plan plus the Normal mode contract to a linked session.
|
|
56
|
+
|
|
57
|
+
The `context` hook filters legacy repeated `plan-mode-context` artifacts but preserves current transition messages.
|
|
58
|
+
When compaction removes the effective physical transition, the hook inserts one canonical fallback at a deterministic retained-history boundary.
|
|
59
|
+
Repeated transforms leave that fallback in place instead of moving it to the newest turn.
|
|
60
|
+
An inactive legacy state entry alone does not inject a Normal contract, so sessions that never entered Plan mode keep their ordinary context after resume or reload.
|
|
61
|
+
Manual `/tree` navigation restores branch-owned Plan state and chooses the matching effective contract without navigating automatically or adding a branch summary.
|
|
62
|
+
Pi currently lists hidden custom transition messages in `/tree`; Plan mode rejects those internal targets, so select an adjacent conversation entry instead.
|
|
63
|
+
|
|
64
|
+
The default `toolVisibility: "after-first-plan"` keeps `plan_mode_question` and `plan_mode_complete` registered but inactive until the first successful Plan activation in an extension runtime.
|
|
65
|
+
That activation appends the two helpers in canonical order and may cause one provider-prefix cache miss because `/plan` is a slash-command transition rather than a model-called deferred-tool loader.
|
|
66
|
+
The helpers and their active-only prompt metadata remain visible after that boundary across off, exit, save, export, implementation, and same-runtime session starts.
|
|
67
|
+
Failed, cancelled, stale, or workflow-busy activation restores the exact prior active-tool list and does not consume the first-activation boundary.
|
|
68
|
+
Choose `toolVisibility: "always"` to expose both helpers at session startup and preserve the previous stable-prefix behavior from the first request.
|
|
69
|
+
Neither choice guarantees a cache hit because provider serialization, cache lifetime, minimum cacheable prefix, implementation details, and session affinity still control reuse.
|
|
70
|
+
A user, Pi, or another extension can change the active tool set outside this extension's guarantee.
|
|
71
|
+
|
|
72
|
+
The default `thinkingLevel: "inherit"` path also avoids a Plan-specific reasoning-parameter change.
|
|
73
|
+
Choosing a fixed Plan thinking level remains supported, but switching reasoning parameters can prevent provider-side state reuse even when system instructions and tool schemas are stable.
|
|
74
|
+
|
|
48
75
|
## 💬 Commands
|
|
49
76
|
|
|
50
77
|
```text
|
|
@@ -63,16 +90,16 @@ Run `/plan <prompt>` when the first planning request is already known.
|
|
|
63
90
|
In TUI and RPC, use bare `/plan` to open the menu for the current Plan state.
|
|
64
91
|
When Plan mode is off and no plan is stored, the launch menu shows the effective next-start tools and offers **Start Plan mode**, **Choose tools, then start…**, **Settings**, and **How Plan mode works**.
|
|
65
92
|
Settings edits the persistent defaults for later workflows.
|
|
66
|
-
Launch-menu
|
|
93
|
+
Launch-menu policy changes remain a draft until **Done — start with this policy** is selected; Back, Escape, Ctrl+C, disposal, session replacement, and shutdown discard the draft without changing Plan state, active tools, thinking, or the stored selection.
|
|
67
94
|
|
|
68
95
|
Use `/plan start` when you want to enter Plan mode directly without sending a model message.
|
|
69
96
|
Use `/plan <prompt>` to enter Plan mode and immediately submit `<prompt>` as the first Plan-mode user message.
|
|
70
97
|
The exact argument `start` is reserved for direct activation; longer text such as `/plan start a migration` remains an inline planning prompt.
|
|
71
|
-
|
|
98
|
+
The extension does not register a startup flag; run `/plan start` after launch for direct activation.
|
|
72
99
|
|
|
73
|
-
Use **Choose tools, then start…** or the `/plan tools` compatibility shortcut to choose a session-specific override before Planning starts.
|
|
74
|
-
Both routes use the same draft selector: **Done — start
|
|
75
|
-
The bounded multi-select shows 10 rows at a time, supports viewport paging, descriptions, and explicit unavailable rows for blocked tools.
|
|
100
|
+
Use **Choose tools, then start…** or the `/plan tools` compatibility shortcut to choose a session-specific Plan policy override before Planning starts.
|
|
101
|
+
Both routes use the same draft selector: **Done — start with this policy** stores the allowlist and starts the workflow, while cancellation leaves Plan mode off and changes nothing.
|
|
102
|
+
The bounded multi-select shows 10 rows at a time, supports viewport paging, descriptions, and explicit unavailable rows for blocked or currently inactive tools.
|
|
76
103
|
In TUI mode, type to fuzzy-search tool names, descriptions, policy, and source metadata; RPC keeps the complete unfiltered list.
|
|
77
104
|
Once Plan mode is active, tools are locked: `/plan` no longer offers tool or Settings actions, and `/plan tools` rejects the request.
|
|
78
105
|
Exit and start a new workflow if a different tool set is required.
|
|
@@ -83,6 +110,10 @@ Completed and saved plan menus offer **Implement here**, which continues with th
|
|
|
83
110
|
The direct `/plan implement` compatibility route remains equivalent to **Implement here** and never opens a selector.
|
|
84
111
|
A successful ready-plan export also leaves Plan mode; saved and active implementation exports retain their existing state.
|
|
85
112
|
`show`, `save`, `export`, and `implement` fail closed when no applicable plan is stored; `finalize` requires active Plan mode.
|
|
113
|
+
Pi executes extension commands immediately during streaming, but changing Plan state or handing off implementation during an active run would mix two mode contracts inside one run.
|
|
114
|
+
Plan mode therefore rejects busy start, exit, save, ready-plan export, implementation, state-changing menu action, and configured-shortcut transitions without changing state; wait for the run to settle and retry.
|
|
115
|
+
Prompts submitted while Plan mode is already active remain ordinary Plan follow-ups, and `/plan finalize` remains available as a Plan-preserving follow-up.
|
|
116
|
+
TUI and RPC show a warning for a rejected busy transition, while print and JSON routes throw an observable error.
|
|
86
117
|
|
|
87
118
|
`/plan export` uses the configured **Export destination**, which defaults to `PLAN.md`.
|
|
88
119
|
Supply a path to override that default for one export.
|
|
@@ -90,7 +121,7 @@ Relative paths resolve from the command's current `ctx.cwd` at export time, abso
|
|
|
90
121
|
Explicit `/plan export <path>` input always wins over the setting.
|
|
91
122
|
Export never overwrites an existing file, directory, or symbolic link: choose another path or remove the existing target first.
|
|
92
123
|
A successful export adds one trailing newline but otherwise preserves the accepted Markdown exactly.
|
|
93
|
-
After a ready plan is written, Plan mode ends, its
|
|
124
|
+
After a ready plan is written, Plan mode ends, its thinking level is restored, the current helper visibility is retained, and the ready state is cleared without starting a model turn.
|
|
94
125
|
Exporting a saved or active implementation plan leaves that state unchanged.
|
|
95
126
|
Failed or cancelled exports leave every Plan-mode state unchanged.
|
|
96
127
|
The resulting file is available to the agent through its normal file-reading tools.
|
|
@@ -109,18 +140,30 @@ The agent may inspect files and run read-only commands, but it should not edit f
|
|
|
109
140
|
It should explore first, then use structured questions when your preference or a tradeoff materially changes the plan.
|
|
110
141
|
Configure persistent defaults or a one-workflow tool override before activation; Planning and ready menus deliberately keep those controls locked.
|
|
111
142
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
`
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
143
|
+
Plan mode registers `plan_mode_question` and `plan_mode_complete` during extension load.
|
|
144
|
+
With the default **After first plan** visibility, `session_start` leaves both helpers inactive until the first admitted Plan workflow appends them in that order.
|
|
145
|
+
With **Always**, `session_start` appends missing helpers in the same canonical order.
|
|
146
|
+
Once revealed, ordinary Plan transitions never remove them during that extension runtime.
|
|
147
|
+
By default, the Plan policy allows active safe built-ins such as `read`, limited `bash`, limited `powershell`, `grep`, `find`, and `ls`.
|
|
148
|
+
The optional native `powershell` tool must already be active, for example through Pi's Windows `defaultTools` setting, before Plan mode can select it.
|
|
149
|
+
Built-in `edit` and `write`, `update_plan`, inactive tools, and deselected tools are blocked at execution time even though active schemas remain visible.
|
|
150
|
+
Extension and custom tools are denied by default because Pi tools do not expose standardized mutability metadata; allow an already active custom tool before starting only when you accept the risk.
|
|
151
|
+
For example, you can opt into an active `firecrawl_scrape`, `firecrawl_search`, or `lsp_diagnostics` tool when you want to use it during planning.
|
|
152
|
+
After they become visible, the Plan-only helpers remain visible in Normal mode, but their handlers and the `tool_call` policy reject calls unless Plan mode owns the active workflow.
|
|
153
|
+
|
|
154
|
+
Limited `bash` uses a fail-closed Bash policy, including when an extension overrides the canonical `bash` tool name.
|
|
119
155
|
It accepts common inspection commands, read-only Git and npm queries, pipelines and command lists composed entirely of accepted commands, plus selected checks such as `npm test`, `npm run typecheck`, and `cargo test`.
|
|
120
156
|
It rejects output/input redirects, shell expansion, substitutions, subshells, background jobs, mutating flags, dependency changes, editors, and unknown commands.
|
|
157
|
+
|
|
158
|
+
Limited `powershell` uses a separate fail-closed PowerShell policy, including when an extension overrides the canonical `powershell` tool name.
|
|
159
|
+
It accepts canonical inspection cmdlets such as `Get-ChildItem`, `Get-Content`, `Get-Item`, `Get-Location`, `Resolve-Path`, `Select-String`, `Test-Path`, `Measure-Object`, `Sort-Object`, `Format-List`, `Format-Table`, `Out-String`, and `Write-Output`.
|
|
160
|
+
It also accepts the same reviewed `git` and configured `gh` queries as limited Bash, including pipelines and semicolon-delimited command lists composed entirely of accepted commands.
|
|
161
|
+
It rejects redirects, variables, substitutions, script blocks, call operators, type or method expressions, stop-parsing tokens, multiline input, non-ASCII quotation delimiters, aliases, mutating cmdlets, and unknown commands.
|
|
162
|
+
Use canonical cmdlet names because PowerShell aliases are intentionally outside the reviewed policy.
|
|
163
|
+
|
|
121
164
|
A rejected parsed command list or pipeline identifies its first blocked command segment; malformed or unsupported shell syntax reports the complete submitted input instead.
|
|
122
165
|
Tests and builds may still write ignored caches or build artifacts and may execute project-defined hooks; enable or invoke them only when the repository is trusted.
|
|
123
|
-
|
|
166
|
+
Both limited-shell policies are extension-level risk reduction, not an OS sandbox or confidentiality boundary.
|
|
124
167
|
|
|
125
168
|
`plan_mode_question` follows Codex's `request_user_input` pattern: the agent can ask 1-3 concise questions, each with meaningful options and a free-form Other path.
|
|
126
169
|
In TUI mode, a single question shows its header as plain muted text, submits as soon as its preset or custom answer is confirmed, and does not show tabs, Review, or question-navigation controls.
|
|
@@ -136,8 +179,9 @@ The TUI rejects either field above 4,000 characters instead of truncating it.
|
|
|
136
179
|
RPC keeps the existing sequential `select` and `editor` dialogs because Pi RPC cannot render custom TUI components.
|
|
137
180
|
If you cancel or no interactive UI is available, the agent should ask a concise plain-text question or proceed only with a clearly stated low-risk assumption instead of prematurely producing a final plan.
|
|
138
181
|
|
|
139
|
-
Pi
|
|
140
|
-
The pre-start selector stores accepted session
|
|
182
|
+
Pi identifies tools by tool name.
|
|
183
|
+
The pre-start selector stores accepted session policy names and shows each effective tool's source from Pi metadata, such as `built-in`, a user extension path, or a project extension path.
|
|
184
|
+
A selected name can run in Plan mode only when that effective tool was already active at session startup.
|
|
141
185
|
If an extension overrides a built-in tool with the same name, Pi exposes the effective tool for that name and the selector shows that source.
|
|
142
186
|
|
|
143
187
|
A complete Plan mode answer should appear only after the agent has resolved discoverable facts and high-impact user decisions.
|
|
@@ -148,36 +192,41 @@ Its visible result contains the full plan, and versioned result details let the
|
|
|
148
192
|
`plan_mode_complete` uses Pi's `terminate: true` hint.
|
|
149
193
|
Termination is best effort: if a model puts it in a parallel tool batch, Pi terminates the batch early only when every finalized sibling tool also terminates.
|
|
150
194
|
The prompt therefore requires the completion call to be standalone and last.
|
|
151
|
-
The extension deliberately does not infer completion from phrases such as “I will present the plan,” and
|
|
152
|
-
|
|
195
|
+
The extension deliberately does not infer completion from phrases such as “I will present the plan,” and ordinary research or clarification turns never trigger automatic retries.
|
|
196
|
+
`/plan finalize` and its exact canonical finalization prompt are explicit recovery requests.
|
|
197
|
+
If one of those requests ends normally without a valid structured question or completed plan, Plan mode waits for `agent_settled` and retries once with stronger tool guidance.
|
|
198
|
+
A valid question, accepted completion, user cancellation, explicit exit, workflow supersession, reload, session replacement, or shutdown cancels the retry.
|
|
199
|
+
A second prose-only failure leaves Plan mode active, warns in interactive modes, and requires another explicit `/plan finalize` request.
|
|
153
200
|
|
|
154
201
|
Legacy sessions and models may still submit one non-empty `<proposed_plan>` block with tags on their own lines.
|
|
155
202
|
That compatibility path remains accepted, but it is not the primary workflow.
|
|
156
203
|
Empty, malformed, unclosed, or multiple legacy blocks keep Plan mode active and produce a warning.
|
|
157
204
|
|
|
158
205
|
After completion, `/plan` opens the ready actions when interactive UI is available.
|
|
159
|
-
The same flat menu shows **Implement here** and **Start fresh and implement**, explains which conversation context each choice uses, and previews
|
|
160
|
-
**Implement here**—and the compatibility route `/plan implement`—
|
|
206
|
+
The same flat menu shows **Implement here** and **Start fresh and implement**, explains which conversation context each choice uses, and previews the selected **Plan reinjection** policy.
|
|
207
|
+
**Implement here**—and the compatibility route `/plan implement`—appends the Normal contract, lifts the Plan runtime policy, captures the reinjection setting, and starts implementation in the current session with its complete planning conversation and tool calls.
|
|
161
208
|
**Start fresh and implement** waits for the source session to become idle, verifies the selected model and authentication, creates a new session linked to the persisted source as its parent, and transfers the exact approved plan without copying planning messages, tool results, or compaction/branch summaries.
|
|
162
209
|
The destination still loads its normal `AGENTS.md`, skills, project resources, and extensions.
|
|
163
|
-
Choosing **Export plan…** asks for a destination, writes the plan,
|
|
210
|
+
Choosing **Export plan…** asks for a destination, writes the plan, appends the Normal contract, restores inherited thinking, and leaves Plan mode without starting a model turn or changing active tools.
|
|
164
211
|
Choosing **Save for later**—or running `/plan save`—instead stores one plan in the current Pi session before leaving Plan mode.
|
|
165
212
|
|
|
166
|
-
When a
|
|
213
|
+
When a resumed active Plan workflow completes before `/plan` has run in that resumed session, the automatic menu cannot obtain Pi's command-only session replacement capability; choosing fresh asks you to reopen `/plan`, where the same action is available.
|
|
167
214
|
A successful fresh handoff does not delete or consume the source planning session.
|
|
168
215
|
Resume it later to inspect or hand off the ready/saved plan again; this deliberate duplication is the recovery path if the destination work is abandoned.
|
|
169
216
|
In-memory sessions create an unlinked fresh session because no parent file exists.
|
|
170
217
|
Escape, Ctrl+C, menu disposal, source replacement/shutdown, model/auth failure, or cancellation by another extension before replacement leaves the source plan unchanged.
|
|
171
|
-
|
|
172
|
-
If
|
|
173
|
-
|
|
218
|
+
Under **Off — conversation history only**, the destination receives the complete plan in its initial user prompt and does not persist active-plan state.
|
|
219
|
+
If that kickoff fails, the complete request remains in the destination editor and the source remains resumable.
|
|
220
|
+
Under either guaranteed-plan policy, the destination persists active-plan state before kickoff.
|
|
221
|
+
If guaranteed-plan persistence fails, the complete request is placed in the destination editor and the source remains resumable.
|
|
222
|
+
If a guaranteed-plan kickoff fails, the destination retains the active plan; send a message to continue, use `/plan exit` to clear it, or resume the parent planning session.
|
|
174
223
|
|
|
175
224
|
A saved plan appears as `plan saved` and remains available after reload, resume, branch-local fork, and compaction in that session.
|
|
176
225
|
It does not expire automatically, cross into a new session, or participate in ordinary model context.
|
|
177
226
|
Open `/plan` to Show, Implement here, Start fresh and implement, Export, open Settings, or Clear it; `/plan show`, `/plan implement`, `/plan export [path]`, and `/plan exit`/`off` retain their direct routes in TUI and RPC.
|
|
178
227
|
Fresh implementation checks idle state, the selected model, and authentication before session replacement; Implement here keeps its established preflight behavior.
|
|
179
228
|
Starting another workflow with `/plan start`, `/plan <prompt>`, or `/plan tools` is blocked until the saved plan is implemented or cleared, so the single saved slot is never silently overwritten.
|
|
180
|
-
Resuming that session
|
|
229
|
+
Resuming that session keeps the plan saved; open `/plan` to review, implement, export, or clear it.
|
|
181
230
|
Cancellation or failed implementation preflight leaves it unchanged.
|
|
182
231
|
|
|
183
232
|
Text print and JSON modes cannot display the bare `/plan` menu and reject that route before changing state; use `/plan start` for direct no-prompt activation or `/plan <prompt>` to start planning with a prompt.
|
|
@@ -187,20 +236,24 @@ Successful export is observable through the created file; exporting a ready plan
|
|
|
187
236
|
An existing target or missing plan fails the command without changing state.
|
|
188
237
|
These modes reject saved-plan display and implementation before changing state because Pi provides neither printable custom-message output nor acknowledged extension-triggered turns; resume the session in TUI or RPC to show or implement it.
|
|
189
238
|
|
|
190
|
-
Both implementation paths apply the current **
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
**
|
|
239
|
+
Both implementation paths apply the current **Plan reinjection** policy in their destination.
|
|
240
|
+
The default **Off — conversation history only** policy does not create active-plan state or inject a hidden plan context.
|
|
241
|
+
Implement here sends `Implement the plan.` and leaves the accepted plan in ordinary planning history.
|
|
242
|
+
Start fresh and implement, or implementing a saved plan here, puts the complete plan in one ordinary initial user prompt because no reliable planning conversation is present.
|
|
243
|
+
Later model calls then rely on Pi's normal conversation history and compaction behavior.
|
|
244
|
+
**Through first implementation run** guarantees the exact plan throughout that run, including retries, compaction retries, and queued continuation, then clears active-plan state at `agent_settled`.
|
|
245
|
+
**Until manually cleared** guarantees the exact plan across later turns, resume, and manual or automatic compaction until `/plan exit` or supersession.
|
|
246
|
+
The guaranteed policies avoid a duplicate context block while the original implementation handoff remains available and inject one hidden canonical copy after that handoff is compacted away.
|
|
247
|
+
Reinjection can consume up to the existing 50,000-character plan limit in model context.
|
|
196
248
|
Cleanup is bound to the matching implementation, so an older run settling cannot clear a newer handoff.
|
|
197
249
|
|
|
198
|
-
While
|
|
250
|
+
While a guaranteed plan is active, `/plan show` displays the accepted plan.
|
|
199
251
|
Interactive `/plan` offers Show, Export plan…, Settings, Start a new plan, and Clear; `/plan exit` and `/plan off` are the direct clear routes.
|
|
200
|
-
Settings changes never alter the policy already captured by
|
|
201
|
-
Automatic cleanup
|
|
202
|
-
Starting a new Plan-mode workflow or implementing a replacement plan supersedes
|
|
203
|
-
The extension deliberately does not infer completion from assistant prose or agent settlement
|
|
252
|
+
Settings changes never alter the policy already captured by an active guaranteed-plan implementation.
|
|
253
|
+
Automatic first-run cleanup removes the active status and future injected context after the triggering implementation run has received the complete plan.
|
|
254
|
+
Starting a new Plan-mode workflow or implementing a replacement plan supersedes an active guaranteed plan.
|
|
255
|
+
The extension deliberately does not infer completion from assistant prose or agent settlement under **Until manually cleared**, so clear the active plan when it no longer applies.
|
|
256
|
+
Under **Off — conversation history only**, implementation messages remain ordinary conversation history and there is no active plan for `/plan exit` to remove.
|
|
204
257
|
Choosing Stay before implementation keeps the plan ready.
|
|
205
258
|
Revision feedback starts another Plan-mode turn and clears the previous implementable plan until an updated completion arrives.
|
|
206
259
|
For clarification-only follow-ups, the agent answers and resubmits the complete unchanged plan so it remains implementable.
|
|
@@ -212,11 +265,11 @@ With `@narumitw/pi-statusline`, this appears in the extension status area:
|
|
|
212
265
|
- `plan active`: Plan mode is enabled and still gathering context or drafting a plan.
|
|
213
266
|
- `plan ready`: A completed plan is stored until you implement it, export it, save it, continue planning, or exit Plan mode.
|
|
214
267
|
- `plan saved`: One completed plan is stored outside model context in the current session until you implement or clear it.
|
|
215
|
-
- `plan implementing`: The exact accepted plan is
|
|
268
|
+
- `plan implementing`: The exact accepted plan is guaranteed under **Through first implementation run** or **Until manually cleared**.
|
|
216
269
|
|
|
217
270
|
You can also exit directly.
|
|
218
271
|
Before implementation, direct exit discards the latest proposed plan; while a plan is saved, it clears that saved plan.
|
|
219
|
-
During implementation, it removes both the original implementation handoff and the extension's canonical active-plan block from later model calls; an earlier Pi-generated compaction summary may still describe prior work:
|
|
272
|
+
During a guaranteed-plan implementation, it removes both the original implementation handoff and the extension's canonical active-plan block from later model calls; an earlier Pi-generated compaction summary may still describe prior work:
|
|
220
273
|
|
|
221
274
|
```text
|
|
222
275
|
/plan exit
|
|
@@ -232,11 +285,11 @@ Saved plans and ordinary implementation after Plan handoff do not hold the group
|
|
|
232
285
|
Every inactive start performs one final synchronous admission after asynchronous preflight and before changing Plan state, persistence, prompts, tools, thinking level, queues, or status.
|
|
233
286
|
If another participant is active, TUI and RPC show an anonymous warning that another workflow is active.
|
|
234
287
|
Print and JSON direct routes throw the same anonymous error before mutation.
|
|
235
|
-
Launch-menu, selected-tool, shortcut,
|
|
288
|
+
Launch-menu, selected-tool, shortcut, active-implementation **Start a new plan**, and restored activation use the same admission boundary.
|
|
236
289
|
A rejected selected-tool launch does not save its draft choices.
|
|
237
290
|
|
|
238
291
|
Restored active Plan state acquires before restoring restrictive tools, thinking, status, or model hooks.
|
|
239
|
-
If restoration is busy, Plan mode stays non-running, leaves persisted history
|
|
292
|
+
If restoration is busy, Plan mode stays non-running, leaves persisted history and active tools untouched, and requires a later reload or explicit new start after the other workflow ends.
|
|
240
293
|
Planning-session cancellation during a fresh implementation preflight keeps the source Plan and its ownership.
|
|
241
294
|
Successful session replacement relies on source-session shutdown to clean up and release; the destination's ordinary active implementation does not acquire the Plan mutex.
|
|
242
295
|
|
|
@@ -258,7 +311,7 @@ Guaranteed coexistence with Goal requires `@narumitw/pi-goal` `0.53.0` or newer
|
|
|
258
311
|
|
|
259
312
|
## ⚙️ Settings
|
|
260
313
|
|
|
261
|
-
Open **Settings** from an inactive `/plan` menu to edit one flat group of
|
|
314
|
+
Open **Settings** from an inactive `/plan` menu to edit one flat group of six workflow choices: **Plan thinking**, **Plan policy tools**, **Plan reinjection**, **Export destination**, **Plan mode shortcut**, and **Plan tools**.
|
|
262
315
|
You can also edit `$PI_CODING_AGENT_DIR/pi-plan-mode.json` (normally `~/.pi/agent/pi-plan-mode.json`) manually.
|
|
263
316
|
`safeSubcommands` remains JSON-only.
|
|
264
317
|
You can change the Plan-mode shortcut with `toggleShortcut` as long as the file remains JSON-only and uses a valid key string.
|
|
@@ -267,8 +320,9 @@ When omitted, the shortcut is disabled by default.
|
|
|
267
320
|
```json
|
|
268
321
|
{
|
|
269
322
|
"thinkingLevel": "inherit",
|
|
323
|
+
"toolVisibility": "after-first-plan",
|
|
270
324
|
"defaultPlanTools": ["read", "bash", "grep", "find", "ls"],
|
|
271
|
-
"implementationPlanRetention": "
|
|
325
|
+
"implementationPlanRetention": "clear-on-start",
|
|
272
326
|
"defaultPlanExportPath": "PLAN.md",
|
|
273
327
|
"safeSubcommands": {
|
|
274
328
|
"git": ["status", "log", "rev-parse", "blame"],
|
|
@@ -278,37 +332,52 @@ When omitted, the shortcut is disabled by default.
|
|
|
278
332
|
}
|
|
279
333
|
```
|
|
280
334
|
|
|
281
|
-
###
|
|
335
|
+
### Plan helper visibility
|
|
336
|
+
|
|
337
|
+
`toolVisibility` accepts `"after-first-plan"` or `"always"`.
|
|
338
|
+
Omit it—or choose **After first plan**—to keep both Plan helpers out of model requests until the first successful Plan activation in that extension runtime.
|
|
339
|
+
A successful activation keeps the helpers visible for the rest of that runtime; changing the setting back to **After first plan** while inactive resets and hides them at an idle, mutex-admitted boundary.
|
|
340
|
+
Choose **Always** to make the helpers model-visible at session startup and avoid the lazy first-use prefix change.
|
|
341
|
+
Settings-menu changes apply and persist immediately only after idle and Workflow Mutex admission; failure restores the prior runtime and displayed value.
|
|
342
|
+
Manual file changes reload automatically and apply visibility when the session is inactive, idle, and mutex-admitted.
|
|
343
|
+
An unsafe manual reload keeps the current tool envelope until the next session start or successful Plan activation.
|
|
344
|
+
A restored active Plan reveals its helpers only after acquiring workflow ownership, while a busy restore leaves active tools untouched.
|
|
345
|
+
This setting uses ordinary active-tool activation and does not claim Pi native deferred loading.
|
|
282
346
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
347
|
+
### Default Plan policy tools
|
|
348
|
+
|
|
349
|
+
`defaultPlanTools` defines the initial runtime allowlist when a session has no stored pre-start selection.
|
|
350
|
+
Omit it—or choose **Use automatic safe built-ins**—to allow already-active safe built-ins by default.
|
|
351
|
+
An explicit empty array appears as **No optional tools** and denies every ordinary tool while the required helpers remain callable in Plan mode.
|
|
352
|
+
Neither setting changes model-visible tool schemas.
|
|
286
353
|
|
|
287
354
|
Tool names must be non-empty strings; duplicates are removed in first-seen order.
|
|
288
|
-
Unknown,
|
|
289
|
-
Settings retains configured
|
|
290
|
-
|
|
291
|
-
Non-built-in
|
|
292
|
-
Plan mode does not interpret
|
|
355
|
+
Unknown, inactive, and Plan-mode-blocked names are unavailable to the policy and never become active merely by entering Plan mode.
|
|
356
|
+
Settings retains configured inactive names and shows them as unavailable; resetting to automatic removes the entire override.
|
|
357
|
+
An ordinary tool registered or activated after the startup baseline is outside the current workflow policy; start a later session to include it in the selectable baseline.
|
|
358
|
+
Non-built-in names in this global setting are an explicit user-risk opt-in, just like selecting them in the pre-start workflow selector.
|
|
359
|
+
Plan mode does not interpret a selected custom tool's arguments or actions: allowing one trusts the whole effective tool.
|
|
293
360
|
Pi resolves tools by name, so if an extension overrides a built-in name, the effective extension tool is selected instead.
|
|
294
|
-
An effective tool named `bash` remains subject to
|
|
361
|
+
An effective active tool named `bash` or `powershell` remains subject to its limited-shell policy regardless of its source metadata.
|
|
295
362
|
|
|
296
363
|
A selection accepted through **Choose tools, then start…** or `/plan tools` is stored in that Pi session and takes precedence over `defaultPlanTools` when the session resumes.
|
|
297
|
-
The global setting remains the baseline for fresh sessions and sessions without an explicit selection.
|
|
298
|
-
Settings saves immediately, but
|
|
299
|
-
|
|
300
|
-
###
|
|
301
|
-
|
|
302
|
-
`implementationPlanRetention` controls the
|
|
303
|
-
Omit it or use `
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
364
|
+
The global setting remains the policy baseline for fresh sessions and sessions without an explicit selection.
|
|
365
|
+
Settings saves immediately, but saved policy names and thinking apply only when a later Plan workflow starts; they never mutate active schemas or a workflow already in progress.
|
|
366
|
+
|
|
367
|
+
### Plan reinjection
|
|
368
|
+
|
|
369
|
+
The stable JSON field `implementationPlanRetention` controls whether and how long the `context` hook restores the exact approved plan when ordinary model context no longer contains it.
|
|
370
|
+
Omit it or use `clear-on-start` for **Off — conversation history only**, the default Codex-like behavior with no active-plan state or hidden context injection.
|
|
371
|
+
In the planning session, this policy sends `Implement the plan.` and relies on the accepted plan already present in ordinary conversation history.
|
|
372
|
+
A fresh session or saved-plan implementation instead places the complete plan in one ordinary kickoff prompt because its planning history is unavailable or intentionally excluded.
|
|
373
|
+
Use `clear-after-first-run` for **Through first implementation run** to guarantee the exact plan until that implementation's first fully settled run ends.
|
|
374
|
+
Use `keep` for **Until manually cleared** to guarantee and reinject the exact plan until `/plan exit` or supersession.
|
|
375
|
+
A resumed guaranteed-plan cleanup policy re-arms against the first context in the replacement session.
|
|
307
376
|
Failed handoff delivery restores the ready or saved plan and does not run automatic cleanup.
|
|
308
377
|
|
|
309
378
|
Changing this setting applies to the next Implement action only.
|
|
310
|
-
Each
|
|
311
|
-
|
|
379
|
+
Each guaranteed-plan implementation stores its effective policy, so a later Settings save cannot shorten or extend an implementation already in progress.
|
|
380
|
+
Conversation-history-only implementation has no active Plan-mode state to show, export, or clear after kickoff.
|
|
312
381
|
|
|
313
382
|
### Export destination
|
|
314
383
|
|
|
@@ -332,7 +401,7 @@ Avoid values that conflict with editor shortcuts.
|
|
|
332
401
|
|
|
333
402
|
### Safe shell subcommands
|
|
334
403
|
|
|
335
|
-
`safeSubcommands` adds reviewed command validators to limited `bash`; it is not a raw shell allowlist.
|
|
404
|
+
`safeSubcommands` adds reviewed command validators to limited `bash` and `powershell`; it is not a raw shell allowlist.
|
|
336
405
|
Only the following exact values are accepted:
|
|
337
406
|
|
|
338
407
|
- `git`: `status`, `log`, `diff`, `show`, `branch`, `remote`, `ls-files`, `grep`, `rev-parse`, `blame`, `describe`, `merge-base`, `ls-tree`, and `cat-file`.
|
|
@@ -396,7 +465,7 @@ A missing file stays absent until an explicit save.
|
|
|
396
465
|
Invalid JSON, invalid values, oversized content, non-regular files, and read failures make Settings read-only; the existing bytes and previous effective settings remain.
|
|
397
466
|
This in-process queue is not a cross-process lock, so concurrent separate Pi processes can still race.
|
|
398
467
|
|
|
399
|
-
Invalid settings produce a warning and fall back to inherited thinking, available safe-built-in tool defaults, `
|
|
468
|
+
Invalid settings produce a warning and fall back to inherited thinking, `after-first-plan` helper visibility, available safe-built-in tool defaults, `clear-on-start`, and `PLAN.md`.
|
|
400
469
|
Compatibility: a valid legacy `plan-mode.json` remains readable with a warning and is never modified automatically.
|
|
401
470
|
If Settings is explicitly saved while only that legacy file exists, the extension creates canonical `pi-plan-mode.json` from the complete legacy document, applies the selected change, preserves unknown fields, and leaves the legacy file untouched.
|
|
402
471
|
If both files exist, the canonical filename takes precedence.
|
|
@@ -410,8 +479,10 @@ This extension maps Codex's `ModeKind::Plan` behavior onto Pi's extension API:
|
|
|
410
479
|
- The agent should use `plan_mode_question` for important non-discoverable preferences or tradeoffs before finalizing.
|
|
411
480
|
- The agent completes with a standalone `plan_mode_complete` tool call instead of relying on semantic prose detection.
|
|
412
481
|
- `update_plan` checklist use is blocked while Plan mode is active.
|
|
413
|
-
- The implementation boundary is explicit: Plan mode
|
|
414
|
-
-
|
|
482
|
+
- The implementation boundary is explicit: Plan mode appends the Normal contract and lifts its runtime allowlist before saving or starting implementation, while revealed helpers remain active.
|
|
483
|
+
- The default `clear-on-start` policy follows Codex by using ordinary conversation history only; `clear-after-first-run` and `keep` add explicit exact-plan guarantees.
|
|
484
|
+
- Pi extension safety is approximated with tool classification and separate fail-closed filtering for every effective tool named `bash` or `powershell`; other non-built-in tools remain user-selected at user risk because Pi does not expose standardized tool mutability metadata.
|
|
485
|
+
- Plan and Normal instructions are append-only conversation contracts; **Always** keeps tool schemas stable from startup, while **After first plan** intentionally changes the helper schema and prompt-metadata prefix once before keeping it stable.
|
|
415
486
|
- Unlike native Codex, this extension uses a terminating Pi tool plus an `agent_settled` ready flow; Pi cannot provide sandbox-level enforcement.
|
|
416
487
|
|
|
417
488
|
## 🗂️ Package layout
|