
Key Updates in Claude Code v2.1.334 - Auto-compact Raised to Around 400K and System Prompt Caching for Bedrock
This page has been translated by machine translation. View original
I'm Ishikawa from the Cloud Business Division. Claude Code v2.1.334 (released 2026-12-01) has been released. This article focuses on changes to the CLI itself, and covers only the major changes to the VS Code extension, Claude Code on the web, and so on. Today, I will try out the behavior in which auto-compact for 1M context models changed to about 400K, via Amazon Bedrock (Tokyo Region).
The previous update article is here.
Update Summary
v2.1.334 includes 283 changes. Counting by the leading word in the CHANGELOG, there are 201 Fixed, 34 Improved, 29 Added, 18 Changed, and 1 Removed. By surface, there are 135 for the CLI itself, 64 for the VS Code extension, 55 for Claude Code on the web, 22 for Claude Tag, 5 for Remote Control, and 2 for Code Review. For the CLI itself, many changes concern auto-compact and prompt caching, as well as bug fixes for worktrees and Code Mode.
Highlighted Updates
Auto-compact for 1M context models is now about 400K
The per-model auto setting for auto-compact has been changed to about 400K for most current 1M context models. This applies not only to interactive sessions but also to -p and SDK runs. It is being rolled out gradually, but it is already enabled if you use a third-party provider (such as Amazon Bedrock) or have disabled telemetry. In addition, an Auto-compact window row has been added to /config, and you can now check and change the configured size with /autocompact.
According to the docs, when auto is 400K, compaction runs at about 367K tokens. If you want to use the 1M window, you can change it with /autocompact 1M.
If you run long sessions or -p/SDK workloads on a 1M context model, the timing of compaction may change, so I think it's a good idea to check the current value with /autocompact.
Independent cache breakpoint for the static part of --system-prompt on Bedrock and others
When using Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, or a gateway, or when the experimental beta features are off, including a __SYSTEM_PROMPT_DYNAMIC_BOUNDARY__ line in --system-prompt now sets an independent cache breakpoint on the text above that line.
__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__ is a line placed between instructions that are the same every time and information that changes with each run. Claude Code splits the prompt at the first boundary line and removes that line itself before sending. According to the Agent SDK docs at the time of writing, the prompt is split only when calling the Claude API directly or when using Claude Platform on AWS, and on Amazon Bedrock and others the entire prompt is sent as a single block. On the other hand, the v2.1.334 CHANGELOG says that on Bedrock and others as well, an independent cache breakpoint is set on the text above the boundary line.
Here is an example.
claude -p --system-prompt "$(cat instructions.md)
__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__
チケット番号: 4821" "このチケットを分類して"
If you use claude -p on Bedrock and combine fixed instructions and per-run information into a single system prompt, I think it's worth considering a setup that inserts the boundary line so the fixed part goes into the cache.
/code-review now supports per-folder REVIEW.md
/code-review now supports per-folder REVIEW.md. In local reviews, it also follows REVIEW.md files in folders above the folder containing the committed changes.
For repositories like monorepos where the review perspective differs by directory, I think it's worth considering placing REVIEW.md files at each level of the hierarchy.
Bug fixes: lost unpushed commits in worktrees and more
- Fixed an issue where resuming an unchanged worktree lost unpushed commits that existed only on that branch.
- Fixed an issue where unnecessary auto-compaction or a false "Prompt is too long" error occurred after a response hit the output token limit before writing any text.
- Fixed an issue where all requests in a session failed after Claude called a tool with non-object input.
If you work in parallel with worktrees, or do work that tends to hit the output token limit, I think many of the bugs resolved in this update will matter to you.
Security: claude purge reporting success for symlinked history files
Fixed an issue where claude purge reported success when the history file was a symbolic link. In v2.1.334, it reports that the item was not deleted and tells you where to delete the prompts.
If you use claude purge to delete prompt history, I think it's safest to check whether your history file is a symbolic link, and if so, delete the prompts at the location it points you to.
Update Details
Here I introduce the changes to the CLI itself. Surfaces other than the CLI are summarized in "Other Surfaces".
New Features
- When the
/modelmodel list exceeds 25 entries, a search box is now shown so you can filter by model name and model ID. To use theskey or number keys while searching, press the ↓ key. /desktopandclaude --desktopcan now be used on Arm-based Windows PCs.- An Auto-compact window row has been added to
/config, and you can now check and change the configured size with/autocompact. --health-host 127.0.0.1for the health page and metrics page has been added to the self-hosted runner orchestrator.placement: "full"andautoFocusforClienthave been added for mods, so in fullscreen mode a mod pane can be displayed across the whole terminal until Esc is pressed, and thatClientcan receive key input from the start.cacheWrite5mandcacheWrite1hhave been added tomodelPricing, along withlongPromptfor Haiku 5.5, andcache_write_5m,cache_write_1h, andlong_prompthave been added to the gateway'spricing.overrides(the old keys continue to work)./code-reviewnow supports per-folder REVIEW.md.- On the Claude apps gateway, you can now validate a config file without starting it, using
claude gateway --config <file> --check config. At startup, it reports an invalid managed policy before connecting to Postgres.
Improvements and Changes
- When using Bedrock, Agent Platform, Foundry, or a gateway, or when the experimental beta features are off, an independent cache breakpoint is now set on the text above the
__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__line in--system-prompt. - Claude apps gateway logging has been improved. There are fewer warnings when Postgres or the upstream is down, no warning is issued for client disconnects before the response starts, and the model is recorded in the audit lines of some rejected requests.
- The Claude apps gateway now warns at startup when a managed MCP server contains
${...}placeholders that Claude Code would send as-is. - When adding a GitHub event to a cloud scheduled task, Claude now understands the request fields and events, resulting in fewer failures.
/design-syncnow shows why a design system cannot be exposed to Claude from the session, and has been changed to expose it even when telemetry is off.- In the survey about sharing session transcripts, the Yes action has been changed to pressing Tab after y.
Security-Related
- Fixed an issue where
claude purgereported success when the history file was a symbolic link. - The account email address check has been improved. It now also rejects git email addresses as client identifiers, and also runs when using an API key, Bedrock, or Google Cloud's Agent Platform. You can stop it by disabling the Privacy plugin.
Fixes
- Fixed request failures on models where thinking cannot be turned off: Fixed an issue where requests with thinking off failed. Because the request is resent with that setting removed, the model may think on those requests.
- Fixed mTLS client certificate switching: Fixed an issue where a single transient HTTP 400 certificate error caused a switch to an expired or unusable certificate file on disk.
- Fixed wrong worktree origin: Fixed an issue where using
--worktreeafter Claude moved to a different repository, or in some bare repositories whose default branch is notmain, created the worktree from the wrong branch or the local HEAD. - Fixed lost unpushed commits when resuming a worktree: Fixed an issue where resuming an unchanged worktree lost unpushed commits that existed only on that branch.
- Fixed skipped plugin SessionStart hooks: Fixed an issue where SessionStart hooks were skipped in terminal and background sessions when plugin loading finished later than session start (mods may receive this event twice).
- Fixed plugins not loading on new machines: Fixed an issue where plugins enabled via
--settingsor user settings were not loaded on the second launch on a new machine (including resumed and background sessions). - Fixed session stalls behind gateways that rewrite API errors: Unknown 400 and 422 errors are now automatically resent, followed by a resend with past thinking removed. You can disable this with
CLAUDE_CODE_DISABLE_REPLAYED_THINKING_PROBE=1. - Fixed unnecessary auto-compaction after hitting the output token limit: Fixed an issue where unnecessary auto-compaction or a false "Prompt is too long" error occurred after a response hit the output token limit before writing any text.
- Fixed request failures caused by non-object input: Fixed an issue where all requests in a session failed after Claude called a tool with non-object input.
- Fixed exits caused by messages that cannot be displayed: Fixed, in most cases, an issue where Claude Code exited in sessions containing messages that cannot be displayed (such messages are shown as placeholders).
- Fixed git certificate verification failures inside the macOS sandbox: Fixed an issue where
gitcertificate verification failed in sandboxed commands when a corporate CA was trusted via the keychain orNODE_EXTRA_CA_CERTS. - Fixed leftover draft notes during compaction: Fixed an issue where
/compactand auto-compaction could leave the model's draft notes before the conversation summary. - Fixed premature compaction in Code Mode and resending of images/PDFs: Fixed an issue where script tool calls were counted toward the context size and triggered compaction early, and an issue where images or PDFs rejected by the API were resent.
- Fixed "Agent stalled" in Code Mode subagents: Fixed a regression from 2.1.333 where a Code Mode subagent failed with "Agent stalled" and lost its command when a script ran for more than 10 minutes.
- Fixed Code Mode scripts overwriting external edits: Fixed, in some cases, an issue where after
/compact, a Code Mode script overwrote file edits made externally. - Fixed high CPU usage and memory growth caused by MCP servers: Fixed an issue where CPU usage became high when an MCP server requested a retry delay of 0 and kept closing the event stream, and an issue where memory grew each time a connection dropped and reconnected.
- Fixed failure detection for grep and similar commands prefixed with variables: Fixed an issue where the Bash tool reported failure when grep, rg, diff, or git diff prefixed with a variable, such as
LC_ALL=C grep, ended with no matches (except after&&). - Fixed handling of Glob and Grep patterns: Fixed an issue where Glob and Grep found nothing for patterns starting with
./, and an issue where Grep found nothing for lists containing brace patterns such as*.{ts,tsx},*.js. - Fixed shifted line numbers in snippets after file changes: Fixed an issue where, when a file that had been read changed on disk, the line numbers after the first change were shifted in the snippet passed to Claude.
- Fixed profile selection in Bedrock setup: Fixed an issue where Bedrock setup profile selection showed sections that are not
~/.aws/configprofiles, such as[services …]. - Fixed expansion of nested braces in
paths: Fixed an issue where nested braces in thepathsof rules or skills (such assrc/{a,b/{c,d}}/*.ts) were expanded incorrectly and failed to match some files. - Fixed the Edit tool writing curly quotes: Fixed an issue where the Edit tool wrote curly quotes into code when the text to replace was specified with
\u2019-style escapes. - A quietly welcome fix: Fixed misaligned borders in Markdown tables whose cells contain tabs, full-width spaces, or non-breaking spaces, and misaligned display of MCP tool results whose keys contain full-width characters. I think this is an unobtrusive but useful fix for those who often have tables output in Japanese.
- In addition, many other small bugs have been fixed, including in Vim mode,
/design-sync, plugin management, LSP tools, and voice input.
Breaking Changes and Behavior Changes
The auto setting for auto-compact is now about 400K on 1M context models
This is the change introduced in the highlighted updates. The notice in the docs says that auto sessions now compact at about 400K instead of 1M. Also, the docs table "Sessions that run past 400K by default" lists 1M for versions before v2.1.334. If you want to keep using the 1M window in v2.1.334 and later, specify it explicitly using the methods described in the docs (the prompt strings are examples).
Before (up to v2.1.333, an example run with no setting):
# Run with no setting (auto)
claude -p "長いリファクタリングを進めて"
After (v2.1.334 onward):
# To use the 1M window, specify it explicitly
claude -p --autocompact 1M "長いリファクタリングを進めて"
# In scripts and CI, you can also specify it via an environment variable
CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000 claude -p "長いリファクタリングを進めて"
Rewrites by managed PostToolUse hooks now return an error
For managed PostToolUse hooks, when a tool cannot use rewrites, an error to that effect is now returned to Claude. To keep the rewrite, return the value in the tool's native output format. This applies to managed hooks. Note that the hooks docs at the time of writing say that values that don't match a built-in tool's output format are ignored and the original output is used.
The following is an example setup in which a managed PostToolUse hook rewrites the output of the Bash tool. The output format after the change (stdout, stderr, interrupted, isImage) is based on the example in the docs.
Before (an example returning a value that doesn't match the tool's output format; per the docs, it is ignored and the original output is used):
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"updatedToolOutput": "[redacted]"
}
}
After (v2.1.334 onward, an example returning the Bash tool's output format to keep the rewrite):
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"updatedToolOutput": {
"stdout": "[redacted]",
"stderr": "",
"interrupted": false,
"isImage": false
}
}
}
Fewer ignore files applied by Grep
In some sessions, Grep now applies fewer ignore files. The CHANGELOG does not state which ignore files are affected, so I only contrast the behavior.
- Before (up to v2.1.333): In some sessions, Grep applied multiple ignore files to exclude files from the results
- After (v2.1.334 onward): Fewer ignore files are applied, and files that were previously excluded may appear in the results
Other Surfaces
VS Code Extension (64 changes)
- The number of changed lines is now shown in the chat header, and a "Review Session Changes" command has been added that opens the files Claude edited during the session in a single diff tab.
- In the new UI, Mermaid diagrams in Claude's replies are now displayed. You can check the text with Show source, and there is also a button to open them in an editor tab.
- In the new UI, Remove, Edit, and Send now have been added to queued messages, and a Try again button has been added below replies that failed due to server errors, overload, or connection loss.
- When using Bedrock, application inference profile ARNs are now shown in the new UI's model menu as the model family or short ID, with the full ARN shown in a tooltip.
- Immediately after VS Code starts or reloads, the path of the open file is now attached to the next message even without clicking inside the file. You can disable this with
claudeCode.attachOpenFile. - Panel menus, dialogs, and notifications now say "session" instead of "conversation" or "chat", and the "New Conversation" command has been changed to "New Session".
- In the new UI, fixed an issue where failures of tests, builds, type checks, and linters piped to commands such as
headortailwere shown as successes. - In addition, many improvements and fixes have been made, mainly to the display and accessibility of the new UI.
Claude Code on the web (55 changes)
- One-time and Custom have been added to the frequency menu in the New scheduled task dialog, so cloud Claude Code tasks can now be run just once or on a cron schedule.
- A Git providers setting has been added that lets Team and Enterprise Owners restrict which GitHub organizations and personal accounts can be linked to the organization (off by default).
- Many cloud scheduled tasks created manually on claude.ai/code without a repository have been changed to become Claude Code tasks that open in claude.ai/code instead of Chat tasks.
- Unlinking a GitHub account no longer disables the member's own scheduled tasks on that repository (tasks run under Claude's agent ID are still disabled).
- In addition, improvements and fixes have been made to scheduled tasks, self-hosted environments, the Changes pane of cloud sessions, and more.
Remote Control (5 changes)
- Archiving a running, connected session from the menu now asks for confirmation first.
- Fixed issues including Send now on a pending message ending background subagents in sessions started with
claude remote-control(v2.1.321 and later).
Claude Tag (22 changes)
- In workspaces not connected to Claude Tag (including Pro and Max accounts), the responses that remained in the previous Claude in Slack app have been removed. Most people will see a notification instead.
- "Copy settings to…" has been added to the menu on the admin-settings Slack workspace and channel pages, so granted access bundles can now be shared with other workspaces and channels.
- Fixed an issue where
MCP_TOOL_TIMEOUTset in cloud environment variables was ignored in almost all Anthropic-hosted sessions. - In addition, improvements and fixes have been made to admin settings and the display in Slack.
Code Review (2 changes)
- The Repositories table in Code Review settings now shows the review level of repositories reviewed via a GitHub organization.
- Fixed an issue in the Add a repository dialog where a repository whose name on GitHub contains uppercase letters could be selected even though it was already in the list.
Trying the auto-compact change to about 400K
The CHANGELOG says it is already enabled when using third-party providers. So I ran Claude Code via Amazon Bedrock (Tokyo Region) and checked both headless execution and an interactive session.

The test environment is as follows.
- Claude Code v2.1.334 (the same version as the article's subject)
- Amazon Bedrock (ap-northeast-1), inference profile
global.anthropic.claude-sonnet-5-5 - Test date: 2026-12-02
Checking the test environment (Management Console)
I opened [Inference profiles] → [System-defined] in the Amazon Bedrock console (Tokyo Region) and confirmed that the global.anthropic.claude-sonnet-5-5 inference profile exists (the image omits the inference profile ARN column).

What can be confirmed in headless mode
I checked with --help the --autocompact flag that specifies the auto-compact window at startup, and ran claude -p once via Bedrock. --bare skips loading hooks and plugins, and --tools "" disables tools.
% claude --version
2.1.334 (Claude Code)
% claude --help | grep -i -A2 autocompact
--autocompact <auto|tokens> Auto-compact window size (auto, or at
least 100k tokens)
% CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=ap-northeast-1 claude -p --bare --max-turns 1 --tools "" --no-session-persistence --model global.anthropic.claude-sonnet-5-5 --output-format json "Reply with OK only." < /dev/null > bedrock_run.json
% jq '{result, input_tokens: .usage.input_tokens, output_tokens: .usage.output_tokens, modelUsage: (.modelUsage | map_values({contextWindow, provider}))}' bedrock_run.json
{
"result": "OK",
"input_tokens": 141,
"output_tokens": 4,
"modelUsage": {
"global.anthropic.claude-sonnet-5-5": {
"contextWindow": 1000000,
"provider": "bedrock"
}
}
}
provider was bedrock and contextWindow was 1000000, confirming that a 1M context model is being used via a third-party provider.
Next, in the CloudWatch console, I selected global.anthropic.claude-sonnet-5-5 from the per-model-ID metrics in the AWS/Bedrock namespace and switched the display to [Number]. Invocations was 1, InputTokenCount was 141, and OutputTokenCount was 4, which matches the output of claude -p (input_tokens 141, output_tokens 4).

Note that the JSON output of the headless run did not include the auto-compact window value.
Checking in an interactive session
I checked the auto-compact window value by running /autocompact without a value in an interactive session. I closed the dialog that appears with Esc and did not change the setting. The images below are screenshots of an interactive session run in tmux.
In the test environment's user settings (~/.claude/settings.json), autoCompactWindow: 1000000 is saved in this model's modelSettings. The docs explain that launching with claude --autocompact auto runs with the adjusted window even if a saved setting exists. So I launched it in three ways, varying whether user settings are loaded and the value of --autocompact.
1. auto specified without loading user settings
I launched with --setting-sources project,local so that user settings are not loaded, and also added --bare.
% CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=ap-northeast-1 claude --bare --setting-sources project,local --model global.anthropic.claude-sonnet-5-5 --autocompact auto
The /autocompact display was Current setting for Sonnet 5.5: auto (400k tokens), confirming that auto is 400K for Sonnet 5.5 on Bedrock.

2. 1M specified without loading user settings
Under the same conditions as 1, I launched with --autocompact 1M.
% CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=ap-northeast-1 claude --bare --setting-sources project,local --model global.anthropic.claude-sonnet-5-5 --autocompact 1M
The display was Current setting for Sonnet 5.5: 1m tokens (from settings), and the slider was at the 1m position.

3. auto specified with user settings loaded
I launched normally with no options other than --autocompact auto.
% CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=ap-northeast-1 claude --model global.anthropic.claude-sonnet-5-5 --autocompact auto
The display was Current setting for Sonnet 5.5: 1m tokens (default for this model), Window: auto. Launching with only --bare and no --setting-sources gave the same display. Even with the same --autocompact auto, a launch that loads user settings showed 1m, while one that doesn't showed 400k. I did not check which value actually triggers compaction.

The Auto-compact window row in /config
When I opened /config with the same launch conditions as 3 and typed compact in the search box, the Auto-compact window row was shown as auto ›. Under the conditions of 1 (launched with --bare and without loading user settings), searching for window showed No settings match "window", and this row could not be found.

Because earlier compaction makes subsequent requests smaller, I expect the effect to be larger in environments billed by token volume, such as Bedrock. I think a practical approach is to widen the window with --autocompact only for long investigation tasks where you want to retain context.
Conclusion
The change of auto-compact to about 400K is being rolled out gradually, and it's worth noting that it is already enabled when using third-party providers. Because the behavior of long sessions and -p batch processing may change, I think it's safest to check the current setting with /autocompact after updating.
If you use Claude Code with 1M context models or Amazon Bedrock, why not update and try it out?
References
