惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
博客园 - Franky
腾讯CDC
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
V
V2EX
N
Netflix TechBlog - Medium
量子位
Jina AI
Jina AI
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
爱范儿
爱范儿
博客园 - 叶小钗
D
Docker
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I Built a Chrome Extension to Fix My Biggest Claude.ai Fr...
Sreyas · 2026-05-10 · via DEV Community

I use Claude for everything — work research, personal projects, side experiments. The problem: I have multiple accounts and switching between them meant logging out, logging back in, waiting for the page to load, every single time.

So I built ClaudeShift — a Chrome extension that saves your Claude.ai sessions and switches between them with one click.

Here's how it works, what I learned, and why I almost gave up halfway through.


The Problem

If you only use one Claude account, this won't resonate. But if you have a work account and a personal account — or you're a developer managing multiple workspaces — you know the pain.

Every switch looks like this:

  1. Open settings
  2. Log out
  3. Wait for redirect
  4. Type email
  5. Type password
  6. Wait for login
  7. Finally back where you wanted to be

Multiply that by 10 times a day and you've wasted a meaningful chunk of your week on something that should take one click.


The Idea

The fix was obvious once I thought about it: Claude.ai uses session cookies to keep you logged in. If I could save those cookies for each account and restore them on demand, switching would be instant.

That's exactly what ClaudeShift does.


How It Works

ClaudeShift is a Chrome extension built with Manifest V3 and plain JavaScript — no frameworks, no build step.

Saving a session

When you hit "Save Session", the extension reads your active Claude.ai session cookies using the Chrome Cookies API and stores them locally using chrome.storage.local. Nothing leaves your browser.

// Read cookies for claude.ai
const cookies = await chrome.cookies.getAll({ domain: 'claude.ai' });

// Store them with a profile name
await chrome.storage.local.set({
  [profileName]: { cookies, savedAt: Date.now() }
});

Enter fullscreen mode Exit fullscreen mode

Switching accounts

When you select a saved profile, the extension:

  1. Clears the current claude.ai cookies
  2. Restores the saved cookies for the selected profile
  3. Refreshes the active Claude tab
// Clear existing session
await chrome.cookies.getAll({ domain: 'claude.ai' })
  .then(cookies => Promise.all(
    cookies.map(c => chrome.cookies.remove({ url: "https://claude.ai", name: c.name }))
  ));

// Restore saved cookies
for (const cookie of savedCookies) {
  await chrome.cookies.set({
    url: "https://claude.ai",
    name: cookie.name,
    value: cookie.value,
    // ...other properties
  });
}

// Refresh the tab
chrome.tabs.reload(tabId);

Enter fullscreen mode Exit fullscreen mode

The whole switch happens in under a second.


The Hard Parts

Manifest V3 service workers

Chrome's Manifest V3 replaced persistent background pages with service workers. Service workers are great for performance but they go to sleep when idle — which means any state stored in memory gets wiped.

I had to move all session state to chrome.storage.local and re-fetch it every time the service worker woke up. It took me longer than I'd like to admit to figure out why my saved sessions kept disappearing.

Cookie scope

Claude.ai sets cookies with specific domain and path attributes. When restoring cookies, you have to match those attributes exactly or the session won't be recognized. One wrong attribute and you get silently logged out.

I spent an afternoon debugging what looked like a working restore that consistently failed — turned out the sameSite attribute was being dropped during serialization.

The incognito window approach

Adding a second account while already logged into the first was tricky. The solution: open a temporary incognito window, let the user log in, detect the successful login, capture those cookies, then close the window. It feels seamless from the user's side but there's a fair bit of tab monitoring happening in the background.


What I'd Do Differently

Start with the edge cases. I built the happy path first and spent twice as long fixing the edge cases after. Cookie expiry, tabs that aren't claude.ai, users with no saved sessions — every one of these needed handling.

Test with real accounts from day one. I used placeholder data early on and it masked several bugs that only appeared with actual session cookies.

Design the UI last. I wasted time polishing the popup before the core logic was stable. Ship the logic first.


The Stack

  • Manifest V3 Chrome Extension API
  • Vanilla JavaScript — no frameworks, no dependencies
  • chrome.cookies — reading and writing session cookies
  • chrome.storage.local — persisting session data
  • chrome.tabs — detecting and refreshing Claude tabs
  • chrome.windows — incognito window management for adding accounts

Total bundle size: essentially zero. No npm, no webpack, no config files.


Try It

ClaudeShift is free and open source.

GitHub: github.com/codebysreyas/ClaudeShift

Landing page: codebysreyas.github.io/ClaudeShift

Installation takes about 30 seconds via Chrome developer mode — full instructions in the README.

If you use Claude with multiple accounts, give it a try. And if you find a bug or want to contribute, PRs are open.


What I Learned

Building a browser extension is a different kind of challenge from building a web app. You're working within a heavily sandboxed environment, the APIs are quirky, and the documentation assumes you already know things it never explains.

But it's also one of the most satisfying things I've built — because every time I switch accounts in one click, I feel it. The problem was real, the solution is real, and the extension is running in my browser right now while I write this.

That's what good side projects should feel like.


Built by Sreyas VM · GitHub · sreyasmurali150@gmail.com