x stores agentic memory at ~/.claude/projects/<project-hash>/memory/. Each project gets its own memory store, keyed by the absolute path to the project root. If memory doesn't seem to carry across sessions, here's how to diagnose.
Step 1: Verify memory files exist
# List all memory stores $ ls -la ~/.claude/projects/*/memory/ # Read the main memory file for any project $ cat ~/.claude/projects/*/memory/MEMORY.md # Check which project x resolved $ x stats --memory
You should see a MEMORY.md file and possibly topic-specific files (e.g., debugging.md, patterns.md). If the directory is empty or missing, x hasn't written any memories for this project yet.
Step 2: Check common issues
Different project path
Memory is keyed by the absolute project path. If you open the project from a different location — via a symlink, a different mount point, or a case-different path — x creates a separate memory store.
Fix: Always cd to the canonical path. Run pwd -P to see the resolved path and compare it with what x stats reports.
MEMORY.md too large
Only the first 200 lines of MEMORY.md are loaded into the agent's context window. If the file has grown beyond that, older entries are silently truncated — they exist on disk but the agent can't see them.
Fix: Consolidate and prune regularly. Move detailed notes into topic files (which are loaded on-demand) and keep MEMORY.md as a concise index.
Permission errors
If the memory directory isn't writable, x fails silently on memory writes. The agent runs normally but nothing persists.
# Test write permission $ touch ~/.claude/projects/<hash>/memory/test && rm $_ # If this fails, fix permissions: $ chmod 755 ~/.claude/projects/<hash>/memory/
Wrong project detected
x walks up the directory tree looking for project markers (.git, package.json, CLAUDE.md). If you're in a subdirectory of a monorepo, x might resolve to a different project root than expected.
Fix: Run x stats and check the "Project root" line. Compare with your actual pwd.
Step 3: Force a memory refresh
# Show what x sees for this project $ x stats --memory # Nuclear option: reset memory (destructive!) $ rm -rf ~/.claude/projects/<hash>/memory/ # x will recreate the directory on next run
Before resetting: Back up the memory directory first. Past memories may contain valuable debugging insights, architecture decisions, or workflow preferences that took multiple sessions to accumulate.
How memory is written
x doesn't write to memory on every turn. Memory writes happen when:
- The agent discovers a stable pattern confirmed across multiple interactions
- The user explicitly asks x to remember something
- A significant architectural decision is made
- A recurring problem is solved
This means short sessions or sessions focused on simple tasks may not produce any memory writes. That's by design — memory is for durable knowledge, not session logs.