# How to Set Up claude-code-unlimited: Automatic Claude Code Session Rotation to Avoid Hitting Limits

> AI Release · @ai_releaseorg · https://ai-release.org/guides/kak-nastroit-claude-code-unlimited-avtomaticheskaya-rot_en.html

## TL;DR

- Time to complete: about 20 minutes (plus one test task long enough to touch a quota limit)
- Difficulty: Intermediate
- You need: a machine where the Claude Code CLI already runs, at least two Claude Pro/Max subscriptions of your own, `git`, and a terminal. Exact Node.js/CLI version requirements — check the documentation of the CLI build you use.

## What you will get

- A cloned and configured `claude-pro-pool` dispatcher (`aaronyi97/claude-pro-pool`, subtitle: “Dispatch Claude Code sub-agents across your own Pro/Max accounts”) that hands sub-agents to whichever of your accounts has the most remaining limit.
- One credential profile per Claude Pro/Max account, so quota exhaustion on account A switches the work to account B automatically, and the task continues from the same place instead of restarting.
- A verification checklist that proves the switch actually happened, plus a written record of which profile holds which subscription.

## Quick start

```bash
git clone https://github.com/aaronyi97/claude-pro-pool.git
cd claude-pro-pool
cat README.md
claude --version
```

Details and verification — in the steps below.

