Overview
For most use cases, server-side compaction is the primary strategy for managing context in long-running conversations. The strategies on this page are useful for specific scenarios where you need more fine-grained control over what content is cleared.
Context editing allows you to selectively clear specific content from conversation history as it grows. Beyond optimizing costs and staying within limits, this is about actively curating what Claude sees: context is a finite resource with diminishing returns, and irrelevant content degrades model focus. Context editing gives you fine-grained runtime control over that curation. For the broader principles behind context management, see Effective context engineering. This page covers:
- Tool result clearing - Best for agentic workflows with heavy tool use where old tool results are no longer needed
- Thinking block clearing - For managing thinking blocks when using extended thinking, with options to preserve recent thinking for context continuity
- Client-side SDK compaction - An SDK-based alternative for summary-based context management (server-side compaction is generally preferred)
| Approach | Where it runs | Strategies | How it works |
|---|---|---|---|
| Server-side | API | Tool result clearing (clear_tool_uses_20250919) Thinking block clearing (clear_thinking_20251015) | Applied before the prompt reaches Claude. Clears specific content from conversation history. Each strategy can be configured independently. |
| Client-side | SDK | Compaction | Available in TypeScript and Ruby SDKs when using tool_runner. Generates a summary and replaces full conversation history. See Client-side compaction. |