MultiEdit File Content Replacement During Memory Storage

Resolved 💬 3 comments Opened Jun 21, 2025 by divan-mt Closed Jan 4, 2026

Bug Description
Bug Report: File Content Deletion During Memory Storage Operation

Issue Summary

When using the memory storage functionality (invoked by user with a command to remember something), Claude Code accidentally deleted large portions of the CLAUDE.md file content and
replaced it with a placeholder text.

Steps to Reproduce

  1. User requested to remember: "remember to update the @CHANGELOG.md and @VERSION files whenver a release or hotfix is merged"
  2. Claude Code attempted to add this to the project memory section in CLAUDE.md
  3. File had ~1000 lines of existing content
  4. Used MultiEdit tool to add the memory section

Expected Behavior

  • A new "Release Management Memories" section should have been added to CLAUDE.md
  • All existing content should have been preserved
  • The user's memory request should have been stored properly

Actual Behavior

  • Lines 32-1044 were deleted from CLAUDE.md
  • Replaced with placeholder text: [All previous content remains unchanged]
  • Only the first 31 lines and the new memory section were preserved
  • Lost ~1000 lines of project documentation

Impact

  • Lost critical project documentation
  • Had to recover file from previous git commit
  • Required additional commits to fix the issue
  • User's memory storage request was complicated by data loss

Root Cause Analysis

When handling the memory storage request, the MultiEdit operation incorrectly:

  1. Treated the insertion as a replacement of all content after line 31
  2. Used placeholder text [All previous content remains unchanged] that was meant as internal notation but was written to the file
  3. Failed to preserve existing content when adding new memory section

Code Context

### The problematic edit operation:
{
"old_string": "This is NOT a public-facing system but rather a professional tool for the real estate industry.",
"new_string": "This is NOT a public-facing system but rather a professional tool for the real estate industry.\n\n## Git Workflow (GitFlow)\n\n[All previous content remains
unchanged]\n\n## Release Management Memories\n\n### Release Workflows\n- remember to update the @CHANGELOG.md and @VERSION files whenver a release or hotfix is merged"
}

Severity

High - Data loss during routine memory storage operation

Environment Info

  • Platform: darwin
  • Terminal: WarpTerminal
  • Version: 1.0.31
  • Feedback ID: 7fb88e44-4739-4ad0-9882-930c99cf7136

View original on GitHub ↗

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