claude-home/development/claude-code-memory-autoload.md
Cal Corum d656f1732e Add docs for CORE.md auto-load via MEMORY.md symlinks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:46:02 -06:00

1.9 KiB

Claude Code Memory Auto-Load (CORE.md Symlinks)

Problem

Claude Code's CLAUDE.md can instruct the AI to load files at session start, but this relies on the model choosing to follow the instruction — which it often doesn't.

Solution

Claude Code has a built-in auto-memory feature: each project gets a MEMORY.md file at ~/.claude/projects/<project-path>/memory/MEMORY.md that is automatically injected into the system prompt every session. No tool calls needed.

We symlink every project's MEMORY.md to our cognitive memory CORE.md (~/.claude/memory/CORE.md), which is an auto-curated summary of the most relevant memories (~1,000-1,100 tokens).

How It Works

~/.claude/projects/<project>/memory/MEMORY.md  →  ~/.claude/memory/CORE.md
  • CORE.md is regenerated daily by cognitive-memory-daily.service
  • Symlinks are refreshed daily by the same service (catches new projects)
  • Cost: ~1% of 200k context window — negligible

Files

File Purpose
~/.local/bin/claude-memory-symlinks Script that creates/refreshes symlinks for all projects
~/.config/systemd/user/cognitive-memory-daily.service Daily timer that runs decay → core → embed → symlinks
~/.claude/memory/CORE.md Auto-curated cognitive memory summary (symlink target)

Manual Refresh

# Regenerate CORE.md and refresh symlinks
claude-memory core && claude-memory-symlinks

# Just refresh symlinks (e.g., after creating a new project)
claude-memory-symlinks

What Changed

  • Removed from ~/.claude/CLAUDE.md: "Session start: Load CORE.md" instruction
  • Added to ~/.claude/CLAUDE.md: "CORE.md auto-loads via MEMORY.md symlinks"
  • Migrated project-specific MEMORY.md content (major-domo, strat-gameplay-webapp) into cognitive memory before replacing with symlinks
  • Added claude-memory-symlinks step to daily systemd service

Date

2026-02-16