I Deleted 168,000 Lines of Comments. My AI Agent Didn't Notice
I removed every comment from our codebase—about 168,000 lines—and had Claude Code build the same features on both versions, three times each. The code quality was identical, and on a small task the agent even used 22% fewer tokens without comments. Comments don't help or hurt AI agents, so keep them only for human readers.
If I had picked one run from each branch, I could have written two opposite blog posts.
- phil-martin
This is so interesting! I would like to see the same experiment, but with these variations:
- All the comments removed (the blog post)
- Half the comments removed
- 10% of the comments replaced with slightly incorrect comments
- 10% of the comments replaced with very incorrect comments
- 10% of the comments replaced with slightly incorrect comments
- 90% of the comments removed, 10% remain but are very incorrect
And variations like that
Test to see where the inflection point is for correctness, token usage and other things
- skeledrew
Of course quality isn't affected... that much (once AGENTS.md is maintained). Where I imagine the difference would been seen the most is in the number of tool calls, and whether the results are useful or not. My prediction is that a codebase with comments - which are kept updated - leads to fewer useless tool calls over time. The benefit stacks, particularly as codebase complexity increases, and across sessions. I've seen enough evidence of this in my projects that I'd rather let the agent comment as it likes (though I imagine it could be even better if there was guidance on ensuring comments don't go stale, as an agent in a fresh session hitting a stale comment can be worse than no comment).
- andyjohnson0
> Almost a third of our source code was comments. I deleted all of them and asked an AI agent to build the same features on both versions of the codebase, three times each. The code it wrote was just as good with or without comments.
Seems like this might be another example of The Bitter Lesson [1]:
"The bitter lesson is the observation in artificial intelligence that, in the long run, general approaches that scale with available computational power tend to outperform ones based on domain-specific understanding because they are better at taking advantage of the falling cost of computation over time."
AIs don't need comments that are designed to work around human cognitive limitations. They're quite happy to just crunch the code and extract the meaning.