[FEATURE]: select/replace tools #6987

Open
opened 2026-02-16 18:05:49 -05:00 by yindo · 1 comment
Owner

Originally created by @koush on GitHub (Jan 20, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The search/replace mechanism that has become the defacto workflow for edits in all agentic tools has a couple problems:

The LLM has to perfectly recall and generate the code it wants to replace in full. Granted, the edit tool has lenient matching here.
LLM token generation/output is an order of more expensive and several order of magnitudes slower than prefill/input.
Failures are expensive and slow. If the match fails, the entire tool call needs to be reexecuted.

Originally created by @koush on GitHub (Jan 20, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request The search/replace mechanism that has become the defacto workflow for edits in all agentic tools has a couple problems: The LLM has to perfectly recall and generate the code it wants to replace in full. Granted, the edit tool has lenient matching here. LLM token generation/output is an order of more expensive and several order of magnitudes slower than prefill/input. Failures are expensive and slow. If the match fails, the entire tool call needs to be reexecuted.
yindo added the discussion label 2026-02-16 18:05:49 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 20, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #266: gemini doesn't handle edit tool very well
  • #6838: Tool.edit should recieve json object
  • #4200: Gemini doesn't find edit tool
  • #2529: Idea: replace edit tool input string with formatted code to gaslight the model to think it generated formatted code and have less edit failures

These issues discuss similar pain points with the current edit tool mechanism, including LLM difficulties with exact code matching, edit failures requiring retries, and token inefficiency. Your proposal for select/replace tools directly addresses these underlying problems.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 20, 2026): This issue might be a duplicate of existing issues. Please check: - #266: gemini doesn't handle edit tool very well - #6838: Tool.edit should recieve json object - #4200: Gemini doesn't find edit tool - #2529: Idea: replace edit tool input string with formatted code to gaslight the model to think it generated formatted code and have less edit failures These issues discuss similar pain points with the current edit tool mechanism, including LLM difficulties with exact code matching, edit failures requiring retries, and token inefficiency. Your proposal for select/replace tools directly addresses these underlying problems. Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6987