Skip to content

Claude Code

Claude Code 2.1.312 stops overwriting big CLAUDE.md files

5 min read

Our AI analyst checked this story itself: it ran, measured and compared against the originals. What we checked

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →

Claude Code 2.1.312, out on October 27, stops Claude from overwriting a very large CLAUDE.md, rules file or @-included file in a subdirectory after reading only its start, according to the release notes on GitHub. On Bedrock, Vertex, Foundry and Mantle, a model name Claude Code doesn’t recognize, such as a custom deployment name or an inference profile ARN, now gets the shorter system prompt even when it fronts Sonnet or Haiku, and keeps the full prompt only with CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0.

How large is very large?

Instead of letting Claude replace such a file, Write now asks it to read the whole file or edit it in place. Anthropic’s memory docs put a number on “very large”. Files that load on demand are cut at 40,000 characters on a 200K context window. That covers a subdirectory CLAUDE.md or CLAUDE.local.md, their @ imports, subdirectory .claude/rules/ files and path-scoped rules. On a 1M window the cut comes at 200,000 characters on Opus 4.6 and Sonnet 4.6, and at 150,000 on later models. Past that point Claude gets the start of the file plus a note telling it to read the rest with the Read tool.

The docs date that limit to v2.1.309; before that version it didn’t apply to on-demand files. The new Write guard appears aimed at exactly that truncated state. A session can reach it without anyone opening the file: these files load once Claude reads, writes or edits another file in that subdirectory, and a Bash cat or head of a single file counts as a read. A related fix makes per-directory and paths: skills findable again after a Bash cd deeper into a git repository.

Custom model names on cloud providers

The same unrecognized names are now also covered by the automatic model switch after a flagged message; CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1 turns those switches off. In the build we examined, the switch picks its target by model family from ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL or ANTHROPIC_DEFAULT_HAIKU_MODEL when they are set. We did not trace the rest of that logic. The release notes are the only place either new variable is described: we found neither on Anthropic’s settings, Amazon Bedrock or model-configuration pages.

For admins: SSO, policy, hooks, telemetry

The Claude apps gateway gets oidc.user_id_claim, which identifies people by an id_token claim other than sub, such as Microsoft Entra ID’s oid. After a sign-in from the VS Code extension, managed settings and organization policy are now fetched for the rest of the session. And when organization settings can’t be loaded or are refused at startup, the VS Code tab now says why and offers Retry or Sign in again, where the session used to end on a bare exit code.

Prompt and agent hooks now run at most 24 at a time per session, sub-agents included, plus at most 12 that have waited longer than their event’s timeout. A timeout under 1 second now counts as 1 second.

Claude Code also stops sending the claude_code.safety_event OpenTelemetry event, which arrived only in 2.1.307. Alerts built on it stop getting events from installs that update.

Usage limit messages now call the 5-hour window the “5-hour limit” instead of the “session limit”, and VS Code shows resets as a clock time. A subagent’s autoCompactWindow can now lower the window set by CLAUDE_CODE_AUTO_COMPACT_WINDOW, though it still never raises it. The full notes cover fixes for cloud sessions, Claude Tag in Slack and Code Review, which had been reviewing an outdated commit, or none at all, when GitHub delivered a push event late.

Our analysis

What we checked

On October 28 we compared the compiled 2.1.311 and 2.1.312 builds and read Anthropic’s memory and monitoring docs.

How we check stories

The notes say Claude Code stopped sending the safety event. The code shows the event switched off through a remote flag’s default but still present, and we infer it could be turned back on without a new release. The “names Claude Code doesn’t recognize” are decided by a match on a few substrings, which settles whether a cloud deployment keeps the full prompt, and the hook limits are hard-coded numbers.

  • Safety event: both builds have the same emitter and call sites. Only the gate differs. It reads the same feature flag, tengu_snoopy_creek, which defaults to true in 2.1.311 and to false in 2.1.312. We did not see the flag flipped back. Anthropic’s monitoring docs still describe the event as live, requiring v2.1.307 or later.
  • Hooks: the limits of 24 and 12 and the 1-second floor are literal constants in 2.1.312 and absent from 2.1.311. The limiter applies only to hooks whose type is prompt or agent.
  • Model names: after a catalog lookup, a name counts as recognized if it contains claude-3-, haiku or sonnet, or is one of claude-opus-4-0, -4-1, -4-5, -4-6 or -4-7. In 2.1.311 a final branch decided the names that matched none of these. That branch is gone in 2.1.312, so those names get the short prompt outright. Our inference from the compiled code: a Bedrock ID or ARN that spells out sonnet or haiku still counts as recognized at this step, though we did not trace the normaliser that runs first. An application inference profile ARN with an opaque ID doesn’t count, and neither does a custom deployment name without those words.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.