Task
Persist user decisions, preferences, and patterns to auto-memory so they survive across sessions.
Locate Memory Directory
The auto-memory directory is per-project at ~/.claude/projects/<project>/memory/.
To find the correct <project> path:
- •Check if inside a git repo:
git rev-parse --show-toplevel - •The project key is the repo root path (or cwd if not in a repo)
with
/replaced by-and leading-stripped - •Verify the memory directory exists at the computed path
- •If the directory does not exist or MEMORY.md is not found:
- •Show the user the path you computed and what you tried
- •Ask if they want you to create it, or if the path looks wrong
- •Do NOT write to a guessed or fallback location without confirmation
Steps
- •Parse what the user wants remembered from
$ARGUMENTSor the preceding conversation - •Read the current MEMORY.md to check for duplicates or conflicts
- •If the note conflicts with an existing memory, show both versions and ask the user to confirm before overwriting
- •Categorize the note (preference, decision, pattern, gotcha, workflow)
- •Write to the appropriate location:
- •Quick one-liner: add directly to MEMORY.md
- •Detailed topic: create/append to a topic file, link from MEMORY.md
- •Existing topic file matches: append there
- •Confirm what was saved and where
Rules
- •Keep entries concise — one line per fact when possible
- •Don't duplicate what's already in CLAUDE.md or rules files
- •MEMORY.md must stay under 200 lines (only first 200 are loaded)
- •Use topic files for anything that needs detail