DEV Community

Cover image for Stuck when your AI hits its usage limit mid-task? I made a tool to switch AIs without losing context
Wageesha Tripathi
Wageesha Tripathi

Posted on Edited on

Stuck when your AI hits its usage limit mid-task? I made a tool to switch AIs without losing context

Update (28 Oct): Google stopped serving Gemini CLI on personal Google accounts, so which-ai-to-use now hands the task to Antigravity CLI (free) instead. ▶ Watch the new 36-second demo: https://youtube.com/shorts/LCt2H7bFwLg

I use Codex, Claude Code and Gemini CLI on the same projects. The worst moment is when one of them hits its usage limit halfway through a feature. The next AI starts cold: it re-reads half the project, asks what we are building, and still misses the decisions I already made.

After a lot of trial and error, I made which-ai-to-use: a free, open-source tool that hands your task to another AI with the full context, so it carries on instead of starting over.

Try it: install it from VS Code (search which-ai-to-use in Extensions), or run npx which-ai-to-use in any project.

which-ai-to-use demo: Claude's usage limit is reached mid-task; the extension is installed from VS Code, writes HANDOFF.md from the Claude Code chat and recommends Gemini CLI; then the same in the terminal, the limit warning and the weekly report

What it does

  • Hands your task to another AI. When the limit hits, it writes a handoff note (HANDOFF.md) with the task, your latest requests, where the AI stopped, the commits and changed files, and your test command. Codex, Gemini CLI or any other AI reads it and carries on instead of starting over.
  • Reads the chat for you. The task and your requests come straight from your Claude Code, Codex or Gemini CLI chat, so you don't retype anything.
  • Keeps your secrets out. API keys, passwords and tokens from the chat are hidden before anything goes into the note.
  • Picks who carries on. It suggests the best AI you have installed for the task and starts it with the note. No other AI installed? It tells you which one to get.
  • Gives the task back. When Claude's limit resets, it offers to hand the task back to Claude with the same note.
  • Tells you which AI to use. For any task, it picks the best of your AI tools and the right model, with a ready command.
  • Helps you hit the limit less. It warns you before your 5-hour window runs out, with ways to make it last (like /compact or a smaller model for small edits), and makes your AI skip files that waste tokens: one package-lock.json can be 50,000+ tokens.
  • Shows your AI week. Tokens per day next to the week before, and requests per AI.

How to use it

  • In VS Code, Cursor or Windsurf: open the Which AI sidebar and click Claude limit over?. It writes the note and shows who should carry on, with a Run in terminal button.
  • In a terminal: run npx which-ai-to-use handoff in your project.
  • Automatically: the optional Claude Code plugin writes the note the moment the limit is reached. Setup is in the README.

Get it

Everything runs on your laptop and nothing is uploaded. Usage warnings and reports read only numbers from the logs; the handoff reads your latest chat, on your laptop, to write the note. It is tested on real projects (250 tests).

What do you put in your handoff notes? I'd love to know what I'm missing.

Top comments (10)

Collapse
 
panthpatel profile image
Panth Patel •

The part I'd want to see is where HANDOFF.md lives after the hand-back. I hit the same cold start from a different side: a long-living session ran out of context and the next one started from nothing. I moved the task into a ticket on a separate service, so the spec, the progress and the corrections are messages in its thread, and whichever agent picks it up next starts from there. Does the note get committed with the branch, or rebuilt from the chat each time?

Collapse
 
wst2002rk profile image
Wageesha Tripathi •

Thanks, Panth, good question! It isn't committed: it sits untracked in the project folder, and the tool says not to commit it. Every handoff, including the hand-back with handoff --back, writes it again from what's there right now: the branch, commits and uncommitted changes from git, plus the latest AI chat it can read. Only the task line is carried over from the old note, and the next AI is told to delete it when the task is done. So it's a short-lived note on one laptop, not a history. Your ticket thread keeps the whole story across machines and sessions, which the note doesn't try to do.

Collapse
 
panthpatel profile image
Panth Patel •

Rebuilding it from git on every handoff means the note can't go stale against the branch, which is the failure I'd expect from a committed file. What I'd check is the chat side: if the user corrected the AI an hour earlier ("not that file, this one"), does "latest requests" reach back that far, or only the last few turns?

Thread Thread
 
wst2002rk profile image
Wageesha Tripathi •

Good catch, Panth: this is now in which-ai-to-use 0.10.2. The note used to keep only the first request and the last 3, so a correction from an hour ago was lost. Now HANDOFF.md also has an "Earlier corrections" list: up to 3 older requests like "no, not that file" or "use pnpm instead", marked as still applying unless a later request changed them. npx which-ai-to-use handoff picks it up, and the VS Code extension has it in 0.3.2. Here's the handoff in action: youtube.com/shorts/LCt2H7bFwLg

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@wst2002rk I haven't split out the handoff, so I have no number for it alone. What I can point to is the whole session: Tokenade reduces token costs by 39% on average on long sessions (over 200k tokens, Claude Code, 10 runs per task). Raw data: pi-infected.github.io/token-harnes... If you measure a handoff the same way, I'd like to see your numbers.

Collapse
 
wst2002rk profile image
Wageesha Tripathi •

Thanks, Paul! I measured one: on a real repo (the which-ai-to-use repo itself), HANDOFF.md came to about 300 tokens (1,258 characters, estimated at 4 characters per token). It grows with the number of changed files; chat excerpts are capped at 600 characters, so it stays small.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

The bill hides in the handoff. The new model reads the whole working context before its first step, so what you carry across is what you pay for.

Collapse
 
wst2002rk profile image
Wageesha Tripathi • • Edited

Exactly, that's why the note stays small on purpose. It carries the task, the last few requests and where the AI stopped (each trimmed to a few lines), plus the names of the changed files, not their contents. The note tells the next AI to read those files first instead of exploring the whole project, and fix makes Claude Code, Gemini CLI, Cursor and Aider skip heavy files like package-lock.json, which alone can be 50k+ tokens.

The one place it carries more is a web chat like ChatGPT, which can't open your files: there it includes the diff, capped so it stays reasonable.

Have you measured what a handoff costs on your side? I'd like to compare.

Collapse
 
sandipan_chakraborty_c557 profile image
Sandipan Chakraborty •

impressive wageesha keep going🤩

Collapse
 
wst2002rk profile image
Wageesha Tripathi •

Thank you so much, Sandipan! 😊 Glad you liked it. If you try it, I'd love to hear what you think.