Skip to content
·4 min read

Claude Code Memory, How /memory and CLAUDE.md Actually Work

The full memory layer explained by the team that built it

Share

Claude Code distinguishes instructions you maintain from auto memory it learns during work. Use repository instructions for shared commands and durable boundaries. Inspect learned notes for stale assumptions before promoting them into team policy.

Documentation reviewed November 7, 2026. This replaces older shortcut and cache claims that should not be treated as a current interface contract.

Choose the right place

InformationA useful homeReview habit
Team build commands and code boundariesProject CLAUDE.md or supported AGENTS.mdUpdate with the code change
Personal preferences across projectsUser instructionsKeep separate from team decisions
Rules for one areaScoped instructions or rulesCheck when the matching code changes
Learned repository factsAuto memoryRemove stale notes and verify important facts
A repeatable procedureA skillTest its trigger and outcome

The official memory documentation describes loading behavior and current controls. Ancestor instructions can load at startup; nested guidance can load when files in its scope are read. Current AGENTS.md support has version and configuration conditions. Do not assume every tool loads the same files or resolves contradictions identically.

The CLAUDE.md format guide has adaptable project templates. The AGENTS.md guide covers shared guidance across clients.

Inspect before adding another rule

Use /memory and the available context view to check the files currently in use. Verify an important path or command in the repository. A note that was accurate during a migration can become wrong after the migration finishes.

Ask four questions:

  1. Is the instruction loaded in this session?
  2. Does it apply to the current task and directory?
  3. Does it contradict another instruction?
  4. Can its intended result be checked in a diff, command result or rendered screen?

Remove duplicates. A repeated “run tests” line does not supply a missing database fixture or correct an invented test command.

Write the smallest reusable lesson

Suppose a generated client was edited directly. A useful correction identifies the source schema and generation command. A vague “be careful with generated files” gives the next session no replacement action.

When changing the catalog API, edit schema/catalog.json and regenerate
using the existing script in package.json. Do not edit src/generated.
Run the affected API checks and report the command results.

This is an illustrative instruction for a fictional repository. Verify paths and scripts before adopting it. If the boundary matters, enforce it in tooling where feasible; prose alone cannot guarantee compliance.

Keep memory distinct from enforcement

Do not store credentials, customer payloads or one-time access tokens in instruction files or learned notes. A remembered preference is not authorization for a new sensitive action. Access controls and required approvals remain independent of what a model remembers.

Likewise, remembering that a test once passed is not evidence about the current change. Run the relevant check again when the code it covers changes. The verification walkthrough supplies a small evidence record.

Avoid brittle shortcuts and cost promises

The older # memory shortcut is historical guidance; use the current documented controls for your installed release. Do not assume that moving a sentence between files guarantees cache reuse or a fixed percentage saving. Context inclusion and cache behavior depend on the actual request and product implementation.

Use the API budget guide for measured usage, and the skill authoring guide when a stable instruction has grown into a reusable procedure. Review the small set of facts that actually changes work, rather than accumulating every session's transcript.

PJ
Pranay Joshi

20+ years building products at scale. VP of Product & Engineering, startup founder, and AI coach. Helping dreamers turn ideas into reality with vibe coding.