CLAUDE LABJP
FORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as OctoberFORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as October
Articles/Claude Code
Claude Code/2026-05-04Intermediate

5 Practical Ways to Work Around Claude Code's Context Window Limit

When Claude Code warns you that the context limit is approaching on large codebases or long sessions, here are five practical approaches — from /clear and /compact to CLAUDE.md and scope splitting.

claude-code129context-window6tokenperformance4workflow37

At some point in a long Claude Code session, you'll see: "Approaching context limit." After that, responses get less reliable — the model starts losing track of earlier instructions, or just stops accepting new input altogether.

For a while my only move was "start a new session and re-explain everything." But after working through this repeatedly on larger projects, I've settled on five distinct approaches — each suited to a different situation.

Why the Context Limit Actually Matters

Claude's context window accumulates everything: your conversation history, file contents the model has read, tool execution results, error outputs. As the session runs long, two problems emerge.

Quality degradation comes first. A packed context makes it harder for the model to maintain a coherent view of what you're working on. Instructions you gave an hour ago start to fade.

Hard stopping comes next. Once the limit is truly reached, Claude Code won't accept further work until the context shrinks.

Approach 1: /clear — Reset and Restart

The most direct option: wipe the conversation history entirely.

# Run inside your Claude Code session
/clear

This doesn't touch your repository or any files — only the in-memory conversation is cleared. Think of it as closing a long meeting and opening a fresh one.

The key is how you restart. Passing a concise summary right after /clear lets you pick up almost exactly where you left off:

/clear

Context summary:
- Refactoring src/components/Auth.tsx
- Moving auth flow from Context API to a custom hook
- useAuthState.ts is done; wiring it into Auth.tsx is what's left

This takes 30 seconds and usually gets you back to full productivity immediately.

Approach 2: /compact — Compress Without Losing Thread

/compact summarizes the conversation history rather than deleting it. The model retains the gist of what was discussed while using far fewer tokens.

/compact

This is my preference when I'm mid-refactor and don't want to lose the context of decisions already made. The summary keeps "we agreed to use X pattern here" alive without keeping the full back-and-forth that led to that decision.

Use /compact to buy time; use /clear when you genuinely want a clean break.

Approach 3: CLAUDE.md — Move Permanent Context Out of the Conversation

A big source of token waste is repeating project setup information in every prompt: the framework version, naming conventions, what not to do. If you're explaining this every session, stop.

Put it in a CLAUDE.md file at your project root. Claude Code reads it automatically at session start:

# CLAUDE.md
 
## Stack
- Next.js 16 (App Router)
- TypeScript strict mode
- Zustand for state
- Tailwind CSS + CSS Modules
 
## Naming Conventions
- Components: PascalCase
- Hooks: use + PascalCase
- Types: PascalCase, no T prefix
 
## Hard Rules
- Never use `any`
- No console.log in production code
- All API calls go through /src/services

Once this is in place, you no longer need to re-explain your project's DNA every session. A short "see CLAUDE.md for project context" is enough.

Approach 4: Split Work into Scopes

Trying to refactor 10 files at once forces the model to load all of them into context simultaneously. Context balloons, quality suffers.

What works better: break large work into isolated scopes and run them as separate sessions.

# Session 1: update type definitions
claude "Update all types in src/types/ to match the new API response shape"
 
# After committing — Session 2 (/clear first)
claude "Update src/services/ API clients to use the updated types"
 
# After committing — Session 3 (/clear first)
claude "Update src/components/ to use the new service layer"

Committing after each session gives you a clean checkpoint. If something goes wrong in session 3, you can see exactly what changed.

Approach 5: Narrow the Files You Load

Claude Code lets you target specific files rather than letting it scan the whole project. When you're fixing a targeted bug, there's no reason to load files unrelated to that bug.

# Start a session focused on specific files
claude --files src/components/Auth.tsx src/hooks/useAuthState.ts
 
# Or within a session, use @ to reference specific files
@src/components/Auth.tsx Fix the error handling in the login function

On large codebases, this alone can cut initial context usage by 80% for focused tasks. Narrower context also tends to produce more precise responses — the model isn't distracted by irrelevant code.

Choosing the Right Approach

Here's my rough decision tree:

  • Want to keep the current session going?/compact
  • Need a clean break?/clear + paste a context summary
  • Repeating the same background info every session? → Move it to CLAUDE.md
  • Starting a large refactor? → Scope it into chunks before you begin
  • Working on one specific thing in a big codebase? → Use --files or @file references

The context limit is a real constraint, but thinking in terms of "what does this session actually need to know?" usually gets you further than any workaround. Start with CLAUDE.md — it's the cheapest fix with the longest lasting benefit.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Claude Code2026-04-27
Claude Code Context Window Mastery — 7 Production Patterns to Stop Sessions From Stalling
Most slowdowns and silent quality drops in Claude Code on large repos come from context window management, not from model limits. This guide walks through seven patterns I rely on in production, with measurement scripts and runtime rules.
Claude Code2026-06-18
Claude Code Adds /cd — Carrying Your Warm Cache Across Repositories
Claude Code's new /cd moves a running session to another working directory without rebuilding the prompt cache. Here are the design calls and pitfalls when you sweep across several repositories in one sitting.
Claude Code2026-06-02
Two Weeks of Splitting iOS Work Between Claude on Xcode and Claude Code
I ran Claude on Xcode, which lives in the Xcode sidebar, alongside Claude Code in the terminal across two weeks of real wallpaper-app work. Here is how I ended up dividing the tasks, and the simple rule I use to decide which one to open.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →