Skip to content

settings.json Is Fully Rewritten and enabledPlugins Is Cleared in Claude Code

Quick fix

Put retained Claude Code project settings in .claude/settings.local.json to avoid loss when cc-switch overwrites user-level settings.json.

Error output
但是只要一切换到 路由模式 上面这段就消失了  导致我设置失效  CC还自动升级 缓存也无法有效命中
English translation

But whenever I switch to route mode, the section above disappears, causing my settings to stop working. CC also auto-upgrades, and the cache cannot be effectively hit.

The report states that cc-switch regenerates and rewrites the entire `~/.claude/settings.json` file using provider configuration and the common config in its database. `statusLine`, `enabledPlugins`, `permissions`, `hooks`, and custom `env` keys outside the common-config allowlist may not be saved in that fragment, so they can be silently lost after disk-writing actions such as switching, syncing, or route mode.

The discussion notes that the switch path from 3.17.0 to 3.18.0 added partial syncing, but update, add, route mode, and startup sync may still overwrite the file with the old fragment. A commenter submitted PR #5786 to cover those paths, but the issue does not show that it was merged or released; it cannot be treated as a verified official fix.

  1. If the issue only needs to be avoided in a specific project, create `.claude/settings.local.json` in that project's repository root and save settings that must persist across cc-switch switches. This file has project-level Local scope, and cc-switch does not write to it.

    // .claude/settings.local.json
    {
    "statusLine": {
    "type": "command",
    "command": "node ~/.claude/plugins/claude-hud/statusline.mjs",
    "padding": 0
    },
    "enabledPlugins": {
    "claude-hud@claude-hud": true
    },
    "skipDangerousModePermissionPrompt": true,
    "hooks": { ... },
    "permissions": { ... }
    }
  2. After switching or syncing, check whether custom settings in `~/.claude/settings.json` were lost. For multiple projects, configure each project's `.claude/settings.local.json` separately.

  3. Monitor whether PR #5786 mentioned in issue #3631 is merged and released. The issue does not yet provide a released version with a verifiable complete fix.

ToolClaude Code
Version受影响:3.17.0 - 3.18.0(报告称非 switch 写盘路径仍可能受影响)
PlatformsWindowsmacOS
Can `~/.claude/settings.local.json` serve as a safe place for user-level settings?
No. The discussion states that no user-level `.local` variant exists; `.claude/settings.local.json` only takes effect in the project repository root.
Does 3.18.0 fix lost `statusLine`?
The discussion says 3.18.0 added partial autosync only to the switch path. Update, add, route mode, and startup sync may still overwrite stale fragments, and the issue does not confirm a complete fix in an official release.
Why can custom `env` keys also disappear?
The source analysis in the discussion says common config uses allowlist serialization; listed custom keys such as `DISABLE_AUTOUPDATER` and `CLAUDE_CODE_ATTRIBUTION_HEADER` do not enter that fragment.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.