Codebase memory management in Claude Code
mirku
THIS IS A PURE F*CKING GOLDMINE Anthropic just documented how Claude Code actually remembers your entire codebase across sessions The idea: stop dumping 500 lines into CLAUDE.md and let the new Haiku 5.5 manage an auto-indexing memory tree while Opus 5.5 audits your rules Zero context bloat, path-scoped rules that load only when touched, and persistent learnings that survive across Git worktrees You just inspect and steer it in Claude Code like this: /memory here's how it splits: → Opus 5.5 audits rule integrity: runs /doctor prompt-audit to catch stale instructions, contradictions, and obsolete configs → Sonnet 5.5 writes path-scoped rules: drafts modular .claude/rules/ with frontmatter globs so rules only load for matching files → Haiku 5.5 maintains auto-memory: indexes MEMORY.md at 340 tok/s and moves deep context into dedicated topic files → you stop burning Opus context on static prompt bloat and keep your session token count razor thin The memory architecture runs through three proven layers: → path-scoped rules: .claude/rules/*.md load strictly when touched files match, saving up to 80% context → auto-memory index: MEMORY.md caps at 200 lines / 25KB, keeping startup instant across all worktrees → on-demand topic files: detailed architectural notes live in ~/.claude/projects/<repo>/memory/ without polluting the turn Opus audits, Haiku indexes, Sonnet scopes JEV engineering is the same move one layer down: the forks that need no thinker (which rule file matches, auto-memory threshold, stale timestamp drop) resolve in code in 15ms, and the frontier models only see the ones that split the full tree > Opus 5.5 audits rule consistency and runs /doctor prompt-audit > Haiku 5.5 prunes and indexes MEMORY.md at 340 tok/s (1M context) > Sonnet 5.5 writes path-scoped rules in .claude/rules/ with frontmatter globs > on-demand topic files capture edge cases without burning startup tokens > ~/.claude/projects/<repo>/memory/ shares learnings across all Git worktrees > Opus 5.5 enforces zero-regression architecture standards > JEV routes path matching in milliseconds paste the tree and this prompt into Claude Code ↓ "Reconfigure my Claude Code memory architecture around this tree: 1. Audit my current CLAUDE.md with /doctor prompt-audit and strip out stale or conflicting rules 2. Move file-specific instructions into .claude/rules/*.md with YAML frontmatter path globs 3. Delegate MEMORY.md indexing and 200-line threshold management to Haiku 5.5 at 340 tok/s 4. Route detailed architectural learnings and edge cases to Sonnet 5.5 as on-demand topic files 5. Reserve Opus 5.5 for high-level rule consistency and cross-worktree memory verification Show me every change as a diff first. No edits until I say go" ↳ https://t.co/yKnVz6F12c save it, it'll come in handyView original post