## Requirements and setup
![Illustration: Requirements and setup](https://ai-release.org/guides/img/kak-nastroit-claude-code-unlimited-avtomaticheskaya-rot-en-1.jpg?v=1795531113)


- **OS:** any system where the Claude Code CLI runs (macOS, Linux, or Windows through WSL). If you are new to the CLI, start with [Claude Code Desktop: setup, limits and how it differs from the CLI](https://ai-release.org/guides/claude-code-desktop-ustanovka.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).
- **Claude Code CLI installed and logged in** at least once. Version — check the documentation.
- **Two or more Claude Pro/Max subscriptions of your own.** The pool dispatches work across *your* accounts only; it is not a way to get more quota than your subscriptions carry.
- **`git`** for cloning the repository.
- **GitHub access** over HTTPS or SSH, depending on how your network is set up.

A **sub-agent** is a separate Claude Code worker that the main agent spawns to do a slice of the job (for example, “refactor module X”). A **quota** is the usage limit that a Pro/Max subscription allows in a period; the pool’s whole job is to notice that one subscription has hit its limit and move the next sub-agent to another subscription.

Prepare the baseline and confirm each tool answers:

```bash
git --version
node --version
claude --version
```

Expected: one line per command. `git version 2.x` and a Node.js version the CLI documentation lists as supported. If `claude --version` prints `command not found`, install the CLI and authenticate before continuing.

## Step 1. Inventory your accounts and keep the profiles apart

**What to do:** list every Claude Pro/Max subscription you own and give each one its own config directory. Claude Code keeps credentials per config directory; separating them is what lets the pool pick a different account instead of reusing one login.

```bash
mkdir -p ~/.claude-profiles/work
mkdir -p ~/.claude-profiles/personal
ls -1 ~/.claude-profiles
```

Expected output:

```
personal
work
```

**Why:** if both accounts share one config directory, the second `/login` overwrites the first set of credentials, and the pool has nothing to switch to — you stay stuck on a single subscription and hit the same limit.

**How to check:** after logging in to each profile (Step 2), `ls -la ~/.claude-profiles/<profile>` must show credential files, not an empty directory.

Log in to the first profile:

```bash
export CLAUDE_CONFIG_DIR="$HOME/.claude-profiles/work"
claude
```

Inside the session type `/login`, finish the browser flow, then exit. Claude Code reads `CLAUDE_CONFIG_DIR` so each profile is isolated — confirm the exact variable name against the documentation for your CLI version. Repeat with `~/.claude-profiles/personal`.

Write the inventory down, because you will need it during triage:

| Profile directory | Subscription | Status |
|---|---|---|
| `~/.claude-profiles/work` | Pro/Max | logged in |
| `~/.claude-profiles/personal` | Pro/Max | logged in |

## Step 2. Install the pool and connect the accounts
![Illustration: Step 2. Install the pool and connect the accounts](https://ai-release.org/guides/img/kak-nastroit-claude-code-unlimited-avtomaticheskaya-rot-en-2.jpg?v=1795531121)


**What to do:** clone the dispatcher and follow its README to register the profiles you created in Step 1.

```bash
cd ~
git clone https://github.com/aaronyi97/claude-pro-pool.git
cd claude-pro-pool
less README.md
```

**Why:** the pool does not create accounts — it dispatches sub-agents across the accounts you already own, choosing by remaining limit. The README of `aaronyi97/claude-pro-pool` is the authoritative source for the registration command, the config file name, and the environment variables it expects. Copy those names from the README rather than guessing; the repository evolves and flag names change.

**Example:** if the README asks for a list of profile paths, the value you feed it is exactly the two directories from Step 1:

```
/Users/<you>/.claude-profiles/work
/Users/<you>/.claude-profiles/personal
```

Launch Claude Code through the dispatcher command documented in the README rather than from a bare shell. A sub-agent started outside the dispatcher is invisible to the pool and will keep hammering the exhausted account.

**How to check:** run the README’s status or doctor command (if it has one — otherwise re-read the “usage” section). You should see both profiles listed as available, each with a remaining-limit figure, and no “0 accounts” line. If you work with a team that shares accounts and sub-agents, the wiring in [Claude Code for Teams: Setting Up Subagents and a Shared AI Superagent](https://ai-release.org/guides/claude-code-dlya-komandy-kak-nastroit-subagentov-i-obsc.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide) applies to the same sub-agent concept and helps you decide what belongs in a shared pool and what should stay personal.

## Step 3. Verify that rotation actually happens
![Illustration: Step 3. Verify that rotation actually happens](https://ai-release.org/guides/img/kak-nastroit-claude-code-unlimited-avtomaticheskaya-rot-en-3.jpg?v=1795531150)


**What to do:** run a task big enough to consume one account’s limit, and watch the pool’s output while it runs. Use a real, disposable job — for example, ask the main agent to split a refactor across several sub-agents so quota is consumed quickly.

```bash
cd /path/to/your/project
# start Claude Code with the dispatcher command from the README
```

Expected sequence on screen: the first sub-agent starts on profile A, the session prints a limit message from that account, the pool moves the next sub-agent to profile B, and the task text continues where it stopped instead of restarting from the first file.

**Why:** the whole promise of the project — auto-switch on quota exhaustion with the work continuing from the same place — is only true if the dispatcher, not your shell, launched the sub-agents. Watching one real switch is the only proof that your wiring is correct.

**How to check:** tick every line:

- [ ] `claude --version` answers in the same terminal used for the task.
- [ ] Both profile directories exist and contain credentials (`ls -la ~/.claude-profiles`).
- [ ] The pool reports at least two available accounts before the task starts.
- [ ] During the task, an account switch is logged and the sub-agent count keeps growing.
- [ ] After the task, the files produced before and after the switch are both present in the working tree (`git status`).

If the fourth box never gets ticked, go to Troubleshooting.

## Troubleshooting

**Problem. The task stops on a quota error and no switch happens**

- Error: `Claude AI usage limit reached. Your limit will reset at <time>.`
- Cause: the sub-agent was started from a plain `claude` session with a single `CLAUDE_CONFIG_DIR`, so the dispatcher never saw it and had only one account in scope.
- Solution: exit the session, re-export nothing manually, and start the task with the dispatcher command from the README. Then confirm the pool lists both profiles:

```bash
ls -1 ~/.claude-profiles
```

If only one directory is listed, repeat the `/login` step for the missing account.

**Problem. A profile refuses to start**

- Error: `Error: Invalid API key · Please run /login`
- Cause: the profile directory was created but never authenticated, or its credentials expired after you logged in to another account in the same directory.
- Solution: point the CLI at that profile and log in again.

```bash
export CLAUDE_CONFIG_DIR="$HOME/.claude-profiles/work"
claude
# inside the session: /login
```

Then re-run the pool’s status command and check that the profile is no longer marked unavailable.

**Problem. The clone fails**

- Error: `fatal: repository 'https://github.com/aaronyi97/claude-pro-pool.git/' not found`
- Cause: a typo in the owner or repository name, a private fork with no access, or no network route to GitHub.
- Solution: test the URL without cloning and compare it character by character with the repository name in the source post (`aaronyi97/claude-pro-pool`).

```bash
git ls-remote https://github.com/aaronyi97/claude-pro-pool.git HEAD
```

A commit hash means the URL is correct and the earlier failure was local (proxy, credentials, or an outdated `git`).

## Summary and next steps

You now have a dispatcher that spreads Claude Code sub-agents over your own Pro/Max subscriptions and moves the work to the next account when one runs out. Next, cap the blast radius: pair the pool with explicit budgets from [How to Set Spending Limits and Budgets for AI Agents](https://ai-release.org/guides/kak-nastroit-limity-rashodov-i-byudzhety-dlya-ii-agento.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide), and if you ever want a cheaper fallback than a subscription, see [How to connect a local LLM to Claude Code: llama-server and an OpenAI-compatible API](https://ai-release.org/guides/kak-podklyuchit-lokalnuyu-model-k-claude-code-llama-ser.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).

## FAQ

**Does claude-pro-pool give me extra quota beyond my subscriptions?**
No. It dispatches sub-agents across your own Pro/Max accounts and picks the one with the most remaining limit; the total limit stays the same.

**What happens to a sub-agent that was running when the account hit its limit?**
According to the project description, the account changes automatically and the work continues from the same place — you do not restart the task.

**How many accounts do I need for the rotation to be useful?**
At least two, otherwise there is nothing to switch to. Each needs its own config directory and its own `/login`.

**Does it work if I only use the CLI, without the desktop app?**
The pool targets Claude Code sub-agents; the desktop app is a separate client. For differences between the two, check the desktop guide linked above. Exact supported CLI versions — check the repository README and the CLI documentation.
