Refactor mode for Agent

I can’t trust Agent for refactoring because it gets creative with implementation.
Refactoring should be strictly mechanical transformation based on syntax tree. Only deterministic precise changes allowed.
If Agent was able to operate an AST-based tool, we could let it bang away and have confidence it didn’t slip in creative decisions.

Hey, you should be able to be super opinionated on how it does your refactoring in your instructions, and it should follow suite.

Project rules (here) may also come in handy!

Thanks @danperks , I use .cursorrules, and am looking forward to using the new rules features.
The problem that I encounter has to do with the code generation model. It fails to implement what the Agent is trying to accomplish, particularly for large files. Gen AI doesn’t seem like the best tool for search/replace and mechanistic refactor. I have had it completely trash large files in the ‘apply code’ step. And it will generally miss instances when doing bulk rename/refactor.

The agent could be more precise and consistent if it had additional tools at its disposal for code modification. JetBrains has had excellent refactor tools for decades, and I’m sure there’s a vscode extension I should pick up.
It would be great if the Agent had access to such tooling. And more efficient token-wise.

I agree that the kind of repetitive ‘search and replace’ tasks are not great when attempted by LLMs, and I think the best thing to do there is to lean on the editor itself, or extensions to help do what is needed.