Out of Claude Code quota? Finish the feature in OpenCode

A half-unrolled sea chart with an amber dotted route, over a band of blue sea.
curl -fsSL 'https://ivar.run/install?ref=claude-code-usage-limit-opencode' | sh

The limit hits mid-feature

When you hit the Claude Code usage limit halfway through a feature, switching model with /model does not get you further. Paid plans have a five-hour session limit and weekly limits, the weekly limits apply across all models, and Claude Code draws from the same pool as Claude chat (Anthropic: usage and length limits). /usage shows what counts against them (Anthropic: models, usage and limits in Claude Code). You can wait, enable usage credits, or keep working in another harness.

A Claude Code feature request from June 2026 describes the cost of switching by hand: copying conversation summaries into a new session and re-explaining the codebase. OpenRouter's tutorial keeps you in Claude Code and moves the bill to an API key. Hora de Codar asks the question this post answers: can the task be finished in OpenCode?

It can, with one condition stated up front. The code is on disk; the conversation is not. A harness switch in ivar is a relay: a fresh session on the same feature, on the same branch and worktrees, under a different provider. Nothing from the Claude Code conversation carries over. What carries over is what the agent writes down in a handoff.

Walkthrough

The example feature is checkout-tax, promoted in an api and a web repo of an ivar hall at ~/acme. Commands, flags and messages below are from ivar 0.21.0. Setting up the hall is a one-time step covered in the quickstart; the hall has to list OpenCode as a provider, which the quickstart's ivar provider add covers.

OpenCode needs a model provider of its own: your Claude subscription does not work there. Anthropic's terms limit subscription sign-in to Claude Code and Claude.ai (The Register, February 2026).

1. Ask Claude Code to leave a handoff

A handoff is a summary, pending tasks, open decisions and changed files, stored in the hall's memory for the next session. The agent's instructions tell it to open one when you wrap up, and also state that nothing opens a handoff for you. So ask for it while Claude Code still answers, for example once /usage shows the window nearly spent:

claude — ~/acme

You: I'm close to my usage limit. Leave a handoff so OpenCode can finish checkout-tax.

acme-ivar - memory_handoff_begin (MCP)(feature: checkout-tax, to.provider: opencode)

Bash(ivar provider list)

Agent: The handoff is open for OpenCode sessions on checkout-tax: the tax line in the web cart and the api rate fixture are pending, and per-line versus per-order rounding is still open. To continue, run the relay below in a terminal at ~/acme.

The handoff the agent wrote carries:

summary:         Tax rates load from the api; the web cart does not show them yet
pending_tasks:   Render the tax line in the web cart
                 Add the rate fixture to the api tests
open_decisions:  Round per line or per order
modified_files:  api/src/tax/rates.ts
                 web/src/cart/summary.tsx
to.provider:     opencode

feature puts it in the feature's queue, and to.provider makes it visible only to OpenCode sessions. Handoffs expire after 7 days by default (memory.handoff_ttl_days in ivar.json).

2. Run the relay

This is the one step you run yourself, because it starts a new harness process: OpenCode opens in your terminal, in place of the Claude Code session that is out of quota. Quit Claude Code first, then paste the command the agent gave you:

ivar session start checkout-tax --relay --provider opencode \
  --prompt "Read the open handoffs for this feature, then continue from the first pending task."

--relay checks three things before it touches anything:

  • --provider, always. A relay exists to switch harnesses.
  • An earlier session on the feature. The Claude Code session counts as long as its view dir exists: quitting Claude Code leaves it in place, ivar session stop removes it.
  • A different provider from that session. Relaying checkout-tax to Claude Code again is refused with relay must switch provider; the most recent session on `checkout-tax` already ran `claude-code` .

The new session gets a new view dir over the same promoted worktrees, OpenCode's native files, and AGENTS.md built from the hall's HALL.md, the same rules Claude Code read as CLAUDE.md. --prompt is OpenCode's first message, so the session opens already working. Because ivar launches OpenCode itself, on Linux the OpenCode process runs under the same Landlock write sandbox a Claude Code session started this way gets.

If Claude Code stopped before it could write a handoff, the relay works the same way. Put what is left in --prompt in your own words; the OpenCode agent then reads the changes already in the worktrees.

3. OpenCode picks the work up

On Claude Code, a session-start hook runs ivar memory brief and prints the open handoffs before the first prompt. OpenCode has no such hook: its plugins cannot inject context at session start. The ivar MCP server's instructions tell the agent to call memory_handoff_list at session start instead, and the --prompt above makes that explicit:

opencode — ~/acme

You: Read the open handoffs for this feature, then continue from the first pending task.

acme-ivar - memory_handoff_list (MCP)(feature: checkout-tax)

acme-ivar - memory_handoff_accept (MCP)

Bash(ivar feature status checkout-tax)

Agent: I claimed the handoff from Claude Code. api and web are promoted on checkout-tax as it left them. Starting with the tax line in the web cart; rounding is still open, so I'll ask before I pick per line or per order.

Check the first answer: the agent should name the pending tasks the handoff lists. Accepting the handoff claims it, so a later session does not pick it up again.

4. Close the Claude Code session

Quitting Claude Code left its session record and view dir in place, which the relay needed. Once OpenCode is working, ask it to remove them:

opencode — ~/acme

You: Stop the old Claude Code session on checkout-tax.

Bash(ivar session list)

Bash(ivar session stop <claude-code-session-id>)

Agent: The Claude Code session is stopped; this OpenCode session is the only one on checkout-tax.

ivar session stop removes the view dir and ends any harness still running in it. Quit Claude Code yourself, as in step 2: two agents should never write into the same worktrees. It warns session.handoff_missing when a session worked and left no handoff, which happens when Claude Code stopped before step 1. The warning does not block the stop.

Result

The feature keeps going on the same branch, in the same worktrees, under OpenCode. The new agent starts from the handoff and the files on disk, with the same hall rules and skills. When the Claude Code window resets, the same relay with --provider claude-code moves it back.

Limits

  • No conversation transfer. The relay is a new session. Reasoning that never made it into a file, a commit or the handoff is gone.
  • The relay is a command you run. It launches OpenCode as a new process in your terminal, which the Claude Code agent cannot do for you, and which it cannot do at all once it is out of quota.
  • OpenCode does not show handoffs on its own. The brief runs at session start on Claude Code, T3 and OMP. On OpenCode the agent has to call memory_handoff_list, which is why the relay passes --prompt.
  • The kernel sandbox needs the relay. The Landlock write sandbox applies only to a harness that ivar session start launches, on Linux 5.13 or later. Opening OpenCode by hand and attaching it with ivar session connect leaves only the tool guard hook, which checks the agent's tool calls but cannot see every write a shell command makes. On macOS there is no kernel sandbox either way.
  • Your Claude plan does not come along. OpenCode needs its own model provider or an API key, billed separately from the plan. If you want Claude specifically and pay per token anyway, the OpenRouter route keeps you in Claude Code.
  • A different model reads the work. Expect the new agent to re-read files before it edits them.
  • macOS and Linux only.

For a single repo and a short task, writing the handoff into a Markdown file and opening OpenCode in the same directory gets you most of the way. The relay helps when the feature spans several repos and worktrees, which a new harness otherwise has to find again on its own.