<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Timur Lolaev</title>
    <description>The latest articles on DEV Community by Timur Lolaev (@bodasooqa).</description>
    <link>https://dev.to/bodasooqa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3941997%2F09dfacd0-486b-4f4b-a340-954a01a9752b.JPG</url>
      <title>DEV Community: Timur Lolaev</title>
      <link>https://dev.to/bodasooqa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bodasooqa"/>
    <language>en</language>
    <item>
      <title>I built nvm-style account manager for Claude Code</title>
      <dc:creator>Timur Lolaev</dc:creator>
      <pubDate>Thu, 21 May 2026 07:00:00 +0000</pubDate>
      <link>https://dev.to/bodasooqa/i-built-nvm-style-account-manager-for-claude-code-47na</link>
      <guid>https://dev.to/bodasooqa/i-built-nvm-style-account-manager-for-claude-code-47na</guid>
      <description>&lt;p&gt;If you use Claude Code with more than one account – personal and work, or one per client – you know the dance. &lt;code&gt;claude&lt;/code&gt; opens, you realize you're under the wrong account, you &lt;code&gt;/logout&lt;/code&gt;, &lt;code&gt;/login&lt;/code&gt;, sit through the OAuth browser flow, then forget which account you're in by the time you switch projects again.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;claudenv&lt;/strong&gt; to make this stop happening.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claudenv use work
claude   &lt;span class="c"&gt;# automatically under your work account&lt;/span&gt;

&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects/clientA
&lt;span class="c"&gt;# auto-switches if you opted in, or:&lt;/span&gt;
claudenv use personal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's it. The same &lt;code&gt;claude&lt;/code&gt; binary, just pointed at different config directories via the official &lt;code&gt;CLAUDE_CONFIG_DIR&lt;/code&gt; environment variable. No symlinks, no patching files in place, no daemons.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Claude Code reads its config from &lt;code&gt;~/.claude&lt;/code&gt; by default, but respects &lt;code&gt;CLAUDE_CONFIG_DIR&lt;/code&gt; if set. &lt;code&gt;claudenv&lt;/code&gt; keeps one directory per account under &lt;code&gt;~/.claudenv/accounts/&amp;lt;name&amp;gt;/&lt;/code&gt; and points the env var at the right one. Each account has its own OAuth state, settings, MCP servers, the whole thing.&lt;/p&gt;

&lt;p&gt;There are three layers of state, exactly like &lt;code&gt;nvm&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global default&lt;/strong&gt; – what you set with &lt;code&gt;claudenv use work&lt;/code&gt;, persists across shells&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-project override&lt;/strong&gt; – a &lt;code&gt;.claudenvrc&lt;/code&gt; file in your repo, picked up via walk-up resolution like &lt;code&gt;.nvmrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shell-session override&lt;/strong&gt; – &lt;code&gt;.claudenvrc&lt;/code&gt; auto-switches on &lt;code&gt;cd&lt;/code&gt; if you enable the hook
Set a default, override per-project, forget about it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Why not just claude-switch or claudectx?
&lt;/h2&gt;

&lt;p&gt;There are other tools in this space – I want to be upfront about that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/SaschaHeyer/claude-switch" rel="noopener noreferrer"&gt;&lt;code&gt;claude-switch&lt;/code&gt;&lt;/a&gt; uses the same &lt;code&gt;CLAUDE_CONFIG_DIR&lt;/code&gt; mechanism, but the workflow is per-launch: &lt;code&gt;claude-switch work&lt;/code&gt; runs Claude under that profile, every time you start a session. If you prefer being explicit on every invocation, use it – it's a fine tool.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;claudectx&lt;/code&gt; and a few others go a different route entirely, symlinking or patching &lt;code&gt;~/.claude.json&lt;/code&gt; in place. That works too, but it's stateful in a way I didn't want. If the symlink breaks or a patch fails halfway, you end up in a weird state that's hard to debug.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;claudenv&lt;/code&gt; is for people who switch accounts more than once a day and don't want to type the profile name every time. If your projects are clearly tied to specific accounts, &lt;code&gt;.claudenvrc&lt;/code&gt; + auto-switch means you basically never think about it again.&lt;/p&gt;
&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/bodasooqa/claudenv/main/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or with &lt;code&gt;wget&lt;/code&gt;, or download and inspect first – instructions are in the README.&lt;/p&gt;

&lt;p&gt;Bash or zsh, that's the only requirement. No Node, no Python, no Homebrew, no extra dependencies. Twenty lines into &lt;code&gt;~/.zshrc&lt;/code&gt;, you're done.&lt;/p&gt;
&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;A few things on the roadmap: a &lt;code&gt;claudenv self-update&lt;/code&gt; command, a Homebrew tap once there's a real release cadence, and a wrapper that makes GUI-launched IDEs (Cursor, VS Code from the Dock or Spotlight) pick up the active profile – currently that's a known limitation with &lt;code&gt;launchd&lt;/code&gt; not reading shell rc files, documented in the README.&lt;/p&gt;

