← Back to context

Comment by bartread

16 hours ago

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.

I use comments for external domain constraints (e.g. this table has three types of records in them that we use for different purposes - I might have the LLM agent be a bit thorough and clearer with the explanation, but I found those type of comments very much helped future iterations)

> 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.

  • Comments explain why the design is the way it is. If you later need to refactor the code, you probably won't remember the reasoning behind it and you don't know if it will be safe to remove or change parts of the design.