On-demand consultation with Codex or Gemini at any point during development. Get a second opinion when you're stuck, validate an approach before committing to it, or sanity-check an architecture decision — without leaving your Claude Code session.
A Claude Code plugin that provides ad-hoc consultations with the Codex or Gemini CLI.
Companion to pre-flight, which reviews plans automatically. MidFlight is for everything that happens after planning.
- You're mid-development and want a second opinion
- Run
/midflight should we use WebSockets or SSE here?(or just/midflightand Claude figures out what to ask) - Claude summarizes the current context and question
- The query is sent to your configured provider (Codex or Gemini)
- Claude presents the external model's perspective alongside its own analysis
No transcript parsing, no hooks — Claude already has full context, so it writes a concise summary and question directly.
| pre-flight | mid-flight | |
|---|---|---|
| Trigger | Automatic (ExitPlanMode hook) | Manual (/midflight) or Claude-initiated |
| Context | Plan file (extracted from transcript) | Claude's own summary (already has full context) |
| Purpose | Catch plan issues before approval | Get unstuck, validate approaches, second opinions |
| Mechanism | Hook + deny/retry pattern | Skill (slash command) + query script |
MidFlight automatically infers whether you need advice or implementation:
- Consult (default) — "Should we use X or Y?", debugging help, architecture validation. The external model provides advice without modifying files.
- Implement — Precise, spec-driven changes: "Add method X to file Y with these exact signatures." The external model reads files, makes edits, and runs verification.
You don't need to specify which mode — Claude classifies intent from the query. When uncertain, it defaults to consult (safe by default).
- Claude Code CLI
- One of the following providers:
- Codex CLI installed and authenticated (default)
- Gemini CLI installed and authenticated
bashin your PATH
claude plugin marketplace add Abeansits/mid-flight
claude plugin install mid-flight@mid-flightRestart Claude Code after installing.
Create ~/.config/mid-flight/config to override defaults:
provider=codex
codex_model=gpt-5.3-codex
codex_reasoning_effort=high
gemini_model=gemini-2.5-pro
| Setting | Default | Description |
|---|---|---|
provider |
codex |
Query provider (codex or gemini) |
codex_model |
gpt-5.3-codex |
Codex model to use |
codex_reasoning_effort |
high |
Reasoning effort (low/medium/high) |
gemini_model |
gemini-2.5-pro |
Gemini model to use |
Separate config from pre-flight so you can use different models/settings for ad-hoc queries vs plan reviews.
# Ask a specific question
/midflight should we use WebSockets or SSE for real-time updates?
# No question — Claude identifies what needs a second opinion
/midflight
# Claude can also self-invoke when it recognizes it's stuck
# (after 3+ failed attempts, unfamiliar technology, etc.)claude plugin marketplace update mid-flight
claude plugin update mid-flight@mid-flightclaude plugin remove mid-flight
claude plugin marketplace remove mid-flightRestart Claude Code after uninstalling.
| Error | Cause | Fix |
|---|---|---|
'codex' CLI not found |
Codex CLI not installed or not in PATH | Install from github.com/openai/codex |
'gemini' CLI not found |
Gemini CLI not installed or not in PATH | Install from github.com/google-gemini/gemini-cli |
Codex query failed |
Auth issue or network error | Run codex --version to verify install, check API key |
Empty response |
Provider returned nothing | Try again or switch providers in config |
Run Claude Code with claude --debug to see query execution logs. All logs are prefixed with [mid-flight] on stderr and include mode, provider, query size, response size, and duration.
Technical details
MidFlight is a skill-based plugin (slash command), not a hook-based plugin like pre-flight. This is a deliberate design choice:
- Skills run inside Claude's context — Claude already knows everything about the current task, so there's no need for transcript parsing
- Claude summarizes, not transcript extraction — produces better, more focused context than any parsing could
- On-demand, not automatic — the user (or Claude itself) decides when a consultation would be valuable
/midflightinvokes the skill, which instructs Claude to assess the situation- Claude writes a structured query (context + question) to a temp file
- The query script (
scripts/query.sh) reads the file, wraps it with a system prompt, and routes to the configured provider - The provider's response is returned to Claude via stdout
- Claude presents the response with its own analysis (agreements, disagreements, recommended next steps)
Same pattern as pre-flight: separate functions (query_codex, query_gemini) behind a config-driven router. Adding a new provider requires only a new function and case branch.
The skill prompt includes guidance for when Claude should consider consulting an external model on its own — e.g., after multiple failed debugging attempts, when facing unfamiliar technology, or when two approaches seem equally valid. When self-invoking, Claude is instructed to be transparent about why.
MIT