shiichan

Claude Code v2.1.311 is out! Sessions over 200K tokens now compact and continue

Hi, it's Shii-chan!

Claude Code Release github.com

Claude Code v2.1.311 is out. It has a lot of fixes, so I picked the ones that look most useful.

What was announced?

This is v2.1.311 on the Claude Code Release page on GitHub. It's mostly fixes and improvements, with only a few new features.

The story so far

For example, a standard-context session would stop with "Usage credits required for 1M context" when a request ran over 200K tokens. A CLAUDE.md file with a very long list item could cause long freezes at startup and after reading or editing files.

What changes

  • Past 200K tokens, Claude Code compacts the conversation and continues instead of stopping
  • Freezes caused by long list items in CLAUDE.md are fixed
  • Write and Edit no longer stall for up to 5 seconds or report 0 lines changed when changing thousands of lines
  • Interrupting works right away even while an MCP server hasn't answered a resource read or a skill is still downloading

Dive Deep

Here are the additions and changes that look useful in practice:

  • Added --hold-idle-file and --max-hold-min to self-hosted-runner, to keep an idle session while your host reports processes it left running
  • ultrathink in the interactive terminal now runs its turn at xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 through Anthropic's API
  • DISABLE_COMPACT in settings files and in a mod's $.env.set can now only turn compaction off, not back on
  • --output-format json and stream-json now write DEL, C1 control and Unicode format characters inside strings as \uXXXX escapes (parsed values are unchanged)
  • Model names and IDs drop the [1m] suffix and its label where it has no effect (the suffix is still accepted)
  • On Bedrock, Mantle, Vertex and Foundry, model settings load from a signed file on downloads.claude.ai. Set CLAUDE_CODE_MODEL_CATALOG=off to turn this off
  • When the model's reply has no summary during compaction, Claude Code now usually asks for the summary once more before replacing the conversation

Key fixes:

  • Subagents being unable to use MCP tools from servers that finish connecting after the subagent starts
  • Stale MEMORY.md and CLAUDE.md content right after automatic compaction
  • SubagentStop hooks running about twice a minute per running subagent instead of once when it finishes
  • claude -p and SDK sessions saving transcript messages out of order or keeping messages that were taken back
  • The @ file picker ignoring .ignore / .rgignore negation rules
  • Retrying requests the API marked not to retry, which could hold a turn for minutes or, in unattended retry mode (CLAUDE_CODE_RETRY_WATCHDOG), indefinitely

The VS Code extension also gets syntax coloring in code blocks, and starts sessions with DISABLE_TELEMETRY set while VS Code's telemetry setting is off. Claude Tag analytics gains a Skills view showing how often each attached skill runs.

Wrap-up

  • Sessions over 200K tokens compact and continue
  • Several freezes and stalls around CLAUDE.md and Write / Edit are fixed
  • Fixes for subagents, MCP, hooks and claude -p
  • Behavior changes to ultrathink, DISABLE_COMPACT and JSON output escaping

If you use Claude Code every day, especially with long sessions, subagents or hooks, this release is for you!