Two Claude Code Accounts Share One Brain by Default
Omarchy now switches Claude Code accounts for you. I read its scripts: both logins share one CLAUDE.md, hook set and transcript folder. What splits them.
In this post
Running two Claude Code accounts on one machine used to be a chore.
You made a second config directory, aliased claude to point
at it, and logged in twice. Omarchy does that for you now, and if you
want, it switches accounts automatically when one runs low. I use it
every day, so I went and read its scripts to see what the second account
actually gets. The scripts I read are on a dev build (4.0.0.r7598) on one of my Macs.
It gets its own login and its own usage pool. Almost nothing else is its own. Same CLAUDE.md, same hooks, same prompt history, same transcript folder. That is what I want from my setup, but it means a second account does not keep work and personal apart, and that is what most people want one for. The account is a billing boundary. Keeping contexts apart is a separate job, and I do it with layers in my markdown vault.
What Omarchy does for you
Four commands cover most of it, shown here with an example label:
omarchy agent account add claude Second
omarchy agent account use second
omarchy agent account use next
omarchy agent account mode auto 90
The script summaries say what each does. add is “Sign in
to a Claude, Codex, or Grok subscription.” use is “Choose
which Claude, Codex, or Grok account new sessions use.” Note that it
says new sessions. When you switch, the script prints “Running sessions
stay on” the account they started with.
mode is the automatic part. In auto mode the script
reports that Claude “switches new sessions to the account with the most
headroom” once the active account passes the threshold you set. In
manual mode, which is the default, it notifies you at 95% and switches
when you say so. The threshold is clamped between 50 and 100. The same
commands work for Codex and Grok.
The mechanism is small. A wrapper script,
omarchy-agent-account-exec, exports
CLAUDE_CONFIG_DIR pointing at the active account’s home
before it launches claude. The scripts are in
/usr/share/omarchy/bin/, all named
omarchy-agent-account-*, if you want to read them yourself.
Extra accounts live under
~/.local/state/omarchy/agents/accounts/claude/<id>,
where the id is a slug of the label. The main account gets no export at
all and uses ~/.claude as usual. More of what I’ve found in
Omarchy’s agent tooling is in the Omarchy
hub.
On CLAUDE_CONFIG_DIR itself: it is in Anthropic’s docs,
and so is the second login. The environment variables
page says it is useful for running multiple accounts side by side,
with an alias that points claude-work at a second
directory. It also says you can write it into the env block
of your user settings, and that project and local settings can’t set it.
The .claude
directory page says that when you set it, “every
~/.claude path on this page lives under that directory
instead,” and that .claude.json moves with it. Done that
way, the second account gets its own settings, history and plugins. What
Omarchy adds is the switching, and the symlinks that make the second
directory share almost everything with the first.
Does switching accounts separate your work and personal context?
No. On my machine the second account’s home holds 15 symlinks back to
~/.claude. I checked with ls -la on the
directory. Here is the shape of it, trimmed:
CLAUDE.md -> ~/.claude/CLAUDE.md
settings.json -> ~/.claude/settings.json
hooks -> ~/.claude/hooks
skills -> ~/.claude/skills
agents -> ~/.claude/agents
commands -> ~/.claude/commands
plugins -> ~/.claude/plugins
history.jsonl -> ~/.claude/history.jsonl
projects -> ~/.claude/projects
plans -> ~/.claude/plans
file-history -> ~/.claude/file-history
Also linked: output-styles,
keybindings.json, themes and
todos. Real files and folders that belong to the account
alone are .credentials.json, .claude.json,
sessions, session-env,
shell-snapshots, cache and
backups, plus some state like tasks and
paste-cache.
The state script’s docstring says this is on purpose. An added
account “holds only that account’s credentials and links everything else
back to the primary home, so conversation history, settings and skills
stay one set across accounts.” There is one more detail in that script.
When you add an account, it copies a few keys from the primary
.claude.json into the new one: mcpServers,
projects (which is where folder trust lives),
theme, an editor-mode setting and two onboarding flags.
Copied, not linked, so those settings start identical and can drift.
Here is what that adds up to in practice:
- One CLAUDE.md. Whatever is in your global file, both logins load it. If you put your employer’s name in there for convenience, your side-project sessions read it too.
- One hook set. A guard you wrote applies to both accounts. That’s fine until you want a hook on only one of them.
- One prompt history. Per the docs,
history.jsonlholds the prompts you’ve typed, with timestamp and project path, and feeds up-arrow recall andCtrl+R. Both accounts write to the same file. - One transcript folder. Transcripts live in
projects/<project>/. The same docs page says they’re plaintext and hold file contents, command output and the instruction files Claude Code loaded, CLAUDE.md included. Every repo you touch, on either login, lands under that one parent folder. - An unpredictable login. If you use auto mode, which account a new session starts on depends on headroom at that moment. So the login can’t be what tells a session which context it is in.
I’m describing files on my disk here and what the docs say about them. I’m not saying anything about how Anthropic stores data on its side, because I haven’t read anything that tells me.
Why I leave it shared
I want the same hooks, skills and agents on both accounts. The second
login exists so I don’t hit a usage limit in the middle of a job. If
Omarchy gave each account its own skills and
hooks, I’d be maintaining two copies and fixing the same
bug twice. The post on what to sync across
machines is about the same shared-versus-local split, across
machines instead of accounts.
If you do want fully separate files, the docs say
CLAUDE_CONFIG_DIR moves everything, so pointing a second
one at an empty folder with no symlinks gets you that. The price is that
every hook and skill you want on both has to be put in both places by
you. Sharing is a reasonable default. Check which one you have before
you put anything account-specific in those files.
The layers do the separating
My context lives in a vault of plain markdown, which I described in AIOS: An AI Operating System in Plain Markdown. I won’t repeat the setup. The relevant part is that the vault has separate walled layers, one of them the professional side, this site included. My personal notes sit in their own folder outside all of them.
A tab-separated file maps each repo to a layer. The columns are repo directory, layer, project name, path, and an optional flags column. With made-up names:
# repo-dir layer project repo-path
client-api client client-api ~/code/client-api
my-site professional my-site ~/code/my-site
A SessionStart hook reads that file. For a mapped repo
it loads that layer’s identity note and that project’s note into the
session, under a header that names the layer, like
=== AIOS brain (<layer>/<project>) ===. The
injected rules tell the session to stay in that layer: don’t pull
another layer’s vault content into this repo’s output, and don’t carry
one layer’s private detail into a public repo. A repo with no row gets
no injected context, and the instructions say to ask which layer
applies.
That flow never asks which Claude account is logged in. The layer
comes from the repo you opened. I can open my-site on my
second account or on the main one, and it gets the same
professional-layer context either way.
Two more pieces keep the layers apart, both of which the account switcher would otherwise blur:
- Auto memory goes to the layer. Claude Code’s memory
defaults to a folder under
~/.claude/projects/, which as shown above is shared between accounts. I point each repo’s auto memory at a vault folder for its layer, using theautoMemoryDirectorysetting. The notes Claude writes to itself about this site live under the professional layer, and each other repo’s notes live under its own layer. It’s the same setting I use to keep memory in sync across machines. - The global CLAUDE.md carries no identity. It’s the
one file every session in every layer reads, so it only imports shared
files with no identity content: a model routing table, reasoning rules,
a few code and planning rules, a rule about
/tmp, and a tool reference. The rule files I wrote say outright that they contain no identity content.
Instructions get ignored, so the layers have a guard
“Stay in your layer” is an instruction, and a model can miss an
instruction. So the vault also has a PreToolUse hook,
vault-write-guard.sh, that checks edits and shell writes
before they land and exits with code 2 to block them. If you haven’t
written a hook like this, the
four hooks I run on every project covers the mechanics, and the /tmp guard post
is another one on the same pattern.
The guard does three things that matter here:
- Each layer’s
sources/folder is immutable. Any write to it is refused. - A cross-layer tripwire blocks a short list of literal strings from being written into layers where they don’t belong. It’s a cheap grep. The header comment is blunt that it only catches unambiguous tokens so it won’t false-positive, and that it is no substitute for a separate audit agent that looks for inferred leaks.
- Shell commands that write to any of those protected paths are
refused too, since otherwise
echo >>goes around the edit check.
The same file’s comments record where it failed. It was written
against Claude Code’s hook payload, and it enforced nothing under
another agent harness I used. The two differed in payload shape, because
the tool arguments sit at a different level, and in tool-name casing,
because that harness says bash where Claude Code says
Bash. I measured it on 2026-08-11: a write into a
sources/ folder blocked under Claude’s payload and went
through under the other. The same append into a protected file blocked
as Bash and was allowed as bash. The guard now
normalizes the payload at the top, and it treats an unrecognized tool
name as a write.
I bring this up because it applies to anyone running more than one account or tool. If your separation depends on a hook, run a write you know should be blocked and check that it is.
Who needs more than one
The AIOS post says one scope is the right answer for most people (a scope there is what I’ve been calling a layer here), and I still think that. Hobby projects, a single job: one scope, no wall, and a second Claude login is just for limits.
I run more than one because a leak from one layer into another is hard to take back once it’s in a pushed commit or a published page. My test for a second layer is whether I could fix it if text from one side ended up on the other.
You don’t need my setup to hit that test. A contractor with two clients whose repos share a laptop hits it. So does an engineer who maintains an open-source project alongside a day job. If you run a team where several clients’ repos live on shared developer machines and you want the separation written down and enforced, that’s the kind of setup I help with on my consulting page.
What I’d do with two accounts
- Add the second login with
omarchy agent account add, or by hand with a separateCLAUDE_CONFIG_DIRand/login. Decide whether you want shared files (Omarchy’s default) or separate ones. - Look at what’s shared. Run
ls -laon the second account’s home and read which entries are symlinks. That list is what both logins see. - Keep your global CLAUDE.md free of names. Treat it as public to every session, because every session reads it.
- Map each repo to a context in one file, one row per repo, and load only that context at session start. Key it on the repo, not the login.
- Guard the one leak you can’t undo with a
PreToolUsehook, and test it with a write that should fail. - Know where transcripts go. They are plaintext under
projects/. For one repo,claude purge <path>deletes its transcripts, auto memory, its prompt lines inhistory.jsonland its entry in.claude.json. It prints the plan and asks first, and--dry-runshows the plan without deleting.
Read next: what to sync across machines covers the same shared-versus-per-machine split for a second computer, and AIOS has the vault setup behind the layers.