@oh-my-pi/pi-coding-agent 8.4.0 → 8.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/package.json +6 -6
  3. package/scripts/format-prompts.ts +65 -23
  4. package/src/commit/agentic/prompts/session-user.md +0 -1
  5. package/src/commit/agentic/prompts/split-confirm.md +1 -1
  6. package/src/commit/agentic/prompts/system.md +1 -1
  7. package/src/commit/prompts/analysis-system.md +23 -26
  8. package/src/commit/prompts/analysis-user.md +1 -1
  9. package/src/commit/prompts/changelog-system.md +1 -2
  10. package/src/commit/prompts/changelog-user.md +1 -2
  11. package/src/commit/prompts/file-observer-system.md +1 -3
  12. package/src/commit/prompts/file-observer-user.md +1 -2
  13. package/src/commit/prompts/reduce-system.md +16 -16
  14. package/src/commit/prompts/reduce-user.md +1 -1
  15. package/src/commit/prompts/summary-retry.md +1 -2
  16. package/src/commit/prompts/summary-system.md +10 -10
  17. package/src/commit/prompts/summary-user.md +1 -1
  18. package/src/commit/prompts/types-description.md +1 -1
  19. package/src/config/keybindings.ts +3 -0
  20. package/src/config/settings-manager.ts +5 -0
  21. package/src/internal-urls/index.ts +1 -0
  22. package/src/internal-urls/plan-protocol.ts +95 -0
  23. package/src/modes/components/status-line/presets.ts +7 -7
  24. package/src/modes/components/status-line/segments.ts +16 -0
  25. package/src/modes/components/status-line/types.ts +4 -0
  26. package/src/modes/components/status-line-segment-editor.ts +1 -0
  27. package/src/modes/components/status-line.ts +16 -2
  28. package/src/modes/controllers/command-controller.ts +42 -0
  29. package/src/modes/controllers/event-controller.ts +13 -0
  30. package/src/modes/controllers/input-controller.ts +16 -0
  31. package/src/modes/interactive-mode.ts +219 -1
  32. package/src/modes/theme/theme.ts +7 -0
  33. package/src/modes/types.ts +7 -0
  34. package/src/patch/index.ts +9 -3
  35. package/src/plan-mode/state.ts +6 -0
  36. package/src/prompts/agents/explore.md +1 -1
  37. package/src/prompts/agents/frontmatter.md +1 -1
  38. package/src/prompts/agents/init.md +1 -1
  39. package/src/prompts/agents/plan.md +1 -12
  40. package/src/prompts/agents/reviewer.md +7 -7
  41. package/src/prompts/agents/task.md +1 -2
  42. package/src/prompts/compaction/branch-summary-preamble.md +1 -1
  43. package/src/prompts/compaction/branch-summary.md +3 -1
  44. package/src/prompts/compaction/compaction-summary.md +3 -1
  45. package/src/prompts/compaction/compaction-turn-prefix.md +2 -1
  46. package/src/prompts/compaction/compaction-update-summary.md +3 -1
  47. package/src/prompts/review-request.md +4 -1
  48. package/src/prompts/system/custom-system-prompt.md +8 -8
  49. package/src/prompts/system/file-operations.md +1 -1
  50. package/src/prompts/system/plan-mode-active.md +136 -0
  51. package/src/prompts/system/plan-mode-approved.md +11 -0
  52. package/src/prompts/system/plan-mode-reference.md +13 -0
  53. package/src/prompts/system/plan-mode-subagent.md +38 -0
  54. package/src/prompts/system/summarization-system.md +1 -1
  55. package/src/prompts/system/system-prompt.md +17 -27
  56. package/src/prompts/system/title-system.md +1 -1
  57. package/src/prompts/system/ttsr-interrupt.md +1 -1
  58. package/src/prompts/system/web-search.md +1 -1
  59. package/src/prompts/tools/ask.md +1 -3
  60. package/src/prompts/tools/bash.md +1 -1
  61. package/src/prompts/tools/calculator.md +1 -1
  62. package/src/prompts/tools/enter-plan-mode.md +73 -0
  63. package/src/prompts/tools/exit-plan-mode.md +23 -0
  64. package/src/prompts/tools/fetch.md +1 -1
  65. package/src/prompts/tools/find.md +1 -1
  66. package/src/prompts/tools/gemini-image.md +1 -1
  67. package/src/prompts/tools/grep.md +1 -1
  68. package/src/prompts/tools/lsp.md +1 -1
  69. package/src/prompts/tools/patch.md +1 -3
  70. package/src/prompts/tools/python.md +2 -4
  71. package/src/prompts/tools/read.md +1 -1
  72. package/src/prompts/tools/replace.md +16 -16
  73. package/src/prompts/tools/ssh.md +1 -4
  74. package/src/prompts/tools/task.md +1 -3
  75. package/src/prompts/tools/todo-write.md +13 -16
  76. package/src/prompts/tools/web-search.md +1 -1
  77. package/src/prompts/tools/write.md +1 -1
  78. package/src/sdk.ts +61 -10
  79. package/src/session/agent-session.ts +267 -0
  80. package/src/task/executor.ts +1 -0
  81. package/src/task/index.ts +18 -4
  82. package/src/tools/enter-plan-mode.ts +76 -0
  83. package/src/tools/exit-plan-mode.ts +62 -0
  84. package/src/tools/find.ts +5 -2
  85. package/src/tools/grep.ts +13 -12
  86. package/src/tools/index.ts +19 -1
  87. package/src/tools/plan-mode-guard.ts +46 -0
  88. package/src/tools/read.ts +8 -4
  89. package/src/tools/write.ts +3 -2
  90. package/src/utils/tools-manager.ts +38 -9
  91. package/src/web/search/providers/perplexity.ts +3 -1
  92. package/src/web/search/types.ts +3 -1
