NachschlagenQuellenregister

SchlüsselarbeitDokumentationerreichbar

Anthropic, How Claude remembers your project

code.claude.com (externe Seite)

Die Her­stel­ler­do­ku­men­ta­tion 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 13.11.2026

Worauf sich diese Seite beruft, wörtlich, abgerufen am 03.08.2026:

  • Claude treats them as context, not enforced configuration.bestätigt 13.11.2026
  • target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.bestätigt 13.11.2026
  • if two instructions contradict each other, Claude may pick one arbitrarilybestätigt 13.11.2026
  • Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers.bestätigt 13.11.2026
  • It 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 13.11.2026
  • it 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 defaultsbestätigt 13.11.2026
  • CLAUDE.md content is delivered as a user message after the system promptbestätigt 13.11.2026
  • Claude 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 13.11.2026
  • Claude skips anything it can derive from the codebase, such as architecture, file paths, or debugging fixes.bestätigt 13.11.2026
  • If the file is near a limit, Claude Code reminds Claude to shorten itbestätigt 13.11.2026
  • Claude gets the whole of each CLAUDE.md file that loads at launch, as long as the file is 4 MiB or smaller. Claude Code skips a file over 4 MiB and loads none of it.bestätigt 13.11.2026
  • The timestamp shows how current the fact is, both to you and to Claude when it reads the memory back.bestätigt 13.11.2026
  • By default, the audit covers your CLAUDE.md, CLAUDE.local.md, and AGENTS.md files, plus the rules, skills, commands, subagents, and output styles underbestätigt 13.11.2026
  • Files in subdirectories load on demand.bestätigt 13.11.2026
  • Each Claude Code session begins with a fresh context window.bestätigt 13.11.2026
  • Both are loaded at the start of every conversation.bestätigt 13.11.2026
  • Auto memory is machine-local.bestätigt 13.11.2026
  • Files are not shared across machines or cloud environments.bestätigt 13.11.2026
  • All worktrees and subdirectories within the same git repository share one auto memory directory.bestätigt 13.11.2026
  • Auto memory lets Claude accumulate knowledge across sessions without you writing anything.bestätigt 13.11.2026
  • or the first 25KB, whichever comes first, are loaded at the start of every conversation.bestätigt 13.11.2026
  • Team members via source controlbestätigt 13.11.2026
  • Two mechanisms carry knowledge across sessionsbestätigt 13.11.2026
  • Run Claude Code in foo/bar/ and it loads instructions from foo/bar/CLAUDE.mdbestätigt 13.11.2026
  • All discovered files are concatenated into context rather than overriding each other.bestätigt 13.11.2026
  • so a project instruction appears in context after a user instructionbestätigt 13.11.2026
  • so your personal notes are the last thing Claude reads at that level.bestätigt 13.11.2026
  • Neither set overrides the otherbestätigt 13.11.2026
  • Claude Code loads each one once Claude reads, writes, or edits another file in that subdirectory.bestätigt 13.11.2026
  • A path-scoped rule loads when Claude uses the Read, Write, or Edit tool on a matching file.bestätigt 13.11.2026
  • /init suggests improvements rather than overwriting itbestätigt 13.11.2026
  • asks which artifacts to set up: CLAUDE.md files, skills, and hooksbestätigt 13.11.2026
  • The variable only changes howbestätigt 13.11.2026
  • Don’t count, and keep loading alongsidebestätigt 13.11.2026
  • stops Claude from readingbestätigt 13.11.2026
  • Claude records the kind as abestätigt 13.11.2026
  • It also skips anything your CLAUDE.md files already say.bestätigt 13.11.2026
  • Claude doesn’t save something every session.bestätigt 13.11.2026
  • Claude reads them on demand using its standard file tools when it needs the information.bestätigt 13.11.2026
  • Auto memory is on by default in local sessions.bestätigt 13.11.2026
  • To add instructions to CLAUDE.md instead, ask Claude directlybestätigt 13.11.2026
  • selecting one that doesn’t exist yet creates it firstbestätigt 13.11.2026
  • run /context all in a session and check the list under Memory filesbestätigt 13.11.2026
  • /context alone collapses that list.bestätigt 13.11.2026
  • line with its path appears in the terminalbestätigt 13.11.2026
  • Imported files are expanded and loaded into context alongside the CLAUDE.md that references them.bestätigt 13.11.2026
  • Relative paths resolve relative to the file containing the importbestätigt 13.11.2026
  • Imported files can recursively import other files, with a maximum depth of four hops.bestätigt 13.11.2026
  • To import a file whose path contains spaces, put a backslash before each space.bestätigt 13.11.2026
  • Import parsing skips Markdown code spans and fenced code blocks.bestätigt 13.11.2026
  • The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files.bestätigt 13.11.2026
  • If you decline, the imports stay disabled and the dialog doesn’t appear again.bestätigt 13.11.2026
  • Claude Code loads their imports without the dialog and trusts them like the rest of your personal configuration.bestätigt 13.11.2026
  • help you organize a long file but don’t reduce its context costbestätigt 13.11.2026
  • only exists in the worktree where you created itbestätigt 13.11.2026
  • files are discovered recursively, so you can organize rules into subdirectoriesbestätigt 13.11.2026
  • are loaded at launch with the same priority as .claude/CLAUDE.mdbestätigt 13.11.2026
  • shares one budget of 1,000 expanded patterns and 4 MiBbestätigt 13.11.2026
  • it matches nothing, and the rule’s other patterns keep workingbestätigt 13.11.2026
  • Project rules are skipped if you exclude project frombestätigt 13.11.2026
  • treats a symlink whose target is outside your working directory like an external importbestätigt 13.11.2026
  • and after that only the ones without a paths field load.bestätigt 13.11.2026
  • To load shared rules without that approval, keep them in ~/.claude/rules/bestätigt 13.11.2026
  • because looking up such a path can contact the host it namesbestätigt 13.11.2026
  • By default, CLAUDE.md files from these directories are not loaded.bestätigt 13.11.2026
  • in your working directory and the directories above itbestätigt 13.11.2026
  • or anything under a .agents/ directorybestätigt 13.11.2026
  • files first and its AGENTS.md after thembestätigt 13.11.2026
  • and auto memory at launchbestätigt 13.11.2026
  • Your change applies from the next message you send and in every new session.bestätigt 13.11.2026
  • first session after you upgradebestätigt 13.11.2026
  • They fire as usual for an AGENTS.md that a CLAUDE.md imports or symlinks tobestätigt 13.11.2026
  • Loads only if you already approved external imports for this project, with no promptbestätigt 13.11.2026
  • Once Claude reads AGENTS.md directly, the hook adds a second copy to the context.bestätigt 13.11.2026
  • only if it decides to open the filebestätigt 13.11.2026
  • Developers can exclude other CLAUDE.md files with the claudeMdExcludes setting, but not this one.bestätigt 13.11.2026
  • lets you put managed CLAUDE.md content directly inside managed-settings.jsonbestätigt 13.11.2026
  • in user, project, or local settings has no effect.bestätigt 13.11.2026
  • Patterns are matched against absolute file paths using glob syntax.bestätigt 13.11.2026
  • Arrays merge across layers.bestätigt 13.11.2026
  • which saves autoMemoryEnabled to your user settings at ~/.claude/settings.jsonbestätigt 13.11.2026
  • a session in a self-hosted environment runs with auto memory off by defaultbestätigt 13.11.2026
  • The value must be an absolute path or start with ~/bestätigt 13.11.2026
  • honors it under the same workspace trust rule as hooks in settings filesbestätigt 13.11.2026
  • excludes the memory files in the memory directory from that retention sweepbestätigt 13.11.2026
  • MEMORY.md and topic files stay until you or Claude edits or deletes them.bestätigt 13.11.2026
  • you see a warning at startup and when you run /statusbestätigt 13.11.2026
  • Each CLAUDE.md, rules file, and @path import counts as a separate file.bestätigt 13.11.2026
  • The main conversation’s auto memory isn’t loaded into subagentsbestätigt 13.11.2026
  • which inherits the parent conversation and system promptbestätigt 13.11.2026
  • If one is missing there, Claude can’t see it.bestätigt 13.11.2026
  • then ask Claude to read a file in that subdirectorybestätigt 13.11.2026
  • If your CLAUDE.md sets commit or pull request rules, turn off the built-in ones withbestätigt 13.11.2026
  • didn’t list an AGENTS.md that Claude read directlybestätigt 13.11.2026
  • Use the InstructionsLoaded hook to log which CLAUDE.md and rules files are loaded, when they load, and why.bestätigt 13.11.2026
  • When you ask Claude to remember somethingbestätigt 13.11.2026
  • When you open a CLAUDE.md file directly with the Read tool, comments remain visible.bestätigt 13.11.2026
  • Claude Code removes the frontmatter before loading the rule into context.bestätigt 13.11.2026
  • Claude Code shows the dialog to protect you from files other people commit to a shared project.bestätigt 13.11.2026
  • Claude Code loads no auto memory from a directory that a repository-supplied settings file chooses and saves none to itbestätigt 13.11.2026
  • Claude reads AGENTS.md from your next session onbestätigt 13.11.2026
  • lives in a nested CLAUDE.md that hasn’t reloaded yet, or is a path-scoped rule that hasn’t matched a file sincebestätigt 13.11.2026
  • If the file is over a limit, the write still succeedsbestätigt 13.11.2026
  • in CLAUDE.md files are stripped before the content is injected into Claude’s contextbestätigt 13.11.2026
  • If a developer starts a session with CLAUDE.md loading turned off altogether, that session doesn’t load the managed content either.bestätigt 13.11.2026
  • When 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 13.11.2026
  • Claude 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 13.11.2026
  • 200,000 characters on Claude Opus 4.6 and Claude Sonnet 4.6, and 150,000 characters on later modelsbestätigt 13.11.2026
  • Before v2.1.309, Claude Code didn’t apply this limit to files that load on demand.bestätigt 13.11.2026
  • The toggle turns auto memory off but doesn’t turn it back on in these sessionsbestätigt 13.11.2026
  • a CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in your working directory or any directory above itbestätigt 13.11.2026
  • or your AGENTS.md files when you have no CLAUDE.md or CLAUDE.local.md in your working directory or above itbestätigt 13.11.2026
  • verify the CLAUDE.md and CLAUDE.local.md files that should load at launchbestätigt 13.11.2026
  • doesn’t appear under Memory files, because it loads on demand rather than at launchbestätigt 13.11.2026
  • the Edit and Write tools refuse to write through a symlinkbestätigt 13.11.2026
  • choosing the personal option does this for youbestätigt 13.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

Alle Quellen

↑↓ auswählenEnter öffnenDie Suche läuft im Browser. Nichts wird übertragen.