Replies: 2 comments 14 replies
-
|
A verification is actually never required, because Serena's replacement tool is extremely robust: In particular, it will fail if the regex match is ambiguous (overlapping matches) or an unexpected number of matches exists. We spent a lot of time optimising the tool to make it LLM/fool-proof, also eliminating the need to apply escapings in the replacement text. We explicitly instruct the LLM not to check the results of replacements in the
So the only thing I would recommend trying is to more strongly discourage the checking of replacements. It is literally always unnecessary for the |
Beta Was this translation helpful? Give feedback.
-
|
Btw. while we are here. I see often a higher token usage because the LLM is doing many symbol updates / regex in the same quite small file. Instructing the LLM to do a full rewrite if a. the file is small (< ~ X lines) and b. there are more then Y replacements needed in the same file seems to improve the behaviour. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Im not sure if it is just Claude Desktop or my environment. In my current project (python) the LLM very often does symbolic edits / regex needle operations, reads the file after for verification and needs to redo the regex till finally it decides to rewrite the whole file.
Im excluding here the "why it missed" part and focus just on token efficiency:
The first part (regex / verification) could be done with just one tool call instead of two. The *set tools with needle function returns a diff with what was changed (+/- X lines for orientation), that gives the LLM a proper verification without needed further tool calls (if it suceeded). I did this already on a MCP im working on and it seems to be quite sucessful. I integrated also a bool to switch off this function on demand. For pure insert or replacement updates no diff is required
Beta Was this translation helpful? Give feedback.
All reactions