Delete the comments: I’ve gone on a tear with these recently because they’re nothing but trouble.
The absolute least worst outcome is they chew up your token budget. But what tends to happen, and this is much more serious, is they poison future work and make further modification of the codebase more burdensome and error prone.
> But what tends to happen, and this is much more serious, is they poison future work and make further modification of the codebase more burdensome and error prone.
Agreed.
Probably better to add whatever instructions it takes so that the agent doesn't write comments, at all, ever. If you need comments to understand the agent's code, the necessary information should already be in a conversation somewhere; and you should summarize it yourself, because the comment will be for your own benefit. Otherwise you are letting past-agent steer future-agent more or less at random.
Absolutely. IMO, comments can explain historical reasoning for the code, but refactorings can benefit heavily from rethinking ideas from scratch, as opposed to trying to follow the same reasons. LLMs tend to be misguided by comments, probably by treating them as instructions. Ergo, get rid of them.
I completely block all LLM comments via pi extension, it makes using them significantly more enjoyable. If the LLM wants to add a comment it must ASK me explicitly to do so.
Seeing LLM comments in other peoples code is very upsetting because theres just so much meaningless noise.
Why delete comments! Constrained grammar! Make invalid state unrepresentable.