SchlüsselarbeitDokumentationerreichbar
Anthropic, How Claude remembers your project
code.claude.com (externe Seite)
Die Herstellerdokumentation zur Projektanweisung und ihren Geltungsbereichen. Sie ist die Quelle für den Satz, auf dem dieses Kapitel steht: Die Datei ist Kontext, keine durchgesetzte Konfiguration, wer etwas verbindlich verhindern will, braucht einen Hook. Dazu die Ladereihenfolge über vier Ebenen, die Größenempfehlung von 200 Zeilen und die Auskunft, dass Claude Code seit Version 2.1.277 auch AGENTS.md selbst liest, standardmäßig aber nur, wenn keine CLAUDE.md im Projekt liegt. Sie belegt außerdem, dass die Datei beim ersten Mal vom Werkzeug erzeugt wird, und beschreibt daneben das zweite Gedächtnis: Notizen, die der Agent sich selbst anlegt, je Repository unter einem eigenen Verzeichnis, maschinenlokal, und beim Start geladen bis zur Grenze von 200 Zeilen oder 25 Kilobyte.
geprüft 10.11.2026
Worauf sich diese Seite beruft, wörtlich, abgerufen am 03.08.2026:
Claude treats them as context, not enforced configuration.
bestätigt 10.11.2026target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.
bestätigt 10.11.2026if two instructions contradict each other, Claude may pick one arbitrarily
bestätigt 10.11.2026Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers.
bestätigt 10.11.2026It then explores your codebase with a subagent, fills in gaps via follow-up questions, and presents a reviewable proposal before writing any files.
bestätigt 10.11.2026it cuts content Claude can derive from the codebase, such as directory layouts, dependency lists, and architecture overviews, and keeps pitfalls, rationale, and conventions that differ from tool defaults
bestätigt 10.11.2026CLAUDE.md content is delivered as a user message after the system prompt
bestätigt 10.11.2026Claude looks for problems such as instructions written for older models, references to files or commands that don't exist, and files that contradict each other.
bestätigt 10.11.2026Claude skips anything it can derive from the codebase, such as architecture, file paths, or debugging fixes.
bestätigt 10.11.2026If the file is near a limit, Claude Code reminds Claude to shorten it
bestätigt 10.11.2026Claude gets the whole of each CLAUDE.md file that loads at launch, as long as the file is 4 Mi
bestätigt 10.11.2026B or smaller. Claude Code skips a file over 4 Mi B and loads none of it. The timestamp shows how current the fact is, both to you and to Claude when it reads the memory back.
bestätigt 10.11.2026By default, the audit covers your CLAUDE.md, CLAUDE.local.md, and AGENTS.md files, plus the rules, skills, commands, subagents, and output styles under
bestätigt 10.11.2026Files in subdirectories load on demand.
bestätigt 10.11.2026Each Claude Code session begins with a fresh context window.
bestätigt 10.11.2026Both are loaded at the start of every conversation.
bestätigt 10.11.2026Auto memory is machine-local.
bestätigt 10.11.2026Files are not shared across machines or cloud environments.
bestätigt 10.11.2026All worktrees and subdirectories within the same git repository share one auto memory directory.
bestätigt 10.11.2026Auto memory lets Claude accumulate knowledge across sessions without you writing anything.
bestätigt 10.11.2026or the first 25KB, whichever comes first, are loaded at the start of every conversation.
bestätigt 10.11.2026Team members via source control
bestätigt 10.11.2026Two mechanisms carry knowledge across sessions
bestätigt 10.11.2026Run Claude Code in foo/
bestätigt 10.11.2026bar/ and it loads instructions from foo/bar/CLAUDE.md All discovered files are concatenated into context rather than overriding each other.
bestätigt 10.11.2026so a project instruction appears in context after a user instruction
bestätigt 10.11.2026so your personal notes are the last thing Claude reads at that level.
bestätigt 10.11.2026Neither set overrides the other
bestätigt 10.11.2026Claude Code loads each one once Claude reads, writes, or edits another file in that subdirectory.
bestätigt 10.11.2026A path-scoped rule loads when Claude uses the Read, Write, or Edit tool on a matching file.
bestätigt 10.11.2026/
bestätigt 10.11.2026init suggests improvements rather than overwriting it asks which artifacts to set up: CLAUDE.md files, skills, and hooks
bestätigt 10.11.2026The variable only changes how
bestätigt 10.11.2026Don’t count, and keep loading alongside
bestätigt 10.11.2026stops Claude from reading
bestätigt 10.11.2026Claude records the kind as a
bestätigt 10.11.2026It also skips anything your CLAUDE.md files already say.
bestätigt 10.11.2026Claude doesn’t save something every session.
bestätigt 10.11.2026Claude reads them on demand using its standard file tools when it needs the information.
bestätigt 10.11.2026Auto memory is on by default in local sessions.
bestätigt 10.11.2026To add instructions to CLAUDE.md instead, ask Claude directly
bestätigt 10.11.2026selecting one that doesn’t exist yet creates it first
bestätigt 10.11.2026run /
bestätigt 10.11.2026context all in a session and check the list under Memory files /
bestätigt 10.11.2026context alone collapses that list. line with its path appears in the terminal
bestätigt 10.11.2026Imported files are expanded and loaded into context alongside the CLAUDE.md that references them.
bestätigt 10.11.2026Relative paths resolve relative to the file containing the import
bestätigt 10.11.2026Imported files can recursively import other files, with a maximum depth of four hops.
bestätigt 10.11.2026To import a file whose path contains spaces, put a backslash before each space.
bestätigt 10.11.2026Import parsing skips Markdown code spans and fenced code blocks.
bestätigt 10.11.2026The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files.
bestätigt 10.11.2026If you decline, the imports stay disabled and the dialog doesn’t appear again.
bestätigt 10.11.2026Claude Code loads their imports without the dialog and trusts them like the rest of your personal configuration.
bestätigt 10.11.2026help you organize a long file but don’t reduce its context cost
bestätigt 10.11.2026only exists in the worktree where you created it
bestätigt 10.11.2026files are discovered recursively, so you can organize rules into subdirectories
bestätigt 10.11.2026are loaded at launch with the same priority as .claude/CLAUDE.md
bestätigt 10.11.2026shares one budget of 1,000 expanded patterns and 4 Mi
bestätigt 10.11.2026B it matches nothing, and the rule’s other patterns keep working
bestätigt 10.11.2026Project rules are skipped if you exclude project from
bestätigt 10.11.2026treats a symlink whose target is outside your working directory like an external import
bestätigt 10.11.2026and after that only the ones without a paths field load.
bestätigt 10.11.2026To load shared rules without that approval, keep them in ~/.claude/
bestätigt 10.11.2026rules/ because looking up such a path can contact the host it names
bestätigt 10.11.2026By default, CLAUDE.md files from these directories are not loaded.
bestätigt 10.11.2026in your working directory and the directories above it
bestätigt 10.11.2026or anything under a .agents/ directory
bestätigt 10.11.2026files first and its AGENTS.md after them
bestätigt 10.11.2026and auto memory at launch
bestätigt 10.11.2026Your change applies from the next message you send and in every new session.
bestätigt 10.11.2026first session after you upgrade
bestätigt 10.11.2026They fire as usual for an AGENTS.md that a CLAUDE.md imports or symlinks to
bestätigt 10.11.2026Loads only if you already approved external imports for this project, with no prompt
bestätigt 10.11.2026Once Claude reads AGENTS.md directly, the hook adds a second copy to the context.
bestätigt 10.11.2026only if it decides to open the file
bestätigt 10.11.2026Developers can exclude other CLAUDE.md files with the claudeMdExcludes setting, but not this one.
bestätigt 10.11.2026lets you put managed CLAUDE.md content directly inside managed-settings.json
bestätigt 10.11.2026in user, project, or local settings has no effect.
bestätigt 10.11.2026Patterns are matched against absolute file paths using glob syntax.
bestätigt 10.11.2026Arrays merge across layers.
bestätigt 10.11.2026which saves autoMemoryEnabled to your user settings at ~/.claude/settings.json
bestätigt 10.11.2026a session in a self-hosted environment runs with auto memory off by default
bestätigt 10.11.2026The value must be an absolute path or start with ~/
bestätigt 10.11.2026honors it under the same workspace trust rule as hooks in settings files
bestätigt 10.11.2026excludes the memory files in the memory directory from that retention sweep
bestätigt 10.11.2026MEMORY.md and topic files stay until you or Claude edits or deletes them.
bestätigt 10.11.2026you see a warning at startup and when you run /
bestätigt 10.11.2026status Each CLAUDE.md, rules file, and @path import counts as a separate file.
bestätigt 10.11.2026The main conversation’s auto memory isn’t loaded into subagents
bestätigt 10.11.2026which inherits the parent conversation and system prompt
bestätigt 10.11.2026If one is missing there, Claude can’t see it.
bestätigt 10.11.2026then ask Claude to read a file in that subdirectory
bestätigt 10.11.2026If your CLAUDE.md sets commit or pull request rules, turn off the built-in ones with
bestätigt 10.11.2026didn’t list an AGENTS.md that Claude read directly
bestätigt 10.11.2026Use the Instructions
bestätigt 10.11.2026Loaded hook to log which CLAUDE.md and rules files are loaded, when they load, and why. When you ask Claude to remember something
bestätigt 10.11.2026When you open a CLAUDE.md file directly with the Read tool, comments remain visible.
bestätigt 10.11.2026Claude Code removes the frontmatter before loading the rule into context.
bestätigt 10.11.2026Claude Code shows the dialog to protect you from files other people commit to a shared project.
bestätigt 10.11.2026Claude Code loads no auto memory from a directory that a repository-supplied settings file chooses and saves none to it
bestätigt 10.11.2026Claude reads AGENTS.md from your next session on
bestätigt 10.11.2026lives in a nested CLAUDE.md that hasn’t reloaded yet, or is a path-scoped rule that hasn’t matched a file since
bestätigt 10.11.2026If the file is over a limit, the write still succeeds
bestätigt 10.11.2026in CLAUDE.md files are stripped before the content is injected into Claude’s context
bestätigt 10.11.2026If a developer starts a session with CLAUDE.md loading turned off altogether, that session doesn’t load the managed content either.
bestätigt 10.11.2026When a subdirectory CLAUDE.md or a rules file that loads on demand is over a per-file size limit, Claude receives only the start of it.
bestätigt 10.11.2026Claude Code skips any import in a user-scope file that resolves to a path outside the session’s working directory and loads the rest of the file.
bestätigt 10.11.2026200,000 characters on Claude Opus 4.6 and Claude Sonnet 4.6, and 150,000 characters on later models
bestätigt 10.11.2026Before v2.1.309, Claude Code didn’t apply this limit to files that load on demand.
bestätigt 10.11.2026The toggle turns auto memory off but doesn’t turn it back on in these sessions
bestätigt 10.11.2026a CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in your working directory or any directory above it
bestätigt 10.11.2026or your AGENTS.md files when you have no CLAUDE.md or CLAUDE.local.md in your working directory or above it
bestätigt 10.11.2026verify the CLAUDE.md and CLAUDE.local.md files that should load at launch
bestätigt 10.11.2026doesn’t appear under Memory files, because it loads on demand rather than at launch
bestätigt 10.11.2026the Edit and Write tools refuse to write through a symlink
bestätigt 10.11.2026choosing the personal option does this for you
bestätigt 10.11.2026
Automatisches Gedächtnis im GlossarProjektanweisung im Glossar03 Der Init05 Das Gedächtnis05 Kontext und Sitzungen09 Bestehenden Code verstehen11 Eine Wissensbasis aufbauen12 Hooks und Skills14 Anweisungen und Gedächtnis27 Übergabe zwischen Sitzungen31 Der Harness