Let your coding agents get a second opinion.
consult is an MCP server that lets Claude Code, Codex and Grok ask each other, and Antigravity, for advice through the CLIs you’re already signed in to. No API keys. It runs on the subscriptions you already have.
npx -y consult-mcp@latest install
Registers with every agent CLI it finds and stays up to date on its own. Node 22+, macOS, Linux or Windows. Install details
Or have every agent you have installed review your changes right now: npx -y consult-mcp@latest review
-
claude
I’ve added a mutex and duplicate rows still show up. Asking Codex before I try a third fix.
ask_agent agent "codex" model "gpt-6-astra" question "Two concurrent sync() calls sometimes insert the same row twice. I lock around the write in src/sync.ts:42 and it still happens. What am I missing?" -
codex
The lock only covers the write. The existence check at src/sync.ts:31 runs before you take it, so both calls see the row as missing and both insert.
Make the insert an upsert on (account_id, remote_id) and let the database settle it. Unlike the mutex, that also holds when the worker process syncs at the same time.
-
claude
That’s the bug. Switching to an upsert and removing the mutex.
Four tools your agent can call
Advisors get read-only access to the repo, so your agent points at files instead of pasting them. Progress streams back while they think. Most calls finish in under a minute and none run past 15.
ask_agent(agent, question, model?, effort?, session_id?, cwd?)- Ask one advisor. The reply carries a
session_id; pass it back to ask a follow-up in the same conversation. ask_agents(agents[], question, effort?, cwd?)- Ask a panel. Two or more advisors work in parallel and their answers come back side by side, so you can see where they agree and where they don’t.
review_changes(agents[], base?, focus?, effort?, cwd?)- Get the diff reviewed before calling it done. consult collects the uncommitted changes, or the branch since
base, and each advisor returns findings with severity,file:lineand a fix. list_agents()- Which agent CLIs are installed, their versions, and the models your account can use.
Every vendor reviews your diff
One command sends your uncommitted changes, or your whole branch, to each agent CLI you have installed. They review in parallel, read the surrounding code to check what they report, and come back with findings: severity, file:line, what goes wrong and how to fix it. Different models catch different bugs, and none of them can change a file.
Your agent gets the same review through review_changes before it calls the work done.
-
consult
[0s] reviewing changes since main with claude, codex, grok (read-only)
[41s] codex finished · [58s] claude finished · [72s] grok finished
-
codex
High · src/billing/refund.ts:57. The refund is sent to Stripe before the row is locked, so two clicks within a second refund twice. Take the row lock first, or pass an idempotency key derived from the refund id.
-
grok
Medium · src/billing/refund.ts:31. amount is checked against the charge total, not what is left after earlier partial refunds, so a third partial refund can exceed the charge.
-
claude
Agrees with the double refund at :57. Nothing else worth fixing; the migration and its rollback match.
npx -y consult-mcp@latest review --base main
Without --base it reviews what you haven’t committed yet. Pick advisors with --agents codex,grok and steer them with --focus "the retry path". The diff goes to each advisor’s provider, the same as when you use that CLI yourself.
Ask the agent that’s already on it
Turn on live sessions and your agents can see the other Claude Code, Codex and Grok sessions you have open, and ask any of them a question. consult forks the session into a read-only copy that knows its whole conversation. The original keeps working and never sees the question.
Off until you turn it on.
-
codex
Every POST to the users endpoint 404s now. The Claude session on feat/accounts has been changing routes, so I’m asking it instead of guessing.
ask_session session_id "4c1e9a20" question "Did /v1/users change? The web client's POSTs 404." -
claude
Yes. I renamed it to /v1/accounts in api/routes.ts:18 an hour ago and kept a redirect for GET only, which is why the POSTs fail.
Point the client at /v1/accounts. The request and response shapes didn’t change.
list_sessions()- The other live sessions you allow: agent, directory, git branch, title, and when each started and was last active. Nothing else from their conversations.
ask_session(session_id, question, effort?)- Ask a read-only copy of one. Pass the reply’s
session_idandcwdtoask_agentfor a follow-up.
| Setting | Who can see and ask whom |
|---|---|
| off | Nobody. The tools don’t appear. This is the default. |
| repo | Sessions in the same git repository, including its worktrees. |
| machine | Every consult session you run on this machine. |
npx -y consult-mcp@latest settings
Install asks whether to turn it on, or pass --sessions=repo. A copy can repeat anything in its session’s conversation to the agent that asked, so choose the scope you’re comfortable with.
Tell the other session what changed
Asking a copy teaches the original nothing. Turn on session messages and an agent can leave a short note for a session that is still running. That agent reads it in its own conversation after its next tool call or when it finishes its turn, marked as coming from a peer agent and not from you. An idle Claude Code or Codex session is woken to read it.
Off until you turn it on. Needs live sessions.
-
claude
I merged and pushed main. The Grok session in this checkout has uncommitted edits, so I’m telling it what moved.
send_message session_id "7be2f0c4" message "main is now at e27f611. Re-read lib/config.ts and lib/ai/registry.ts; your edits were kept." -
grok
A message arrived from the Claude session on main. I re-read both files before continuing; my edits to lib/ai/decision.ts still apply.
send_message(session_id, message)- Leave up to 4,000 characters for a live session. An idle Claude Code or Codex session is woken, which starts a turn there; an idle Grok session reads the message once you prompt it again. Nothing confirms that it was read.
npx -y consult-mcp@latest install --sessions=repo --messages=on
Delivery uses a hook that install adds to each agent’s own hook file and removes again when you turn messages off. A message puts one agent’s text into another’s context, so it follows the same scope as live sessions and is limited in size and rate.
Hand off a task and keep going
Turn on task dispatch and your agent can give a well-defined job, like the tests for a module or a mechanical refactor, to a Codex or Grok worker running in the background, then check in on it. Workers are the one exception to read-only: they edit files in the working directory, so review their diff before building on it.
Off until you turn it on.
dispatch_task(agent, task, model?, effort?, cwd?)- Start a worker and get a
task_idback at once. Codex workers stay in Codex’s workspace sandbox with no network. task_status(task_id?, wait_sec?, since?)- Commands run, files edited and the worker’s final report. Wait up to ten minutes for it to finish, with each update streamed as progress.
cancel_task(task_id)- Stop the worker. Files it already changed stay changed.
It tells your agent when to ask
consult ships with instructions for the agent that hosts it, so it asks at the moments that pay off instead of on every turn:
- Stuck after two fixes that didn’t work. A third guess from the same model usually fails the same way.
- Before a decision that’s hard to undo, like a schema, a public API or a data migration.
- Before calling work done, with
review_changeson the diff or a plan to check.
It also nudges agents to ask a different vendor than themselves. Different training catches different mistakes.
Advisors can read. They can’t touch.
Every advisor runs headless, read-only and with no MCP servers. It can’t edit files or run commands that change anything, and it can’t call consult back, so two agents can never get stuck consulting each other.
| Advisor | How consult runs it |
|---|---|
| claude | -p --restricted --tools Read,Grep,Glob --strict-mcp-config |
| codex | exec with sandbox_mode="read-only" and approval_policy="never", plugins off, every MCP server disabled by name |
| grok | --tools read_file,grep,list_dir, with the MCP helper tools disallowed |
| agy | -p, only after checking agy’s own settings before every call: writes, shell commands and URL fetches must need approval (so headless agy denies them), with no MCP servers, plugins or hooks |
Advisors read files in the working directory and send them to their own provider, the same as when you use that CLI yourself. Point them at code you’d share with that provider.
Copies of live sessions get the same flags, forked with --resume <id> --fork-session (exec fork for Codex), so the original session’s transcript is only read.
Install
You need Node 22 or later on macOS, Linux or Windows (live sessions and messages need macOS or Linux), and at least one of the claude, codex or grok CLIs, signed in. Antigravity’s agy joins as an advisor when it’s installed too.
-
Register consult with every agent CLI on your
PATH, at user scope. In a terminal it also asks whether to turn on live sessions:npx -y consult-mcp@latest install -
Restart any agent sessions that are already running. To check the setup, and that every advisor is signed in and answers:
npx -y consult-mcp@latest doctor --ask -
Ask for it by name, or let your agent decide:
“Get a second opinion from Codex on this migration plan.”
Updates itself
Each new agent session starts the latest release through npx, so there’s nothing to upgrade by hand.
Runs on Windows
Advisors, reviews and task dispatch work on Windows too, and consult never passes a question through cmd.exe. Live sessions and messages need macOS or Linux.
Removes cleanly
npx -y consult-mcp@latest uninstall takes it out of every CLI it was added to.
Ask from your own terminal
Install it globally with npm i -g consult-mcp and the same advisors answer you directly. consult review has every advisor you have installed review your changes before you commit, and consult doctor checks the whole setup.
$ consult ask codex --model gpt-6-astra "Is the retry logic in src/sync.ts safe?"
$ consult ask codex --resume <session_id> "What would you change first?"
$ consult review --base main
$ consult doctor --ask
$ consult settings
Found a bug?
Tell us in two steps. It takes about two minutes, and you only need a GitHub account.
-
Run doctor and copy what it prints. It shows your consult version, platform and agent CLIs, and what’s misconfigured. Your home directory appears as
~.npx -y consult-mcp@latest doctor -
Open the bug report form, which asks what happened, how to reproduce it and for the doctor output:
Reports are public, so leave out secrets and private code. For a security problem, use private vulnerability reporting instead.