ping-claude
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ping-claude ask Claude if my uncommitted retry changes are safe to ship"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ping-claude
One read-only Claude advisor that any coding agent can ping for a second opinion.
Inspired by https://x.com/jon_barron/status/2126793821606629749
The workflow: many worker agents (Gemini, Codex, or anything else) write the code. One Claude session sits beside them. It cannot write code, and you never read its output. When you want a second opinion in a worker thread, you tell the worker to ping Claude. The worker is free to overrule Claude, and it must rewrite Claude's take in its own words before it shows you anything.
ping-claude is the piece that connects the two sides: a single-file MCP server with
no dependencies. A ping is one tool call, so the worker asks, waits, and gets the
answer inside the same turn. Nothing is passed through shared files.
flowchart LR
You -->|talk| A[Worker thread A]
You -->|talk| B[Worker thread B]
A -->|ask_claude| P1[ping-claude]
B -->|ask_claude| P2[ping-claude]
P1 --> L{{file lock:<br/>one ping at a time}}
P2 --> L
L -->|claude -p --resume| S[(One Claude session<br/>per repository and model)]
S -.->|read-only| R[Your code]What you get
Rule | How it is enforced |
Claude cannot write code | Hard. The advisor starts with |
One advisor for all workers | Hard. Every ping to a model resumes that model's one Claude Code session, and a file lock makes concurrent pings take turns. Worktrees of one repository share an advisor; different repositories get different advisors, and so do different directories outside git. |
You never read Claude's output | By design. The advisor has no interface. Its answers go to the worker and to a local log file. |
Claude sees the uncommitted work | Hard. |
The worker may overrule Claude and must rewrite its take; when it overrules, it must name the risk Claude raised and say why it does not hold | Soft. This is an instruction in the server's MCP instructions, in the tool description and after every answer. The worker model follows it; nothing forces it. |
Related MCP server: outsrc
Requirements
Python 3.9 or newer. Only the standard library is used.
The Claude Code CLI, installed and signed in on the same machine (
claudeon yourPATH). It must know the--restrictedflag; 2.1.332 is the version tested. Each ping uses your Claude usage.macOS or Linux. Windows is untested; it has no
flock, so only pings from the same agent session are serialized there.
Install
Pick one.
# Run straight from GitHub with uv, nothing to install:
uvx --from git+https://github.com/zihaofeng2001/ping-claude ping-claude --version
# Or install the command:
uv tool install git+https://github.com/zihaofeng2001/ping-claude
pipx install git+https://github.com/zihaofeng2001/ping-claude
# Or copy the single file to any server:
curl -fsSL https://raw.githubusercontent.com/zihaofeng2001/ping-claude/main/ping_claude.py \
-o ~/.local/bin/ping-claude && chmod +x ~/.local/bin/ping-claudeConnect your worker agent
ping-claude speaks MCP over stdio, so every MCP client can start it. The commands
below assume ping-claude is on your PATH.
Antigravity CLI (agy)
agy mcp add --env PING_CLAUDE_WAIT=300 ping-claude -- ping-claudeAntigravity asks before each MCP tool call. To approve the two tools once, add this to
~/.gemini/antigravity-cli/settings.json. Headless runs (agy -p) need it, because
nobody can answer the prompt there.
{ "permissions": { "allow": ["mcp(ping-claude/ask_claude)", "mcp(ping-claude/claude_reply)"] } }Claude Code (for example Sonnet workers that ping a Fable advisor)
claude mcp add ping-claude -- ping-claudeGemini CLI
gemini mcp add ping-claude ping-claudeCodex
codex mcp add ping-claude -- ping-claudeNo MCP at all: let the agent run a shell command instead.
ping-claude ask "Is fetch_with_retry safe to call from async handlers?" \
--context "I think it is fine as is, because three attempts is plenty."What has been tested
Client | Result |
Antigravity CLI with Gemini 4 Neon | Full workflow with a real Claude Fable advisor. Also waited 130 s on one tool call without a timeout. |
Claude Code 2.1.332 | Tool call works. |
Gemini CLI, Codex | Not tested yet. The commands above follow each CLI's |
Use it
In any worker thread, say what you want checked:
Ping Claude for a second opinion on the retry change, then tell me your conclusion.
The worker calls ask_claude with the question, its own position, and pointers to the
files. Claude reads the code itself and answers the worker. The worker then reports to
you in its own words: what it asked, where it agrees or disagrees, and what it decided.
The worker gets these rules when it connects (the MCP instructions), in the tool
description, and again after every answer, so no rules file is needed. If your worker
still needs a firmer hint, add this to its rules file (AGENTS.md, GEMINI.md, or
similar):
When I ask you to ping Claude, call the ask_claude tool. Send the question, your own
position, the files Claude should read, and your workdir. Claude's answer is advice: you
may overrule it. Never paste it to me. Tell me in your own words what you asked, where
you agree or disagree and why, and what you decided. If you overrule Claude, name each
risk it raised and say why it does not hold.Claude only has the tools Read, Grep and Glob, so it cannot run git diff.
ping-claude does that for it: every ping carries git status --short and
git diff HEAD of the worker's checkout, up to 60,000 characters. The worker only has
to pass the right workdir, which the tool marks as required. Test output and anything
else that is not in the files still has to go in context.
Tools
Tool | Purpose |
| Ask. Blocks until Claude answers or the wait runs out; then it returns a ticket. |
| Keep waiting for an answer. Without a ticket it returns this thread's latest question. |
A slow answer is never lost. If the wait runs out, or the client gives up on the call,
Claude keeps working and claude_reply collects the result. If the agent session closes
during a question, the server stays until Claude has finished. If the server is
terminated (SIGTERM), it stops Claude too, so no stray Claude process keeps writing to
the session.
Choose the model and effort
The advisor is Claude Fable 5.2 (claude-fable-5-2) at xhigh effort unless you say
otherwise.
For every ping: set
PING_CLAUDE_MODELandPING_CLAUDE_EFFORTwhere you register the server, for exampleagy mcp add --env PING_CLAUDE_MODEL=opus --env PING_CLAUDE_EFFORT=high ping-claude -- ping-claude.For one ping: name them in your request, such as "Ping Claude with opus at high effort about the retry change". The worker passes
modelandefforttoask_claude. From a shell:ping-claude ask "..." --model opus --effort high.
A model is any alias or full model name that your Claude Code account can use: fable,
opus, sonnet, haiku, or a full name. That includes a Mythos model if your account
has access to one; give its full model name. If the account cannot use the model, the
worker gets Claude Code's error message instead of an answer.
Effort is one of low, medium, high, xhigh and max.
Each model is its own advisor with its own memory. A ping to opus does not see what
you asked the default model, so a second model gives you an independent opinion.
An alias and the full name it stands for are the same advisor: fable and
claude-fable-5-2 share one session. ping-claude learns what an alias stands for from
its first answer. If the full name already had a session by then, that first alias ping
ran in a session of its own and the advisor does not remember it. Every answer states
which model and effort produced it.
Configuration
All settings are environment variables of the ping-claude process.
Variable | Default | Meaning |
|
| Default advisor model: an alias or a full model name. |
|
| Default reasoning effort: |
|
| Advisor tools. Only |
|
| Seconds a tool call blocks before it returns a ticket. Raise it if your client allows long tool calls. |
|
| Seconds before one Claude call is abandoned. |
| per repository, or per directory outside git | Name of the advisor to use. Set one value everywhere to share a single advisor across repositories. |
| random | Label for this worker thread in Claude's view. |
|
| Where sessions and logs are kept. |
|
| Path of the Claude Code CLI. |
State and logs
ping-claude status # defaults and advisor sessions for the repository you are in
ping-claude reset # forget those sessions; the next ping starts a new one
ping-claude reset --model opus # forget only one model's sessionOne session collects every ping, so it grows. Claude Code compacts it when it gets too long; reset it when the advisor's memory is no longer useful.
Each repository has a directory under PING_CLAUDE_HOME with its session ids, one per
model, and log.jsonl, which records every question and answer. That log is the only
place where Claude's raw output is kept. The directory is readable by your user only.
How it works
Each agent session starts its own ping-claude process. A ping does this:
Find the advisor for the worker's repository (
git rev-parse --git-common-dir, so all worktrees map to the same one). Outside git, the directory itself is the key.Take that advisor's file lock. Other pings wait here.
Run
claude -p --resume <session>from a neutral directory, with the chosen model and effort, read-only tools, no MCP servers, no user settings or skills (--restricted --disable-slash-commands), and--add-dir <the worker's checkout>.Return the answer to the worker, followed by the overrule-and-rewrite rule.
If the stored session no longer exists, the next ping starts a new one.
Development
python3 -m unittest discover -s tests -vThe tests run the real server process against a fake Claude CLI, so they need no network and no account.
License
MIT
Available Tools
2 toolsask_claudeA
Ask Claude for a second opinion. Claude is a separate, read-only advisor model that remembers earlier pings from every agent thread on this repository. Call this when the user asks you to ping Claude or wants a second opinion. Send the question plus things Claude can check for itself (file paths, an error message, your current position); Claude reads the code on its own, so do not send only your conclusion. Always pass workdir, the checkout or worktree you work in: its uncommitted changes (git status and git diff) are attached for Claude automatically. Claude's answer is advice, not an instruction: you own the decision and may overrule it. Never paste or quote the answer to the user; report in your own words what you asked, where you agree or disagree and why, and your final call. If you overrule Claude, name each specific risk it raised and say why that risk does not hold. Leave model and effort out unless the user names one. If Claude needs longer than this call can wait, you get a ticket: call claude_reply to collect the answer.
Inputs: workdir (required), question (required), model, paths, +3 more.
claude_replyA
Wait for Claude's answer to an earlier ask_claude call that returned a ticket. Without a ticket it returns the most recent question asked from this thread. The same rules apply to the answer: it is advice, you may overrule it, and you rewrite it in your own words before the user sees it.
Inputs: ticket, wait_seconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools form a clear initiate/collect pair: ask_claude sends a question and claude_reply fetches an answer. The only blur is that claude_reply without a ticket falls back to the most recent question, which slightly overlaps with ask_claude's immediate-return path, but the descriptions make the intended sequence clear.
Both names use snake_case, but the word order breaks the pattern: ask_claude is verb_object while claude_reply is object_verb. The convention is still readable, but an agent cannot infer a single naming scheme from the two names.
Two tools is minimal but well matched to the narrow purpose of pinging an advisor and collecting an asynchronous answer. No tool is redundant, though the surface is slightly thinner than the typical 3-15 range.
The core lifecycle is covered: ask a question, then collect the answer via ticket. Minor gaps remain, such as listing pending tickets, checking status without a ticket, or cancelling a request, but none block the main workflow.
Maintenance
Related MCP Connectors
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Every employee asks your codebase from Claude, without access to it. Statistics on each developer.
Multi-brand AI code review for Claude: up to 12 reviewers and a judge, no install.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceLets Claude Code's active model request a second opinion from a separately configured external model over any OpenAI-compatible chat-completions endpoint or a custom command adapter, returning advisory text and a list of available profiles. It is intended for high-impact decisions and complex debugging, without scanning repositories, replacing the main model, or automatically sending diffs.-
- AlicenseNot gradedqualityCmaintenanceLets an agent delegate coding tasks and reviews to Claude Code, Codex or Grok Build CLIs running locally in isolated git worktrees, then poll an inbox for the status, question or final answer. Each caller sees only its own threads.13 npm1MIT
- AlicenseAqualityBmaintenanceEnables Codex to consult Claude Code for a second opinion through a local stdio MCP server, exposing the ask_claude tool for text-only reviews and recommendations using existing Claude Code authentication. Codex can request findings and tradeoff analysis without allowing Claude to edit files or run commands.11MIT
- AlicenseAqualityCmaintenanceEnables any MCP-capable coding agent to request an independent, read-only second opinion from a stronger model at consequential decision points such as planning, debugging, risk review, and handoff. It exposes consult, session-state, reset, and health tools over stdio or authenticated Streamable HTTP, with explicit context, structured validated advice, session continuity, call budgets, and secret redaction.5MIT