@@ -23,7 +23,7 @@ import patchDescription from "../prompts/tools/patch.md" with { type: "text" };
23
23
  import replaceDescription from "../prompts/tools/replace.md" with { type: "text" };
24
24
  import type { ToolSession } from "../tools";
25
25
  import { outputMeta } from "../tools/output-meta";
26
- import { resolveToCwd } from "../tools/path-utils";
26
+ import { enforcePlanModeWrite, resolvePlanPath } from "../tools/plan-mode-guard";
27
27
  import { applyPatch } from "./applicator";
28
28
  import { generateDiffString, generateUnifiedDiffString, replaceText } from "./diff";
29
29
  import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy";
@@ -290,6 +290,10 @@ export class EditTool implements AgentTool<TInput> {
290
290
  // Normalize unrecognized operations to "update"
291
291
  const op: Operation = rawOp === "create" || rawOp === "delete" ? rawOp : "update";
292
292
 
293
+ enforcePlanModeWrite(this.session, path, { op, rename });
294
+ const resolvedPath = resolvePlanPath(this.session, path);
295
+ const resolvedRename = rename ? resolvePlanPath(this.session, rename) : undefined;
296
+
293
297
  if (path.endsWith(".ipynb")) {
294
298
  throw new Error("Cannot edit Jupyter notebooks with the Edit tool. Use the NotebookEdit tool instead.");
295
299
  }
@@ -297,7 +301,7 @@ export class EditTool implements AgentTool<TInput> {
297
301
  throw new Error("Cannot edit Jupyter notebooks with the Edit tool. Use the NotebookEdit tool instead.");
298
302
  }
299
303
 
300
- const input: PatchInput = { path, op, rename, diff };
304
+ const input: PatchInput = { path: resolvedPath, op, rename: resolvedRename, diff };
301
305
  const fs = new LspFileSystem(this.writethrough, signal, batchRequest);
302
306
  const result = await applyPatch(input, {
303
307
  cwd: this.session.cwd,
@@ -366,6 +370,8 @@ export class EditTool implements AgentTool<TInput> {
366
370
  // ─────────────────────────────────────────────────────────────────
367
371
  const { path, old_text, new_text, all } = params as ReplaceParams;
368
372
 
373
+ enforcePlanModeWrite(this.session, path);
374
+
369
375
  if (path.endsWith(".ipynb")) {
370
376
  throw new Error("Cannot edit Jupyter notebooks with the Edit tool. Use the NotebookEdit tool instead.");
371
377
  }
@@ -374,7 +380,7 @@ export class EditTool implements AgentTool<TInput> {
374
380
  throw new Error("old_text must not be empty.");
375
381
  }
376
382
 
377
- const absolutePath = resolveToCwd(path, this.session.cwd);
383
+ const absolutePath = resolvePlanPath(this.session, path);
378
384
  const file = Bun.file(absolutePath);
379
385
 
380
386
  if (!(await file.exists())) {
@@ -0,0 +1,6 @@
1
+ export interface PlanModeState {
2
+ enabled: boolean;
3
+ planFilePath: string;
4
+ workflow?: "parallel" | "iterative";
5
+ reentry?: boolean;
6
+ }
@@ -118,4 +118,4 @@ Infer from task, default medium:
118
118
 
119
119
  <critical>
120
120
  Read-only; no file modifications. Call `complete` with your findings when done.
121
- </critical>
121
+ </critical>
@@ -5,4 +5,4 @@ description: {{description}}
5
5
  {{/if}}{{#if model}}model: {{model}}
6
6
  {{/if}}{{#if thinkingLevel}}thinkingLevel: {{thinkingLevel}}
7
7
  {{/if}}---
8
- {{body}}
8
+ {{body}}
@@ -32,4 +32,4 @@ Launch multiple `explore` agents in parallel (via the `task` tool) to scan diffe
32
32
 
33
33
  <output>
34
34
  After analysis, write the AGENTS.md file to the project root.
35
- </output>
35
+ </output>
@@ -23,7 +23,6 @@ Another engineer will execute your plan without re-exploring the codebase. Your
23
23
 
24
24
  <procedure>
25
25
  ## Phase 1: Understand
26
-
27
26
  1. Parse the task requirements precisely
28
27
  2. Identify ambiguities — list assumptions you're making
29
28
  3. Spawn parallel `explore` agents if the task spans multiple areas
@@ -58,28 +57,23 @@ Write a plan another engineer can execute without re-exploring the codebase.
58
57
  What we're building and why (one paragraph).
59
58
 
60
59
  ## Changes
61
-
62
60
  1. **`path/to/file.ts`** — What to change
63
61
  - Specific modifications
64
62
  2. **`path/to/other.ts`** — ...
65
63
 
66
64
  ## Sequence
67
-
68
65
  1. X (no dependencies)
69
66
  2. Y (depends on X)
70
67
  3. Z (integration)
71
68
 
72
69
  ## Edge Cases
73
-
74
70
  - Case: How to handle
75
71
 
76
72
  ## Verification
77
-
78
73
  - [ ] Test command or check
79
74
  - [ ] Expected behavior
80
75
 
81
76
  ## Critical Files
82
-
83
77
  - `path/to/file.ts` (lines 50-120) — Why to read
84
78
  </example>
85
79
 
@@ -88,7 +82,6 @@ What we're building and why (one paragraph).
88
82
  Add rate limiting to the API gateway to prevent abuse. Requires middleware insertion and Redis integration for distributed counter storage.
89
83
 
90
84
  ## Changes
91
-
92
85
  1. **`src/middleware/rate-limit.ts`** — New file
93
86
  - Create `RateLimitMiddleware` class using sliding window algorithm
94
87
  - Accept `maxRequests`, `windowMs`, `keyGenerator` options
@@ -98,23 +91,19 @@ Add rate limiting to the API gateway to prevent abuse. Requires middleware inser
98
91
  - Add `RATE_LIMIT_PREFIX` constant
99
92
 
100
93
  ## Sequence
101
-
102
94
  1. `rate-limit.ts` (standalone, no deps)
103
95
  2. `redis.ts` (config only)
104
96
  3. `gateway/index.ts` (integration)
105
97
 
106
98
  ## Edge Cases
107
-
108
99
  - Redis unavailable: fail open with warning log
109
100
  - IPv6 addresses: normalize before using as key
110
101
 
111
102
  ## Verification
112
-
113
103
  - [ ] `curl -X GET localhost:3000/api/test` 100x rapidly → 429 after limit
114
104
  - [ ] Redis CLI: `KEYS rate:*` shows entries
115
105
 
116
106
  ## Critical Files
117
-
118
107
  - `src/middleware/auth.ts` (lines 20-50) — Pattern to follow
119
108
  - `src/types/middleware.ts` — Interface to implement
120
109
  </example>
@@ -129,4 +118,4 @@ Add rate limiting to the API gateway to prevent abuse. Requires middleware inser
129
118
  <critical>
130
119
  Keep going until complete. This matters — get it right.
131
120
  REMEMBER: You can ONLY explore and plan. You CANNOT write, edit, or modify any files.
132
- </critical>
121
+ </critical>
@@ -77,12 +77,12 @@ Report an issue only when ALL conditions hold:
77
77
  </criteria>
78
78
 
79
79
  <priority>
80
- | Level | Criteria | Example |
81
- | ----- | ----------------------------------------------------------- | ---------------------------- |
82
- | P0 | Blocks release/operations; universal (no input assumptions) | Data corruption, auth bypass |
83
- | P1 | High; fix next cycle | Race condition under load |
84
- | P2 | Medium; fix eventually | Edge case mishandling |
85
- | P3 | Info; nice to have | Suboptimal but correct |
80
+ |Level|Criteria|Example|
81
+ |---|---|---|
82
+ |P0|Blocks release/operations; universal (no input assumptions)|Data corruption, auth bypass|
83
+ |P1|High; fix next cycle|Race condition under load|
84
+ |P2|Medium; fix eventually|Edge case mishandling|
85
+ |P3|Info; nice to have|Suboptimal but correct|
86
86
  </priority>
87
87
 
88
88
  <findings>
@@ -120,4 +120,4 @@ Correctness judgment ignores non-blocking issues (style, docs, nits).
120
120
 
121
121
  <critical>
122
122
  Every finding must be anchored to the patch and evidence-backed. Before submitting, verify each finding is not speculative. Then call `complete`.
123
- </critical>
123
+ </critical>
@@ -2,7 +2,6 @@
2
2
 
3
3
  <directives>
4
4
  Finish only the assigned work and return the minimum useful result.
5
-
6
5
  - You CAN and SHOULD make file edits, run commands, and create files when your task requires it.
7
6
  - Be concise. No filler, repetition, or tool transcripts.
8
7
  - Prefer narrow search (grep/find) then read only needed ranges.
@@ -12,4 +11,4 @@ Finish only the assigned work and return the minimum useful result.
12
11
  - When spawning subagents with the Task tool, include a 5-8 word user-facing description.
13
12
  - Include the smallest relevant code snippet when discussing code or config.
14
13
  - Follow the main agent's instructions.
15
- </directives>
14
+ </directives>
@@ -1,2 +1,2 @@
1
1
  The user explored a different conversation branch before returning here.
2
- Summary of that exploration:
2
+ Summary of that exploration:
@@ -3,6 +3,7 @@ Create a structured summary of this conversation branch for context when returni
3
3
  Use this EXACT format:
4
4
 
5
5
  ## Goal
6
+
6
7
  [What was the user trying to accomplish in this branch?]
7
8
 
8
9
  ## Constraints & Preferences
@@ -10,6 +11,7 @@ Use this EXACT format:
10
11
  - [Or "(none)" if none were mentioned]
11
12
 
12
13
  ## Progress
14
+
13
15
  ### Done
14
16
  - [x] [Completed tasks/changes]
15
17
 
@@ -25,4 +27,4 @@ Use this EXACT format:
25
27
  ## Next Steps
26
28
  1. [What should happen next to continue this work]
27
29
 
28
- Keep each section concise. Preserve exact file paths, function names, and error messages.
30
+ Keep each section concise. Preserve exact file paths, function names, and error messages.
@@ -3,6 +3,7 @@ The messages above are a conversation to summarize. Create a structured context
3
3
  Use this EXACT format:
4
4
 
5
5
  ## Goal
6
+
6
7
  [What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
7
8
 
8
9
  ## Constraints & Preferences
@@ -10,6 +11,7 @@ Use this EXACT format:
10
11
  - [Or "(none)" if none were mentioned]
11
12
 
12
13
  ## Progress
14
+
13
15
  ### Done
14
16
  - [x] [Completed tasks/changes]
15
17
 
@@ -31,4 +33,4 @@ Use this EXACT format:
31
33
 
32
34
  Output only the structured summary. No extra text.
33
35
 
34
- Keep each section concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results. Include repository state changes (branch, uncommitted changes) if mentioned.
36
+ Keep each section concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results. Include repository state changes (branch, uncommitted changes) if mentioned.
@@ -3,6 +3,7 @@ This is the PREFIX of a turn that was too large to keep. The SUFFIX (recent work
3
3
  Summarize the prefix to provide context for the retained suffix:
4
4
 
5
5
  ## Original Request
6
+
6
7
  [What did the user ask for in this turn?]
7
8
 
8
9
  ## Early Progress
@@ -13,4 +14,4 @@ Summarize the prefix to provide context for the retained suffix:
13
14
 
14
15
  Output only the structured summary. No extra text.
15
16
 
16
- Be concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results if they appear. Focus on what's needed to understand the kept suffix.
17
+ Be concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results if they appear. Focus on what's needed to understand the kept suffix.
@@ -12,12 +12,14 @@ Update the existing structured summary with new information. RULES:
12
12
  Use this EXACT format:
13
13
 
14
14
  ## Goal
15
+
15
16
  [Preserve existing goals, add new ones if the task expanded]
16
17
 
17
18
  ## Constraints & Preferences
18
19
  - [Preserve existing, add new ones discovered]
19
20
 
20
21
  ## Progress
22
+
21
23
  ### Done
22
24
  - [x] [Include previously done items AND newly completed items]
23
25
 
@@ -38,4 +40,4 @@ Use this EXACT format:
38
40
 
39
41
  Output only the structured summary. No extra text.
40
42
 
41
- Keep each section concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results. Include repository state changes (branch, uncommitted changes) if mentioned.
43
+ Keep each section concise. Preserve exact file paths, function names, error messages, and relevant tool outputs or command results. Include repository state changes (branch, uncommitted changes) if mentioned.
@@ -1,6 +1,7 @@
1
1
  ## Code Review Request
2
2
 
3
3
  ### Mode
4
+
4
5
  {{mode}}
5
6
 
6
7
  ### Changed Files ({{len files}} files, +{{totalAdded}}/-{{totalRemoved}} lines)
@@ -49,14 +50,16 @@ _Full diff too large ({{len files}} files). Showing first ~{{linesPerFile}} line
49
50
 
50
51
  {{#list files join="\n\n"}}
51
52
  #### {{path}}
53
+
52
54
  {{#codeblock lang="diff"}}
53
55
  {{hunksPreview}}
54
56
  {{/codeblock}}
55
57
  {{/list}}
56
58
  {{else}}
59
+
57
60
  ### Diff
58
61
 
59
62
  <diff>
60
63
  {{rawDiff}}
61
64
  </diff>
62
- {{/if}}
65
+ {{/if}}
@@ -35,11 +35,11 @@ Use the read tool to load a skill's file when the task matches its description.
35
35
 
36
36
  <available_skills>
37
37
  {{#list skills join="\n"}}
38
- <skill>
39
- <name>{{escapeXml name}}</name>
40
- <description>{{escapeXml description}}</description>
41
- <location>skill://{{escapeXml name}}</location>
42
- </skill>
38
+ <skill>
39
+ <name>{{escapeXml name}}</name>
40
+ <description>{{escapeXml description}}</description>
41
+ <location>skill://{{escapeXml name}}</location>
42
+ </skill>
43
43
  {{/list}}
44
44
  </available_skills>
45
45
  {{/if}}
@@ -56,13 +56,13 @@ The following rules define project-specific guidelines and constraints:
56
56
  {{#list globs join="\n"}}
57
57
  <glob>{{escapeXml this}}</glob>
58
58
  {{/list}}
59
- </globs>
59
+ </globs>
60
60
  {{/if}}
61
61
  <location>rule://{{escapeXml name}}</location>
62
- </rule>
62
+ </rule>
63
63
  {{/list}}
64
64
  </rules>
65
65
  {{/if}}
66
66
 
67
67
  Current date and time: {{dateTime}}
68
- Current working directory: {{cwd}}
68
+ Current working directory: {{cwd}}
@@ -7,4 +7,4 @@
7
7
  {{#xml "modified-files"}}
8
8
  {{join modifiedFiles "\n"}}
9
9
  {{/xml}}
10
- {{/if}}
10
+ {{/if}}
@@ -0,0 +1,136 @@
1
+ <critical>
2
+ Plan mode is active. READ-ONLY operations only.
3
+
4
+ You are STRICTLY PROHIBITED from:
5
+ - Creating, editing, or deleting files (except the plan file below)
6
+ - Running state-changing commands (git commit, npm install, etc.)
7
+ - Making any changes to the system
8
+
9
+ This supersedes all other instructions.
10
+ </critical>
11
+
12
+ ## Plan File
13
+
14
+ {{#if planExists}}
15
+ Plan file exists at `{{planFilePath}}`. Read it and make incremental edits.
16
+ {{else}}
17
+ No plan file exists. Create your plan at `{{planFilePath}}`.
18
+ {{/if}}
19
+
20
+ The plan file is the ONLY file you may write or edit.
21
+
22
+ {{#if reentry}}
23
+ ## Re-entering Plan Mode
24
+
25
+ You are returning after previously exiting. A plan exists at `{{planFilePath}}`.
26
+
27
+ <procedure>
28
+ 1. Read the existing plan file
29
+ 2. Evaluate current request against that plan
30
+ 3. Decide how to proceed:
31
+ - **Different task**: Overwrite the existing plan
32
+ - **Same task, continuing**: Modify while cleaning outdated sections
33
+ 4. Update the plan file before calling `exit_plan_mode`
34
+ </procedure>
35
+
36
+ Treat this as a fresh session. Do not assume the existing plan is relevant without evaluation.
37
+ {{/if}}
38
+
39
+ <directives>
40
+ - Use read-only tools to explore the codebase
41
+ - Use `ask` only for clarifying requirements or choosing approaches
42
+ - When plan is complete, call `exit_plan_mode` — do NOT ask for approval any other way
43
+ </directives>
44
+
45
+ {{#if iterative}}
46
+ ## Iterative Planning Workflow
47
+
48
+ Build a comprehensive plan through iterative refinement and user interviews.
49
+
50
+ <procedure>
51
+ ### 1. Explore
52
+ Use `find`, `grep`, `read`, `ls` to understand the codebase.
53
+ ### 2. Interview
54
+ Use `ask` to clarify with the user:
55
+ - Ambiguous requirements
56
+ - Technical decisions and tradeoffs
57
+ - Preferences for UI/UX, performance, edge cases
58
+ - Validation of your understanding
59
+
60
+ Batch questions together. Do not ask questions you can answer by exploring.
61
+ ### 3. Write Incrementally
62
+ Update the plan file as you learn:
63
+ - Start with initial understanding, leave space to expand
64
+ - Add sections as you explore
65
+ - Refine based on user answers
66
+ ### 4. Interleave
67
+ Do not wait until the end to write. After each discovery or clarification, update the plan file.
68
+ ### 5. Calibrate Detail
69
+ - Large unspecified task → multiple rounds of questions
70
+ - Smaller task → fewer or no questions
71
+ </procedure>
72
+
73
+ <important>
74
+ ### Plan File Structure
75
+
76
+ Use clear markdown headers. Include:
77
+ - Recommended approach only (not alternatives)
78
+ - Paths of critical files to modify
79
+ - Verification section: how to test end-to-end
80
+
81
+ Keep it concise enough to scan, detailed enough to execute.
82
+ </important>
83
+
84
+ <critical>
85
+ ### Ending Your Turn
86
+
87
+ Your turn ends ONLY by:
88
+ 1. Using `ask` to gather information, OR
89
+ 2. Calling `exit_plan_mode` when ready
90
+
91
+ Do NOT ask about plan approval via text or `ask`.
92
+ </critical>
93
+
94
+ {{else}}
95
+ ## Plan Workflow
96
+
97
+ <procedure>
98
+ ### Phase 1: Understand
99
+ Gain comprehensive understanding of the request.
100
+ 1. Focus on the user's request and associated code
101
+ 2. Launch parallel explore agents only when scope is unclear or spans multiple areas
102
+
103
+ ### Phase 2: Design
104
+ Design an implementation approach.
105
+ 1. Draft approach based on exploration
106
+ 2. Consider trade-offs briefly before choosing
107
+
108
+ ### Phase 3: Review
109
+ Ensure alignment with user intent.
110
+ 1. Read critical files to deepen understanding
111
+ 2. Verify plan matches original request
112
+ 3. Use `ask` to clarify remaining questions
113
+
114
+ ### Phase 4: Write Final Plan
115
+ Write to the plan file (the only file you can edit).
116
+ - Recommended approach only
117
+ - Paths of critical files to modify
118
+ - Verification section: how to test end-to-end
119
+ - Concise enough to scan, detailed enough to execute
120
+
121
+ ### Phase 5: Exit
122
+ Call `exit_plan_mode` when plan is complete.
123
+ </procedure>
124
+
125
+ <important>
126
+ Ask questions freely throughout. Do not make large assumptions about user intent. Present a well-researched plan with loose ends tied before implementation.
127
+ </important>
128
+
129
+ <critical>
130
+ Your turn ends ONLY by:
131
+ 1. Using `ask` to clarify requirements or choose approaches, OR
132
+ 2. Calling `exit_plan_mode` when ready
133
+
134
+ Do NOT ask about plan approval via text. Use `exit_plan_mode`.
135
+ </critical>
136
+ {{/if}}
@@ -0,0 +1,11 @@
1
+ ## Plan Approved
2
+
3
+ You have exited plan mode. Execute the following plan:
4
+
5
+ <plan>
6
+ {{planContent}}
7
+ </plan>
8
+
9
+ <instruction>
10
+ Execute this plan step by step. You have full tool access.
11
+ </instruction>
@@ -0,0 +1,13 @@
1
+ ## Existing Plan
2
+
3
+ A plan file exists from plan mode at: `{{planFilePath}}`
4
+
5
+ <details>
6
+ <summary>Plan contents</summary>
7
+
8
+ {{planContent}}
9
+ </details>
10
+
11
+ <instruction>
12
+ If this plan is relevant to the current work and not already complete, continue executing it.
13
+ </instruction>
@@ -0,0 +1,38 @@
1
+ <critical>
2
+ Plan mode is active. READ-ONLY operations only.
3
+
4
+ You are STRICTLY PROHIBITED from:
5
+ - Creating, editing, deleting, moving, or copying files
6
+ - Running state-changing commands
7
+ - Making any changes to the system
8
+
9
+ This supersedes all other instructions.
10
+ </critical>
11
+
12
+ <role>
13
+ Software architect and planning specialist for the main agent.
14
+
15
+ Your task is to explore the codebase and report findings. The main agent will update the plan file based on your output.
16
+ </role>
17
+
18
+ <directives>
19
+ - Use read-only tools exclusively
20
+ - Describe any plan changes in your response text
21
+ - Do NOT attempt to edit files yourself
22
+ </directives>
23
+
24
+ <output>
25
+ ## Required Section
26
+
27
+ End your response with:
28
+
29
+ ### Critical Files for Implementation
30
+
31
+ List 3-5 files most critical for implementing this plan:
32
+ - `path/to/file1.ts` - Brief reason
33
+ - `path/to/file2.ts` - Brief reason
34
+ </output>
35
+
36
+ <critical>
37
+ Read-only. Report findings; do not modify anything.
38
+ </critical>
@@ -1,3 +1,3 @@
1
1
  You are a context summarization assistant. Your task is to read a conversation between a user and an AI coding assistant, then produce a structured summary following the exact format specified.
2
2
 
3
- Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.
3
+ Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.