[KongchangAI]
· 2 min read· 1,220 words

Deleted 168,000 Lines of Comments and My AI Agent Didn't Notice a Thing

Deleted 168,000 Lines of Comments and …

Deleting 168,000 lines of comments went unnoticed by an AI Agent, exposing its blind spot in code understanding.

A developer deleted 168,000 lines of comments from his project, yet his AI coding assistant continued working normally, completely unaware of the massive change. The article points out that current AI programming tools primarily retrieve relevant code snippets to inject as context, relying more on structural signals like function signatures, type definitions, and call relationships, while comments carry extremely low weight in vector retrieval and may even be filtered out as noise. This exposes three problems: the false sense of abundance in context windows, the breakdown of knowledge transfer, and Agents' lack of continuous global cognition of projects. The article argues that comments are far more valuable for human collaboration than for AI understanding, and suggests extracting key design decisions into independent documents or knowledge bases so AI can find them through clearer retrieval paths.

A Thought Prompted by Deleting Comments

A developer shared an experiment on Hacker News: after deleting 168,000 lines of commented-out code from his project, the AI coding assistant (AI Agent) he relied on daily showed absolutely no awareness of this massive change in subsequent work. This seemingly simple operation directly exposed a key blind spot in the depth of code understanding of current AI programming tools.

What does 168,000 lines mean? At 80 characters per line, that's roughly 13 million characters of text removed. For human developers, comments carry design intent, business logic explanations, and lessons learned from pitfalls—deleting them is equivalent to erasing a large amount of the project's "tacit knowledge." But the AI Agent's response was—to continue working normally, as if nothing had happened.

What Does AI Actually "See"?

The core issue here isn't whether the AI Agent is smart enough, but how it actually processes code. The working mechanism of most current AI programming tools is: retrieve relevant code snippets when needed, inject them as context into the prompt, then generate completions or modification suggestions.

There's a key difference here: comments have completely different value for AI than for humans. When humans read code, comments are a shortcut to understanding intent; when AI reads code, it tends to rely more on structural signals like function signatures, type definitions, call relationships, and naming patterns. Comments often carry very low weight in vector retrieval, and may even be filtered out as "noise" during preprocessing.

This explains why after deleting 168,000 lines of comments, the AI Agent could still complete tasks normally—it never treated those comments as core evidence in the first place.

What is vector retrieval? The retrieval mechanism that most current AI programming tools rely on works by converting code snippets (functions, code blocks, comments, etc.) into high-dimensional vectors through embedding models, then returning the snippets most relevant to the current task based on semantic similarity. This process has several hidden pitfalls: first, structural information is lost during vectorization—a piece of logically complex code may be compressed into a vector whose details are hard to distinguish; second, similarity is relative, and the semantic distance between comments and code body is often large, so they are naturally at a disadvantage in ranking; third, the "target" of retrieval is determined by the needs of the generation stage—if the model doesn't proactively realize it needs design-intent information, it won't go looking for comments. These three factors combined explain why after massive comment deletion, the AI Agent's retrieval results and generation behavior still appeared "normal"—it was already mainly relying on vector signals from the code body.

What is a context window? The context window refers to the upper limit of tokens a model can read simultaneously in a single inference, often mistakenly thought of as the total capacity of "working memory." In reality, it's just the input limit for a single request—it doesn't mean the model can continuously remember the entire codebase. Developers often have a "false sense of abundance": believing that if they open the context window wide enough, the model will understand the entire project. But what gets stuffed into the window depends on retrieval and concatenation strategies, not on the model actively scanning. Even if all comments are preserved in the codebase, as long as the retrieval step doesn't pick them out, the model effectively hasn't seen them during generation. Therefore, context window size and "understanding the project" are not directly equivalent—what truly determines understanding quality is retrieval, ranking, and injection methods.

What Problems Does This Expose

The false sense of abundance in context windows. Many developers believe that giving AI a sufficiently large context window means it can "understand the entire project." But this experiment shows that even if information genuinely exists in the codebase, AI won't necessarily actively use it. It retrieves what it considers relevant, and comments simply aren't in its priority list.

The breakdown of knowledge transfer. Comments often contain decision rationale that the code itself cannot express, such as "why not use the more elegant approach B here—because approach B crashes under a certain edge condition." When this information is deleted, the AI Agent won't raise an alarm, but the next developer who takes over or the next round of AI-generated code might fall into the same pit.

Agents lack global awareness. A true "agent" should be able to perceive major changes in project structure. When 168,000 lines of text disappear, the codebase's retrieval index, file structure, and even statistical characteristics undergo dramatic changes. The AI Agent's non-reaction shows that it hasn't established continuous global cognition of the project—it's merely performing local pattern matching.

What This Means for Developers

This isn't to say comments can be deleted casually. On the contrary, the conclusion is the opposite: comments are more important than many people think, but their importance is mainly reflected at the human collaboration level, not the AI understanding level.

If you're using AI-assisted programming, this incident suggests several practical approaches:

First, don't treat comments as content "written for AI to read." Documents, design specifications, and architecture decision records—materials with higher structural organization—may be more valuable to AI.

Second, regularly check whether AI-generated code truly understands the project context. It may still "perform normally" after you've deleted large amounts of comments, but that doesn't mean it understands your intent.

Third, consider extracting key design decisions from comments and placing them in independent documents or knowledge bases, so AI can find them through clearer retrieval paths.

Deeper Implications

The discussion on Hacker News, though brief, points to a larger issue: how far are we from AI Agents that can truly "understand" codebases.

Current AI programming tools excel at local tasks—completing a function, fixing a bug, generating a test. But their understanding of projects is fragmented, passive, and retrieval-driven. A senior human engineer would notice during a code review that "how did all the comments in this module disappear?" while an AI Agent won't, because it never truly "saw" the entire project.

The value of this experiment lies in the fact that it used an extreme, quantifiable method to put this problem on the table. When 168,000 lines of comments disappear, humans are shocked, AI is indifferent—this contrast alone is worth serious consideration by anyone who relies on AI programming.

One-line Summary

Deleting 168,000 lines of comments went unnoticed by an AI Agent, exposing its blind spot in code understanding.

Paragraph Summary

After a developer deleted 168,000 lines of comments from his project, the AI coding assistant continued working normally, completely unaware of the massive change. The article points out that current AI programming tools primarily work by retrieving relevant code snippets to inject as context, relying more on structural signals like function signatures, type definitions, and call relationships, while comments carry extremely low weight in vector retrieval and may even be filtered out as noise. This exposes three problems: the false sense of abundance in context windows, the breakdown of knowledge transfer, and Agents' lack of continuous global cognition of projects. The article argues that comments are far more valuable for human collaboration than for AI understanding, and suggests not treating comments as content written for AI, but rather extracting key design decisions into independent documents or knowledge bases so AI can find them through clearer retrieval paths.

#AI Agent#code comments#vector retrieval#context window#AI programming tools
Share:

Related articles