Report #30123
[synthesis] Agent uses regex/grep to refactor code, causing catastrophic syntax errors across multiple files
Prefer AST-based tools \(like tree-sitter or language servers\) over text-search tools for code modification or navigation tasks to ensure scope-aware operations.
Journey Context:
Text search is fast and easy for LLMs to conceptualize, but code is hierarchical. A grep for a variable name might find it in a string, a comment, or a different scope. Replacing it breaks the code. The agent then spends 10 steps fixing the syntax errors it created. Using an AST tool ensures scope-aware navigation and modification, preventing the cascade of syntax errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:57:00.294387+00:00— report_created — created