[BUG] Claude Code frequently removes existing code comments near edited lines

Resolved 💬 3 comments Opened Feb 2, 2026 by ntsk Closed Mar 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When editing code, Claude Code frequently removes existing comments near the lines being modified, even though the user did not ask to remove or change any comments.

Comments often contain important context, explanations, or documentation that should not be silently deleted.

What Should Happen?

Claude Code should preserve existing code comments unless explicitly asked to modify or remove them.

Error Messages/Logs

No error messages. The comments are silently removed.

Steps to Reproduce

  1. Have a code file with comments near the code you want to modify
  2. Ask Claude Code to make a change to the code (not the comments)
  3. Observe that existing comments near the changed lines are removed in the edit

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.29

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