Skip to content

Conversation

@sandipwane
Copy link
Owner

Instead of sending entire file contents on every edit, the LLM can now
use apply_diff to make targeted changes by specifying old_string and
new_string. This significantly reduces token usage and improves
performance when editing large files.

Changes:

  • Add new apply_diff tool with old_string/new_string replacement
  • Support replace_all option for multiple occurrences
  • Add validation for file existence and string matching
  • Display byte count differences in output
  • Update write tool description to guide LLM to prefer apply_diff

claude and others added 12 commits November 7, 2025 08:53
Instead of sending entire file contents on every edit, the LLM can now
use apply_diff to make targeted changes by specifying old_string and
new_string. This significantly reduces token usage and improves
performance when editing large files.

Changes:
- Add new apply_diff tool with old_string/new_string replacement
- Support replace_all option for multiple occurrences
- Add validation for file existence and string matching
- Display byte count differences in output
- Update write tool description to guide LLM to prefer apply_diff
Added a comprehensive system prompt that instructs the agent on:
- When to use apply_diff vs write (prefer apply_diff for edits)
- Best practices for file operations (read before edit)
- Proper usage of bash tool with descriptions and timeouts
- Emphasis on being precise with whitespace in apply_diff

This will help the agent make better decisions about which tools to use
and significantly reduce unnecessary token usage by preferring targeted
edits over full file rewrites.
- Added biome.json configuration for linting and formatting rules.
- Updated package.json to include @biomejs/biome as a dev dependency.
- Enhanced index.ts with improved tool descriptions and consistent formatting.
- Refactored code for better readability and maintainability.
- Updated local settings for streamlined permissions management.
- Replaced the existing system prompt with a new version that provides clearer instructions for tool usage.
- Emphasized best practices for file operations, including reading before editing and using apply_diff for modifications.
- Improved clarity on the usage of the bash tool and error handling.
- Aims to optimize agent performance and reduce token usage by promoting targeted edits.
- Changed CLI version from v0.2 to v0.3 in the main function for clarity.
- Removed outdated comment regarding the system prompt and refined the prompt for better user guidance.
- Updated TOOL_DESCRIPTIONS to use string literals instead of arrays for better clarity and consistency.
- This change enhances the maintainability of the code and aligns with previous formatting improvements.
- Introduced a new `bundle.ts` script to build the coding-agent binary for the current platform.
- Enhanced `index.ts` with ANSI color-coded logging for added and removed lines in diffs.
- Updated `package.json` to include a new script for bundling.
- Modified local settings to expand permissions for Bash commands.
- Modified the build script in `bundle.ts` to reflect the new binary name `chai-cli` and include the version from `package.json`.
- Enhanced logging to display the version during the build process, improving clarity on the output binary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants