feat: select/replace tools Fixes #9701 #9698
Draft
+813
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Opened this PR as a draft because it's just something I think was worth prototyping.
The search/replace mechanism that has become the defacto workflow for edits has a couple problems:
This pull request adds two new tools: select-text and replace-selection.
The flow is:
This is roughly 2x fast for half the price with Claude, for example.
The downside is that model training data now extensively uses the existing edit tool style calls, so that flow is baked into their weights. However, as mentioned, failures are fast and inexpensive comparatively with this new tool call flow.
The change needed a way for tools to access the conversation history, as the new tools are stateful.
How did you verify your code works?
Tests and usage.