@oh-my-pi/pi-coding-agent 10.2.1 → 10.2.3
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 +45 -0
- package/package.json +7 -7
- package/src/commit/agentic/prompts/analyze-file.md +7 -7
- package/src/commit/agentic/prompts/session-user.md +4 -4
- package/src/commit/agentic/prompts/system.md +14 -16
- package/src/commit/prompts/analysis-system.md +7 -9
- package/src/commit/prompts/analysis-user.md +0 -3
- package/src/commit/prompts/changelog-system.md +14 -19
- package/src/commit/prompts/file-observer-system.md +2 -2
- package/src/commit/prompts/reduce-system.md +13 -23
- package/src/commit/prompts/summary-system.md +7 -21
- package/src/config/settings-schema.ts +135 -38
- package/src/cursor.ts +2 -1
- package/src/debug/index.ts +1 -1
- package/src/debug/report-bundle.ts +1 -1
- package/src/extensibility/extensions/index.ts +0 -11
- package/src/extensibility/extensions/types.ts +1 -30
- package/src/extensibility/hooks/types.ts +1 -31
- package/src/index.ts +0 -11
- package/src/ipy/prelude.py +1 -113
- package/src/lsp/index.ts +66 -515
- package/src/lsp/render.ts +0 -11
- package/src/lsp/types.ts +3 -87
- package/src/modes/components/settings-defs.ts +3 -2
- package/src/modes/components/settings-selector.ts +14 -14
- package/src/modes/interactive-mode.ts +5 -5
- package/src/modes/theme/theme.ts +45 -1
- package/src/prompts/agents/designer.md +23 -27
- package/src/prompts/agents/explore.md +28 -38
- package/src/prompts/agents/init.md +17 -17
- package/src/prompts/agents/plan.md +21 -27
- package/src/prompts/agents/reviewer.md +37 -37
- package/src/prompts/compaction/branch-summary.md +9 -9
- package/src/prompts/compaction/compaction-summary.md +8 -12
- package/src/prompts/compaction/compaction-update-summary.md +17 -19
- package/src/prompts/review-request.md +12 -13
- package/src/prompts/system/custom-system-prompt.md +6 -26
- package/src/prompts/system/plan-mode-active.md +23 -35
- package/src/prompts/system/plan-mode-subagent.md +7 -7
- package/src/prompts/system/subagent-system-prompt.md +7 -7
- package/src/prompts/system/system-prompt.md +84 -125
- package/src/prompts/system/web-search.md +10 -10
- package/src/prompts/tools/ask.md +12 -15
- package/src/prompts/tools/bash.md +7 -7
- package/src/prompts/tools/exit-plan-mode.md +6 -6
- package/src/prompts/tools/gemini-image.md +4 -4
- package/src/prompts/tools/grep.md +4 -4
- package/src/prompts/tools/lsp.md +12 -19
- package/src/prompts/tools/patch.md +26 -30
- package/src/prompts/tools/python.md +14 -57
- package/src/prompts/tools/read.md +4 -4
- package/src/prompts/tools/replace.md +8 -8
- package/src/prompts/tools/ssh.md +14 -27
- package/src/prompts/tools/task.md +23 -35
- package/src/prompts/tools/todo-write.md +29 -38
- package/src/prompts/tools/write.md +3 -3
- package/src/sdk.ts +0 -2
- package/src/session/agent-session.ts +27 -6
- package/src/system-prompt.ts +1 -219
- package/src/task/agents.ts +2 -1
- package/src/tools/bash-interceptor.ts +0 -24
- package/src/tools/bash.ts +1 -7
- package/src/tools/index.ts +8 -3
- package/src/tools/read.ts +74 -17
- package/src/tools/renderers.ts +0 -2
- package/src/lsp/rust-analyzer.ts +0 -184
- package/src/tools/ls.ts +0 -307
package/src/prompts/tools/ask.md
CHANGED
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
# Ask
|
|
2
2
|
|
|
3
|
-
Ask
|
|
3
|
+
Ask user when you need clarification or input during task execution.
|
|
4
4
|
|
|
5
5
|
<conditions>
|
|
6
6
|
- Clarify ambiguous requirements before implementing
|
|
7
7
|
- Get decisions on implementation approach when multiple valid options exist
|
|
8
|
-
- Request
|
|
8
|
+
- Request preferences (styling, naming conventions, architecture patterns)
|
|
9
9
|
- Offer meaningful choices about task direction
|
|
10
10
|
</conditions>
|
|
11
11
|
|
|
12
12
|
<instruction>
|
|
13
|
-
- Use `recommended: <index>` to mark
|
|
14
|
-
- Use `questions`
|
|
15
|
-
- Set `multi: true` on
|
|
13
|
+
- Use `recommended: <index>` to mark default (0-indexed); " (Recommended)" added automatically
|
|
14
|
+
- Use `questions` for multiple related questions instead of asking one at a time
|
|
15
|
+
- Set `multi: true` on question to allow multiple selections
|
|
16
16
|
</instruction>
|
|
17
17
|
|
|
18
18
|
<output>
|
|
19
|
-
Returns
|
|
19
|
+
Returns selected option(s) as text. For multi-part questions, returns map of question IDs to selected values.
|
|
20
20
|
</output>
|
|
21
21
|
|
|
22
22
|
<important>
|
|
23
23
|
- Provide 2-5 concise, distinct options
|
|
24
|
-
- Users can always select "Other" for custom input (UI adds this automatically)
|
|
25
24
|
</important>
|
|
26
25
|
|
|
27
26
|
<critical>
|
|
28
|
-
**Exhaust all other options before asking.**
|
|
29
|
-
1. **Unknown file location?** → Search with grep/find first
|
|
30
|
-
2. **Ambiguous syntax/format?** → Infer from context and codebase conventions
|
|
31
|
-
3. **Missing details?** → Check docs, related files, commit history
|
|
32
|
-
4. **Implementation approach?** → Choose based on codebase patterns
|
|
33
|
-
|
|
34
|
-
If you can make a reasonable inference from the user's request, **do it**. Users communicate intent, not specifications—your job is to translate intent into correct implementation.
|
|
35
|
-
**Do NOT include an "Other" option in your options array.** The UI automatically adds "Other (type your own)" to every question. Adding your own creates duplicates.
|
|
27
|
+
**Exhaust all other options before asking.**
|
|
28
|
+
1. **Unknown file location?** → Search with grep/find first; ask only if search fails.
|
|
29
|
+
2. **Ambiguous syntax/format?** → Infer from context and codebase conventions; make reasonable choice.
|
|
30
|
+
3. **Missing details?** → Check docs, related files, commit history; fill gaps yourself.
|
|
31
|
+
4. **Implementation approach?** → Choose based on codebase patterns; ask only for genuinely novel architectural decisions.
|
|
32
|
+
**Do NOT include "Other" option in your options array.** UI automatically adds "Other (type your own)" to every question; adding your own creates duplicates.
|
|
36
33
|
</critical>
|
|
37
34
|
|
|
38
35
|
<example name="single">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bash
|
|
2
2
|
|
|
3
|
-
Executes
|
|
3
|
+
Executes bash command in shell session for terminal operations like git, bun, cargo, python.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
6
|
- Use `cwd` parameter to set working directory instead of `cd dir && ...`
|
|
@@ -11,9 +11,9 @@ Executes a bash command in a shell session for terminal operations like git, bun
|
|
|
11
11
|
</instruction>
|
|
12
12
|
|
|
13
13
|
<output>
|
|
14
|
-
Returns stdout, stderr,
|
|
15
|
-
- Output truncated after 50KB or 2000 lines (whichever
|
|
16
|
-
- If output
|
|
14
|
+
Returns stdout, stderr, exit code from command execution.
|
|
15
|
+
- Output truncated after 50KB or 2000 lines (whichever first); use `head` parameter to limit output
|
|
16
|
+
- If output truncated, full output stored under $ARTIFACTS and referenced as `artifact://<id>` in metadata
|
|
17
17
|
- Exit codes shown on non-zero exit; stderr captured
|
|
18
18
|
</output>
|
|
19
19
|
|
|
@@ -27,11 +27,11 @@ Do NOT use Bash for these operations—specialized tools exist:
|
|
|
27
27
|
</critical>
|
|
28
28
|
|
|
29
29
|
<avoid>
|
|
30
|
-
Do NOT pipe through `head` or `tail`—use
|
|
30
|
+
Do NOT pipe through `head` or `tail`—use `head` and `tail` parameters instead:
|
|
31
31
|
- `command | head -n 50` → use `head: 50` parameter
|
|
32
32
|
- `command | tail -n 100` → use `tail: 100` parameter
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Pipe pattern breaks streaming output and prevents artifact storage.
|
|
35
35
|
|
|
36
|
-
Do NOT use `2>&1`—stdout and stderr
|
|
36
|
+
Do NOT use `2>&1`—stdout and stderr already merged.
|
|
37
37
|
</avoid>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
Signals plan completion
|
|
1
|
+
Signals plan completion, requests user approval to begin implementation.
|
|
2
2
|
|
|
3
3
|
<conditions>
|
|
4
4
|
Use when:
|
|
5
|
-
- Plan
|
|
5
|
+
- Plan written to plan file
|
|
6
6
|
- No unresolved questions about requirements or approach
|
|
7
|
-
- Ready for user
|
|
7
|
+
- Ready for user review and approval
|
|
8
8
|
</conditions>
|
|
9
9
|
|
|
10
10
|
<instruction>
|
|
11
|
-
- Write
|
|
12
|
-
-
|
|
11
|
+
- Write plan to plan file BEFORE calling this tool
|
|
12
|
+
- Tool reads plan from file—does not take plan content as parameter
|
|
13
13
|
- User sees plan contents when reviewing
|
|
14
14
|
</instruction>
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ Unsure about auth method (OAuth vs JWT).
|
|
|
28
28
|
</example>
|
|
29
29
|
|
|
30
30
|
<avoid>
|
|
31
|
-
- Calling before plan
|
|
31
|
+
- Calling before plan written to file
|
|
32
32
|
- Using `ask` to request plan approval (this tool does that)
|
|
33
33
|
- Calling after pure research tasks (no implementation planned)
|
|
34
34
|
</avoid>
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
Generate or edit images using Gemini image models.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
Provide structured parameters for best results.
|
|
6
|
+
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
|
|
8
|
+
When using multiple `input_images`, 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>
|
|
12
12
|
|
|
13
13
|
<output>
|
|
14
|
-
Returns
|
|
14
|
+
Returns generated image saved to disk. Response includes file path where image was written.
|
|
15
15
|
</output>
|
|
16
16
|
|
|
17
17
|
<important>
|
|
18
18
|
- For photoreal: add "ultra-detailed, realistic, natural skin texture" to style
|
|
19
19
|
- For posters/cards: use 9:16 aspect ratio with negative space for text placement
|
|
20
|
-
- For iteration: use `changes`
|
|
20
|
+
- For iteration: use `changes` for targeted adjustments rather than regenerating from scratch
|
|
21
21
|
- For text: add "sharp, legible, correctly spelled" for important text; keep text short
|
|
22
22
|
- For diagrams: include "scientifically accurate" in style and provide facts explicitly
|
|
23
23
|
</important>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Grep
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Powerful search tool built on ripgrep.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
6
|
- Supports full regex syntax (e.g., `log.*Error`, `function\\s+\\w+`)
|
|
@@ -15,12 +15,12 @@ Results depend on `output_mode`:
|
|
|
15
15
|
- `files_with_matches`: File paths only (one per line)
|
|
16
16
|
- `count`: Match counts per file
|
|
17
17
|
|
|
18
|
-
In `content` mode, truncated at 100 matches
|
|
19
|
-
For `files_with_matches` and `count` modes, use `limit`
|
|
18
|
+
In `content` mode, truncated at 100 matches default (configurable via `limit`).
|
|
19
|
+
For `files_with_matches` and `count` modes, use `limit` truncate results.
|
|
20
20
|
</output>
|
|
21
21
|
|
|
22
22
|
<critical>
|
|
23
|
-
- ALWAYS use Grep for search tasks—NEVER invoke `grep` or `rg` via Bash.
|
|
23
|
+
- ALWAYS use Grep for search tasks—NEVER invoke `grep` or `rg` via Bash. Has correct permissions and access.
|
|
24
24
|
</critical>
|
|
25
25
|
|
|
26
26
|
<avoid>
|
package/src/prompts/tools/lsp.md
CHANGED
|
@@ -3,33 +3,26 @@
|
|
|
3
3
|
Interact with Language Server Protocol servers for code intelligence.
|
|
4
4
|
|
|
5
5
|
<operations>
|
|
6
|
-
- `diagnostics`: Get errors/warnings for a file
|
|
7
|
-
- `workspace_diagnostics`: Check entire project (uses tsc, cargo check, go build, etc.)
|
|
8
6
|
- `definition`: Go to symbol definition
|
|
9
|
-
- `references`: Find all references to
|
|
7
|
+
- `references`: Find all references to symbol
|
|
10
8
|
- `hover`: Get type info and documentation
|
|
11
|
-
- `symbols`: List symbols in
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
14
|
-
- `
|
|
15
|
-
- `incoming_calls`: Find all callers of a function
|
|
16
|
-
- `outgoing_calls`: Find all functions called by a function
|
|
9
|
+
- `symbols`: List symbols in file, or search workspace (with query, no file)
|
|
10
|
+
- `rename`: Rename symbol across codebase
|
|
11
|
+
- `diagnostics`: Get errors/warnings for file, or check entire project (no file)
|
|
12
|
+
- `reload`: Restart the language server
|
|
17
13
|
</operations>
|
|
18
14
|
|
|
19
15
|
<output>
|
|
20
|
-
|
|
21
|
-
- `
|
|
22
|
-
- `definition`: File path and position of the definition
|
|
23
|
-
- `references`: List of locations (file + position) where symbol is used
|
|
16
|
+
- `definition`: File path and position of definition
|
|
17
|
+
- `references`: List of locations (file + position) where symbol used
|
|
24
18
|
- `hover`: Type signature and documentation text
|
|
25
|
-
- `symbols
|
|
19
|
+
- `symbols`: List of symbol names, kinds, locations
|
|
26
20
|
- `rename`: Confirmation of changes made across files
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
21
|
+
- `diagnostics`: List of errors/warnings with file, line, severity, message
|
|
22
|
+
- `reload`: Confirmation of server restart
|
|
29
23
|
</output>
|
|
30
24
|
|
|
31
25
|
<important>
|
|
32
|
-
- Requires
|
|
33
|
-
- Some operations require
|
|
34
|
-
- `workspace_diagnostics` may be slow on large projects
|
|
26
|
+
- Requires running LSP server for target language
|
|
27
|
+
- Some operations require file to be saved to disk
|
|
35
28
|
</important>
|
|
@@ -1,56 +1,54 @@
|
|
|
1
1
|
# Edit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Patch operations on file given diff. Primary tool for existing-file edits.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
6
|
**Hunk Headers:**
|
|
7
|
-
- `@@` — bare header when context lines
|
|
8
|
-
- `@@ $ANCHOR` — anchor
|
|
9
|
-
**Anchor Selection
|
|
10
|
-
1.
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- unique string literal / error message
|
|
7
|
+
- `@@` — bare header when context lines unique
|
|
8
|
+
- `@@ $ANCHOR` — anchor copied verbatim from file (full line or unique substring)
|
|
9
|
+
**Anchor Selection:**
|
|
10
|
+
1. Otherwise choose highly specific anchor copied from file:
|
|
11
|
+
- full function signature
|
|
12
|
+
- class declaration
|
|
13
|
+
- unique string literal/error message
|
|
15
14
|
- config key with uncommon name
|
|
16
|
-
|
|
15
|
+
2. On "Found multiple matches": add context lines, use multiple hunks with separate anchors, or use longer anchor substring
|
|
17
16
|
**Context Lines:**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- When editing structured blocks (nested braces, tags, indented regions), include opening and closing lines in context so the edit stays inside the block
|
|
17
|
+
Use enough ` `-prefixed lines to make match unique (usually 2–8)
|
|
18
|
+
When editing structured blocks (nested braces, tags, indented regions), include opening and closing lines so edit stays inside block
|
|
21
19
|
</instruction>
|
|
22
20
|
|
|
23
21
|
<parameters>
|
|
24
22
|
```ts
|
|
25
23
|
type T =
|
|
26
|
-
// Diff is one or more hunks
|
|
27
|
-
// - Each hunk begins with "@@" (
|
|
28
|
-
// - Each hunk body
|
|
29
|
-
// - Each hunk
|
|
24
|
+
// Diff is one or more hunks in the same file.
|
|
25
|
+
// - Each hunk begins with "@@" (anchor optional).
|
|
26
|
+
// - Each hunk body only has lines starting with ' ' | '+' | '-'.
|
|
27
|
+
// - Each hunk includes at least one change (+ or -).
|
|
30
28
|
| { path: string, op: "update", diff: string }
|
|
31
|
-
// Diff is
|
|
29
|
+
// Diff is full file content, no prefixes.
|
|
32
30
|
| { path: string, op: "create", diff: string }
|
|
33
|
-
//
|
|
31
|
+
// No diff for delete.
|
|
34
32
|
| { path: string, op: "delete" }
|
|
35
|
-
// New path for update
|
|
33
|
+
// New path for update+move.
|
|
36
34
|
| { path: string, op: "update", rename: string, diff: string }
|
|
37
35
|
```
|
|
38
36
|
</parameters>
|
|
39
37
|
|
|
40
38
|
<output>
|
|
41
|
-
Returns success/failure
|
|
39
|
+
Returns success/failure; on failure, error message indicates:
|
|
42
40
|
- "Found multiple matches" — anchor/context not unique enough
|
|
43
41
|
- "No match found" — context lines don't exist in file (wrong content or stale read)
|
|
44
42
|
- Syntax errors in diff format
|
|
45
43
|
</output>
|
|
46
44
|
|
|
47
45
|
<critical>
|
|
48
|
-
- Always read
|
|
46
|
+
- Always read target file before editing
|
|
49
47
|
- Copy anchors and context lines verbatim (including whitespace)
|
|
50
|
-
- Never use anchors as comments (no line numbers, location labels,
|
|
51
|
-
- Do not place new lines outside
|
|
52
|
-
- If
|
|
53
|
-
- If indentation
|
|
48
|
+
- Never use anchors as comments (no line numbers, location labels, placeholders like `@@ @@`)
|
|
49
|
+
- Do not place new lines outside intended block
|
|
50
|
+
- If edit fails or breaks structure, re-read file and produce new patch from current content—do not retry same diff
|
|
51
|
+
- If indentation/alignment wrong after editing, run formatter (`go fmt`, `cargo fmt`, `ruff format`, `biome`, etc.)—never make repeated edit attempts to fix whitespace
|
|
54
52
|
</critical>
|
|
55
53
|
|
|
56
54
|
<example name="create">
|
|
@@ -71,8 +69,6 @@ edit {"path":"obsolete.txt","op":"delete"}
|
|
|
71
69
|
|
|
72
70
|
<avoid>
|
|
73
71
|
- Generic anchors: `import`, `export`, `describe`, `function`, `const`
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- Repeating the same addition in multiple hunks (creates duplicate blocks)
|
|
77
|
-
- Falling back to full-file overwrites for minor changes (acceptable for major restructures or short files)
|
|
72
|
+
- Repeating same addition in multiple hunks (duplicate blocks)
|
|
73
|
+
- Full-file overwrites for minor changes (acceptable for major restructures or short files)
|
|
78
74
|
</avoid>
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# Python
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runs Python cells sequentially in persistent IPython kernel.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
|
|
6
|
+
Kernel persists across calls and cells; **imports, variables, and functions survive—use this.**
|
|
7
7
|
**Work incrementally:**
|
|
8
|
-
- One logical step per cell (imports, define
|
|
9
|
-
- Pass multiple small cells in one call
|
|
8
|
+
- One logical step per cell (imports, define function, test it, use it)
|
|
9
|
+
- Pass multiple small cells in one call
|
|
10
10
|
- Define small functions you can reuse and debug individually
|
|
11
|
-
- Put explanations in
|
|
11
|
+
- Put explanations in assistant message or cell title, **not** in code
|
|
12
12
|
**When something fails:**
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- Resubmit with only the fixed cell (or the fixed cell + remaining cells)
|
|
16
|
-
- Do NOT rewrite working cells or re-import modules
|
|
13
|
+
- Errors tell you which cell failed (e.g., "Cell 3 failed")
|
|
14
|
+
- Resubmit only fixed cell (or fixed cell + remaining cells)
|
|
17
15
|
</instruction>
|
|
18
16
|
|
|
19
17
|
<prelude>
|
|
@@ -36,26 +34,23 @@ All helpers auto-print results and return values for chaining.
|
|
|
36
34
|
</prelude>
|
|
37
35
|
|
|
38
36
|
<output>
|
|
39
|
-
|
|
40
|
-
If output is truncated, full output is stored under $ARTIFACTS and referenced as `artifact://<id>` in metadata.
|
|
37
|
+
Streams in real time, truncated after 100KB; if truncated, full output stored under $ARTIFACTS and referenced as `artifact://<id>` in metadata.
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
User sees output like Jupyter notebook; rich displays render fully:
|
|
43
40
|
- `display(JSON(data))` → interactive JSON tree
|
|
44
41
|
- `display(HTML(...))` → rendered HTML
|
|
45
42
|
- `display(Markdown(...))` → formatted markdown
|
|
46
43
|
- `plt.show()` → inline figures
|
|
47
|
-
**You will see object repr** (e.g., `<IPython.core.display.JSON object>`)
|
|
44
|
+
**You will see object repr** (e.g., `<IPython.core.display.JSON object>`). Trust `display()`; do not assume user sees only repr.
|
|
48
45
|
</output>
|
|
49
46
|
|
|
50
47
|
<important>
|
|
51
|
-
-
|
|
52
|
-
- Use `reset: true` to clear state when session mode
|
|
48
|
+
- Per-call mode uses fresh kernel each call
|
|
49
|
+
- Use `reset: true` to clear state when session mode active
|
|
53
50
|
</important>
|
|
54
51
|
|
|
55
52
|
<critical>
|
|
56
|
-
- Use `
|
|
57
|
-
- Use `display()` from IPython.display for rich output (HTML, Markdown, images, etc.)
|
|
58
|
-
- Use `sh()` or `run()` for shell commands, never raw `subprocess`
|
|
53
|
+
- Use `run()` for shell commands; never raw `subprocess`
|
|
59
54
|
</critical>
|
|
60
55
|
|
|
61
56
|
<example name="good">
|
|
@@ -68,42 +63,4 @@ cells: [
|
|
|
68
63
|
{"title": "use helper", "code": "configs = [parse_config(p) for p in Path('.').glob('*.json')]"}
|
|
69
64
|
]
|
|
70
65
|
```
|
|
71
|
-
</example>
|
|
72
|
-
|
|
73
|
-
<example name="prelude-helpers">
|
|
74
|
-
```python
|
|
75
|
-
# Concatenate all markdown files in docs/
|
|
76
|
-
cat(*find("*.md", "docs"))
|
|
77
|
-
|
|
78
|
-
# Mass rename: foo -> bar across all .py files
|
|
79
|
-
rsed(r'\bfoo\b', 'bar', glob_pattern="*.py")
|
|
80
|
-
|
|
81
|
-
# Process files in batch
|
|
82
|
-
batch(find("*.json"), lambda p: json.loads(p.read_text()))
|
|
83
|
-
|
|
84
|
-
# Sort and deduplicate lines
|
|
85
|
-
sort_lines(read("data.txt"), unique=True)
|
|
86
|
-
|
|
87
|
-
# Extract columns 0 and 2 from TSV
|
|
88
|
-
cols(read("data.tsv"), 0, 2, sep="\t")
|
|
89
|
-
```
|
|
90
|
-
</example>
|
|
91
|
-
|
|
92
|
-
<example name="shell-commands">
|
|
93
|
-
```python
|
|
94
|
-
# Good
|
|
95
|
-
sh("bun run check")
|
|
96
|
-
run("cargo build --release")
|
|
97
|
-
|
|
98
|
-
# Bad - never use subprocess directly
|
|
99
|
-
import subprocess
|
|
100
|
-
subprocess.run(["bun", "run", "check"], ...)
|
|
101
|
-
```
|
|
102
|
-
</example>
|
|
103
|
-
|
|
104
|
-
<avoid>
|
|
105
|
-
- Putting everything in one giant cell
|
|
106
|
-
- Re-importing modules you already imported
|
|
107
|
-
- Rewriting working cells when only one part failed
|
|
108
|
-
- Large functions that are hard to debug piece by piece
|
|
109
|
-
</avoid>
|
|
66
|
+
</example>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Read
|
|
2
2
|
|
|
3
|
-
Reads files from
|
|
3
|
+
Reads files from local filesystem or internal URLs.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
- Reads up to {{DEFAULT_MAX_LINES}} lines
|
|
6
|
+
- Reads up to {{DEFAULT_MAX_LINES}} lines default
|
|
7
7
|
- Use `offset` and `limit` for large files
|
|
8
|
-
- Use `lines: true`
|
|
8
|
+
- Use `lines: true` include line numbers
|
|
9
9
|
- Supports images (PNG, JPG) and PDFs
|
|
10
|
-
- For directories,
|
|
10
|
+
- For directories, returns formatted listing with modification times
|
|
11
11
|
- Parallelize reads when exploring related files
|
|
12
12
|
- Supports internal URLs:
|
|
13
13
|
- `skill://<name>` - read SKILL.md for a skill
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
# Replace
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
String replacements in files with fuzzy whitespace matching.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
- Use
|
|
7
|
-
- If `old_text`
|
|
6
|
+
- Use smallest edit that uniquely identifies change
|
|
7
|
+
- If `old_text` not unique, 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
|
- Prefer editing existing files over creating new ones
|
|
10
10
|
</instruction>
|
|
11
11
|
|
|
12
12
|
<output>
|
|
13
|
-
Returns success/failure status. On success,
|
|
13
|
+
Returns success/failure status. On success, file modified in place with replacement applied. On failure (e.g., `old_text` not found or matches multiple locations without `all: true`), returns error describing issue.
|
|
14
14
|
</output>
|
|
15
15
|
|
|
16
16
|
<critical>
|
|
17
|
-
-
|
|
17
|
+
- Must read file at least once in conversation before editing. Tool errors if you attempt edit without reading file first.
|
|
18
18
|
</critical>
|
|
19
19
|
|
|
20
20
|
<bash*alternatives>
|
|
21
|
-
Replace
|
|
21
|
+
Replace for content-addressed changes—you identify \_what* to change by its text.
|
|
22
22
|
|
|
23
|
-
For position-addressed or pattern-addressed changes, bash
|
|
23
|
+
For position-addressed or pattern-addressed changes, bash more efficient:
|
|
24
24
|
|
|
25
25
|
|Operation|Command|
|
|
26
26
|
|---|---|
|
|
@@ -33,6 +33,6 @@ For position-addressed or pattern-addressed changes, bash is more efficient:
|
|
|
33
33
|
|Copy lines N-M to another file|`sed -n 'N,Mp' src >> dest`|
|
|
34
34
|
|Move lines N-M to another file|`sed -n 'N,Mp' src >> dest && sed -i 'N,Md' src`|
|
|
35
35
|
|
|
36
|
-
Use Replace when
|
|
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
|
@@ -1,64 +1,51 @@
|
|
|
1
1
|
# SSH
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run commands on remote hosts.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
|
|
7
|
-
2. Use ONLY commands for that shell type
|
|
8
|
-
3. Construct your command using the reference below
|
|
6
|
+
Build commands from reference below
|
|
9
7
|
</instruction>
|
|
10
8
|
|
|
11
9
|
<commands>
|
|
12
|
-
**linux/bash, linux/zsh, macos/bash, macos/zsh** — Unix-like
|
|
10
|
+
**linux/bash, linux/zsh, macos/bash, macos/zsh** — Unix-like:
|
|
13
11
|
- Files: `ls`, `cat`, `head`, `tail`, `grep`, `find`
|
|
14
|
-
- System: `ps`, `top`, `df`, `uname
|
|
12
|
+
- System: `ps`, `top`, `df`, `uname` (all), `free` (Linux only)
|
|
15
13
|
- Navigation: `cd`, `pwd`
|
|
16
|
-
**windows/bash, windows/sh** — Windows
|
|
17
|
-
- Files:
|
|
18
|
-
|
|
19
|
-
- Navigation: `cd`, `pwd`
|
|
20
|
-
- Note: These are Windows hosts but use Unix commands
|
|
21
|
-
**windows/powershell** — Native Windows PowerShell:
|
|
14
|
+
**windows/bash, windows/sh** — Windows Unix layer (WSL, Cygwin, Git Bash):
|
|
15
|
+
- Files/System/Navigation: same as Unix-like above, minus `free`
|
|
16
|
+
**windows/powershell** — PowerShell:
|
|
22
17
|
- Files: `Get-ChildItem`, `Get-Content`, `Select-String`
|
|
23
18
|
- System: `Get-Process`, `Get-ComputerInfo`
|
|
24
19
|
- Navigation: `Set-Location`, `Get-Location`
|
|
25
|
-
**windows/cmd** —
|
|
20
|
+
**windows/cmd** — Command Prompt:
|
|
26
21
|
- Files: `dir`, `type`, `findstr`, `where`
|
|
27
22
|
- System: `tasklist`, `systeminfo`
|
|
28
23
|
- Navigation: `cd`, `echo %CD%`
|
|
29
24
|
</commands>
|
|
30
25
|
|
|
31
26
|
<output>
|
|
32
|
-
|
|
33
|
-
If
|
|
27
|
+
stdout/stderr combined, truncated at 50KB; exit code captured.
|
|
28
|
+
If truncated, full output stored under $ARTIFACTS as `artifact://<id>`.
|
|
34
29
|
</output>
|
|
35
30
|
|
|
36
31
|
<critical>
|
|
37
|
-
|
|
38
|
-
Verify host shell type from "Available hosts" and use matching commands.
|
|
32
|
+
Verify shell type from "Available hosts", use matching commands.
|
|
39
33
|
</critical>
|
|
40
34
|
|
|
41
35
|
<example name="linux">
|
|
42
|
-
Task: List
|
|
36
|
+
Task: List /home/user files on "server1"
|
|
43
37
|
Host: server1 (10.0.0.1) | linux/bash
|
|
44
38
|
Command: `ls -la /home/user`
|
|
45
39
|
</example>
|
|
46
40
|
|
|
47
41
|
<example name="windows-cmd">
|
|
48
|
-
Task: Show running processes on
|
|
42
|
+
Task: Show running processes on "winbox"
|
|
49
43
|
Host: winbox (192.168.1.5) | windows/cmd
|
|
50
44
|
Command: `tasklist /v`
|
|
51
45
|
</example>
|
|
52
46
|
|
|
53
|
-
<example name="windows-wsl">
|
|
54
|
-
Task: Check disk usage on host "wsl-dev"
|
|
55
|
-
Host: wsl-dev (192.168.1.10) | windows/bash
|
|
56
|
-
Command: `df -h`
|
|
57
|
-
Note: Windows host with WSL — use Unix commands
|
|
58
|
-
</example>
|
|
59
|
-
|
|
60
47
|
<example name="macos">
|
|
61
|
-
Task: Get system info on
|
|
48
|
+
Task: Get system info on "macbook"
|
|
62
49
|
Host: macbook (10.0.0.20) | macos/zsh
|
|
63
50
|
Command: `uname -a && sw_vers`
|
|
64
51
|
</example>
|