Claude Code v2.1.247 Major Updates - Addition of /claude-api cost-optimize tool and Sonnet 5 auto-compact 1M upgrade

Claude Code v2.1.247 Major Updates - Addition of /claude-api cost-optimize tool and Sonnet 5 auto-compact 1M upgrade

Claude Code v2.1.247 has been released. Here is a summary of the update, which brings significant practical improvements including easier cost optimization with the newly added /claude-api cost-optimize tool and auto-compact for Sonnet 5 now supporting the full 1M context. I tried out /claude-api cost-optimize.
2026.08.27

This page has been translated by machine translation. View original

This is Ishikawa from the Cloud Business Division. Claude Code v2.1.247 (released 2026-08-26) has been released. This was a release where the newly added /claude-api cost-optimize tool caught my eye. I tried out /claude-api cost-optimize.

The previous update article is here.

https://dev.classmethod.jp/articles/20260826-cc-updates-v2-1-246/

Update Summary

v2.1.247 includes 33 changes: 4 new features, 5 improvements, 4 security-related, 1 performance, and 19 fixes. Fixes account for more than half of the total, and they include high-impact issues such as sessions becoming unresponsive and configuration files being lost. There are no explicit breaking changes or deprecations.

Notable Updates

Addition of the SendFeedback Tool

A SendFeedback tool has been added that allows Claude to draft a feedback report when a problem occurs during a session, which can then be reviewed and submitted via /feedback. If you don't need the draft, it can be disabled with the feedbackDrafts setting.

Since the place to report issues is now consolidated under /feedback, I feel it will become easier to capture minor bugs that previously went unreported.

Addition of /claude-api cost-optimize

/claude-api cost-optimize has been added. It allows you to profile the Claude API usage costs of existing projects and review cost factors one by one—including caching, token volume cleanup, batching, effort, and model selection—while measuring each. At the same time, the /claude-api skill itself now supports the Admin API (organization members, invitations, workspaces, API keys, rate limit reports, workload identity federation, and CMEK).

For those operating applications that use the Claude API directly, I feel this can serve as a first step toward identifying opportunities for cost reduction.

Auto-compact for Sonnet 5 Now Covers the Entire 1M Context

The default auto-compact window for Sonnet 5 has been changed to cover the entire 1M context. In sessions with a 1M window, auto-compact will now run at approximately 967K tokens instead of approximately 934K tokens.

For those running long sessions with 1M context, this should be a tangible change as it expands the breathing room before compression kicks in.

Fix for Sessions Becoming Unresponsive

A bug has been fixed where hooks or background agents producing several MB of error output would overflow the conversation, causing sessions to become unresponsive with a "Prompt is too long" error. Additionally, a bug where subagents would stop if they received a 404 model error on their first call has been fixed, and they will now use the session's fallback model chain. Errors returned to the parent agent now include the error type, status, request ID, and model name.

I see this as a fix that will particularly benefit those who have hooks with large outputs or those using subagents and background agents together.

Security Enhancements for Plugins and Terminal Display

The plugin marketplace has been hardened, and names containing control characters or invisible characters are now rejected. Text from the marketplace included in the output of /plugin and claude plugin is also now escaped. On the terminal side, hyperlinks in rendered Markdown that point to network paths or automounter paths, contain control characters, or begin with invisible characters will now be displayed as plain text.

For those who install plugins from third-party marketplaces or casually click on links appearing in the terminal, I feel this is an understated but effective defense.

Update Details

New Features

  • SendFeedback tool: As mentioned above, you can review and submit feedback about issues that occur during a session via /feedback.
  • /claude-api cost-optimize: As mentioned above, you can review Claude API cost factors while measuring them.
  • Display of organization-specific Tips: Entries in the format {id, text, cooldownSessions, priority} along with tipsFile and label have been added to spinnerTipsOverride, allowing organizations to display their own custom Tips in rotation alongside built-in Tips.
  • Auto mode guidance in Bash permission prompt: A tip guiding users to auto mode has been added to the Bash permission prompt, allowing "Yes, and switch to auto mode" to be selected with a single key.

Improvements

  • MCP server connection failures communicated to Claude: In Bedrock, Vertex, and Foundry sessions (and sessions with telemetry disabled), Claude is now informed when an MCP server fails to connect, improving the behavior where it would mistakenly determine that a tool doesn't exist.
  • Admin API support for /claude-api skill: It can now handle organization members, invitations, workspaces, API keys, rate limit reports, workload identity federation, and CMEK.
  • Auto-compact window for Sonnet 5: As mentioned above, the entire 1M context is now the default.
  • Collapsing of peer messages: Peer messages across sessions are now collapsed by default into a one-line preview of Message from @<sender>: <first line>. The full text can be expanded with Ctrl+O.
  • Suppression of PR badge rechecks: The PR badge in the prompt footer will now skip re-querying GitHub on terminal refocus if less than one minute has passed since the last check.
  • Identification of gateway sign-in: Sign-in requests to the Claude apps gateway can now be identified as coming from Claude Code (via the surface=claude_code parameter in device-authorization and the claude-code/<version> User-Agent).

