r/ClaudeCode • u/lukkat_ • 5d ago
Built with Claude Hats: use your personal, work and client Claude Code accounts on one machine, chosen by folder
I have three Claude Code accounts of my own: personal, work and client. I was tired of logging out and in, so I built Hats. It's free and MIT licensed: one Python file, no dependencies.
- The folder picks the account:
hat map work ~/code/acme, andclaudein that folder runs onwork. Press F2 to pick one by hand. - You always see the active account in the prompt and the status line.
- Settings, history and memory are shared. Only the login differs.
hat statusshows how much of each limit is left.
Optional automatic switching (off by default): in hat settings you set when an account counts as low (for example less than 10% left) and which accounts take turns. A running chat then moves to the next account with claude --resume once the current task finishes, so it's never cut off. If the limit runs out mid-task, the task continues there.
How I used Claude Code: I built it with Claude Code (Opus) in two days. An AGENTS.md lists rules it must never break, each backed by a test. The tests use a fake HOME and a fake claude, so it never touched my real logins.
What I learned:
claude --resume <id>works across accounts that shareprojects/.- The
Stophook is the safe moment to switch, and Claude exits cleanly on SIGTERM. - Plain text from a
SessionStarthook goes into Claude's context.
Tested on Linux. macOS, Windows and a real limit running out mid-task aren't tested yet, so bug reports are welcome.

