[BUG] /auto-mode-setup stores autoMode.environment globally with no per-repo key — facts from different repos get silently blended

Status Open
Reported on v2.1.233
Maintainer reply None cached
Activity 1 comment · opened Aug 17, 2026

Title

[BUG] /auto-mode-setup stores autoMode.environment globally with no per-repo key — facts from different repos get silently blended

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet (closest: #87233, same-repo dedup bug — orthogonal; #81990, general global/local scoping gap — related but not this case)
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

Ran /auto-mode-setup in repo A (mac-os-config). It wrote an autoMode.environment array into the global ~/.claude/settings.json containing repo-A-specific facts (trusted repo path, protected branch master, sensitive-data locations specific to that codebase), grouped under ### Org-wide / ### User-specific headings.

Later ran /auto-mode-setup in an unrelated repo B (unicef-web-app-nextjs). Instead of scoping repo B's facts separately, or replacing repo A's now-irrelevant profile, it appended repo B's facts into the same global array, under the same shared headings. The result is one flat list where repo A's and repo B's facts are interleaved with no key distinguishing which repo a bullet applies to — e.g. two different "Trusted repo" lines and two different "Default / protected branches" lines (master vs develop), both under one un-scoped ### Org-wide section.

This is inconsistent with the rest of the config system: this same repo's .claude/settings.local.json already scopes permissions.allow entries per-project correctly. autoMode.environment doesn't follow that pattern at all.

What Should Happen?

/auto-mode-setup should either (a) write repo-specific autoMode.environment data to the invoking project's own settings file, or (b) if it must live globally, key each entry/section by repo path so profiles don't blend, and replace rather than append when re-run against the same repo.

Error Messages/Logs

None — no error surfaced; the corruption is silent.

Steps to Reproduce

  1. In repo A, run /auto-mode-setup, apply the proposal.
  2. cat ~/.claude/settings.json → note autoMode.environment contains repo-A-specific facts (trusted repo, protected branch, sensitive-data locations).
  3. cd into unrelated repo B, run /auto-mode-setup, apply the proposal.
  4. cat ~/.claude/settings.json again → repo A's and repo B's facts now sit in the same array under shared headings, with no per-repo scoping. Example from my own file: one ### Org-wide section contains both **Default / protected branches**: master (repo A) and **Default / protected branches**: develop (repo B) as separate bullets with no indication which repo either applies to.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

(not applicable — first time using this command)

Claude Code Version

2.1.233 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

Related: #87233 (same command duplicates/contradicts entries on re-run within one repo — a fact-level dedup bug; this report is the orthogonal problem of no repo-level scoping at all, so even perfect same-repo dedup wouldn't stop cross-repo blending). #81990 ([FEATURE] settings.local.json for ~/.claude global settings) covers the general scoping gap this concretely falls into.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