diff options
Diffstat (limited to '.rules')
| -rw-r--r-- | .rules/changelog/2026-03/24/14.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/.rules/changelog/2026-03/24/14.md b/.rules/changelog/2026-03/24/14.md new file mode 100644 index 0000000..bfa9c2f --- /dev/null +++ b/.rules/changelog/2026-03/24/14.md @@ -0,0 +1,33 @@ +# Improve edit_file tool prompts, empty-file support, and approval details + +## Files Changed + +- `src/ollama-client.ts` +- `src/tools.ts` +- `src/chat-view.ts` +- `styles.css` + +## Changes + +### Improved system prompt for edit_file workflow (`ollama-client.ts`) +- Expanded `TOOL_SYSTEM_PROMPT` with a mandatory numbered workflow: get path, read file, copy exact text, then edit. +- Added explicit rules: never skip reading, never guess file contents, never leave old_text empty on non-empty files. +- Documented the empty-file exception: old_text may be empty only when the file itself is empty. + +### Improved edit_file tool description and parameters (`tools.ts`) +- Updated the `edit_file` function description to instruct the model to call `read_file` first. +- Documented the empty-file special case in both the function description and the `old_text` parameter description. +- Updated `executeEditFile` to allow empty `old_text` when the file is truly empty (writes initial content). +- When `old_text` is empty but the file has content, returns a descriptive error guiding the model to read the file first. +- Improved error messages on match failure to remind the model to read the file first. + +### Added edit details to approval prompt (`chat-view.ts`) +- The `edit_file` approval prompt now includes a collapsible "Review changes" section (expanded by default). +- Shows labeled "Old text" and "New text" blocks so the user can review the full change before approving. +- Empty old_text displays "(empty — new file)" placeholder. + +### Added edit details to tool call summary (`chat-view.ts`) +- The `edit_file` tool call details section now shows structured "File", "Old text", and "New text" labels instead of raw JSON args. + +### Added CSS for tool call labels (`styles.css`) +- Added `.ai-organizer-tool-call-label` styling for the labeled sections in edit_file details. |
