Claude Code

Claude Code Context: CLAUDE.md, Auto Memory, and Subagents

How Claude Code manages context through fresh windows, CLAUDE.md, auto memory, settings, MCP servers, and subagents.

Updated 2026-07-06 10 min read Cite this page

"Each Claude Code session begins with a fresh context window."

Source: How Claude remembers your project, Claude Code Docs.

Every session starts fresh, then context is loaded

The most important Claude Code context fact is that a new session does not inherit the full transcript of every prior session. It starts with a fresh context window, then loads configured project guidance, user guidance, and memory. That is why durable instructions belong in files and settings, not in a one-off chat message you hope will be remembered.

This also explains why short, specific project guidance is more reliable than a sprawling handbook. Whatever loads at startup competes with the current task for attention.

Use CLAUDE.md for intentional project context

`CLAUDE.md` is best for instructions humans choose: build commands, repo layout, testing expectations, coding standards, release rules, and warnings about sharp edges. It is context, not a hard security boundary. If an action must be blocked, use settings, permissions, hooks, or policy mechanisms rather than relying on prose alone.

Keep `CLAUDE.md` close to the work. Large teams often need scoped rules rather than one universal file. The point is to load the right local conventions, not every convention the organization has ever written.

Use auto memory for discovered patterns

Auto memory is different. It captures learnings Claude derives from corrections and repeated patterns. That can be valuable for build quirks, debugging discoveries, and user preferences, but it should be audited. A stale memory can be worse than no memory because it looks authoritative while quietly sending the agent in the wrong direction.

Settings, skills, and MCP servers are also context controls

Claude Code settings can configure permissions, environment variables, tool behavior, skills, and MCP servers. Those settings shape the action space Claude sees. A context review should therefore inspect not only the prompt files but also which tools, MCP servers, and skills are available.

For deeper memory-specific patterns, use Claude Memories. For broader Claude Code engineering practice, use Claude Ships Code.

Subagents preserve focus by isolating side work

Claude Code subagents run with their own context window, prompt, tool access, and permissions. Use them when research, log scanning, or file exploration would flood the main conversation with material you only need as a summary.

The main risk is delegating work that should stay visible. Keep strategic decisions, user constraints, and final synthesis in the main thread. Send bounded exploration and repeatable specialist work to subagents.

FAQ

Is CLAUDE.md enforced configuration?

No. Claude Code docs describe it as context. Use hooks, settings, permissions, or managed policy for enforcement.

When should I use a Claude Code subagent?

Use a subagent when side exploration would consume main-thread context but can return a compact summary.

Sources Used

  • How Claude remembers your project, Claude Code Docs. Accessed 2026-07-06. Official explanation of fresh Claude Code sessions, CLAUDE.md, auto memory, and load behavior.
  • Claude Code settings, Claude Code Docs. Accessed 2026-07-06. Configuration categories, including memory files, settings, skills, MCP servers, and precedence.
  • Create custom subagents, Claude Code Docs. Accessed 2026-07-06. Official subagent context-window behavior, scoped prompts, tool access, and context preservation.
  • Effective context engineering for AI agents, Anthropic Engineering. Accessed 2026-07-06. Primary explanation of context engineering, context pollution, compaction, note-taking, and sub-agent architectures.

Cite this page

Suggested citation: Claude Context, "Claude Code Context: CLAUDE.md, Auto Memory, and Subagents," updated 2026-07-06, https://claudecontext-com.pages.dev/claude-code-context/.

This page is an independent educational resource and is not affiliated with Anthropic.