Skip to content

Claude Code

Claude Code stops wiping .env files

5 min read

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.327, released by Anthropic on November 17, fixes four bugs that could delete or overwrite your files. In one of them, stopping Remote Control in worktree mode wiped a running session’s git-ignored files, such as .env. If you use Remote Control worktrees, self-hosted runners or project-scoped MCP servers, this update closes those gaps. Auto mode users should also read the new notice: an upcoming release removes the fallback to billed classifier requests.

The release notes on GitHub list well over a hundred changes. Most are small fixes to resumed sessions, subagents and the terminal display. The ones below change what you do, or what you can trust Claude Code to leave alone.

Files that could disappear

The Remote Control bug hit a running session’s git-ignored files when the server stopped in worktree mode. Git keeps no copy of a file it ignores, so a .env lost that way had no undo.

Self-hosted runners started with --use-anthropic-git-proxy had a similar problem. At startup they deleted a non-empty directory named by GIT_CONFIG_GLOBAL. The runner now keeps that directory, ignores the variable and shows a warning.

With project scope, claude mcp add and claude mcp remove deleted other top-level keys from .mcp.json, such as $schema or another tool’s servers. A new guard covers a related case. If .mcp.json lists its servers at the top level with no mcpServers key, claude mcp add --scope project now stops instead of overwriting the file.

/export overwrote an existing file without asking. Now the dialog asks first, and /export <name> leaves the existing file alone and tells you to run /export instead. Several silent failures now report themselves too. /rewind says so when some files could not be restored, and a settings change from /config that fails to save gets a line under the prompt. ExitWorktree asks before removing a worktree that may hold unsaved work. In don’t-ask mode, or with nobody to answer, it refuses unless an allow rule, auto mode or bypass permissions mode allows it.

Secrets and the first Bash command

The new claude mcp add-json <name> - reads a server’s JSON from standard input, so tokens no longer have to appear on the command line. It doesn’t work inside a Claude Code session, so run it from your own shell. On newer models and in PowerShell, Claude is now told not to commit files that likely contain secrets. Claude in Chrome now refuses to upload some credential files; you attach those to the page yourself.

One speed change works in the other direction. To get a session’s first Bash command running sooner, Claude Code may now run your shell’s start-up files before you approve that command, even if you then refuse it. To turn this off, set CLAUDE_CODE_DISABLE_SHELL_HEAD_START=1.

Fixes you’ll notice day to day

Resumed sessions get the biggest share of the fixes. Several cases are closed where messages, an answer or tasks were lost after a crash, a killed process or /clear. A transcript read that ends early is now retried once, so messages are lost less often. Other changes:

  • After a longer outage such as a VPN drop, most remote MCP servers on other machines reached by hostname over https are now retried in the background for about a day.
  • claude -p no longer hangs when fetching a model’s settings stalls, for example at a proxy. After 10 seconds it carries on without them.
  • Claude Code starts again when https_proxy or HTTPS_PROXY is a bare host:port and neither its input nor its output is a terminal (the desktop app, an SDK, cron).
  • In-process agent teammates on a different model from the lead now compact at their own context limit and run on their own model, billed at that model’s rate.
  • On unrecognized models, a reply cut at 32,000 output tokens now continues with a limit of 128,000.
  • When a mod’s $.model.complete or $.model.classify call hits a usage limit, it now gets the API’s error at once instead of hanging the turn. Mods should handle that error.
  • In VS Code, “Claude Code: Add to Chat” in the Explorer’s right-click menu @-mentions the selected files and folders in the chat.

Where auto mode is heading

Auto mode’s notice about falling back to billed classifier requests now says an upcoming release removes that fallback. After that, each action the fallback would have checked will be asked about or denied. Some setups already work this way. Since version 2.1.319, sessions with telemetry or feature flags off, gateways included, have had no built-in classifier fallback, and calls the server couldn’t check are asked about or denied.

This release tightens auto mode in other ways too. It ignores more allow rules that run any package, such as Bash(pnpm dlx *), plus path or version forms of rules it already ignored (/usr/bin/npm run:*). The safety check now decides those calls. Some symbolic links are now refused in path checks, and some paths no longer count as inside a working directory, so they ask for permission.

With permissions.blockReadsOutsideWorkingDirectories on, more Bash commands now get a prompt in bypass and auto modes, and some are denied in auto mode. A Bash command that names a path under a Read or Edit deny rule is now refused more often, where it used to get a prompt.

No comments yet. Be the first.

Join the conversation

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