twinlane is a command-line tool designed to integrate Anthropic's Claude Code CLI and OpenAI's Codex CLI into a unified workflow. It leverages the user's existing subscriptions and helps developers switch efficiently between the two AI coding engines through usage-aware routing, saved handoff briefs, and background tasks with receipts.
Main purposes
- When Claude Code or Codex approaches its usage limit, the other engine may still have quota; twinlane displays the usage readings of both together and helps route the next task.
- Supports running AI coding agents in parallel in separate git worktrees.
- Provides guard hooks to ensure autonomous coding agents stay active within their worktree.
Main capabilities
- Unified usage view: View the usage windows of Claude Code and Codex at the same time, including the window currently limiting each engine.
- Task routing: Select an engine based on task type, latest usage readings, and configured thresholds. Default thresholds: 75% warning, 80% prepare handoff, 85% stop new non-urgent work, 100% hard stop. Unknown or stale readings are treated as unknown and cannot authorize that engine.
- Handoff briefs: Save task goals, progress, decisions, and recent evidence for the next engine to use.
- Background tasks and receipts: Background tasks leave an event log, final result, and receipt that can be reviewed locally.
- Failover: If a dispatched worker ends due to a usage limit, twinlane can make one policy-checked attempt with the other engine, carrying the original brief, partial output, and worktree changes.
- Coordination commands: Supports waiting for coordination sessions, viewing the board, checking delegated work, and more.
- Worktree management: Code workers can edit the selected worktree; intelligence workers get a read-only configuration.
- Security features: When code workers start, secret-like environment variables (such as TOKEN, SECRET, PASSWORD, API_KEY, etc.) are stripped, and receipts list the stripped names rather than values.
Usage
- Installation: requires Git and Python 3.9+, can be installed via pipx, for example
pipx install git+https://github.com/mmelqadi/twinlane. Live work requires the claude and codex CLIs to be installed and logged in. - Refresh usage readings:
twinlane meter --fresh. Run a read-only task: inspect the repository using the included brief. - Run a write task: requires a linked Git worktree.
- Optional: interactive usage warning hook.
- All commands support
--help. Exit codes: 0 success, 2 usage error, 3 policy rejection, 4 still running or lock held, 5 failure, 6 engine limit hit.
Applicable scenarios
- Developers who frequently encounter Claude Code usage limits or Codex rate limits.
- Teams that want to run AI coding agents in parallel in separate git worktrees.
- Automated coding workflows that need usage-aware routing and failover.
Limitations
- Requires the user to have subscriptions to Claude Code and Codex.
- Live work requires the corresponding CLI to be installed and logged in.
- Usage readings are cached for 120 seconds by default, and dispatch only trusts readings within this period.
- Claude dispatch is rejected when paid extra usage is enabled or the status is unknown; Codex is rejected when readings are missing, unknown, stale, using credits, or over the included usage or spending cap.
- Long-running Codex tasks may still incur paid credits (if the account allows it).
- Platform details: automatic discovery of Codex Desktop is Windows-only; macOS/Linux requires setting TWINLANE_CODEX_BIN or using rollout evidence.
- Worker liveness has three states: alive, dead, unknown; the unknown state occupies an engine slot and blocks certain operations.
- Archiving old tasks has a default 14-day age limit and requires the receipt status and read conditions to be met.