Actionable /context Suggestions for Context Window Optimization
Claude Code 2.1.74 upgrades the /context command with actionable diagnostic suggestions that identify specific sources of context bloat in the current session. Rather than showing raw token counts, the enhanced command now flags context-heavy tools, memory bloat from oversized CLAUDE.md files, and capacity warnings when the context window approaches saturation — paired with specific optimization tips for each problem detected. The release also introduces autoMemoryDirectory, a new setting to control where auto-memory files are stored.
Sources & Mentions
5 external resources covering this update
/context Becomes a Diagnostic Tool
The /context command in Claude Code has historically shown token usage and a breakdown of what occupies the current session's context window. Version 2.1.74 extends this from a passive readout into an active diagnostic: the command now analyzes the session state and surfaces specific, actionable suggestions whenever it detects problems.
What the New Suggestions Cover
The enhanced /context output identifies three categories of issues:
Context-heavy tools. When MCP servers or built-in tools have unusually large schema definitions consuming significant token budget, /context now flags them by name and suggests disabling or pruning the worst offenders. Previously, users had to manually cross-reference raw counts against the tool list to identify the culprit.
Memory bloat. Oversized CLAUDE.md files are a common source of context waste, particularly in projects where the file has accumulated months of instructions without pruning. The new suggestions surface which memory files are largest and recommend trimming strategies. This is complemented by a concurrent change that makes CLAUDE.md HTML comments invisible to Claude when auto-injected — they remain visible when the file is read directly with the Read tool — reducing accidental token consumption from commented-out instructions.
Capacity warnings. As the context window approaches saturation, /context now provides a graded alert with specific guidance: which items to remove, whether to run /compact, or whether starting a new session would be more effective.
autoMemoryDirectory Setting
Version 2.1.74 also introduces autoMemoryDirectory, a settings field that lets teams redirect where Claude Code writes its auto-memory files. Previously, auto-memory was always written to a fixed location relative to the project root. The new setting accommodates setups where the project root is read-only, where auto-memory should be shared across related projects, or where the organization prefers to keep AI-generated files in a dedicated directory outside the main codebase.
Streaming Buffer Memory Leak Fixed
A notable stability fix also ships in 2.1.74: streaming API response buffers were not being released when the generator was terminated early (for example, via Escape or interruption), causing unbounded RSS growth on the Node.js/npm code path. In long or interrupt-heavy sessions, this could accumulate into significant memory pressure. The fix ensures buffers are released promptly on early termination.