refactor(coding-agent/prompts): updated system and tool prompts to present
- Updated system and tool prompts to present dedicated tools as preferred defaults rather than absolute prohibitions. - Relaxed the hard-forbidding of shell equivalents for file operations, searching, and editing. - Retained guidance on prioritizing tools for their gitignore semantics, structure, and line-anchoring capabilities.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
### Changed
|
||||
|
||||
- Unified subprocess lifecycle management for mnemopi, speech, tiny-model, and TTS workers
|
||||
- Softened the system-prompt and tool-prompt guidance that hard-forbade reaching for shell equivalents of dedicated tools (`grep`/`rg`, `sed`/`perl -i`, `cat`/`head`/`tail`, `find`/`fd`). The "Specialized Tool Priority" section, the `bash`/`search`/`find`/`read`/`replace` tool prompts, and the FORBIDDEN/NEVER framing now state the dedicated tools as the preferred default rather than an absolute prohibition, so the agent no longer fights itself when a quick shell command is the right call. The opt-in `bashInterceptor` (default off) still hard-blocks these commands for users who enable it.
|
||||
- Refined TUI dashboard and list component layout logic for consistent rendering
|
||||
- Standardized scrollbar behaviors and keyboard navigation across all list components
|
||||
- Optimized internal message framing logic for better performance when handling large data bursts
|
||||
|
||||
@@ -101,17 +101,17 @@ Use tools whenever they improve correctness, completeness, or grounding.
|
||||
{{#if secretsEnabled}}- Redacted `#XXXX#` tokens in output are opaque strings.{{/if}}
|
||||
{{#has tools "inspect_image"}}- Image tasks: prefer `{{toolRefs.inspect_image}}` over `{{toolRefs.read}}` to spare session context.{{/has}}
|
||||
|
||||
# Specialized Tool Priority
|
||||
You MUST use the specialized tool over its shell equivalent:
|
||||
{{#has tools "read"}}- File or directory reads → `{{toolRefs.read}}`, not `cat` or `ls` (a directory path lists entries).{{/has}}
|
||||
{{#has tools "edit"}}- Surgical edits → `{{toolRefs.edit}}`, not `sed`.{{/has}}
|
||||
{{#has tools "write"}}- Create or overwrite → `{{toolRefs.write}}`, not shell redirection.{{/has}}
|
||||
{{#has tools "lsp"}}- Code intelligence → `{{toolRefs.lsp}}`, not blind search.{{/has}}
|
||||
{{#has tools "search"}}- Regex search → `{{toolRefs.search}}`, not `grep`, `rg`, or `awk`.{{/has}}
|
||||
{{#has tools "find"}}- Globbing → `{{toolRefs.find}}`, not `ls **/*.ext` or `fd`.{{/has}}
|
||||
# Specialized Tools
|
||||
Dedicated tools add gitignore semantics, structured output, and line anchors a raw shell command lacks — reach for them first when they fit:
|
||||
{{#has tools "read"}}- File or directory reads → `{{toolRefs.read}}` (a directory path lists entries).{{/has}}
|
||||
{{#has tools "edit"}}- Surgical edits → `{{toolRefs.edit}}`.{{/has}}
|
||||
{{#has tools "write"}}- Create or overwrite → `{{toolRefs.write}}`.{{/has}}
|
||||
{{#has tools "lsp"}}- Code intelligence → `{{toolRefs.lsp}}`.{{/has}}
|
||||
{{#has tools "search"}}- Regex search → `{{toolRefs.search}}`.{{/has}}
|
||||
{{#has tools "find"}}- Globbing → `{{toolRefs.find}}`.{{/has}}
|
||||
{{#has tools "eval"}}- Quick compute → `{{toolRefs.eval}}`; you SHOULD go step by step.{{/has}}
|
||||
{{#has tools "bash"}}- Use `{{toolRefs.bash}}` for terminal work—builds, tests, git, package managers—and pipelines that COMPUTE a fact: `wc -l`, `sort | uniq -c`, `comm`, `diff a b`, checksums. Commands shadowing the tools above are blocked.
|
||||
- Litmus: produces a count, frequency, set difference, or checksum no tool returns → bash. Merely moves, pages, or trims bytes a tool can fetch → use the tool.{{/has}}
|
||||
{{#has tools "bash"}}- Use `{{toolRefs.bash}}` for terminal work—builds, tests, git, package managers—and pipelines that COMPUTE a fact: `wc -l`, `sort | uniq -c`, `comm`, `diff a b`, checksums.
|
||||
- Litmus: produces a count, frequency, set difference, or checksum no tool returns → bash. Otherwise a dedicated tool usually fits.{{/has}}
|
||||
|
||||
{{#has tools "report_tool_issue"}}
|
||||
<critical>
|
||||
|
||||
@@ -14,7 +14,6 @@ Runs bash in a shell session — terminal ops: git, bun, cargo, python.
|
||||
</instruction>
|
||||
|
||||
<critical>
|
||||
- NEVER shell out to fetch, display, list, page, or search what a dedicated tool serves: `cat`/`head`/`tail`/`less`/`more`/`ls` → `read`; `grep`/`rg`/`ag`/`ack` → `search`; `find`/`fd` → `find`; `sed -i`/`perl -i`/`awk -i` → `edit`; `echo >`/heredoc → `write`. Tools keep gitignore semantics, line anchors, structured output shell loses.
|
||||
- NEVER trim or silence output: no `| head -n N`, `| tail -n N`, `| less`, `2>&1`, `2>/dev/null`. stderr already merged; long output auto-truncated, FULL capture kept at `artifact://<id>`.
|
||||
- Pipelines that COMPUTE a new fact are correct bash: `wc -l`, `sort | uniq -c`, `comm`, `cut`, `diff a b`, `shasum`. Litmus: produces a count, frequency table, set difference, or checksum no tool returns → bash. Merely moves or trims bytes a tool can fetch → use the tool.
|
||||
</critical>
|
||||
|
||||
@@ -14,6 +14,3 @@ Matching paths sorted by mtime (newest first), grouped under `# <dir>/` headers
|
||||
Open-ended searches needing multiple rounds of globbing/searching: you MUST use the Task tool instead.
|
||||
</avoid>
|
||||
|
||||
<critical>
|
||||
- You MUST use the built-in Find tool for every file-name lookup. NEVER shell out to `find`, `fd`, `locate`, `ls`, or `git ls-files` via Bash — they ignore `.gitignore`, blow past result limits, and waste tokens.
|
||||
</critical>
|
||||
|
||||
@@ -70,7 +70,6 @@ For `.sqlite`, `.sqlite3`, `.db`, `.db3`:
|
||||
All URI schemes take the same line selectors. `artifact://<id>` recovers full output a bash/eval/tool result spilled or truncated. `history://<agentId>` = agent transcript; bare `history://` lists agents.
|
||||
|
||||
<critical>
|
||||
- MUST use `read` for every file/directory/archive/URL inspection. `cat`, `head`, `tail`, `less`, `more`, `ls`, `tar`, `unzip`, `curl`, `wget` are FORBIDDEN bash calls, however convenient.
|
||||
- Line ranges go in the selector (`path="src/foo.ts:50-200"`) — NEVER `sed -n`, `awk NR`, or `head`/`tail` pipelines.
|
||||
- Line ranges go in the selector: `path="src/foo.ts:50-200"`.
|
||||
- Summary footer names elided ranges? Re-issue ONLY those ranges. NEVER guess `..`/`…` content.
|
||||
</critical>
|
||||
|
||||
@@ -25,5 +25,5 @@ For pattern-addressed bulk changes, bash is more efficient:
|
||||
|Bulk replace across files|`sd 'pattern' 'replacement' **/*.ts`|
|
||||
|
||||
Use Replace when _content itself_ identifies location; use `ast_edit` for structure-aware codemods.
|
||||
NEVER use `sed -i`/`perl -i`/heredoc redirection for edits — those calls are blocked; use this tool or `write`.
|
||||
For in-place edits prefer this tool or `write` — you get a diff preview and fuzzy matching.
|
||||
</bash-alternatives>
|
||||
|
||||
@@ -17,6 +17,5 @@ Searches files using regex.
|
||||
</output>
|
||||
|
||||
<critical>
|
||||
- MUST use built-in `search` for any content search. NEVER shell out to `grep`, `rg`, `ripgrep`, `ag`, `ack`, `git grep`, `awk`, `sed`-for-search, or any CLI search via Bash — not even for one match or a quick check.
|
||||
- Open-ended search needing multiple rounds? MUST use the Task tool with the explore subagent, NOT chained `search` calls.
|
||||
</critical>
|
||||
|
||||
Reference in New Issue
Block a user