coding-agents
Claude Too Limiting? Fall Back to Codex Seamlessly
Handle CLI usage-limit failures by auto-retrying prompts with Codex, keeping automation resilient without masking real errors.
Where this fits
You’re running an automated workflow that drives Claude Code headlessly — a nightly report, a code review, a batch refactor. Everything works for weeks until one morning the output is empty and the stderr logs contain weekly limit reached. Your pipeline treats it as a success because the exit code was zero, or worse, it crashes without a task. The claude-codex-fallback skill solves this specific gap: when Claude fails due to a genuine usage cap, it re-executes the same prompt with Codex CLI, then records which model actually did the work.
Why agents benefit
- Distinguishes usage limits from real failures — it inspects stdout/stderr for phrases like
weekly limitorhit your limitand ignores network, auth, or parse errors, so you don’t waste Codex calls on unrelated faults. - Persists the original prompt safely — the same prompt is written to a secure temporary file before launch, ensuring the fallback uses identical instructions, not a re-rendered version.
- Preserves your CLI auth context — it relies on existing OAuth or ChatGPT credentials, so no new token handling or secrets management is introduced.
- Fails with transparency — if both CLIs fail, it logs both errors together and does not emit a synthetic success, protecting your downstream automation from acting on broken output.
- Provides a verification checklist — the README lists three test paths (Claude success, Claude limit, Claude generic error) so you can validate behavior before going to production.
Practical scenarios
Nightly dependency update PR generation
Your scheduled job invokes Claude Code to open a PR describing dependency changes. On peak usage days, Claude returns a limit error. The skill catches that, runs Codex with the same prompt, and the PR still lands — you only see a note that Codex produced it.
CI-based code comment generation
Inside a GitHub Action, you trigger Claude to add docstrings to a diff. If Claude hits a weekly cap, the skill falls back to Codex, keeping CI green without requiring you to pre-purchase Claude quota for every runner.
Local agent assistant with mixed usage budgets
You use Claude for primary reasoning and Codex as a reserve. When your personal Claude limit is exhausted, the skill automatically hands off to Codex for that single turn, then returns to normal on the next run after the limit resets.
The skill is listed in the OpenAgentSkill catalog along with other coding-agent patterns — see this skill’s page for community notes.
Add it to your agent workflow
Install with:
npx skills add bam-bam-2/solo-skills --skill claude-codex-fallback
After setup, you configure your orchestration script to call the skill’s entrypoint with your usual Claude flags. A minimal example:
claude-codex-fallback --prompt "Explain the function foo" --claude-flags "--dangerously-skip-permissions" --codex-flags "--model gpt-5"
The skill runs Claude, checks for a usage-limit pattern in stderr, and only then invokes Codex with the same prompt file.
Compare before adopting
Before integrating, compare it against three things: quality signals — does it differentiate usage limits from ordinary rate limits (the README explicitly excludes generic 429s)? maintenance freshness — the repo is small but active (11 stars, recent updates); check if it still tracks CLI flag changes. alternatives — you could write a wrapper script yourself, but this one encodes the battle-tested pattern. workflow fit — does your automation already handle failures gracefully? If you only need occasional manual fallback, a shell alias may be enough.
Why it is worth tracking
This skill is a compact, mature example of a resilience pattern that every heavy CLI-automation user eventually needs. The repo’s explicit test conditions and security notes (no token logging) signal a careful author. As usage-limit detection gets more nuanced (e.g., model-specific limit messages), this pattern will evolve — worth watching for updates. Evaluate it now if your Claude automation has ever silently missed a deadline due to a quota error.
Featured Skill
claude-codex-fallback
Skill by bam-bam-2