Security

  • Hardening of the plugin marketplace: As mentioned above, names containing control characters or invisible characters are now rejected, and output escaping has been added.
  • Safeguarding of terminal hyperlinks: As mentioned above, links pointing to network paths, containing control characters, or beginning with invisible characters are displayed as plain text.
  • Disabling analytics from startup: When gateway login is enforced via managed settings or a custom OAuth deployment is configured, analytics will now remain disabled from startup rather than only after login.
  • Change in sign-in enforcement behavior: If managed settings from the administrator cannot be read, the system will now exit at startup due to organizational sign-in enforcement, even if host-provided settings or per-user Windows registry settings exist.

Fixes

  • Fixed session freezes caused by large output from hooks and background agents: A bug where conversations would overflow due to several MB of error output, causing sessions to become unresponsive with "Prompt is too long," has been resolved.
  • Fixed subagent stopping on initial model 404: Subagents now use the session's fallback model chain, and errors returned to the parent agent now include the error type, status, request ID, and model name.
  • Fixed Bash sandbox deleting settings.json symlinks: A bug where post-command cleanup would delete symlinks to ~/.claude/settings.json that were pointed outside the sandbox's writable area by dotfile management tools (nix/home-manager, stow) has been resolved.
  • Fixed /terminal-setup overwriting Zed's entire keymap.json: A bug where the entire file was overwritten instead of merging keybindings has been resolved.
  • Fixed memory growth when hook output file writes fail: A bug where memory usage would grow without limit has been resolved, and locations where output was lost are now recorded in a file.
  • Fixed incorrect selections from fast arrow key + Enter operations: A bug in history search, /config, /mcp, /skills, background tasks, and /model where operations would be executed on the line above the intended one has been resolved.
  • A quietly welcome fix: A bug where, when mouse reports were split and read right after an escape prefix, strings like <35;150;7M would be entered into the prompt has been fixed. Many people may have been silently deleting these without knowing the cause.
  • In addition, numerous minor bugs have been fixed in cloud sessions, background sessions, Remote Control, non-Latin keyboard layouts, initial setup, and more.

Trying Out the /claude-api cost-optimize Tool

This is a subcommand of the claude-api skill bundled with Claude Code, and it is an interactive auditing and improvement workflow for "reducing the execution cost of existing Claude API calls without degrading output quality."

To state the conclusion upfront: when I actually tried it, I found that it is a feature for inspecting Claude projects (repositories), and its use differs from optimizing the execution cost of Claude API call code. It's possible my operation during the trial was insufficient, but the actual behavior was as follows. As a result, I felt this feature is useful for a different aspect of cost auditing.

Since the tab is an interactive UI, the steps are as follows:

  1. Run /claude-api cost-optimize

    20260827-cc-updates-v2-1-247-1

  2. Select a scope from the scan results (2. Target genu54's GenU)

    20260827-cc-updates-v2-1-247-4

  3. The Claude project (repository) is analyzed and a report is output.

    20260827-cc-updates-v2-1-247-6

In the above, the artifact-design skill was automatically executed, a browser launched, and a report like the following was displayed. (I ran it several times, and in some cases I was asked whether to output a report as an Artifact.)

20260827-cc-updates-v2-1-247-7

In Closing

With the addition of the /claude-api cost-optimize tool and the expansion of Sonnet 5's auto-compact to 1M, I feel this is a release that raises the day-to-day usability by another notch. For those running long sessions that use up the full 1M context, this should be an especially tangible change.

For those who regularly use hooks or subagents, or those deploying organization-wide with managed settings, I encourage you to review the relevant fixes and changes and give the update a try.

References

https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md

https://code.claude.com/docs/en/changelog

https://dev.classmethod.jp/articles/20260826-cc-updates-v2-1-246/


Claudeならクラスメソッドにお任せください

クラスメソッドは、Anthropic社とリセラー契約を締結しています。各種製品ガイドから、業種別の活用法、フェーズごとのお悩み解決などサービス支援ページにまとめております。まずはご覧いただき、お気軽にご相談ください。

サービス詳細を見る

Share this article

AWSのお困り事はクラスメソッドへ