[BUG] # [insert memory] command overwrites CLAUDE.md instead of appending to it

Resolved 💬 4 comments Opened Jun 6, 2025 by jm7610 Closed Dec 10, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [X] Other: Claude Code
  • Claude CLI version: v1.0.16
  • Operating System: macOS 15.5
  • Terminal: Terminal App

## Bug Description
The # [insert memory] terminal command completely overwrote the CLAUDE.md file instead of appending new content to it, resulting in loss of all existing project documentation and guidance.

## Steps to Reproduce

  1. Have an existing CLAUDE.md file with comprehensive project documentation (multiple sections,~800+ lines)
  2. Use the # [insert memory] command in terminal to add a new memory/guidance
  3. Check the CLAUDE.md file contents

## Expected Behavior
The # [insert memory] command should:

  • Append the new memory/guidance to the existing CLAUDE.md file
  • Preserve all existing content

## Actual Behavior
The # [insert memory] command:

  • Completely overwrote the entire CLAUDE.md file
  • Replaced all existing content with only the new memory
  • Resulted in a file with just a few lines instead of the original comprehensive documentation

Example of what happened:

  • Original CLAUDE.md: ~800+ lines with sections for pipeline architecture, development principles, troubleshooting, etc.
  • After # [insert memory]: Only 8 lines remaining with just the header and single new memory

## Additional Context
This is a critical issue because:

  • CLAUDE.md files often contain essential project-specific instructions that guide Claude Code's behavior
  • The documentation may include architectural decisions, coding standards, and complex workflows that are difficult to recreate
  • Users may not realize their documentation has been overwritten until they notice unexpected behavior

Suggested improvements:

  1. Make # [insert memory] append rather than overwrite
  2. Add a confirmation prompt if overwriting will occur
  3. Create automatic backups before modifying CLAUDE.md

View original on GitHub ↗

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