In the last six months, I’ve done everything you can do with the agent. Greenfield generation from scratch, massive refactorings, small updates, targeted refinements, you name it.
Now, early on, when I got into some of the more complex tasks, and often with terminal commands and the way the models execute them, I had issues. But I wrapped rule after rule around all of these things, and then refined those rules, and made them stricter where they needed to be, and added more rules. I normalized my approach to prompting, and refined my prompting, as I learned how the Cursor agent works.
Rules are a big factor here. Insufficient, inadequate or otherwise poor quality rules, leave plenty of loopholes, and the models, being probabilistic in nature and highly non-deterministic, WILL find their way through those loopholes as often as you wold expect. So you have to find and close those loopholes.
I do some rule refinement here and there, especially after I’ve introduced some new thing to the process. But for the most part, a lot of my working with the agent these days, has settled, become much more consistent, and more often than not just works. I think a lot of that, has to do with all the rules I have established.
But I have plenty of success updating existing code. You just have to be more careful, more explicit, and have to make sure you include all the necessary things to ensure the agent and model work properly. For example, most of my work today, has been updating a user defined function in postgres. My initial prompt wasn’t quite clear enough about making sure the agent DID NOT “delete first, rewrite later” (a TERRIBLE problem with EVERY model!) I have some rules that address this, but apparently they were not applied (there are reasons, I have otehr threads addressing this). So, the agent deleted code first, then rewrote it. And it did it really badly. So I had to be clearer in my instructions: “COPY the original code from @this.file and then make only the necessary targeted changes to effect the required improvements.”
Imprecision in, nets imprecision out.
Models are dumb. They have no intelligence. You have to bring the intelligence yourself. If you vaguely instruct a model, then your gonna get vague, imprecise, incorrect, ineffective results.