&lt;p&gt;If it solves your problem, a star helps me prioritize what to build next. Issues and PRs welcome.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bodasooqa" rel="noopener noreferrer"&gt;
        bodasooqa
      &lt;/a&gt; / &lt;a href="https://github.com/bodasooqa/claudenv" rel="noopener noreferrer"&gt;
        claudenv
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      nvm-style account manager for Claude Code. Switch profiles via CLAUDE_CONFIG_DIR, with per-project .claudenvrc and auto-switch on cd.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;claudenv&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="https://github.com/bodasooqa/claudenv/actions/workflows/shellcheck.yml" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/bab801b170cc2b6688d4c30fb2e3fef9ae9734f9b9650b2019af0e498017a8e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626f6461736f6f71612f636c617564656e762f7368656c6c636865636b2e796d6c3f6272616e63683d6d61696e266c6162656c3d7368656c6c636865636b266c6f676f3d676974687562616374696f6e73266c6f676f436f6c6f723d7768697465" alt="ShellCheck"&gt;&lt;/a&gt;
&lt;a href="https://github.com/bodasooqa/claudenv/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/7b622f3368be3e0f7f75d7bd7087035a0987dd7208d89f5aa44436a90f6facd1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626f6461736f6f71612f636c617564656e76" alt="License: MIT"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/fabc47dc27a22a4897c60771aa5a633cb9387fd1d1448dd4f0f4cb6339fb3444/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61634f532d737570706f727465642d3030303030303f6c6f676f3d6170706c65266c6f676f436f6c6f723d7768697465"&gt;&lt;img src="https://camo.githubusercontent.com/fabc47dc27a22a4897c60771aa5a633cb9387fd1d1448dd4f0f4cb6339fb3444/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61634f532d737570706f727465642d3030303030303f6c6f676f3d6170706c65266c6f676f436f6c6f723d7768697465" alt="macOS"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/4ab8915a6f4a0fe1beca0d0cb34e8bcea1ce557405db6e171a1af9e030e9e2a0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e75782d737570706f727465642d4643433632343f6c6f676f3d6c696e7578266c6f676f436f6c6f723d626c61636b"&gt;&lt;img src="https://camo.githubusercontent.com/4ab8915a6f4a0fe1beca0d0cb34e8bcea1ce557405db6e171a1af9e030e9e2a0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e75782d737570706f727465642d4643433632343f6c6f676f3d6c696e7578266c6f676f436f6c6f723d626c61636b" alt="Linux"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An &lt;strong&gt;nvm-style&lt;/strong&gt; account manager for &lt;a href="https://docs.claude.com/en/docs/claude-code" rel="nofollow noopener noreferrer"&gt;Claude Code&lt;/a&gt;. Set a default account, override per-project with &lt;code&gt;.claudenvrc&lt;/code&gt;, optionally auto-switch on &lt;code&gt;cd&lt;/code&gt;. Zero dependencies.&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;claudenv import default       &lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; save current ~/.claude as 'default' (auto-activated — first profile)&lt;/span&gt;
claudenv add work             &lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; create new empty slot&lt;/span&gt;
claudenv use work             &lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; switch this shell + set as global default&lt;/span&gt;
claude                        &lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; /login here, isolated from 'default'&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;When &lt;code&gt;accounts/&lt;/code&gt; is empty, the first &lt;code&gt;import&lt;/code&gt; or &lt;code&gt;add&lt;/code&gt; auto-activates the new profile so you don't have to follow with &lt;code&gt;claudenv use&lt;/code&gt;. Subsequent ones don't change the active profile.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Is this for you?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Claude Code already supports &lt;code&gt;CLAUDE_CONFIG_DIR&lt;/code&gt; for account isolation. Several tools wrap this — pick the one that fits how you work:&lt;/p&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;claudenv&lt;/th&gt;
&lt;th&gt;&lt;a href="https://github.com/SaschaHeyer/claude-switch" rel="noopener noreferrer"&gt;claude-switch&lt;/a&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mental model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Set a default, work normally&lt;/td&gt;
&lt;td&gt;Specify account on every launch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Typical command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude&lt;/code&gt; (after &lt;code&gt;claudenv use work&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude-switch work&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Per-project config&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.claudenvrc&lt;/code&gt; (walk-up resolution)&lt;/td&gt;
&lt;td&gt;✗&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/bodasooqa/claudenv" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>claude</category>
      <category>cli</category>
      <category>productivity</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
