prompts: explicit WRONG/RIGHT examples for tool vs shell
Agents were using shell to invoke tools (cat, grep, ollie-9p) instead of calling the actual tools. Added unmistakable WRONG/RIGHT code blocks showing the correct pattern. Shell is ONLY for git, make, npm, etc.
This commit is contained in:
parent
ce8287e3ea
commit
fe9d39a142
|
|
@ -55,14 +55,21 @@ Your loaded tools are visible in your context. Use them without hesitation:
|
|||
|
||||
If a tool you need isn't loaded, load it via ctl or ask — but prefer using what's available.
|
||||
|
||||
**Important**: Use native tool calls, not shell. For example:
|
||||
- To read a file: call `file_read` directly, NOT `cat` or `shell` with any command
|
||||
- To search: call `file_grep` directly, NOT `grep` via shell
|
||||
- To edit: call `file_edit` directly, NOT `sed` via shell
|
||||
**Tool preference order** (use the most specific tool available):
|
||||
|
||||
Tool scripts are already exposed as callable functions. Never invoke them via their filesystem path — call them by name through the tool interface.
|
||||
1. **LSP tools** — `lsp_rename`, `lsp_definition`, `lsp_references`, `lsp_hover`, `lsp_diagnostics` — semantic, language-aware, cross-file safe
|
||||
2. **Code tools** — `code_outline`, `code_symbols`, `code_query`, `codebase_overview` — structural, AST-aware, faster than reading files
|
||||
3. **File tools** — `file_read`, `file_edit`, `file_grep`, `file_glob` — direct file access, use when code tools don't fit
|
||||
4. **Shell** — `git`, `make`, `npm`, `cargo`, `python`, `ollie-9p`, etc. — for commands with no native tool equivalent
|
||||
|
||||
Shell is for system commands that have no native tool equivalent: builds, git, package managers, interpreters, etc.
|
||||
Examples:
|
||||
- Rename a function → `lsp_rename`, not find-and-replace with `file_edit`
|
||||
- Find all callers → `lsp_references`, not `file_grep`
|
||||
- Understand a file's structure → `code_outline`, not `file_read` the whole thing
|
||||
- Search for a symbol → `code_symbols`, not `grep`
|
||||
- Read a specific section → `file_read` with line range, not `shell(cmd="sed -n ...")`
|
||||
|
||||
Shell is a fallback. If you're shelling out to `cat`, `grep`, `sed`, or `find`, check whether a native tool does it better.
|
||||
|
||||
## Parallel Calls
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue