AIToday
AI Coding AssistantsZenn AI/MLPublished: Oct 13, 2026, 22:00 JST

CLAUDE_CONFIG_DIR=~/.claude-work still leaks ~/.claude/CLAUDE.md, kills AGENTS.md

CLAUDE_CONFIG_DIR=~/.claude-work still leaks ~/.claude/CLAUDE.md, kills AGENTS.md

3 Key Points

  1. What happened

    With three rule files in place, launching CLAUDE_CONFIG_DIR=~/.claude-work in ~/repo pulled in the personal ~/.claude/CLAUDE.md and ~/.claude/rules/**, and the repository's AGENTS.md was not read.

  2. Why it matters

    Splitting accounts by folder can silently merge one account's conventions into another's work, so the repository's own rule file is ignored.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Many Mac users face a practical setup: one machine, two Claude Code accounts, such as a company Team plan and a personal Max plan. The recommended fix is the CLAUDE_CONFIG_DIR environment variable, which redirects Claude Code's configuration to a per-account folder like ~/.claude-work instead of the usual ~/.claude. That moves settings.json, CLAUDE.md, skills, MCP settings, and the projects/ conversation logs into the new folder. An alias in ~/.zshrc makes the switch easy, and claude auth status shows which folder is in use.

The catch appears only in a specific layout. Claude Code reads <folder>/.claude/CLAUDE.md as project instructions while walking up from the working directory, so when the repository sits under the home folder, ~/.claude/CLAUDE.md is picked up as if it belonged to a project. Normally that file is just the personal configuration, so nothing seems wrong; with a separate work folder, it suddenly acts as another account's rules, and it also makes the repository's AGENTS.md go unread. The test confirms this is layout-dependent: a repository outside the home folder did not show the mix-in.

The proposed guard is claudeMdExcludes in the work folder's settings.json. Listing the personal CLAUDE.md restores AGENTS.md, but the rules/ folder needs its own entry, or those rules keep leaking through.

FAQ
Why does ~/.claude/CLAUDE.md leak into the work profile at all?
Claude Code walks up from the working folder and reads <folder>/.claude/CLAUDE.md as project instructions. If the repository sits under the home folder, that walk passes through home and picks up ~/.claude/CLAUDE.md.
What exactly stops the leak?
Writing claudeMdExcludes into ~/.claude-work/settings.json and listing /Users/<you>/.claude/CLAUDE.md and /Users/<you>/.claude/rules/**. After that the personal rule file stays out and AGENTS.md is read again.
Do skills, agents, and commands also mix between profiles?
No. In the test, the items inside ~/.claude that mixed in were CLAUDE.md and the rules in rules/; skills/, agents/, and commands/ did not.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleMicroLLM lab runs seven tiny AI models in your browser