Is there a name for the type of comments agents add where they leak the prompt?
9
xxdennis about 3 hours ago 3 comments
HI version is available. Content is displayed in original English for accuracy.
This is a stupid example to illustrate what I mean. Say you have this code:
def create_background(width: int, height: int) -> Image:
...
You tell the agent to use default values for create_background, the same as in create_screen. It changes the code to: # Now create_background params have default values, the same as create_screen in screen.py
def create_background(width: int = DEFAULT_WIDTH, height: int = DEFAULT_HEIGHT) -> Image:
...
The unnecessary comment is a staple of vibed code, but the tone also annoys me because it leaves behind the prompt. It words comments based on what it was asked to do, not in a timeless manner.I keep telling people in code reviews to remove unnecessary comments, and I feel I lack the vocabulary to express why this is bad.

Discussion (3 Comments)Read Original on HackerNews
I've heard the argument that leaving these comments in, helps support future AI code generation. In this example, it was important to you at the time you made the change that create_* functions have defaults, so having this in the code captures that knowledge for later agents. It's similar to a more general argument that you should leave (correct) AI-generated code alone because it will be easier for the AI to "understand" code it generated that your modified version of it.
I see the validity in these arguments, but I don't think we should be so deferential to these models. The first part of this comment ("Now create_background params have default values") is completely redundant with the function signature and as no place in the code. The second part ("the same as create_screen") is genuine knowledge that is worth capturing for the agent, but it should be captured at a higher level doc about the codebase, rather than tacked onto some arbitrary function as a comment.