@oh-my-pi/pi-coding-agent 14.9.9 → 15.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 +123 -0
- package/examples/extensions/plan-mode.ts +0 -1
- package/package.json +9 -9
- package/scripts/build-binary.ts +5 -0
- package/scripts/format-prompts.ts +1 -1
- package/src/autoresearch/helpers.ts +17 -0
- package/src/autoresearch/tools/log-experiment.ts +9 -17
- package/src/autoresearch/tools/run-experiment.ts +2 -17
- package/src/capability/skill.ts +7 -0
- package/src/cli/args.ts +2 -2
- package/src/cli/list-models.ts +1 -1
- package/src/cli/shell-cli.ts +3 -13
- package/src/cli/update-cli.ts +1 -1
- package/src/cli.ts +11 -29
- package/src/commands/acp.ts +24 -0
- package/src/commands/launch.ts +6 -4
- package/src/commit/agentic/prompts/system.md +1 -1
- package/src/commit/agentic/tools/propose-changelog.ts +8 -1
- package/src/commit/analysis/conventional.ts +8 -66
- package/src/commit/map-reduce/reduce-phase.ts +6 -65
- package/src/commit/pipeline.ts +2 -2
- package/src/commit/shared-llm.ts +89 -0
- package/src/config/config-file.ts +210 -0
- package/src/config/model-equivalence.ts +8 -11
- package/src/config/model-registry.ts +13 -2
- package/src/config/model-resolver.ts +31 -4
- package/src/config/settings-schema.ts +102 -1
- package/src/config/settings.ts +1 -1
- package/src/config.ts +3 -219
- package/src/edit/index.ts +22 -1
- package/src/edit/modes/patch.ts +10 -0
- package/src/edit/modes/replace.ts +3 -0
- package/src/edit/renderer.ts +17 -1
- package/src/eval/js/context-manager.ts +1 -1
- package/src/eval/js/executor.ts +3 -0
- package/src/eval/js/shared/rewrite-imports.ts +122 -50
- package/src/eval/js/shared/runtime.ts +31 -4
- package/src/eval/js/tool-bridge.ts +43 -21
- package/src/eval/py/executor.ts +5 -0
- package/src/exa/factory.ts +2 -2
- package/src/exa/mcp-client.ts +74 -1
- package/src/exec/bash-executor.ts +5 -1
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +0 -11
- package/src/extensibility/extensions/runner.ts +55 -2
- package/src/extensibility/extensions/types.ts +98 -221
- package/src/extensibility/hooks/types.ts +89 -314
- package/src/extensibility/shared-events.ts +343 -0
- package/src/extensibility/skills.ts +42 -1
- package/src/goals/index.ts +3 -0
- package/src/goals/runtime.ts +500 -0
- package/src/goals/state.ts +37 -0
- package/src/goals/tools/goal-tool.ts +237 -0
- package/src/hashline/anchors.ts +2 -2
- package/src/hindsight/mental-models.ts +1 -1
- package/src/internal-urls/agent-protocol.ts +1 -20
- package/src/internal-urls/artifact-protocol.ts +1 -19
- package/src/internal-urls/docs-index.generated.ts +9 -10
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/issue-pr-protocol.ts +577 -0
- package/src/internal-urls/registry-helpers.ts +25 -0
- package/src/internal-urls/router.ts +6 -3
- package/src/internal-urls/types.ts +22 -1
- package/src/main.ts +24 -11
- package/src/mcp/oauth-flow.ts +20 -0
- package/src/modes/acp/acp-agent.ts +412 -71
- package/src/modes/acp/acp-client-bridge.ts +152 -0
- package/src/modes/acp/acp-event-mapper.ts +180 -15
- package/src/modes/acp/terminal-auth.ts +37 -0
- package/src/modes/components/assistant-message.ts +14 -8
- package/src/modes/components/bash-execution.ts +24 -63
- package/src/modes/components/custom-message.ts +14 -40
- package/src/modes/components/eval-execution.ts +27 -57
- package/src/modes/components/execution-shared.ts +102 -0
- package/src/modes/components/hook-message.ts +17 -49
- package/src/modes/components/mcp-add-wizard.ts +26 -5
- package/src/modes/components/message-frame.ts +88 -0
- package/src/modes/components/model-selector.ts +1 -1
- package/src/modes/components/read-tool-group.ts +29 -1
- package/src/modes/components/session-observer-overlay.ts +6 -2
- package/src/modes/components/session-selector.ts +1 -1
- package/src/modes/components/status-line/segments.ts +55 -4
- package/src/modes/components/status-line/types.ts +4 -0
- package/src/modes/components/status-line.ts +28 -10
- package/src/modes/components/tool-execution.ts +7 -8
- package/src/modes/controllers/command-controller-shared.ts +108 -0
- package/src/modes/controllers/command-controller.ts +27 -10
- package/src/modes/controllers/event-controller.ts +60 -18
- package/src/modes/controllers/extension-ui-controller.ts +8 -2
- package/src/modes/controllers/input-controller.ts +85 -39
- package/src/modes/controllers/mcp-command-controller.ts +56 -61
- package/src/modes/controllers/ssh-command-controller.ts +18 -57
- package/src/modes/interactive-mode.ts +675 -39
- package/src/modes/print-mode.ts +16 -86
- package/src/modes/rpc/rpc-mode.ts +30 -88
- package/src/modes/runtime-init.ts +115 -0
- package/src/modes/theme/defaults/dark-poimandres.json +2 -0
- package/src/modes/theme/defaults/light-poimandres.json +2 -0
- package/src/modes/theme/theme.ts +18 -6
- package/src/modes/types.ts +20 -5
- package/src/modes/utils/context-usage.ts +13 -13
- package/src/modes/utils/ui-helpers.ts +25 -6
- package/src/plan-mode/approved-plan.ts +35 -1
- package/src/prompts/agents/designer.md +5 -5
- package/src/prompts/agents/explore.md +7 -7
- package/src/prompts/agents/init.md +9 -9
- package/src/prompts/agents/librarian.md +14 -14
- package/src/prompts/agents/plan.md +4 -4
- package/src/prompts/agents/reviewer.md +5 -5
- package/src/prompts/agents/task.md +10 -10
- package/src/prompts/commands/orchestrate.md +2 -2
- 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/goals/goal-budget-limit.md +16 -0
- package/src/prompts/goals/goal-continuation.md +28 -0
- package/src/prompts/goals/goal-mode-active.md +23 -0
- package/src/prompts/memories/consolidation.md +2 -2
- package/src/prompts/memories/read-path.md +1 -1
- 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 +17 -17
- package/src/prompts/system/agent-creation-user.md +2 -2
- package/src/prompts/system/commit-message-system.md +2 -2
- package/src/prompts/system/custom-system-prompt.md +2 -2
- package/src/prompts/system/eager-todo.md +6 -6
- package/src/prompts/system/handoff-document.md +1 -1
- package/src/prompts/system/plan-mode-active.md +25 -24
- package/src/prompts/system/plan-mode-approved.md +4 -4
- package/src/prompts/system/plan-mode-compact-instructions.md +16 -0
- package/src/prompts/system/plan-mode-reference.md +2 -2
- package/src/prompts/system/plan-mode-subagent.md +8 -8
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +3 -3
- package/src/prompts/system/project-prompt.md +4 -4
- package/src/prompts/system/subagent-system-prompt.md +7 -7
- package/src/prompts/system/subagent-yield-reminder.md +4 -4
- package/src/prompts/system/system-prompt.md +72 -71
- package/src/prompts/system/ttsr-interrupt.md +1 -1
- package/src/prompts/tools/apply-patch.md +1 -1
- package/src/prompts/tools/ast-edit.md +3 -3
- package/src/prompts/tools/ast-grep.md +3 -3
- package/src/prompts/tools/bash.md +6 -0
- package/src/prompts/tools/browser.md +3 -3
- package/src/prompts/tools/checkpoint.md +3 -3
- package/src/prompts/tools/find.md +3 -3
- package/src/prompts/tools/github.md +2 -5
- package/src/prompts/tools/goal.md +13 -0
- package/src/prompts/tools/hashline.md +104 -116
- package/src/prompts/tools/image-gen.md +3 -3
- package/src/prompts/tools/irc.md +1 -1
- package/src/prompts/tools/lsp.md +2 -2
- package/src/prompts/tools/patch.md +6 -6
- package/src/prompts/tools/read.md +8 -7
- package/src/prompts/tools/replace.md +5 -5
- package/src/prompts/tools/resolve.md +6 -5
- package/src/prompts/tools/retain.md +1 -1
- package/src/prompts/tools/rewind.md +2 -2
- package/src/prompts/tools/search.md +2 -2
- package/src/prompts/tools/ssh.md +2 -2
- package/src/prompts/tools/task.md +12 -6
- package/src/prompts/tools/web-search.md +2 -2
- package/src/prompts/tools/write.md +3 -3
- package/src/sdk.ts +81 -17
- package/src/session/agent-session.ts +656 -125
- package/src/session/blob-store.ts +36 -3
- package/src/session/client-bridge.ts +81 -0
- package/src/session/compaction/errors.ts +31 -0
- package/src/session/compaction/index.ts +1 -0
- package/src/session/messages.ts +67 -2
- package/src/session/session-manager.ts +131 -12
- package/src/session/session-storage.ts +33 -15
- package/src/session/streaming-output.ts +309 -13
- package/src/slash-commands/acp-builtins.ts +46 -0
- package/src/slash-commands/builtin-registry.ts +717 -116
- package/src/slash-commands/helpers/context-report.ts +39 -0
- package/src/slash-commands/helpers/format.ts +23 -0
- package/src/slash-commands/helpers/marketplace-manager.ts +25 -0
- package/src/slash-commands/helpers/mcp.ts +532 -0
- package/src/slash-commands/helpers/parse.ts +85 -0
- package/src/slash-commands/helpers/ssh.ts +193 -0
- package/src/slash-commands/helpers/todo.ts +279 -0
- package/src/slash-commands/helpers/usage-report.ts +91 -0
- package/src/slash-commands/types.ts +126 -0
- package/src/ssh/ssh-executor.ts +5 -0
- package/src/system-prompt.ts +4 -2
- package/src/task/executor.ts +27 -10
- package/src/task/index.ts +20 -1
- package/src/task/render.ts +27 -18
- package/src/task/types.ts +4 -0
- package/src/tools/ast-edit.ts +21 -120
- package/src/tools/ast-grep.ts +21 -119
- package/src/tools/bash-interactive.ts +9 -1
- package/src/tools/bash.ts +203 -6
- package/src/tools/browser/attach.ts +3 -3
- package/src/tools/browser/launch.ts +81 -18
- package/src/tools/browser/registry.ts +1 -5
- package/src/tools/browser/tab-supervisor.ts +51 -14
- package/src/tools/conflict-detect.ts +21 -10
- package/src/tools/eval.ts +3 -1
- package/src/tools/fetch.ts +15 -4
- package/src/tools/find.ts +39 -39
- package/src/tools/gh-renderer.ts +0 -12
- package/src/tools/gh.ts +689 -182
- package/src/tools/github-cache.ts +548 -0
- package/src/tools/index.ts +25 -11
- package/src/tools/inspect-image.ts +3 -10
- package/src/tools/output-meta.ts +176 -37
- package/src/tools/path-utils.ts +125 -2
- package/src/tools/read.ts +605 -239
- package/src/tools/render-utils.ts +92 -0
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resolve.ts +72 -44
- package/src/tools/search.ts +120 -186
- package/src/tools/write.ts +67 -10
- package/src/tui/code-cell.ts +70 -2
- package/src/utils/file-mentions.ts +1 -1
- package/src/utils/image-loading.ts +7 -3
- package/src/utils/image-resize.ts +32 -43
- package/src/vim/parser.ts +0 -17
- package/src/vim/render.ts +1 -1
- package/src/vim/types.ts +1 -1
- package/src/web/search/providers/gemini.ts +35 -95
- package/src/prompts/tools/exit-plan-mode.md +0 -6
- package/src/tools/exit-plan-mode.ts +0 -97
- package/src/utils/fuzzy.ts +0 -108
- package/src/utils/image-convert.ts +0 -27
|
@@ -1,162 +1,150 @@
|
|
|
1
1
|
Your patch language is a compact, line-anchored edit format.
|
|
2
2
|
|
|
3
|
-
A patch contains one or more file sections. The first non-blank line of every edit section
|
|
3
|
+
A patch contains one or more file sections. The first non-blank line of every edit section MUST be `@@ PATH`.
|
|
4
4
|
Operations reference lines in the file by their line number and hash, called "Anchors", e.g. `5th`, `123ab`.
|
|
5
|
-
You
|
|
5
|
+
You MUST copy them verbatim from the latest output for the file you're editing.
|
|
6
6
|
|
|
7
|
-
Purely textual format. The tool has NO awareness of language, indentation, brackets, fences, or table widths.
|
|
7
|
+
Purely textual format. The tool has NO awareness of language, indentation, brackets, fences, or table widths. You MUST emit valid syntax in replacements/insertions.
|
|
8
8
|
|
|
9
9
|
<ops>
|
|
10
10
|
@@ PATH header: subsequent ops apply to PATH
|
|
11
|
+
Each op line is ONE of:
|
|
11
12
|
+ ANCHOR insert lines AFTER the anchored line (or EOF); payload follows as `{{hsep}}TEXT` lines
|
|
12
13
|
< ANCHOR insert lines BEFORE the anchored line (or BOF); payload follows as `{{hsep}}TEXT` lines
|
|
13
14
|
- A..B delete the line range (inclusive).
|
|
14
15
|
= A..B replace the range with payload `{{hsep}}TEXT` lines, or with one blank line if no payload follows.
|
|
15
16
|
</ops>
|
|
16
17
|
|
|
18
|
+
<format-reminder>
|
|
19
|
+
Op lines carry no content — payload goes on the next line.
|
|
20
|
+
|
|
21
|
+
WRONG: + 5pg| some code
|
|
22
|
+
RIGHT: + 5pg
|
|
23
|
+
{{hsep}} some code
|
|
24
|
+
|
|
25
|
+
A single `+`/`<`/`=` op accepts MANY `{{hsep}}` payload lines. To insert N consecutive lines, write ONE op followed by N payload lines — NEVER N ops with one payload each.
|
|
26
|
+
|
|
27
|
+
WRONG (one op per inserted line, with fabricated anchors):
|
|
28
|
+
+ 5pg
|
|
29
|
+
{{hsep}}first new line
|
|
30
|
+
+ 6xx ← FABRICATED
|
|
31
|
+
{{hsep}}second new line
|
|
32
|
+
|
|
33
|
+
RIGHT (one op, many payload lines):
|
|
34
|
+
+ 5pg
|
|
35
|
+
{{hsep}}first new line
|
|
36
|
+
{{hsep}}second new line
|
|
37
|
+
</format-reminder>
|
|
38
|
+
|
|
17
39
|
<rules>
|
|
18
|
-
- Every line
|
|
19
|
-
-
|
|
20
|
-
- Payload is
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- **
|
|
25
|
-
-
|
|
40
|
+
- Every payload line MUST start with `{{hsep}}`.
|
|
41
|
+
- Payload is verbatim — NEVER escape unicode.
|
|
42
|
+
- **Payload is only what's NEW relative to your range:**
|
|
43
|
+
- `=` replaces inside; NEVER include lines outside.
|
|
44
|
+
- `+`/`<` adds at the anchor; NEVER repeat line A or neighbors.
|
|
45
|
+
- Payload matching nearby content duplicates — drop it or widen.
|
|
46
|
+
- **Pick a self-contained unit first.** Touching a multiline construct? Widen to the whole thing.
|
|
47
|
+
- Then smallest op: add → `+`/`<`; delete → `-`; `=` ONLY when modifying inside.
|
|
26
48
|
</rules>
|
|
27
49
|
|
|
28
50
|
<brace-shapes>
|
|
29
|
-
When your edit
|
|
30
|
-
- **Whole block
|
|
31
|
-
- **Signature
|
|
32
|
-
- **Insert inside
|
|
33
|
-
- **
|
|
51
|
+
When braces bound your edit, you SHOULD prefer these shapes:
|
|
52
|
+
- **Whole block**: range spans `{` through matching `}`.
|
|
53
|
+
- **Signature only**: one-line `=` on the opener; body untouched.
|
|
54
|
+
- **Insert inside**: anchor on `{` or last interior line; NEVER repeat the braces.
|
|
55
|
+
- **End on `}`**: only when that `}` is part of the change. Otherwise extend or stop earlier.
|
|
34
56
|
</brace-shapes>
|
|
35
57
|
|
|
36
58
|
<common-failures>
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **Anchor only inside the visible region.**
|
|
40
|
-
- **
|
|
41
|
-
- **Anchors
|
|
59
|
+
- **NEVER replay past your range.** Stop before B+1; extend B if it must go.
|
|
60
|
+
- **NEVER duplicate chunks inside one payload.** Caught re-emitting? Rewrite.
|
|
61
|
+
- **Anchor only inside the visible region.** B+1 truncated? Re-`read` first.
|
|
62
|
+
- **You SHOULD prefer the narrowest self-contained edit.** Small `+`/`-` beats wide `=`.
|
|
63
|
+
- **Anchors reference the file as last read.** NEVER shift for prior ops.
|
|
64
|
+
- **One `+`/`<` op per block, NOT per line.** N lines = ONE op, N payloads. Collapse adjacent ops.
|
|
65
|
+
- **NEVER fabricate anchor hashes.** Missing? Re-`read`.
|
|
42
66
|
</common-failures>
|
|
43
67
|
|
|
44
|
-
<case file="
|
|
68
|
+
<case file="mod.ts">
|
|
45
69
|
{{hline 1 "const DEF = \"guest\";"}}
|
|
46
|
-
{{hline 2 ""}}
|
|
47
|
-
{{hline 3 "
|
|
48
|
-
{{hline 4 "\
|
|
49
|
-
{{hline 5 "\
|
|
50
|
-
{{hline 6 "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<case file="b.ts">
|
|
54
|
-
{{hline 1 "const {"}}
|
|
55
|
-
{{hline 2 "\tevents,"}}
|
|
56
|
-
{{hline 3 "\tresponse,"}}
|
|
57
|
-
{{hline 4 "\trequestId,"}}
|
|
58
|
-
{{hline 5 "} = await getStreamResponse("}}
|
|
59
|
-
{{hline 6 "\trequest,"}}
|
|
60
|
-
{{hline 7 "\tsignal,"}}
|
|
61
|
-
{{hline 8 ");"}}
|
|
62
|
-
{{hline 9 "await notify(requestId);"}}
|
|
70
|
+
{{hline 2 "export function label(name) {"}}
|
|
71
|
+
{{hline 3 "\treturn ["}}
|
|
72
|
+
{{hline 4 "\t\tname?.trim() || DEF,"}}
|
|
73
|
+
{{hline 5 "\t\t\" • \","}}
|
|
74
|
+
{{hline 6 "\t].join(\"\");"}}
|
|
75
|
+
{{hline 7 "}"}}
|
|
63
76
|
</case>
|
|
64
77
|
|
|
65
78
|
<examples>
|
|
66
|
-
# Replace one line (
|
|
67
|
-
@@
|
|
68
|
-
= {{hrefr
|
|
69
|
-
{{hsep}}
|
|
70
|
-
|
|
71
|
-
# Replace a
|
|
72
|
-
@@
|
|
73
|
-
= {{hrefr
|
|
74
|
-
{{hsep}}
|
|
75
|
-
{{hsep}}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{{
|
|
83
|
-
{{hsep}}
|
|
84
|
-
{{hsep}}} = await getStreamResponse(
|
|
85
|
-
{{hsep}} request,
|
|
86
|
-
{{hsep}} signal,
|
|
87
|
-
{{hsep}} onEvent,
|
|
88
|
-
{{hsep}});
|
|
89
|
-
|
|
90
|
-
# Insert BEFORE a line
|
|
91
|
-
@@ a.ts
|
|
79
|
+
# Replace one line (the payload must re-emit the original indentation)
|
|
80
|
+
@@ mod.ts
|
|
81
|
+
= {{hrefr 4}}..{{hrefr 4}}
|
|
82
|
+
{{hsep}} name?.trim().toUpperCase() || DEF,
|
|
83
|
+
|
|
84
|
+
# Replace a full multiline statement (widen to a self-contained boundary)
|
|
85
|
+
@@ mod.ts
|
|
86
|
+
= {{hrefr 3}}..{{hrefr 6}}
|
|
87
|
+
{{hsep}} return [
|
|
88
|
+
{{hsep}} name?.trim() || DEF,
|
|
89
|
+
{{hsep}} "·",
|
|
90
|
+
{{hsep}} " • ",
|
|
91
|
+
{{hsep}} ].join("");
|
|
92
|
+
|
|
93
|
+
# Insert AFTER/BEFORE a line
|
|
94
|
+
@@ mod.ts
|
|
95
|
+
+ {{hrefr 3}}
|
|
96
|
+
{{hsep}} "·",
|
|
92
97
|
< {{hrefr 5}}
|
|
93
|
-
{{hsep}}
|
|
94
|
-
|
|
95
|
-
# Insert AFTER a line
|
|
96
|
-
@@ a.ts
|
|
97
|
-
+ {{hrefr 4}}
|
|
98
|
-
{{hsep}} if (clean.length === 0) return DEF;
|
|
98
|
+
{{hsep}} "·",
|
|
99
99
|
|
|
100
|
-
# Append to
|
|
101
|
-
@@
|
|
100
|
+
# Append to file
|
|
101
|
+
@@ mod.ts
|
|
102
102
|
+ EOF
|
|
103
103
|
{{hsep}}export const done = true;
|
|
104
104
|
|
|
105
|
-
# Delete a
|
|
106
|
-
@@
|
|
107
|
-
- {{hrefr
|
|
105
|
+
# Delete a line
|
|
106
|
+
@@ mod.ts
|
|
107
|
+
- {{hrefr 5}}..{{hrefr 5}}
|
|
108
108
|
|
|
109
|
-
# Blank a line
|
|
110
|
-
@@
|
|
111
|
-
= {{hrefr
|
|
109
|
+
# Blank a line (replace with LF)
|
|
110
|
+
@@ mod.ts
|
|
111
|
+
= {{hrefr 5}}..{{hrefr 5}}
|
|
112
112
|
</examples>
|
|
113
113
|
|
|
114
114
|
<anti-pattern>
|
|
115
|
-
# WRONG — replaces
|
|
116
|
-
@@
|
|
117
|
-
= {{hrefr 1}}..{{hrefr
|
|
115
|
+
# WRONG — replaces 3 lines just to add one.
|
|
116
|
+
@@ mod.ts
|
|
117
|
+
= {{hrefr 1}}..{{hrefr 3}}
|
|
118
118
|
{{hsep}}const DEF = "guest";
|
|
119
119
|
{{hsep}}const DEBUG = false;
|
|
120
|
-
{{hsep}}
|
|
121
120
|
{{hsep}}export function label(name) {
|
|
122
|
-
{{hsep}}
|
|
123
|
-
{{hsep}} return clean.trim();
|
|
124
|
-
|
|
121
|
+
{{hsep}} return [
|
|
125
122
|
# RIGHT — same effect, one-line insert
|
|
126
|
-
@@
|
|
123
|
+
@@ mod.ts
|
|
127
124
|
+ {{hrefr 1}}
|
|
128
125
|
{{hsep}}const DEBUG = false;
|
|
129
126
|
|
|
130
|
-
# WRONG —
|
|
131
|
-
@@
|
|
132
|
-
= {{hrefr
|
|
133
|
-
{{hsep}}
|
|
134
|
-
{{hsep}}
|
|
135
|
-
{{hsep}}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{{hsep}}
|
|
142
|
-
{{hsep}}
|
|
143
|
-
{{hsep}}
|
|
144
|
-
{{hsep}} requestId,
|
|
145
|
-
{{hsep}}} = await getStreamResponse(
|
|
146
|
-
{{hsep}} request,
|
|
147
|
-
{{hsep}} signal,
|
|
148
|
-
{{hsep}} onEvent,
|
|
149
|
-
{{hsep}});
|
|
150
|
-
|
|
151
|
-
If your replacement payload would render with even one unchanged line in the diff, or if the first or last payload line is only a continuation fragment from a larger construct (`} =`, `);`, `,`, `.method(`), you have the wrong op or range. Stop and widen to a self-contained boundary before minimizing the edit.
|
|
127
|
+
# WRONG — replace from the middle of a larger statement (error-prone)
|
|
128
|
+
@@ mod.ts
|
|
129
|
+
= {{hrefr 4}}..{{hrefr 5}}
|
|
130
|
+
{{hsep}} name?.trim() || DEF,
|
|
131
|
+
{{hsep}} "·",
|
|
132
|
+
{{hsep}} " • ",
|
|
133
|
+
# RIGHT — widen to the full statement
|
|
134
|
+
@@ mod.ts
|
|
135
|
+
= {{hrefr 3}}..{{hrefr 6}}
|
|
136
|
+
{{hsep}} return [
|
|
137
|
+
{{hsep}} name?.trim() || DEF,
|
|
138
|
+
{{hsep}} "·",
|
|
139
|
+
{{hsep}} " • ",
|
|
140
|
+
{{hsep}} ].join("");
|
|
152
141
|
</anti-pattern>
|
|
153
142
|
|
|
154
143
|
<critical>
|
|
155
|
-
-
|
|
156
|
-
- Every
|
|
157
|
-
-
|
|
158
|
-
- `= A..B` deletes the range; payload is what's written.
|
|
159
|
-
- Multiple ops
|
|
160
|
-
- Before
|
|
161
|
-
- `= A..B` removes the range as a unit; the lines immediately outside it remain. If those outside lines form a wrapper (`try {`, `catch`, `if`, `else`, loop delimiters) you do not intend to delete, your payload is inserted inside that wrapper. Make sure the payload remains valid and preserves required behavior like error handling. If you need to change the wrapper itself, include it in the range and reproduce it.
|
|
144
|
+
- Copy anchors verbatim (line number + 2-char hash); NEVER include the `|TEXT` body.
|
|
145
|
+
- Every payload line MUST start with `{{hsep}}`; raw content is invalid.
|
|
146
|
+
- NEVER write unified diff syntax. Header is `@@ PATH`; ops are `<`/`+`/`-`/`=`.
|
|
147
|
+
- `= A..B` deletes the range; payload is what's written. Edge line matches just outside? Widen, or it duplicates.
|
|
148
|
+
- Multiple ops are cheap. SHOULD prefer two narrow ops over one wide `=`.
|
|
149
|
+
- Before `= A..B`, mentally delete A..B. Splits an unclosed bracket/brace/string from above, or orphans a closer inside? You're bisecting a construct.
|
|
162
150
|
</critical>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Generates or edits images.
|
|
2
2
|
|
|
3
3
|
<instructions>
|
|
4
|
-
- You
|
|
5
|
-
- When using multiple `input`, you
|
|
6
|
-
- For text: you
|
|
4
|
+
- You MUST provide a single detailed `subject` prompt for image generation or editing.
|
|
5
|
+
- When using multiple `input`, you SHOULD describe each image's role directly in `subject`, e.g. `Image 1` for composition reference, `Image 2` for lighting reference, `Image 3` for background.
|
|
6
|
+
- For text: you SHOULD add "sharp, legible, correctly spelled" for important text; keep text short
|
|
7
7
|
</instructions>
|
package/src/prompts/tools/irc.md
CHANGED
|
@@ -9,7 +9,7 @@ Sends short text messages to other live agents in this process and receives thei
|
|
|
9
9
|
</instruction>
|
|
10
10
|
|
|
11
11
|
<when_to_use>
|
|
12
|
-
You
|
|
12
|
+
You SHOULD reach for `irc` proactively when continuing alone is wasteful or wrong. When in doubt, prefer messaging.
|
|
13
13
|
- **Unexpected state.** You hit something the original task did not describe — a missing file, a config that contradicts the assignment, an API behaving differently than you were told, a tool failing in a way that suggests the spec is wrong. DM `0-Main` (or the spawning agent) for guidance instead of guessing.
|
|
14
14
|
- **Blocked by another agent.** A peer holds the file/branch/resource you need, has already started the change you are about to make, or owns a decision you depend on. DM that peer (or broadcast to discover who) before duplicating or stepping on work.
|
|
15
15
|
- **Decision points outside your scope.** A genuine fork in the road that the assignment did not pre-decide (e.g. which of two viable APIs to use, whether to refactor adjacent code). Ask the requester rather than picking unilaterally.
|
package/src/prompts/tools/lsp.md
CHANGED
|
@@ -36,7 +36,7 @@ Interacts with Language Server Protocol servers for code intelligence.
|
|
|
36
36
|
</caution>
|
|
37
37
|
|
|
38
38
|
<critical>
|
|
39
|
-
- You
|
|
40
|
-
- You
|
|
39
|
+
- You MUST use `lsp` for symbol-aware operations (rename, find references, go to definition/implementation, code actions) whenever a language server is available — it is safer and more accurate than text-based alternatives.
|
|
40
|
+
- You NEVER perform cross-file renames with `ast_edit`, `sed`, `rsed`, or manual edits when `lsp` `rename` can do it. Text-based renames miss shadowing, re-exports, and usages in other files.
|
|
41
41
|
- Prefer `lsp` `code_actions` for imports, quick-fixes, and refactors the language server already knows how to apply.
|
|
42
42
|
</critical>
|
|
@@ -42,12 +42,12 @@ Returns success/failure; on failure, error message indicates:
|
|
|
42
42
|
</output>
|
|
43
43
|
|
|
44
44
|
<critical>
|
|
45
|
-
- You
|
|
46
|
-
- You
|
|
47
|
-
- You
|
|
48
|
-
- You
|
|
49
|
-
- If edit fails or breaks structure, you
|
|
50
|
-
-
|
|
45
|
+
- You MUST read the target file before editing
|
|
46
|
+
- You MUST copy anchors and context lines verbatim (including whitespace)
|
|
47
|
+
- You NEVER use anchors as comments (no line numbers, location labels, placeholders like `@@ @@`)
|
|
48
|
+
- You NEVER place new lines outside the intended block
|
|
49
|
+
- If edit fails or breaks structure, you MUST re-read the file and produce a new patch from current content — you NEVER retry the same diff
|
|
50
|
+
- 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.
|
|
51
51
|
</critical>
|
|
52
52
|
|
|
53
53
|
<examples>
|
|
@@ -2,8 +2,8 @@ Reads the content at the specified path or URL.
|
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
4
|
The `read` tool is multi-purpose and more capable than it looks — inspects files, directories, archives, SQLite databases, images, documents (PDF/DOCX/PPTX/XLSX/RTF/EPUB/ipynb), **and URLs**.
|
|
5
|
-
- You
|
|
6
|
-
- For URLs, `read` fetches the page and returns clean extracted text/markdown by default (reader-mode). It handles HTML pages, GitHub issues/PRs, Stack Overflow, Wikipedia, Reddit, NPM, arXiv, RSS/Atom, JSON endpoints, PDFs, etc. You
|
|
5
|
+
- You MUST parallelize reads when exploring related files
|
|
6
|
+
- For URLs, `read` fetches the page and returns clean extracted text/markdown by default (reader-mode). It handles HTML pages, GitHub issues/PRs, Stack Overflow, Wikipedia, Reddit, NPM, arXiv, RSS/Atom, JSON endpoints, PDFs, etc. You SHOULD reach for `read` — not a browser/puppeteer tool — for fetching and inspecting web content.
|
|
7
7
|
|
|
8
8
|
## Parameters
|
|
9
9
|
- `path` — file path or URL (required). Append `:<sel>` for line ranges or raw mode (for example `src/foo.ts:50-200` or `src/foo.ts:raw`).
|
|
@@ -17,6 +17,7 @@ The `read` tool is multi-purpose and more capable than it looks — inspects fil
|
|
|
17
17
|
|`:50-200`|Read lines 50-200|
|
|
18
18
|
|`:50+150`|Read 150 lines starting at line 50|
|
|
19
19
|
|`:20+1`|Read exactly one line|
|
|
20
|
+
|`:5-16,960-973`|Read multiple ranges in one call (comma-separated; ranges sort and merge automatically)|
|
|
20
21
|
|`:raw`|Read verbatim text without anchors or summarization|
|
|
21
22
|
|`:conflicts`|Return a one-line-per-block index of every merge conflict in the file|
|
|
22
23
|
|
|
@@ -55,9 +56,9 @@ Extracts content from web pages, GitHub issues/PRs, Stack Overflow, Wikipedia, R
|
|
|
55
56
|
</instruction>
|
|
56
57
|
|
|
57
58
|
<critical>
|
|
58
|
-
- You
|
|
59
|
-
- You
|
|
60
|
-
- You
|
|
61
|
-
- For specific line ranges, append the selector to `path` (e.g. `path="src/foo.ts:50-200"`, `path="src/foo.ts:50+150"`) —
|
|
62
|
-
- You
|
|
59
|
+
- You MUST use `read` for every file, directory, archive, and URL read. `cat`, `head`, `tail`, `less`, `more`, `ls`, `tar`, `unzip`, `curl`, and `wget` are **FORBIDDEN** for inspection — any such Bash call is a bug, regardless of how short or convenient it looks.
|
|
60
|
+
- You MUST prefer `read` over a browser/puppeteer tool for fetching URL content; only use a browser if `read` fails to deliver reasonable content.
|
|
61
|
+
- You MUST always include the `path` parameter — never call `read` with an empty argument object `{}`.
|
|
62
|
+
- For specific line ranges, append the selector to `path` (e.g. `path="src/foo.ts:50-200"`, `path="src/foo.ts:50+150"`) — NEVER reach for `sed -n`, `awk NR`, or `head`/`tail` pipelines.
|
|
63
|
+
- You MAY use path suffix selectors with URL reads; the tool paginates cached fetched output.
|
|
63
64
|
</critical>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Performs string replacements in files with fuzzy whitespace matching.
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
|
-
- Params
|
|
5
|
-
- You
|
|
6
|
-
- If `old_text` is not unique, you
|
|
7
|
-
- You
|
|
4
|
+
- Params MUST be `{ path, edits }`; `path` is required at the top level and applies to every replacement
|
|
5
|
+
- You MUST use the smallest `old_text` that uniquely identifies the change
|
|
6
|
+
- If `old_text` is not unique, you MUST expand it with more context or use `all: true` to replace all occurrences
|
|
7
|
+
- You SHOULD prefer editing existing files over creating new ones
|
|
8
8
|
</instruction>
|
|
9
9
|
|
|
10
10
|
<output>
|
|
@@ -12,7 +12,7 @@ Returns success/failure status. On success, file modified in place with replacem
|
|
|
12
12
|
</output>
|
|
13
13
|
|
|
14
14
|
<critical>
|
|
15
|
-
- You
|
|
15
|
+
- You MUST read the file at least once in the conversation before editing. Tool errors if you attempt edit without reading file first.
|
|
16
16
|
</critical>
|
|
17
17
|
|
|
18
18
|
<bash-alternatives>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Resolves a pending
|
|
1
|
+
Resolves a pending action by either applying or discarding it.
|
|
2
2
|
- `action` is required:
|
|
3
|
-
- `"apply"` persists the pending
|
|
4
|
-
- `"discard"` rejects the pending
|
|
5
|
-
- `reason` is required and must explain why you chose to apply or discard.
|
|
3
|
+
- `"apply"` persists / submits the pending action.
|
|
4
|
+
- `"discard"` rejects the pending action.
|
|
5
|
+
- `reason` is required and must briefly explain why you chose to apply or discard.
|
|
6
|
+
- `extra` (optional) is free-form metadata passed to the resolving tool. Schema depends on context:
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Valid whenever a pending action exists — either a preview-style staging (e.g. `ast_edit`) or a long-lived approval gate.
|
|
8
9
|
Call fails with an error when no pending action exists.
|
|
@@ -3,4 +3,4 @@ Store one or more facts in long-term memory for future sessions.
|
|
|
3
3
|
Use for durable, reusable knowledge: user preferences, project decisions, architectural choices, anything that improves future responses.
|
|
4
4
|
Ephemeral task state does not belong here.
|
|
5
5
|
|
|
6
|
-
Each item
|
|
6
|
+
Each item MUST be specific and self-contained — include who, what, when, and why. Batch related facts in a single call; they are deduplicated and consolidated.
|
|
@@ -3,10 +3,10 @@ End an active checkpoint. Rewind context to it, replacing intermediate explorati
|
|
|
3
3
|
Call immediately after `checkpoint`-started investigative work.
|
|
4
4
|
|
|
5
5
|
Requirements:
|
|
6
|
-
- `report` is
|
|
6
|
+
- `report` is REQUIRED and must be concise, factual, and actionable.
|
|
7
7
|
- Include key findings, decisions, and any unresolved risks.
|
|
8
8
|
- Do not include raw scratch logs unless essential.
|
|
9
|
-
- You
|
|
9
|
+
- You MUST call this before yielding if a checkpoint is active.
|
|
10
10
|
|
|
11
11
|
Behavior:
|
|
12
12
|
- If no checkpoint is active, this tool errors.
|
|
@@ -17,8 +17,8 @@ Searches files using powerful regex matching.
|
|
|
17
17
|
</output>
|
|
18
18
|
|
|
19
19
|
<critical>
|
|
20
|
-
- You
|
|
20
|
+
- You MUST use the built-in `search` tool for any content search. NEVER shell out to `grep`, `rg`, `ripgrep`, `ag`, `ack`, `git grep`, `awk`, `sed`-for-search, or any other CLI search via Bash — even for a single match, even "just to check quickly", even piped through other commands.
|
|
21
21
|
- Bash `grep`/`rg` loses `.gitignore` semantics, bypasses result limits, and wastes tokens. The `search` tool is faster, structured, and already wired into the workspace — there is no scenario where Bash search is preferable.
|
|
22
22
|
- If you catch yourself typing `grep`, `rg`, or `| grep` in a Bash command, stop and re-issue the lookup through the `search` tool instead.
|
|
23
|
-
- If the search is open-ended, requiring multiple rounds, you
|
|
23
|
+
- If the search is open-ended, requiring multiple rounds, you MUST use the Task tool with the explore subagent instead of chaining `search` calls yourself.
|
|
24
24
|
</critical>
|
package/src/prompts/tools/ssh.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Runs commands on remote hosts.
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
|
-
You
|
|
4
|
+
You MUST build commands from the reference below
|
|
5
5
|
</instruction>
|
|
6
6
|
|
|
7
7
|
<commands>
|
|
@@ -22,7 +22,7 @@ You **MUST** build commands from the reference below
|
|
|
22
22
|
</commands>
|
|
23
23
|
|
|
24
24
|
<critical>
|
|
25
|
-
You
|
|
25
|
+
You MUST verify the shell type from "Available hosts" and use matching commands.
|
|
26
26
|
</critical>
|
|
27
27
|
|
|
28
28
|
<examples>
|
|
@@ -2,14 +2,20 @@ Launches subagents to parallelize workflows.
|
|
|
2
2
|
|
|
3
3
|
{{#if asyncEnabled}}
|
|
4
4
|
- Results are delivered automatically when complete.
|
|
5
|
-
-
|
|
6
|
-
|
|
5
|
+
- The tool result lists the assigned task ids (e.g. `0-AuthLoader`) — those are the live agent ids.
|
|
6
|
+
{{#if ircEnabled}}
|
|
7
|
+
- Coordinate with running tasks via `irc` using those ids. `job cancel` terminates a task and **cannot carry a message** — only use it for stalled/abandoned work.
|
|
8
|
+
- If genuinely blocked on completion, wait with `job poll`; otherwise keep working.
|
|
9
|
+
{{else}}
|
|
10
|
+
- If genuinely blocked on completion, wait with `job poll`; otherwise keep working.
|
|
11
|
+
- Use `job list` to snapshot manager state; `cancel: [id]` only to actually stop a stuck task.
|
|
12
|
+
{{/if}}
|
|
7
13
|
{{/if}}
|
|
8
14
|
|
|
9
15
|
{{#if ircEnabled}}
|
|
10
16
|
Subagents have no conversation history, but they can reach you and their siblings live via the `irc` tool. Front-load every fact, file path, and direction they need in {{#if contextEnabled}}`context` or `assignment`{{else}}each `assignment`{{/if}}.
|
|
11
17
|
{{else}}
|
|
12
|
-
Subagents have no conversation history. Every fact, file path, and direction they need
|
|
18
|
+
Subagents have no conversation history. Every fact, file path, and direction they need MUST be explicit in {{#if contextEnabled}}`context` or `assignment`{{else}}each `assignment`{{/if}}.
|
|
13
19
|
{{/if}}
|
|
14
20
|
|
|
15
21
|
<parameters>
|
|
@@ -24,8 +30,8 @@ Subagents have no conversation history. Every fact, file path, and direction the
|
|
|
24
30
|
</parameters>
|
|
25
31
|
|
|
26
32
|
<rules>
|
|
27
|
-
-
|
|
28
|
-
- **Subagents do not verify, lint, or format.** Every assignment
|
|
33
|
+
- NEVER assign tasks to run project-wide build/test/lint. Caller verifies after the batch.
|
|
34
|
+
- **Subagents do not verify, lint, or format.** Every assignment MUST instruct the subagent to skip all gates and formatters. You run them once at the end across the union of changed files — avoids redundant runs and racing formatter passes.
|
|
29
35
|
{{#if ircEnabled}}
|
|
30
36
|
- Each task: ≤3–5 explicit files. Overlapping file sets are tolerable when peers can coordinate via `irc`, but still fan out to a cluster when the scopes are cleanly separable.
|
|
31
37
|
- No globs, no "update all", no package-wide scope.
|
|
@@ -52,7 +58,7 @@ Parallel when tasks touch disjoint files or are independent refactors/tests.
|
|
|
52
58
|
{{#if contextEnabled}}
|
|
53
59
|
<context-fmt>
|
|
54
60
|
# Goal ← one sentence: what the batch accomplishes
|
|
55
|
-
# Constraints ←
|
|
61
|
+
# Constraints ← MUST/NEVER rules and session decisions
|
|
56
62
|
# Contract ← exact types/signatures if tasks share an interface
|
|
57
63
|
</context-fmt>
|
|
58
64
|
{{/if}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Searches the web for up-to-date information beyond Claude's knowledge cutoff.
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
|
-
- You
|
|
5
|
-
- You
|
|
4
|
+
- You SHOULD prefer primary sources (papers, official docs) and corroborate key claims with multiple sources
|
|
5
|
+
- You MUST include links for cited sources in the final response
|
|
6
6
|
</instruction>
|
|
7
7
|
|
|
8
8
|
<caution>
|
|
@@ -8,7 +8,7 @@ Creates or overwrites file at specified path.
|
|
|
8
8
|
</conditions>
|
|
9
9
|
|
|
10
10
|
<critical>
|
|
11
|
-
- You
|
|
12
|
-
- You
|
|
13
|
-
- You
|
|
11
|
+
- You SHOULD use Edit tool for modifying existing files (more precise, preserves formatting)
|
|
12
|
+
- You NEVER create documentation files (*.md, README) unless explicitly requested
|
|
13
|
+
- You NEVER use emojis unless requested
|
|
14
14
|
</critical>
|