<?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: Filipe Synthis</title>
    <description>The latest articles on DEV Community by Filipe Synthis (@synth1s).</description>
    <link>https://dev.to/synth1s</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%2F3832584%2F6cce5614-4ff9-4187-8db4-d5d324de4c04.png</url>
      <title>DEV Community: Filipe Synthis</title>
      <link>https://dev.to/synth1s</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/synth1s"/>
    <language>en</language>
    <item>
      <title>How I solved Claude Code's biggest missing feature</title>
      <dc:creator>Filipe Synthis</dc:creator>
      <pubDate>Wed, 18 Mar 2026 20:33:27 +0000</pubDate>
      <link>https://dev.to/synth1s/how-i-solved-claude-codes-biggest-missing-feature-1cdi</link>
      <guid>https://dev.to/synth1s/how-i-solved-claude-codes-biggest-missing-feature-1cdi</guid>
      <description>&lt;p&gt;If you use Claude Code with more than one account, you know the pain.&lt;/p&gt;

&lt;p&gt;Switch from work to personal? /logout, /login, lose your session state, watch your MCP servers vanish. Do it again tomorrow. And the day after.&lt;/p&gt;

&lt;p&gt;195+ developers &lt;a href="https://github.com/anthropics/claude-code/issues/18435" rel="noopener noreferrer"&gt;https://github.com/anthropics/claude-code/issues/18435&lt;/a&gt;. It's been months. No native solution.&lt;/p&gt;

&lt;p&gt;So I built one.&lt;/p&gt;

&lt;p&gt;The problem&lt;/p&gt;

&lt;p&gt;Claude Code stores everything in two places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;~/.claude.json — your OAuth token and session&lt;/li&gt;
&lt;li&gt;~/.claude/settings.json — your preferences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One set of files. One account. Want to switch? Destroy the first session, create a new one. Every time.&lt;/p&gt;

&lt;p&gt;For developers working with a corporate account during the day and a personal account at night, this is a daily annoyance.&lt;/p&gt;

&lt;p&gt;The discovery&lt;/p&gt;

&lt;p&gt;Buried in Claude Code's &lt;a href="https://code.claude.com/docs/en/env-vars" rel="noopener noreferrer"&gt;https://code.claude.com/docs/en/env-vars&lt;/a&gt;, there's a variable called CLAUDE_CONFIG_DIR. It redirects where Claude Code reads and writes its config files.&lt;/p&gt;

&lt;p&gt;An Anthropic team member &lt;a href="https://github.com/anthropics/claude-code/issues/261:" rel="noopener noreferrer"&gt;https://github.com/anthropics/claude-code/issues/261:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;▎ "As an immediate workaround you can use CLAUDE_CONFIG_DIR env var to set the directory to keep your profile data in."&lt;/p&gt;

&lt;p&gt;The variable exists. It works. But using it manually is clunky — you have to remember paths, set environment variables, and manage directories yourself.&lt;/p&gt;

&lt;p&gt;The solution: Cloak&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/synth1s/cloak" rel="noopener noreferrer"&gt;https://github.com/synth1s/cloak&lt;/a&gt; — a CLI addon that wraps CLAUDE_CONFIG_DIR into a friendly interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @synth1s/cloak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save your current session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  cloak create work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Log out, log in with another account, save it too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  cloak create home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switch instantly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  cloak switch work
  cloak switch home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. No logout. No login. Tokens, MCP servers, settings — all preserved.&lt;/p&gt;

&lt;p&gt;How it works&lt;/p&gt;

&lt;p&gt;Each account gets its own isolated directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ~/.cloak/
  └── profiles/
      ├── work/
      │   ├── .claude.json
      │   ├── settings.json
      │   └── ...
      └── home/
          ├── .claude.json
          └── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you switch, Cloak sets CLAUDE_CONFIG_DIR to point to the right directory. Claude Code reads from there. Nothing is copied, moved, or overwritten.&lt;/p&gt;

&lt;p&gt;Concurrent sessions&lt;/p&gt;

&lt;p&gt;Different terminal, different account. At the same time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="c"&gt;# Terminal A:&lt;/span&gt;
  claude &lt;span class="nt"&gt;-a&lt;/span&gt; work

  &lt;span class="c"&gt;# Terminal B:&lt;/span&gt;
  claude &lt;span class="nt"&gt;-a&lt;/span&gt; home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No conflicts. Each terminal has its own environment variable pointing to a different directory.&lt;/p&gt;

&lt;p&gt;The shell integration story&lt;/p&gt;

&lt;p&gt;Here's something I learned the hard way: a child process can't modify its parent's environment variables. This is an OS-level constraint.&lt;/p&gt;

&lt;p&gt;When you run cloak switch work, the cloak binary sets the variable inside itself — but when it exits, the parent shell still has the old value.&lt;/p&gt;

&lt;p&gt;The solution is a shell function that runs inside the shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;cloak init&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This injects two functions — cloak() and claude() — that intercept the switch command and apply the export in the current shell. First time you run cloak switch, it offers to set this up automatically.&lt;/p&gt;

&lt;p&gt;Built with TDD&lt;/p&gt;

&lt;p&gt;Every feature was test-first. The project has 113 tests across 13 suites, all using Node.js native node:test runner — zero test framework dependencies.&lt;/p&gt;

&lt;p&gt;The TDD discipline caught real bugs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A shell eval was trying to execute "You're already wearing..." as bash code (the apostrophe in "You're" broke it)&lt;/li&gt;
&lt;li&gt;A --print-env flag was leaking user-facing messages to stdout, corrupting the shell eval&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both would have been invisible without tests that specifically checked "stdout must contain only eval-safe shell code."&lt;/p&gt;

&lt;p&gt;Security&lt;/p&gt;

&lt;p&gt;The project went through a security audit before publishing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Path traversal: account names validated against ^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$&lt;/li&gt;
&lt;li&gt;Credential files: created with 0o700 (dirs) and 0o600 (files) permissions&lt;/li&gt;
&lt;li&gt;Shell injection: export paths are double-quoted in eval output&lt;/li&gt;
&lt;li&gt;Token safety: OAuth tokens are never read, logged, or transmitted — only copied as files&lt;/li&gt;
&lt;li&gt;RC file safety: .bashrc modifications include a backup file and marker comment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's next&lt;/p&gt;

&lt;p&gt;The tool is live on npm and solving the problem for 700+ developers who installed it in the first day. The main gap is IDE support — VSCode and JetBrains extensions don't respect CLAUDE_CONFIG_DIR yet&lt;br&gt;
  (&lt;a href="https://github.com/anthropics/claude-code/issues/4739" rel="noopener noreferrer"&gt;https://github.com/anthropics/claude-code/issues/4739&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you're juggling multiple Claude Code accounts, give it a try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @synth1s/cloak
  cloak create work
  cloak create home
  cloak switch work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The source is on GitHub: &lt;a href="https://github.com/synth1s/cloak" rel="noopener noreferrer"&gt;https://github.com/synth1s/cloak&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Built because 195+ developers asked for it and nobody had built it yet.&lt;/p&gt;




</description>
      <category>claudecode</category>
      <category>cli</category>
      <category>opensource</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
