context editing

Context editing is the practice of clearing stale content such as old tool results from a conversation history to manage the context window, and the name of a Claude API feature from Anthropic.

1 articleLast mentioned

Context editing is a technique for managing a model's context window by removing or shrinking parts of the conversation history that are no longer needed. Anthropic added a feature of this name to the Claude API in 2025. It automatically clears older tool results or thinking blocks once the history passes a configured size.

Long-running AI agents tend to fill the context window as tool results pile up. Unlike compaction, which replaces the whole history with a summary, context editing removes only selected parts of it. Because it alters earlier parts of the history, it can invalidate the prefix stored by prompt caching.

This entry is based on AIPOST articles and widely known facts. If something is wrong, please send us a correction request.

Articles covering this entry

  • Claude Code's Code Mode Runs Tools From JavaScript and Trims Token CostsAI in Practice ·

    Anthropic's API offers context editing that prunes tool results and thinking blocks, but if the tokens saved are smaller than the penalty for breaking the cache…

    Read article

Found a mistake or missing an entry?

Wiki entries are based on AIPOST articles and widely known facts. If an entry is wrong, send us a correction request and we will check and fix it. Names from new articles are added to the wiki after the article is published.