Claude Code model router

Agentmail To Claude Code

Email gateway that opens a Claude Code session per inbound AgentMail message (cmux or Ghostty)

Install

From source
git clone https://github.com/mvanhorn/agentmail-to-claude-code.git

From the README

agentmail-to-claude-code

Email gateway for Claude Code. Subscribe an
AgentMail inbox over WebSocket, or poll a
Primitive inbox over REST; on every authenticated,
allowlisted message the daemon opens a fresh Claude Code session in your
terminal, writes the email to a prompt file, and tells Claude to read and act
on it.

Send an email to the watched inbox and Claude Code starts working on whatever's
in the subject and body, with any attachments available to it by path.

The point: because the trigger is just an email, you can put Claude Code to work
on your own computer from anywhere. I've wired it to a cc command in my agent
Hermes, so from my phone I run cc  and it lands as a working session on
my Mac, no VPN or SSH into the machine. See How I use it with Hermes.

It drives either terminal:

- cmux (cmux.com) via its Unix-socket control plane, or
- standalone Ghostty (ghostty.org) via AppleScript.

Pick one with CC_TERMINAL in your env.

How it works

1. cc-daemon.py connects to the selected provider:
   - CC_MAIL_PROVIDER=agentmail subscribes to AgentMail's WebSocket for AGENTMAIL_INBOX.
   - CC_MAIL_PROVIDER=primitive polls Primitive for PRIMITIVE_INBOX.
2. On each incoming message, the handler drops anything whose sender isn't in CC_ALLOWED_FROM or that failed DKIM/SPF.
3. Attachments are downloaded under CC_HOME/attachments//. Per-attachment failures log a warning and continue.
4. A prompt is built from From:, Subject:, the body, and a footer listing every downloaded attachment by absolute path. It's written to CC_HOME/prompts/.md.
5. The selected backend opens a new Claude Code session and sends a single-line pointer telling Claude to read and act on the prompt file:
   - cmux: surface.create (auto-launches Claude Code via the Ghostty config cmux reads) -> poll…
Read the full README on GitHub

Details

Language
Python
License
MIT
Last updated
4 June 2026

FAQ

What is Agentmail To Claude Code?

Email gateway that opens a Claude Code session per inbound AgentMail message (cmux or Ghostty) It is a model router for Claude Code, from mvanhorn/agentmail-to-claude-code on GitHub.

How do I install Agentmail To Claude Code?

Clone mvanhorn/agentmail-to-claude-code from GitHub and follow the setup steps in its README.

Is Agentmail To Claude Code popular?

mvanhorn/agentmail-to-claude-code has 48 GitHub stars and 8 forks. It was last updated on 4 June 2026.

More model routers & proxies

Browse the most popular Claude Code mods, all model routers & proxies, or the skills and MCP server directories.