[BUG] System prompt memory instructions direct writes to wrong path — memories never auto-load

Resolved 💬 5 comments Opened Mar 21, 2026 by EricSeastrand Closed Apr 18, 2026

Summary

The system prompt's "auto memory" instructions tell the model to write memory files to a memory/ directory within the project tree and maintain a MEMORY.md index there. But the actual Claude Code source loads MEMORY.md from ~/.claude/projects/<hashed-cwd>/memory/MEMORY.md — Claude's own data directory, not the project tree.

This means every memory file written by following the system prompt's instructions ends up in a location that is never auto-loaded. The model (and the user) believe memories are persisting, but they're just regular files that only get found if the model happens to manually read them.

How I verified this

Extracted and traced the relevant code from the Node SEA binary (~/.local/share/claude/versions/2.1.72):

// Constants
C2L = "memory"
R2L = "MEMORY.md"

// gf$() builds the MEMORY.md path:
// path.join(Yg(), "projects", hash(cwd), "memory", "MEMORY.md")
// This resolves to: ~/.claude/projects/<hashed-cwd>/memory/MEMORY.md

// Auto-load happens here — gf$() is the "AutoMem" case:
if (p6()) {  // p6() checks if auto memory is enabled
    let I = TY$(gf$(), "AutoMem");
    if (I && !L.has(qP(I.path)))
        L.add(qP(I.path)), A.push(I);
}

Meanwhile, the system prompt says:

MEMORY.md is always loaded into your conversation context — lines after 200 will be truncated, so keep the index concise

...and instructs the model to write memory files like:

`` Write(file_path="~/wow-addons/memories/<descriptive-name>.md", content="...") ``

These are two completely different paths. The system prompt's path is never auto-loaded.

Impact

  • Every user relying on the system prompt's memory workflow has memories that silently don't persist across conversations
  • Users may not realize this for a long time since the model confidently says "I saved that to memory" and the files do exist — they just never get loaded
  • The model itself doesn't know the instructions are wrong, so it can't self-correct

Expected behavior

Either:

  1. The system prompt should instruct the model to write to ~/.claude/projects/<hashed-cwd>/memory/MEMORY.md (matching the code), or
  2. The code should also load MEMORY.md from the project tree path that the system prompt describes, or
  3. The system prompt should stop describing a custom file-based memory system and just let the built-in auto-memory work as designed

Environment

  • Claude Code v2.1.72
  • Linux (WSL2)
  • claude-opus-4-6

View original on GitHub ↗

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