Context Window Management
Large codebases easily exceed Claude's context window. This pattern provides strategies to keep sessions productive: use /compact to summarize history, structure CLAUDE.md to front-load critical information, split tasks into focused sessions, and use file-level summaries instead of loading entire modules. Includes a decision tree for when to start a new session vs. compact the current one.
Pattern Code
Copy this pattern into your project configuration to implement.
Terminal Preview
About Context Window Management
Claude Code patterns are proven architectural designs and workflow structures that help you tackle complex development scenarios. Context Window Management is a Workflow pattern at the Intermediate level that provides a tested, repeatable approach you can adapt to your projects for more efficient and consistent results.
Related Patterns
Parallel Task Execution
Split large tasks into independent subtasks and execute them concurrently across multiple Claude Code instances.
Code Review Feedback Loop
Establish an iterative review cycle where Claude Code reviews, fixes, and re-validates code changes automatically.
Monorepo Navigation Pattern
Configure CLAUDE.md to help Claude Code efficiently navigate and modify code across monorepo packages.