[BUG] #memory adds entries to incorrect section in CLAUDE.md

Resolved 💬 6 comments Opened Nov 3, 2025 by santoshmano Closed Jan 11, 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?

Description

When using #memory to store project-specific information, Claude Code incorrectly appends the memory entry to the last section of CLAUDE.md rather than placing it in an appropriate or dedicated section.

Impact

  • Creates misleading context for anyone reading the CLAUDE.md file
  • Memories appear semantically associated with unrelated sections
  • Could confuse Claude itself about the context of these instructions

What Should Happen?

Expected Behavior

The memory entry should be:

  • Added to a dedicated "Project Memories" or "Project Context" section
  • OR appended to a logical general section
  • NOT inserted into unrelated sections like "Commit message format"

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

  1. Initialize a new project with /init (creates CLAUDE.md)
  2. Work on the project for a while
  3. Use #memory to add a project memory, e.g., "Don't ask me permission to run sed, awk commands in this project"
  4. Check the CLAUDE.md file

Actual Behavior

The memory entry is appended to whatever section happens to be last in the file, causing semantic confusion. In my case, it was added to the "Commit message format" section:

Commit message format:

  • Use conventional commits (feat:, fix:, docs:, etc.)
  • Keep first line concise (50 chars max)
  • Include detailed explanation in body if needed
  • Don't ask me permission to run sed, awk commands in this project

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.31

Platform

Other

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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