shotgun
by lukabudik
README.md
<p align="center">
<img src="assets/banner.svg" alt="ride shotgun: your coding agents phone you while you drive" width="100%">
</p>
<p align="center">
<b>When your coding agents need you while you're driving, they don't send a notification you can't read.<br>They batch their questions into one phone call.</b>
</p>
<p align="center">
<a href="https://github.com/lukabudik/ride-shotgun/actions/workflows/ci.yml"><img src="https://github.com/lukabudik/ride-shotgun/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://www.npmjs.com/package/ride-shotgun"><img src="https://img.shields.io/npm/v/ride-shotgun?color=f0b23e&label=npm" alt="npm version"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-17202a" alt="MIT license"></a>
<a href="#hook-up-your-agents"><img src="https://img.shields.io/badge/MCP-server-17202a" alt="MCP server"></a>
<a href="#claude-code-plugin-recommended"><img src="https://img.shields.io/badge/Claude%20Code-plugin-a8650a" alt="Claude Code plugin"></a>
</p>
---
## The pitch
You leave three agents running and get in the car. Twenty minutes later two of them are stuck on questions, and a third will be soon. Normally they'd sit there until you're back at a desk.
With ride-shotgun they queue the question and keep working on anything that doesn't depend on it. A local daemon waits a couple of minutes for the others to pile up, then calls your phone **once**. You answer hands-free over CarPlay, the answers are checked against what the agents actually offered, and each agent gets its own answer back.
```text
Shotgun Hey Luka, it's Shotgun. Three questions from two agents, about two minutes. Good time, or should I call back?
You Go.
Shotgun Question one, from the API agent. Redis or in-memory storage for the rate limiter? The agent suggests Redis.
You Redis.
Shotgun Got it, Redis. Question two, from the checkout agent: deploy the checkout page to production now?
That one has to be approved at the keyboard. Want to leave a note?
You Yeah, wait till Monday.
Shotgun Question three, from the checkout agent. Put the new layout behind a flag?
You You decide.
Shotgun Recap. One: Redis. Two: deferred, wait till Monday. Three: agent's call. All correct?
You Yep.
```
Works with **Claude Code** (plugin or MCP), **Codex**, **Cursor**, any other MCP client, and **T3 Code** threads, all on the same call.
> [!IMPORTANT]
> Hands-free only. Keep calls short, and pull over for anything that needs real thought. The whole design goal is a shorter call, not a longer one.
## Contents
- [Quick start](#quick-start)
- [Hook up your agents](#hook-up-your-agents)
- [How it works](#how-it-works)
- [Trust and safety](#trust-and-safety)
- [iPhone and CarPlay setup](#iphone-and-carplay-setup)
- [Commands](#commands)
- [Configuration](#configuration)
- [Costs](#costs)
- [FAQ](#faq)
- [Prior art](#prior-art)
- [Roadmap](#roadmap)
## Quick start
Requires Node.js 22 or newer.
### 1. Try it with the simulator (no phone, no accounts)
```bash
npm i -g ride-shotgun # or prefix every command with `npx ride-shotgun`
shotgun init # your number + name; pick the simulator for now
shotgun driving on # starts the daemon if needed
shotgun ask "Redis or in-memory for the rate limiter?" --options redis,memory --recommend redis --agent "the API agent"
shotgun call-now # skip the 2-minute batching window
shotgun answer # pick up in this terminal; macOS reads it aloud, you type
```
The simulator runs the same agenda, the same validation and the same delivery as a real call. `shotgun status` shows the queue, what the policy would do next, and recent calls.
### 2. Real phone calls (ElevenLabs + Twilio)
You need:
- an **ElevenLabs** account with an API key (Agents platform)
- a **Twilio** account with a phone number. A US number needs no paperwork. A local EEA number is cheaper to call EU mobiles from but needs ID verification. See [Costs](#costs).
Run the wizard again and choose ElevenLabs, or set it up directly:
```bash
export ELEVENLABS_API_KEY=sk_...
shotgun setup elevenlabs --twilio-sid AC... --twilio-token ... --twilio-number +1...
```
This creates the "Shotgun" voice agent in your ElevenLabs workspace (driving-first prompt, end-call and voicemail tools, data-collection fields) and imports your Twilio number into ElevenLabs. Then:
```bash
shotgun service install # keep the daemon running at login (launchd / systemd)
shotgun doctor # check config, credentials, daemon and integrations
```
Finish with the [iPhone setup](#iphone-and-carplay-setup) so the call actually rings through Driving Focus.
## Hook up your agents
All agents talk to the same local daemon, so they all share one queue and one call. The first MCP session starts the daemon in the background if it isn't running.
### Claude Code plugin (recommended)
```text
/plugin install ride-shotgun --marketplace lukabudik/ride-shotgun
```
Claude Code 2.1.275 or newer. On older versions, or from your shell:
```bash
claude plugin marketplace add lukabudik/ride-shotgun
claude plugin install ride-shotgun@ride-shotgun
```
The plugin bundles three things:
| Piece | What it does |
|---|---|
| MCP server `shotgun` | The four tools below, via `npx -y ride-shotgun@latest mcp`. |
| `ask-owner` skill | Teaches the agent to write questions for the ear: one sentence, no code or paths, at most four short options, a recommendation. |
| `PreToolUse` hook on `AskUserQuestion` | At the keyboard it does nothing. In driving mode it sends Claude's own multiple-choice questions to the phone and hands the answers back. No prompt changes. |
### Claude Code, plain MCP
```bash
claude mcp add shotgun -- npx -y ride-shotgun mcp
```
### Codex
In `~/.codex/config.toml`:
```toml
[mcp_servers.shotgun]
command = "npx"
args = ["-y", "ride-shotgun", "mcp"]
# only matters if agents call ask_owner with wait_seconds > 0
tool_timeout_sec = 1800
```
### Cursor and other MCP clients
Any client that speaks stdio MCP works. For Cursor, in `.cursor/mcp.json`:
```json
{
"mcpServers": {
"shotgun": { "command": "npx", "args": ["-y", "ride-shotgun", "mcp"] }
}
}
```
### MCP tools
| Tool | What it does |
|---|---|
| `ask_owner` | Queue a question: `question`, up to 4 `options`, `recommend`, `context`, `task`, `urgency` (`low` / `normal` / `urgent`), `blocking`, `risk`, `wait_seconds`. Returns a ticket immediately unless `wait_seconds > 0`. |
| `get_answers` | Answers and new instructions the owner gave this agent since it last checked. Each item is returned once. |
| `cancel_question` | Withdraw a queued question by ticket. |
| `owner_status` | Is the owner driving, how many questions are queued, would a call happen now. |
The spoken agent name defaults to the working directory ("the api server agent"). Set `SHOTGUN_AGENT_NAME` in the server's env to choose it yourself.
### T3 Code (no agent changes)
```bash
shotgun setup t3
```
The daemon watches T3 for threads in *waiting* status. If you haven't answered at the desk within 90 seconds (`t3.graceSec`), the pending question joins the next call. Answers go back through T3's own API (`t3_pending_request respond`), and new instructions arrive as a thread message. Permission approvals are never answerable by phone.
## How it works
### Architecture
```mermaid
flowchart LR
subgraph sources["Sources"]
MCP["MCP tool ask_owner"]
HOOK["Claude Code hook on AskUserQuestion"]
T3["T3 Code waiting threads"]
CLI["shotgun ask"]
end
subgraph daemon["Local daemon, one per machine"]
Q["Queue"]
POL["Policy: should we call now?"]
VAL["Validation: options, risk, second reader"]
AUD["Audit log"]
end
subgraph voice["Voice provider"]
EL["ElevenLabs Agent + Twilio"]
SIM["Terminal simulator"]
end
subgraph delivery["Delivery"]
PULL["pull: get_answers, hook, long-poll"]
T3R["t3-request: answer the T3 prompt"]
T3T["t3-thread: message into the thread"]
end
MCP --> Q
HOOK --> Q
T3 --> Q
CLI --> Q
Q --> POL
POL -->|"agenda"| EL
POL -->|"agenda"| SIM
EL -->|"transcript"| VAL
SIM -->|"transcript"| VAL
VAL --> AUD
VAL --> PULL
VAL --> T3R
VAL --> T3T
```
Every arrow to the cloud points outward. The agenda goes in as dynamic variables when the call starts, and the transcript is polled after it ends. Your Mac can sit behind NAT with no tunnel.
### One call
```mermaid
sequenceDiagram
autonumber
participant A as API agent, Claude Code
participant F as Frontend agent, T3 thread
participant D as shotgun daemon
participant V as ElevenLabs + Twilio
participant Y as You, driving
A->>D: ask_owner, recommends Redis
D-->>A: ticket, agent keeps working
F->>F: question waiting in T3
D->>F: poll, waiting longer than 90 s, read question
Note over D: batch closes, driving on, not quiet hours, rate limit OK
D->>V: outbound call to the configured number, with agenda
V->>Y: rings, allowed by Driving Focus
Y->>V: "Redis. Behind a flag."
V->>Y: recap, confirmed, end call
D->>V: poll until done, transcript + extracted decisions
D->>D: snap to options, destructive to defer, second reader must agree
D-->>A: get_answers returns Redis
D->>F: answer the T3 request
```
### Should we call now?
The policy is a pure function (`src/core/policy.ts`), evaluated every two seconds and whenever something changes.
```mermaid
flowchart TD
Q(["Questions pending"]) --> C1{"Call already in progress?"}
C1 -->|"yes"| H1["Hold: joins the next call"]
C1 -->|"no"| C2{"Snoozed with call me back in N?"}
C2 -->|"yes"| W1["Wait until the snooze ends"]
C2 -->|"no"| C3{"Quiet hours, 22:00 to 08:00?"}
C3 -->|"yes, unless urgent and allowed"| H2["Hold"]
C3 -->|"no"| C4{"Driving mode on and not expired?"}
C4 -->|"no"| C4b{"notDrivingCallAfterMin set and reached?"}
C4b -->|"no"| H3["Hold for the keyboard"]
C4b -->|"yes"| C5
C4 -->|"yes"| C5{"Enough gap since last call? 75 s after a first miss, else 10 min"}
C5 -->|"no"| W2["Wait"]
C5 -->|"yes"| C6{"Fewer than 3 calls this hour?"}
C6 -->|"no"| H4["Hold"]
C6 -->|"yes"| C7{"Urgent, or 3 queued, or oldest waited 120 s?"}
C7 -->|"no"| W3["Keep batching"]
C7 -->|"yes"| CALL[["Dial: up to 6 questions"]]
```
`shotgun call-now` skips this and dials right away. Deeper internals (question lifecycle, delivery, the hook, the daemon API, writing a voice provider) are in [docs/how-it-works.md](docs/how-it-works.md).
## Trust and safety
A transcript of someone talking in a moving car is untrusted input. So is anything an agent puts in a question. The rules are enforced in code, not in the voice prompt:
- **Answers snap to the offered options.** A choice must fuzzy-match one of the agent's options, or be "you decide" or "skip". Anything else becomes `deferred`.
- **Destructive questions can't be approved by phone.** Deploys, production, force-push, deleting data, secrets, payments, sending email, publishing: you can discuss them and leave a note, but the decision is always deferred to the keyboard.
- **Risk only goes up.** A keyword check marks a question destructive even if the agent called it `safe`. Nothing can lower it.
- **A second reader must agree.** After the call, an independent model reads the transcript and extracts the decisions again. If it disagrees with the voice platform's own extraction, the answer is deferred and marked unconfirmed. The reader is the Claude Code CLI on your subscription, or the Anthropic API, or off (`verifier` in config). With it off, the platform's extraction stands alone, and the other checks still apply.
- **Only one number is callable.** `ownerNumber` is set at the keyboard. The voice side has no dial or transfer tool, and no tool that acts on your machine. Calls are talk-only.
- **The local API is token-authenticated.** The daemon listens on `127.0.0.1` with a per-run bearer token stored in `~/.shotgun/daemon.json` (mode 0600).
- **Everything is audited.** Every question, call, decision and delivery goes to an append-only `~/.shotgun/audit.jsonl`.
- **New instructions are labelled.** An instruction you give mid-call ("also tell the API agent to add rate-limit headers") must be read back and confirmed on the call, and reaches the agent marked as transcribed. It still goes through the agent's own permissions.
See [SECURITY.md](SECURITY.md) for the threat model and how to report a vulnerability.
## iPhone and CarPlay setup
Do this once:
1. **Save your Twilio number as a contact named "Shotgun".** The car display then shows who's calling.
2. **Settings → Focus → Driving → People → Allow calls from →** add Shotgun.
3. In the same Focus, **turn on Repeated Calls.** If you miss the first call, Shotgun retries once after 75 seconds, inside iOS's three-minute window, so the second ring always gets through.
4. Before you drive: `shotgun driving on`. Driving mode switches itself off after 4 hours (`policy.drivingExpiresMin`) in case you forget.
If you can't talk, say "call me back in ten". Shotgun recaps anything already decided, hangs up, and won't call again until then.
## Commands
| Command | What it does |
|---|---|
| `shotgun init` | Guided setup: your number, voice provider, agents, background service. `--number`, `--name`, `-y` for no prompts. |
| `shotgun doctor` | Check config, credentials, daemon and integrations. |
| `shotgun setup elevenlabs` | Create the voice agent and import your Twilio number into ElevenLabs. `--twilio-sid`, `--twilio-token`, `--twilio-number`. |
| `shotgun setup t3` | Connect to T3 Code, so waiting threads join your calls. |
| `shotgun service install` / `uninstall` | Run the daemon at login (launchd on macOS, systemd on Linux). |
| `shotgun daemon` | Run the daemon in the foreground. |
| `shotgun start` / `stop` / `restart` | Start, stop or restart the daemon in the background (`restart` goes through the service manager when installed). |
| `shotgun logs` | Follow the daemon log. |
| `shotgun status` | Queue, policy decision and recent calls. `--json` for scripts. |
| `shotgun driving [on\|off]` | Tell Shotgun you're driving, or back at the keyboard. Default `on`. |
| `shotgun ask <question>` | Queue a question yourself. `--options a,b`, `--recommend`, `--context`, `--agent`, `--urgency low\|normal\|urgent`. |
| `shotgun call-now` | Dial now. Skips the batching window, quiet hours and rate limits, since you asked. |
| `shotgun answer` | Pick up a simulated call in this terminal. `--quiet` to skip text-to-speech. |
| `shotgun mcp` | stdio MCP server for an agent. |
| `shotgun hook ask-user-question` | Claude Code hook handler, used by the plugin. |
## Configuration
`~/.shotgun/config.json`. Every key is optional; `shotgun init` writes the ones you choose.
| Key | Default | Meaning |
|---|---|---|
| `ownerNumber` | `""` | E.164 number of the only person this tool will ever call. Set at the keyboard. |
| `ownerName` | `"there"` | What the voice assistant calls you. |
| `language` | `"en"` | Spoken language of the call (ISO 639-1). |
| `port` | `7477` | Preferred local port for the daemon. Falls back to any free port. |
| `provider` | `"simulator"` | `simulator` or `elevenlabs`. |
| `verifier` | `"auto"` | Second reader of the transcript: `auto` (Claude Code CLI if installed, else Anthropic API if a key is set, else off), `claude-code`, `anthropic-api`, `off`. |
| `elevenlabs.agentId` | `""` | Set by `setup elevenlabs`. |
| `elevenlabs.phoneNumberId` | `""` | Set by `setup elevenlabs`. |
| `elevenlabs.llm` | `"claude-sonnet-5-5"` | LLM that drives the conversation (any id ElevenLabs supports). |
| `elevenlabs.voiceId` | `""` | ElevenLabs voice id. Empty means the platform default. |
| `elevenlabs.baseUrl` | `"https://api.elevenlabs.io"` | Use `https://api.eu.residency.elevenlabs.io` for EU data residency. |
| `policy.batchWindowSec` | `120` | Collect questions this long before dialing. |
| `policy.batchMaxQuestions` | `3` | Close the window early once this many are queued. |
| `policy.notDrivingCallAfterMin` | `0` | When not driving, call if something has waited this long. `0` means never call unless driving. |
| `policy.maxCallsPerHour` | `3` | Rate limit. |
| `policy.minGapBetweenCallsMin` | `10` | Minimum gap between calls. |
| `policy.quietHours` | `"22:00-08:00"` | Local time with no calls. `null` disables. |
| `policy.allowUrgentInQuietHours` | `false` | Let `urgent` questions through quiet hours. |
| `policy.retryAfterSec` | `75` | Retry a missed call once after this long. `0` disables. |
| `policy.drivingExpiresMin` | `240` | Driving mode turns itself off after this long. |
| `policy.maxQuestionsPerCall` | `6` | Hard cap per call (max 10). |
| `t3.enabled` | `false` | Watch T3 Code for waiting threads. |
| `t3.url` | `""` | Read from `~/.t3/userdata/server-runtime.json` when empty. |
| `t3.pollSec` | `8` | How often to poll T3. |
| `t3.graceSec` | `90` | Time to answer at the desk before a T3 question joins a call. |
**Secrets** live in `~/.shotgun/secrets.json` (mode 0600), or in environment variables, which take precedence:
| Env var | Used for |
|---|---|
| `ELEVENLABS_API_KEY` | ElevenLabs provider and setup. |
| `ANTHROPIC_API_KEY` | `anthropic-api` verifier. Not needed if Claude Code is installed. |
| `SHOTGUN_T3_TOKEN` | T3 Code API token. |
Other env vars: `SHOTGUN_HOME` (instead of `~/.shotgun`), `SHOTGUN_PROVIDER`, `SHOTGUN_AGENT_NAME` and `SHOTGUN_AGENT_ID` (per MCP server), `SHOTGUN_T3_THREAD_ID` (post answers into that T3 thread), `SHOTGUN_HOOK_WAIT_SEC` (how long the hook waits, default 1500).
## Costs
Roughly **$0.40–0.75 for a 3-minute call**, depending on where your Twilio number is.
| Piece | Approximate cost |
|---|---|
| ElevenLabs Agents | about $0.08/min on paid plans. The conversation LLM is billed separately. |
| Twilio outbound to an EU mobile | about $0.15/min from a US number, about $0.05/min from a local EEA number (needs ID verification). |
| Second reader | included in your Claude Code subscription, pay-per-use on the Anthropic API, or off. |
| The daemon | nothing. It makes no AI calls of its own. |
The policy defaults (batching, 3 calls an hour, 10 minutes apart, never when not driving) keep this bounded. The simulator costs nothing.
## FAQ
**Does it use my Claude subscription?**
Only for the second reader, and only if the Claude Code CLI is installed: it runs `claude -p` once per call to re-read the transcript. The voice conversation runs on ElevenLabs. Set `verifier` to `anthropic-api` or `off` to change that.
**Does my Mac need to be reachable from the internet?**
No. The daemon only makes outbound requests: it starts the call with the whole agenda, then polls for the result. No ngrok, no tunnel, no open port. The trade-off is that the voice agent can't look anything up mid-call. That's what the v2 relay is for.
**What if I miss the call?**
Shotgun retries once after 75 seconds, which Repeated Calls lets through Driving Focus. If you miss that too, it backs off to the normal 10-minute gap. Voicemail is detected and hung up on. Questions stay queued, and agents keep working on whatever doesn't depend on them.
**Can it approve permission prompts?**
No, by design. Tool permissions, T3 approvals and anything destructive stay at the keyboard. The phone answers questions; it doesn't grant access.
**What happens to an answer the system isn't sure about?**
It's deferred. The agent gets "deferred" with whatever note you left and carries on with other work; the question waits for the keyboard. With the Claude Code hook, if nothing in the batch got a usable answer, the normal question dialog is shown instead.
**Linux?**
The daemon, MCP server, hook and real calls are plain Node and work on Linux; `shotgun service install` uses systemd there. Two things are macOS-only: `caffeinate` (keeping the machine awake while questions wait) and the simulator reading lines aloud with `say`. On Linux, make sure the machine doesn't sleep.
**Windows?**
Untested.
## Prior art
Calling the person who owns an agent is a solved problem for one agent at a time, and these projects did it first. Go look at them:
| Project | Approach |
|---|---|
| [call-me](https://github.com/ZeframLou/call-me) | Claude Code plugin; the agent itself calls you over Twilio or Telnyx and talks through STT/TTS. |
| [voicemode](https://github.com/mbailey/voicemode) | Natural voice conversations with Claude Code through a local mic or LiveKit. |
| [agentring](https://github.com/mutonby/agentring) | Own iOS/Android app with VoIP push; agents call your phone and you can call them back. |
| [awesome-claude-call](https://github.com/PatterAI/awesome-claude-call) | Gives Claude Code a phone number, with hooks that ring when a session stops. |
| claude-code-voice | Vapi voice agent with repo tools, over a tunnel. |
| [elevenlabs-mcp](https://github.com/elevenlabs/elevenlabs-mcp) | The official ElevenLabs MCP server, including outbound calls. A building block. |
Each of them is one agent per call. ride-shotgun is built around the other case:
- **Many agents, one call.** Questions from every session and tool are batched into one agenda.
- **Driving policy.** Driving mode, quiet hours, batching, rate limits, a missed-call retry tuned for iOS, "call me back in ten".
- **Non-blocking.** Agents get a ticket and keep working; answers arrive later.
- **A trust layer.** Option snapping, a hard no-voice list for destructive actions, a second reader, one callable number.
## Roadmap
- **v2 relay** (Cloudflare Worker). Lets the voice agent do live lookups mid-call, and gives the iOS Driving Focus automation a webhook so driving mode switches on by itself.
- **LiveKit / self-hosted voice provider.**
- **ntfy push fallback** after missed calls.
- **Codex-native hooks**, the equivalent of the Claude Code `AskUserQuestion` hook.
## Contributing
Issues and PRs are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md); everything can be developed against the simulator, no phone or accounts needed.
## License
[MIT](LICENSE) © Luka Budík
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues