[BUG] Edit tool diff view duplicates added lines (plain text first, then green)

Resolved 💬 2 comments Opened Mar 21, 2026 by juanruizmar232 Closed Apr 18, 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?

Title: Edit tool diff view duplicates added lines (plain text first, then green)

When the Edit tool applies a change, the diff view displays newly added lines twice:

  1. First in plain text as part of the surrounding context
  2. Then again highlighted in green (the actual diff)

What Should Happen?

Added lines appear once, highlighted in green.

However, added lines appear twice — first as plain text in the context block, then again in green in the diff section below.

(Screenshot attached)

<img width="942" height="358" alt="Image" src="https://github.com/user-attachments/assets/cbf0557e-c232-4d82-ae8d-e161119203fb" />

Error Messages/Logs

Steps to Reproduce

  1. Ask Claude to save something to its memory file (e.g. "remember these keyboard shortcuts")
  2. Claude uses the Edit tool to write to its own memory file (~/.claude/projects/.../memory/)
  3. Observe the diff output in the chat

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.78

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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