@oh-my-pi/pi-coding-agent 12.19.3 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/package.json +7 -7
- package/src/commit/prompts/analysis-system.md +3 -3
- package/src/commit/prompts/analysis-user.md +14 -14
- package/src/commit/prompts/changelog-system.md +4 -4
- package/src/commit/prompts/changelog-user.md +4 -4
- package/src/commit/prompts/file-observer-system.md +2 -2
- package/src/commit/prompts/file-observer-user.md +2 -2
- package/src/commit/prompts/reduce-system.md +4 -4
- package/src/commit/prompts/reduce-user.md +6 -6
- package/src/commit/prompts/summary-system.md +4 -4
- package/src/commit/prompts/summary-user.md +6 -6
- package/src/discovery/helpers.ts +13 -1
- package/src/internal-urls/docs-index.generated.ts +2 -2
- package/src/internal-urls/index.ts +8 -3
- package/src/internal-urls/local-protocol.ts +223 -0
- package/src/internal-urls/{docs-protocol.ts → pi-protocol.ts} +12 -12
- package/src/internal-urls/router.ts +1 -1
- package/src/internal-urls/types.ts +1 -1
- package/src/ipy/executor.ts +4 -32
- package/src/memories/index.ts +1 -1
- package/src/modes/controllers/event-controller.ts +4 -4
- package/src/modes/interactive-mode.ts +84 -64
- package/src/modes/types.ts +11 -3
- package/src/modes/utils/ui-helpers.ts +5 -3
- package/src/patch/hashline.ts +42 -42
- package/src/patch/index.ts +106 -153
- package/src/patch/shared.ts +21 -51
- package/src/plan-mode/approved-plan.ts +55 -0
- package/src/prompts/agents/designer.md +6 -6
- package/src/prompts/agents/explore.md +4 -4
- package/src/prompts/agents/frontmatter.md +1 -0
- package/src/prompts/agents/init.md +10 -10
- package/src/prompts/agents/plan.md +6 -6
- package/src/prompts/agents/reviewer.md +4 -3
- package/src/prompts/agents/task.md +10 -10
- package/src/prompts/compaction/branch-summary.md +3 -3
- package/src/prompts/compaction/compaction-short-summary.md +7 -7
- package/src/prompts/compaction/compaction-summary-context.md +1 -1
- package/src/prompts/compaction/compaction-summary.md +5 -5
- package/src/prompts/compaction/compaction-turn-prefix.md +3 -3
- package/src/prompts/compaction/compaction-update-summary.md +11 -11
- package/src/prompts/memories/consolidation.md +5 -5
- package/src/prompts/memories/read-path.md +11 -0
- package/src/prompts/memories/stage_one_input.md +1 -1
- package/src/prompts/memories/stage_one_system.md +5 -5
- package/src/prompts/review-request.md +4 -4
- package/src/prompts/system/agent-creation-architect.md +21 -21
- package/src/prompts/system/agent-creation-user.md +2 -2
- package/src/prompts/system/custom-system-prompt.md +6 -6
- package/src/prompts/system/plan-mode-active.md +20 -20
- package/src/prompts/system/plan-mode-approved.md +9 -7
- package/src/prompts/system/plan-mode-reference.md +2 -2
- package/src/prompts/system/plan-mode-subagent.md +8 -8
- package/src/prompts/system/subagent-submit-reminder.md +5 -5
- package/src/prompts/system/subagent-system-prompt.md +9 -9
- package/src/prompts/system/subagent-user-prompt.md +3 -5
- package/src/prompts/system/summarization-system.md +1 -1
- package/src/prompts/system/system-prompt.md +109 -84
- package/src/prompts/system/title-system.md +2 -2
- package/src/prompts/system/ttsr-interrupt.md +2 -2
- package/src/prompts/system/web-search.md +16 -16
- package/src/prompts/tools/ask.md +6 -6
- package/src/prompts/tools/bash.md +9 -9
- package/src/prompts/tools/browser.md +5 -5
- package/src/prompts/tools/cancel-job.md +2 -2
- package/src/prompts/tools/exit-plan-mode.md +13 -10
- package/src/prompts/tools/find.md +2 -2
- package/src/prompts/tools/gemini-image.md +7 -7
- package/src/prompts/tools/grep.md +4 -3
- package/src/prompts/tools/hashline.md +55 -56
- package/src/prompts/tools/patch.md +6 -6
- package/src/prompts/tools/poll-jobs.md +1 -1
- package/src/prompts/tools/python.md +10 -12
- package/src/prompts/tools/read.md +2 -12
- package/src/prompts/tools/replace.md +7 -7
- package/src/prompts/tools/ssh.md +2 -7
- package/src/prompts/tools/task.md +48 -38
- package/src/prompts/tools/todo-write.md +65 -49
- package/src/prompts/tools/web-search.md +2 -2
- package/src/prompts/tools/write.md +4 -3
- package/src/sdk.ts +11 -9
- package/src/session/agent-session.ts +92 -51
- package/src/session/artifacts.ts +1 -1
- package/src/session/messages.ts +1 -0
- package/src/task/agents.ts +1 -0
- package/src/task/index.ts +2 -1
- package/src/task/render.ts +2 -2
- package/src/task/types.ts +1 -0
- package/src/tools/bash-interactive.ts +1 -1
- package/src/tools/bash-skill-urls.ts +3 -2
- package/src/tools/bash.ts +21 -12
- package/src/tools/exit-plan-mode.ts +30 -2
- package/src/tools/grep.ts +131 -75
- package/src/tools/index.ts +13 -3
- package/src/tools/path-utils.ts +2 -1
- package/src/tools/plan-mode-guard.ts +8 -8
- package/src/tools/python.ts +0 -2
- package/src/tools/read.ts +2 -2
- package/src/tools/todo-write.ts +276 -146
- package/src/internal-urls/plan-protocol.ts +0 -95
- package/src/modes/components/todo-display.ts +0 -114
- package/src/prompts/memories/read_path.md +0 -11
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
Signals plan completion, requests user approval
|
|
1
|
+
Signals plan completion, requests user approval, and provides the final plan title for handoff.
|
|
2
2
|
|
|
3
3
|
<conditions>
|
|
4
4
|
Use when:
|
|
5
|
-
- Plan written to
|
|
5
|
+
- Plan written to `local://PLAN.md`
|
|
6
6
|
- No unresolved questions about requirements or approach
|
|
7
7
|
- Ready for user review and approval
|
|
8
8
|
</conditions>
|
|
9
9
|
|
|
10
10
|
<instruction>
|
|
11
|
-
-
|
|
11
|
+
- You MUST write plan to plan file BEFORE calling this tool
|
|
12
12
|
- Tool reads plan from file—does not take plan content as parameter
|
|
13
|
+
- You MUST provide a `title` argument for the final plan artifact (example: `WP_MIGRATION_PLAN`)
|
|
14
|
+
- `.md` is optional in `title`; it is appended automatically when omitted
|
|
13
15
|
- User sees plan contents when reviewing
|
|
14
16
|
</instruction>
|
|
15
17
|
|
|
16
18
|
<output>
|
|
17
|
-
Presents plan to user for approval. If approved,
|
|
19
|
+
Presents plan to user for approval. If approved, plan mode exits with full tool access restored and the plan is renamed to `local://<title>.md`.
|
|
18
20
|
</output>
|
|
19
21
|
|
|
20
22
|
<example name="ready">
|
|
21
|
-
Plan complete at
|
|
22
|
-
→ Call `exit_plan_mode`
|
|
23
|
+
Plan complete at local://PLAN.md, no open questions.
|
|
24
|
+
→ Call `exit_plan_mode` with `{ "title": "WP_MIGRATION_PLAN" }`
|
|
23
25
|
</example>
|
|
24
26
|
|
|
25
27
|
<example name="unclear">
|
|
@@ -28,11 +30,12 @@ Unsure about auth method (OAuth vs JWT).
|
|
|
28
30
|
</example>
|
|
29
31
|
|
|
30
32
|
<avoid>
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
33
|
+
- MUST NOT call before plan is written to file
|
|
34
|
+
- MUST NOT omit `title`
|
|
35
|
+
- MUST NOT use `ask` to request plan approval (this tool does that)
|
|
36
|
+
- MUST NOT call after pure research tasks (no implementation planned)
|
|
34
37
|
</avoid>
|
|
35
38
|
|
|
36
39
|
<critical>
|
|
37
|
-
|
|
40
|
+
You MUST only use when planning implementation steps. Research tasks (searching, reading, understanding) do not need this tool.
|
|
38
41
|
</critical>
|
|
@@ -6,7 +6,7 @@ Fast file pattern matching that works with any codebase size.
|
|
|
6
6
|
- Pattern includes the search path: `src/**/*.ts`, `lib/*.json`, `**/*.md`
|
|
7
7
|
- Simple patterns like `*.ts` automatically search recursively from cwd
|
|
8
8
|
- Includes hidden files by default (use `hidden: false` to exclude)
|
|
9
|
-
-
|
|
9
|
+
- You SHOULD perform multiple searches in parallel when potentially useful
|
|
10
10
|
</instruction>
|
|
11
11
|
|
|
12
12
|
<output>
|
|
@@ -14,5 +14,5 @@ Matching file paths sorted by modification time (most recent first). Results tru
|
|
|
14
14
|
</output>
|
|
15
15
|
|
|
16
16
|
<avoid>
|
|
17
|
-
|
|
17
|
+
For open-ended searches requiring multiple rounds of globbing and grepping, you MUST use Task tool instead.
|
|
18
18
|
</avoid>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Generate or edit images using Gemini image models.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
|
|
6
|
+
You SHOULD provide structured parameters for best results. Tool assembles into optimized prompt.
|
|
7
7
|
|
|
8
|
-
When using multiple `input_images`, describe each image's role in `subject` or `scene` field:
|
|
8
|
+
When using multiple `input_images`, you MUST describe each image's role in `subject` or `scene` field:
|
|
9
9
|
- "Use Image 1 for the character's face and outfit, Image 2 for the pose, Image 3 for the background environment"
|
|
10
10
|
- "Match the color palette from Image 1, apply the lighting style from Image 2"
|
|
11
11
|
</instruction>
|
|
@@ -15,9 +15,9 @@ Returns generated image saved to disk. Response includes file path where image w
|
|
|
15
15
|
</output>
|
|
16
16
|
|
|
17
17
|
<caution>
|
|
18
|
-
- For photoreal: add "ultra-detailed, realistic, natural skin texture" to style
|
|
19
|
-
- For posters/cards: use 9:16 aspect ratio with negative space for text placement
|
|
20
|
-
- For iteration: use `changes` for targeted adjustments rather than regenerating from scratch
|
|
21
|
-
- For text: add "sharp, legible, correctly spelled" for important text; keep text short
|
|
22
|
-
- For diagrams: include "scientifically accurate" in style and provide facts explicitly
|
|
18
|
+
- For photoreal: you SHOULD add "ultra-detailed, realistic, natural skin texture" to style
|
|
19
|
+
- For posters/cards: you SHOULD use 9:16 aspect ratio with negative space for text placement
|
|
20
|
+
- For iteration: you SHOULD use `changes` for targeted adjustments rather than regenerating from scratch
|
|
21
|
+
- For text: you SHOULD add "sharp, legible, correctly spelled" for important text; keep text short
|
|
22
|
+
- For diagrams: you SHOULD include "scientifically accurate" in style and provide facts explicitly
|
|
23
23
|
</caution>
|
|
@@ -12,6 +12,7 @@ Powerful search tool built on ripgrep.
|
|
|
12
12
|
|
|
13
13
|
<output>
|
|
14
14
|
- Results are always content mode.
|
|
15
|
+
- Results grouped by directory (`# dir`) and file (`## └─ file`) headings
|
|
15
16
|
{{#if IS_HASHLINE_MODE}}
|
|
16
17
|
- Text output is CID prefixed: `LINE#ID:content`
|
|
17
18
|
{{else}}
|
|
@@ -22,7 +23,7 @@ Powerful search tool built on ripgrep.
|
|
|
22
23
|
</output>
|
|
23
24
|
|
|
24
25
|
<critical>
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- If the search is open-ended, requiring multiple rounds, use Task tool with explore subagent instead
|
|
26
|
+
- You MUST use Grep when searching for content.
|
|
27
|
+
- You MUST NOT invoke `grep` or `rg` via Bash.
|
|
28
|
+
- If the search is open-ended, requiring multiple rounds, you MUST use Task tool with explore subagent instead.
|
|
28
29
|
</critical>
|
|
@@ -3,25 +3,24 @@
|
|
|
3
3
|
Apply precise file edits using `LINE#ID` tags, anchoring to the file content.
|
|
4
4
|
|
|
5
5
|
<workflow>
|
|
6
|
-
1. `read` the target range to capture current `LINE#ID` tags.
|
|
7
|
-
2.
|
|
8
|
-
3.
|
|
9
|
-
4.
|
|
10
|
-
5. If another edit is needed in that file, re-read first (hashes changed).
|
|
11
|
-
6.
|
|
6
|
+
1. You MUST `read` the target range to capture current `LINE#ID` tags.
|
|
7
|
+
2. You MUST pick the smallest operation per change site (line/range/insert/content-replace).
|
|
8
|
+
3. You MUST direction-lock every edit: exact current text → intended text.
|
|
9
|
+
4. You MUST submit one `edit` call per file containing all operations.
|
|
10
|
+
5. If another edit is needed in that file, you MUST re-read first (hashes changed).
|
|
11
|
+
6. You MUST output tool calls only; no prose.
|
|
12
12
|
</workflow>
|
|
13
13
|
|
|
14
14
|
<operations>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `
|
|
18
|
-
-
|
|
19
|
-
- `{ op: "replace", first: "N#ID", last: "N#ID", content: […] }`
|
|
15
|
+
Every edit has `op`, `first` (start anchor), `last` (end anchor), and `content`. All anchors use `"LINE#ID"` format.
|
|
16
|
+
- **Line or range replace/delete**
|
|
17
|
+
- `{ op: "replace", first: "N#ID", content: […] }` (single line)
|
|
18
|
+
- `{ op: "replace", first: "N#ID", last: "N#ID", content: […] }` (range)
|
|
20
19
|
- Use for swaps, block rewrites, or deleting a full span (`content: null`).
|
|
21
20
|
- **Insert** (new content)
|
|
22
|
-
- `{ op: "prepend",
|
|
23
|
-
- `{ op: "append",
|
|
24
|
-
- `{ op: "insert",
|
|
21
|
+
- `{ op: "prepend", last: "N#ID", content: […] }` or `{ op: "prepend", content: […] }` (no anchor = insert at beginning of file)
|
|
22
|
+
- `{ op: "append", first: "N#ID", content: […] }` or `{ op: "append", content: […] }` (no anchor = insert at end of file)
|
|
23
|
+
- `{ op: "insert", first: "N#ID", last: "N#ID", content: […] }` (between adjacent anchors; safest for blocks)
|
|
25
24
|
- **File-level controls**
|
|
26
25
|
- `{ delete: true, edits: [] }` deletes the file (cannot be combined with `rename`).
|
|
27
26
|
- `{ rename: "new/path.ts", edits: […] }` writes result to new path and removes old path.
|
|
@@ -29,33 +28,33 @@ Apply precise file edits using `LINE#ID` tags, anchoring to the file content.
|
|
|
29
28
|
</operations>
|
|
30
29
|
|
|
31
30
|
<rules>
|
|
32
|
-
1. **Minimize scope:** one logical mutation site per operation.
|
|
33
|
-
2. **Preserve formatting:** keep indentation, punctuation, line breaks, trailing commas, brace style.
|
|
34
|
-
3. **Prefer insertion over neighbor rewrites:** anchor on structural boundaries (`}`, `]`, `},`) not interior property lines.
|
|
35
|
-
4. **No no-ops:** replacement content
|
|
36
|
-
5. **Touch only requested code:**
|
|
37
|
-
6. **Use exact current tokens:**
|
|
38
|
-
7. **For swaps/moves:** prefer one range operation over multiple single-line operations.
|
|
31
|
+
1. **Minimize scope:** You MUST use one logical mutation site per operation.
|
|
32
|
+
2. **Preserve formatting:** You MUST keep indentation, punctuation, line breaks, trailing commas, brace style.
|
|
33
|
+
3. **Prefer insertion over neighbor rewrites:** You SHOULD anchor on structural boundaries (`}`, `]`, `},`) not interior property lines.
|
|
34
|
+
4. **No no-ops:** replacement content MUST differ from current content.
|
|
35
|
+
5. **Touch only requested code:** You MUST NOT make incidental edits.
|
|
36
|
+
6. **Use exact current tokens:** You MUST NOT rewrite approximately; mutate the token that exists now.
|
|
37
|
+
7. **For swaps/moves:** You SHOULD prefer one range operation over multiple single-line operations.
|
|
39
38
|
</rules>
|
|
40
39
|
|
|
41
|
-
<
|
|
42
|
-
- One wrong line → `set`
|
|
43
|
-
- Adjacent block changed → `insert`
|
|
44
|
-
- Missing line/block →
|
|
45
|
-
</
|
|
40
|
+
<op-choice>
|
|
41
|
+
- One wrong line → MUST use `set`
|
|
42
|
+
- Adjacent block changed → MUST use `insert`
|
|
43
|
+
- Missing line/block → MUST use `append`/`prepend`
|
|
44
|
+
</op-choice>
|
|
46
45
|
|
|
47
|
-
<
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- For inserts, prefer `insert`
|
|
51
|
-
-
|
|
52
|
-
</
|
|
46
|
+
<tag-choice>
|
|
47
|
+
- You MUST copy tags exactly from the prefix of the `read` or error output.
|
|
48
|
+
- You MUST NOT guess tags.
|
|
49
|
+
- For inserts, you SHOULD prefer `insert` > `append`/`prepend` when both boundaries are known.
|
|
50
|
+
- You MUST re-read after each successful edit call before issuing another on same file.
|
|
51
|
+
</tag-choice>
|
|
53
52
|
|
|
54
53
|
<recovery>
|
|
55
54
|
**Tag mismatch (`>>>`)**
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- If mismatch repeats, stop and re-read the exact block.
|
|
55
|
+
- You MUST retry with the updated tags shown in error output.
|
|
56
|
+
- You MUST re-read only if required tags are missing from error snippet.
|
|
57
|
+
- If mismatch repeats, you MUST stop and re-read the exact block.
|
|
59
58
|
</recovery>
|
|
60
59
|
|
|
61
60
|
<example name="fix a value or type">
|
|
@@ -63,8 +62,8 @@ Apply precise file edits using `LINE#ID` tags, anchoring to the file content.
|
|
|
63
62
|
{{hlinefull 23 " const timeout: number = 5000;"}}
|
|
64
63
|
```
|
|
65
64
|
```
|
|
66
|
-
op: "
|
|
67
|
-
|
|
65
|
+
op: "replace"
|
|
66
|
+
first: "{{hlineref 23 " const timeout: number = 5000;"}}"
|
|
68
67
|
content: [" const timeout: number = 30_000;"]
|
|
69
68
|
```
|
|
70
69
|
</example>
|
|
@@ -75,8 +74,8 @@ content: [" const timeout: number = 30_000;"]
|
|
|
75
74
|
{{hlinefull 8 "const data = fetchSync(url);"}}
|
|
76
75
|
```
|
|
77
76
|
```
|
|
78
|
-
op: "
|
|
79
|
-
|
|
77
|
+
op: "replace"
|
|
78
|
+
first: "{{hlineref 7 "// @ts-ignore"}}"
|
|
80
79
|
content: null
|
|
81
80
|
```
|
|
82
81
|
</example>
|
|
@@ -86,8 +85,8 @@ content: null
|
|
|
86
85
|
{{hlinefull 14 " placeholder: \"DO NOT SHIP\","}}
|
|
87
86
|
```
|
|
88
87
|
```
|
|
89
|
-
op: "
|
|
90
|
-
|
|
88
|
+
op: "replace"
|
|
89
|
+
first: "{{hlineref 14 " placeholder: \"DO NOT SHIP\","}}"
|
|
91
90
|
content: [""]
|
|
92
91
|
```
|
|
93
92
|
</example>
|
|
@@ -129,10 +128,10 @@ content: null
|
|
|
129
128
|
```
|
|
130
129
|
```
|
|
131
130
|
op: "prepend"
|
|
132
|
-
|
|
131
|
+
last: "{{hlineref 1 "import * as fs from \"node:fs/promises\";"}}"
|
|
133
132
|
content: ["import * as os from \"node:os\";"]
|
|
134
133
|
```
|
|
135
|
-
Use `
|
|
134
|
+
Use `last` for anchored insertion before a specific line. Omit anchor to prepend at BOF.
|
|
136
135
|
</example>
|
|
137
136
|
|
|
138
137
|
<example name="append at end of file">
|
|
@@ -141,10 +140,10 @@ Use `before` for anchored insertion before a specific line. Omit `before` to pre
|
|
|
141
140
|
```
|
|
142
141
|
```
|
|
143
142
|
op: "append"
|
|
144
|
-
|
|
143
|
+
first: "{{hlineref 260 "export { serialize, deserialize };"}}"
|
|
145
144
|
content: ["export { validate };"]
|
|
146
145
|
```
|
|
147
|
-
Use `
|
|
146
|
+
Use `first` for anchored insertion after a specific line. Omit anchor to append at EOF.
|
|
148
147
|
</example>
|
|
149
148
|
|
|
150
149
|
<example name="add an entry between known siblings">
|
|
@@ -154,8 +153,8 @@ Use `after` for anchored insertion after a specific line. Omit `after` to append
|
|
|
154
153
|
```
|
|
155
154
|
```
|
|
156
155
|
op: "insert"
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
first: "{{hlineref 44 " \"build\": \"bun run compile\","}}"
|
|
157
|
+
last: "{{hlineref 45 " \"test\": \"bun test\""}}"
|
|
159
158
|
content: [" \"lint\": \"biome check\","]
|
|
160
159
|
```
|
|
161
160
|
Dual anchors pin the insert to exactly one gap, preventing drift from edits elsewhere in the file. **Always prefer dual anchors when both boundaries are content lines.**
|
|
@@ -170,10 +169,10 @@ Dual anchors pin the insert to exactly one gap, preventing drift from edits else
|
|
|
170
169
|
```
|
|
171
170
|
```
|
|
172
171
|
op: "insert"
|
|
173
|
-
|
|
172
|
+
last: "{{hlineref 103 "export function serialize(data: unknown): string {"}}"
|
|
174
173
|
content: ["function validate(data: unknown): boolean {", " return data != null && typeof data === \"object\";", "}", ""]
|
|
175
174
|
```
|
|
176
|
-
The trailing `""` in `content` preserves the blank-line separator. **Anchor to the structural line (`export function
|
|
175
|
+
The trailing `""` in `content` preserves the blank-line separator. **Anchor to the structural line (`export function …`), not the blank line above it** — blank lines are ambiguous and may be added or removed by other edits.
|
|
177
176
|
</example>
|
|
178
177
|
|
|
179
178
|
<example name="file delete">
|
|
@@ -194,23 +193,23 @@ edits: […]
|
|
|
194
193
|
<example name="anti-pattern: anchoring to whitespace">
|
|
195
194
|
Bad — tags to a blank line; fragile if blank lines shift:
|
|
196
195
|
```
|
|
197
|
-
|
|
196
|
+
first: "{{hlineref 102 ""}}"
|
|
198
197
|
content: ["function validate() {", …, "}"]
|
|
199
198
|
```
|
|
200
199
|
|
|
201
200
|
Good — anchors to the structural target:
|
|
202
201
|
|
|
203
202
|
```
|
|
204
|
-
|
|
203
|
+
last: "{{hlineref 103 "export function serialize(data: unknown): string {"}}"
|
|
205
204
|
content: ["function validate() {", …, "}"]
|
|
206
205
|
```
|
|
207
206
|
</example>
|
|
208
207
|
|
|
209
208
|
<critical>
|
|
210
|
-
|
|
209
|
+
You MUST ensure:
|
|
211
210
|
- Payload shape is `{ "path": string, "edits": [operation, …], "delete"?: boolean, "rename"?: string }`
|
|
212
|
-
-
|
|
213
|
-
- Every tag
|
|
214
|
-
- Scope
|
|
211
|
+
- Each edit has `op`, optional `first`/`last` anchors, and `content`
|
|
212
|
+
- Every tag MUST be copied EXACTLY from a tool result as `N#ID`
|
|
213
|
+
- Scope MUST be minimal and formatting MUST be preserved except targeted token changes
|
|
215
214
|
</critical>
|
|
216
|
-
**Final reminder:** tags are immutable references to the last read snapshot.
|
|
215
|
+
**Final reminder:** tags are immutable references to the last read snapshot. You MUST re-read when state changes, then edit.
|
|
@@ -43,11 +43,11 @@ Returns success/failure; on failure, error message indicates:
|
|
|
43
43
|
</output>
|
|
44
44
|
|
|
45
45
|
<critical>
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- If edit fails or breaks structure, re-read file and produce new patch from current content—
|
|
46
|
+
- You MUST read the target file before editing
|
|
47
|
+
- You MUST copy anchors and context lines verbatim (including whitespace)
|
|
48
|
+
- You MUST NOT use anchors as comments (no line numbers, location labels, placeholders like `@@ @@`)
|
|
49
|
+
- You MUST NOT place new lines outside the intended block
|
|
50
|
+
- If edit fails or breaks structure, you MUST re-read the file and produce a new patch from current content — you MUST NOT retry the same diff
|
|
51
51
|
- **NEVER** use edit to fix indentation, whitespace, or reformat code. Formatting is a single command run once at the end (`bun fmt`, `cargo fmt`, `prettier --write`, etc.)—not N individual edits. If you see inconsistent indentation after an edit, leave it; the formatter will fix all of it in one pass.
|
|
52
52
|
</critical>
|
|
53
53
|
|
|
@@ -60,7 +60,7 @@ edit {"path":"src/app.py","op":"update","diff":"@@ def greet():\n def greet():\n
|
|
|
60
60
|
</example>
|
|
61
61
|
|
|
62
62
|
<example name="rename">
|
|
63
|
-
edit {"path":"src/app.py","op":"update","rename":"src/main.py","diff":"@@\n
|
|
63
|
+
edit {"path":"src/app.py","op":"update","rename":"src/main.py","diff":"@@\n …\n"}
|
|
64
64
|
</example>
|
|
65
65
|
|
|
66
66
|
<example name="delete">
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Block until one or more background jobs complete, fail, or are cancelled.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You MUST use this instead of polling `read jobs://` in a loop when you need to wait for background task or bash results before continuing.
|
|
6
6
|
|
|
7
7
|
Returns the status and results of all watched jobs once at least one finishes.
|
|
@@ -5,13 +5,13 @@ Runs Python cells sequentially in persistent IPython kernel.
|
|
|
5
5
|
<instruction>
|
|
6
6
|
Kernel persists across calls and cells; **imports, variables, and functions survive—use this.**
|
|
7
7
|
**Work incrementally:**
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
- You SHOULD use one logical step per cell (imports, define function, test it, use it)
|
|
9
|
+
- You SHOULD pass multiple small cells in one call
|
|
10
|
+
- You SHOULD define small functions you can reuse and debug individually
|
|
11
|
+
- You MUST put explanations in assistant message or cell title, MUST NOT put them in code
|
|
12
12
|
**When something fails:**
|
|
13
13
|
- Errors tell you which cell failed (e.g., "Cell 3 failed")
|
|
14
|
-
-
|
|
14
|
+
- You SHOULD resubmit only the fixed cell (or fixed cell + remaining cells)
|
|
15
15
|
</instruction>
|
|
16
16
|
|
|
17
17
|
<prelude>
|
|
@@ -34,23 +34,21 @@ All helpers auto-print results and return values for chaining.
|
|
|
34
34
|
</prelude>
|
|
35
35
|
|
|
36
36
|
<output>
|
|
37
|
-
Streams in real time, truncated after 100KB; if truncated, full output stored under $ARTIFACTS and referenced as `artifact://<id>` in metadata.
|
|
38
|
-
|
|
39
37
|
User sees output like Jupyter notebook; rich displays render fully:
|
|
40
38
|
- `display(JSON(data))` → interactive JSON tree
|
|
41
|
-
- `display(HTML(
|
|
42
|
-
- `display(Markdown(
|
|
39
|
+
- `display(HTML(…))` → rendered HTML
|
|
40
|
+
- `display(Markdown(…))` → formatted markdown
|
|
43
41
|
- `plt.show()` → inline figures
|
|
44
|
-
**You will see object repr** (e.g., `<IPython.core.display.JSON object>`). Trust `display()`;
|
|
42
|
+
**You will see object repr** (e.g., `<IPython.core.display.JSON object>`). Trust `display()`; you MUST NOT assume user sees only repr.
|
|
45
43
|
</output>
|
|
46
44
|
|
|
47
45
|
<caution>
|
|
48
46
|
- Per-call mode uses fresh kernel each call
|
|
49
|
-
-
|
|
47
|
+
- You MUST use `reset: true` to clear state when session mode active
|
|
50
48
|
</caution>
|
|
51
49
|
|
|
52
50
|
<critical>
|
|
53
|
-
-
|
|
51
|
+
- You MUST use `run()` for shell commands; you MUST NOT use raw `subprocess`
|
|
54
52
|
</critical>
|
|
55
53
|
|
|
56
54
|
<example name="good">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Read
|
|
2
2
|
|
|
3
|
-
Reads files from local filesystem or
|
|
3
|
+
Reads files from local filesystem or harness URLs.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
6
|
- Reads up to {{DEFAULT_MAX_LINES}} lines default
|
|
@@ -14,17 +14,7 @@ Reads files from local filesystem or internal URLs.
|
|
|
14
14
|
{{/if}}
|
|
15
15
|
- Supports images (PNG, JPG) and PDFs
|
|
16
16
|
- For directories, returns formatted listing with modification times
|
|
17
|
-
-
|
|
18
|
-
- Supports internal URLs:
|
|
19
|
-
- `skill://<name>` - read SKILL.md for a skill
|
|
20
|
-
- `skill://<name>/<path>` - read relative path within skill directory
|
|
21
|
-
- `rule://<name>` - read rule content
|
|
22
|
-
- `memory://root` - read memory summary (`memory_summary.md`)
|
|
23
|
-
- `memory://root/<path>` - read relative path within project memory root
|
|
24
|
-
- `agent://<id>` - read agent output artifact
|
|
25
|
-
- `agent://<id>/<path>` or `agent://<id>?q=<query>` - extract JSON from agent output
|
|
26
|
-
- `docs://` - list available pi documentation files
|
|
27
|
-
- `docs://<file>.md` - read a specific pi documentation file
|
|
17
|
+
- You SHOULD parallelize reads when exploring related files
|
|
28
18
|
</instruction>
|
|
29
19
|
|
|
30
20
|
<output>
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
String replacements in files with fuzzy whitespace matching.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
-
|
|
7
|
-
- If `old_text` not unique, expand to include more context or use `all: true` to replace all occurrences
|
|
6
|
+
- You MUST use the smallest edit that uniquely identifies the change
|
|
7
|
+
- If `old_text` not unique, you MUST expand to include more context or use `all: true` to replace all occurrences
|
|
8
8
|
- Fuzzy matching handles minor whitespace/indentation differences automatically
|
|
9
|
-
-
|
|
9
|
+
- You SHOULD prefer editing existing files over creating new ones
|
|
10
10
|
</instruction>
|
|
11
11
|
|
|
12
12
|
<output>
|
|
@@ -14,17 +14,17 @@ Returns success/failure status. On success, file modified in place with replacem
|
|
|
14
14
|
</output>
|
|
15
15
|
|
|
16
16
|
<critical>
|
|
17
|
-
-
|
|
17
|
+
- You MUST read the file at least once in the conversation before editing. Tool errors if you attempt edit without reading file first.
|
|
18
18
|
</critical>
|
|
19
19
|
|
|
20
|
-
<bash
|
|
20
|
+
<bash-alternatives>
|
|
21
21
|
Replace for content-addressed changes—you identify \_what* to change by its text.
|
|
22
22
|
|
|
23
23
|
For position-addressed or pattern-addressed changes, bash more efficient:
|
|
24
24
|
|
|
25
25
|
|Operation|Command|
|
|
26
26
|
|---|---|
|
|
27
|
-
|Append to file|`cat >> file <<'EOF'
|
|
27
|
+
|Append to file|`cat >> file <<'EOF'`…`EOF`|
|
|
28
28
|
|Prepend to file|`{ cat - file; } <<'EOF' > tmp && mv tmp file`|
|
|
29
29
|
|Delete lines N-M|`sed -i 'N,Md' file`|
|
|
30
30
|
|Insert after line N|`sed -i 'Na\text' file`|
|
|
@@ -35,4 +35,4 @@ For position-addressed or pattern-addressed changes, bash more efficient:
|
|
|
35
35
|
|
|
36
36
|
Use Replace when _content itself_ identifies location.
|
|
37
37
|
Use bash when _position_ or _pattern_ identifies what to change.
|
|
38
|
-
</
|
|
38
|
+
</bash-alternatives>
|
package/src/prompts/tools/ssh.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Run commands on remote hosts.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
|
|
6
|
+
You MUST build commands from the reference below
|
|
7
7
|
</instruction>
|
|
8
8
|
|
|
9
9
|
<commands>
|
|
@@ -23,13 +23,8 @@ Build commands from reference below
|
|
|
23
23
|
- Navigation: `cd`, `echo %CD%`
|
|
24
24
|
</commands>
|
|
25
25
|
|
|
26
|
-
<output>
|
|
27
|
-
stdout/stderr combined, truncated at 50KB; exit code captured.
|
|
28
|
-
If truncated, full output stored under $ARTIFACTS as `artifact://<id>`.
|
|
29
|
-
</output>
|
|
30
|
-
|
|
31
26
|
<critical>
|
|
32
|
-
|
|
27
|
+
You MUST verify the shell type from "Available hosts" and use matching commands.
|
|
33
28
|
</critical>
|
|
34
29
|
|
|
35
30
|
<example name="linux">
|