4 ms·
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 b
by bartread 1mo 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.
- LoganDark 1mo agoAbsolutely. 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.
- acedTrex 1mo agoI 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.
- copperx 1mo agoWhat's the extension, please?
- gessha 1mo agoAuthor probably cobbler it together themselves.
- furst-blumier 1mo agoWhich extension is it?
- acedTrex 1mo agoIts a personal extension i wrote myself, maybe I should put it up somewhere.. Its so simple though i dont know if its worth it vs just "go build it yourself"
- zahlman 1mo agoWhat happens when the LLM tries to defy this? Is the file-write rejected, or does the extension just strip comments from what gets written, or just what?
- acedTrex 1mo agoI have it set up to pop up an approval dialogue that shows me the comments its trying to write and if i reject it the model is told essentially "no comments allowed, retry the patch without them." It usually only takes one of those in the context for the model to reorient its behavior for future edits.
- zahlman 1mo ago> 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.
- trenchgun 1mo agoWhy delete comments! Constrained grammar! Make invalid state unrepresentable.
- vaylian 1mo agoComments 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.
- ThunderSizzle 1mo agoI 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)