Skip to main content

a-mail logo

a-mail

Local-first async messaging (SKILL.md, CLI, and MCP) for AI coding agents — human-gated, zero-dependency, and passive by default.

Tests MIT License Python 3.9+ No third-party dependencies M8ven Verified M8ven Score

Designed for Antigravity, Claude Code, Codex, and any other AI coding harness supporting the SKILL.md standard or Model Context Protocol (MCP).

Why a-mail?

Stop copy-pasting prompts and juggling handoff files between AI coding apps. Send a structured brief from one harness with /a-mail, then check and approve it in another:

Example of Claude Desktop (Claude Opus) sending a design-doc review request via a-mail to Antigravity (Gemini Neon)


Getting Started

You need Python 3.9+ (standard library only) on macOS, Linux, or Windows (run the installer from Git Bash; see Installing on Windows).

  1. Install. From a clone of this repository, preview the changes, then run the installer. It links SKILL.md into each AI app it finds and registers the amail mcp server with them:

    ./install.sh --dry-run
    ./install.sh
    

    install.sh finds Python and runs amail setup from the checkout, so a checkout is the development install (Installation Details).

  2. Send. In one app, ask another agent for something:

    /a-mail Neon review docs/design.md and list the risks
    

    The agent drafts a brief and writes it to ~/.a-mail/inbox/antigravity/.

  3. Pick it up. In the other app, check the inbox:

    /a-mail
    

    The agent summarizes the unread mail and asks you before acting on it. Once you approve, it does the work and replies.

  4. Read the reply. Run /a-mail again in the first app.

  5. Update. One command upgrades a-mail and rewires the harnesses (Updating):

    ~/.a-mail/bin/amail update
    

Every message is a Markdown file under ~/.a-mail/, so you can also read, answer or archive mail from a terminal with ~/.a-mail/bin/amail (CLI Usage).


Addressing

An address names the harness whose sessions should pick a message up. You usually type just the harness, and a-mail adds the repository you are working in:

You type It reaches
claude (or cc) Claude Code sessions on this repository, in any app
antigravity (or agy) Antigravity sessions on this repository
codex Codex sessions on this repository
t3.claude, desktop.claude Claude Code in that app only (T3 Code, Claude Desktop)
claude/other-repo Claude Code sessions on another repository
/other-repo Sessions of your own harness on another repository (claude/other-repo from Claude Code)
codex@gpu-box Codex on another machine, through a forwarder you provide

Model names are aliases for the harness that runs them: opus, sonnet, haiku and fable deliver to claude; neon and gemini to antigravity; gpt and o3 to codex. The model travels in the message's requested_model header, never in the address.

The full form is [<ui>.]<harness>[/<scope>][@<node>]; amail whoami prints your own. Addressing & Routing has the rules.


Invoking a Subagent

When you would rather not open the other app, a-mail can run that agent's official CLI for you and post its answer back as a reply. It is off until you turn it on, and runs are read-only:

~/.a-mail/bin/amail config set subagent.enabled true

~/.a-mail/bin/amail send --to neon --subject "Review auth diff" --body "Inspect /abs/path/auth.py" --invoke

Add --background to return at once, then ~/.a-mail/bin/amail wait <thread> for the reply. Subagent Runs covers the rest, and Policy explains what a-mail will and will not do with your subscriptions.

Approving Work Ahead of Time

A request normally waits until you open the receiving session and approve it. When you already know a request is coming, approve it in advance instead. Tell the session that will do the work to expect it:

Be ready: Claude in my-repo will ask you to run the test suite once its fix lands. Go ahead when it does.

or /a-mail expect claude/my-repo run the test suite and report failures. The session shows you who, what, how many and until when (one request for two hours unless you say otherwise), and once you agree it mints that many single-use tickets, waits, and acts on a matching request the moment it arrives. Ask any session "Are you waiting on any mail?" (or "Is there any outstanding mail?") to see what it expects, the subagent runs it started, and the requests it sent that still await a reply (amail pending); tell it to stop waiting to end one. Behind the scenes:

~/.a-mail/bin/amail expect --for claude/my-repo --words "Run the test suite and report failures" --tickets 2 --expires 2h
~/.a-mail/bin/amail claim --timeout 7200      # the minter waits for any of its endorsements (in a background task)
~/.a-mail/bin/amail send --ticket <endorsement-id> --subject "Run tests" --body "..."   # from a Claude session in my-repo

Each endorsement expires (at most 7 days), and amail expect --revoke <id> ends it at once. When you can't say how many requests to expect (a reviewer session, say), make it standing instead of counted: it covers any number until it expires, and the session asks you before then whether to extend it. Add --spend-codes when only a session you choose should spend it: you get a single-use code per ticket to hand to that session. To make every mint take a deliberate step, set a mint PIN in your own terminal (amail expect --set-mint-pin); sessions then mint only with the PIN you type in chat. The asking session shows you the endorsement and spends a ticket only with your yes. docs/ENDORSEMENTS.md has the rules and their limits.

Sending from a Chat (Gmail Relay)

A chat on the web or your phone cannot reach this machine, so the Gmail Relay passes its message through your own Gmail drafts. Ask Claude or Gemini to "send this to my Claude Code": the chat saves a draft, and the next time a code session with the Gmail connector checks mail, it files the draft into a-mail and deletes it.

  • Both ends use each app's official Gmail connector. a-mail stores no Google credentials and never connects to Google itself.
  • Drafts are never sent. Chat sessions send to code sessions, never the reverse.
  • The relay is on by default; install.sh asks, and amail config set relays.gmail.enabled false turns it off.
  • Run /a-mail setup gmail in your coding agent once. It adds the a-mail-relay skill to each chat app you use, so the chat knows the addresses and the draft format.
  • ChatGPT runs the skill only in Work mode, so send from a Work-mode chat there; an ordinary ChatGPT chat stalls without loading it.
  • In Gemini, send from a chat using Neon; Hydrogen does not follow the skill.

relays/gmail/README.md has the draft format, the carrier's steps and the adapter. The Gmail Relay is a relay module: docs/RELAYS.md describes the pattern, so you can add relays of your own in ~/.a-mail/relays/.


Policy

a-mail moves files between agents that you drive. These rules decide when it may do more than that, and why.

Passive by Default

By default, a-mail is passive (subagent.enabled: false): it only moves files, and every handoff is carried out by a session you are driving. Watchers (bin/amail-notify.sh), SessionStart hooks (amail hook-check), and inbound gateways (amail receive, amail post) never spawn AI harnesses, even with subagents enabled.

When you opt in, a-mail invokes the official local headless CLI for Antigravity (agy -p), Claude Code (claude -p), or Codex (codex exec) for local, human-authorized tasks, and posts the result back into the bus via amail reply.

Approval Ahead of Time

Every request needs your approval, but you can give it before the request arrives. An endorsement you give in chat, in the session that will do the work, approves each request that spends one of its tickets: only the work your own words describe, only from the addresses you named, and only until it expires, is spent or is revoked. A message can never create, extend or widen one. Endorsements start no harness. The minter does the work itself, and amail invoke refuses a claimed request, as it refuses any message outside inbox/. Within one machine an address is stated rather than proven, so docs/ENDORSEMENTS.md sets out what bounds a session that states another one.

Vendor Terms & Rationale (With Citations)

Not legal advice. This is the project's reading of each vendor's published terms at the time of writing. Terms change; read them yourself before enabling a runner, and turn it off (subagent.allow_<harness> false) if they change.

The published terms we found draw a line between running the official CLI locally for your own individual tasks and extracting credentials, proxying the model, or pooling/reselling subscription access. a-mail only does the former, and only when you opt in. Its constraints follow three rules the vendors' terms share: work runs through the vendor's own harness, a subscription is not direct model access, and credentials stay inside the vendor's client. What the terms ask, and why we agree with them gives the reason for each.

Harness Permitted Subset Implemented by a-mail Key Guardrails & Caveats Primary Citations
Antigravity (headless mode, which Google's FAQ calls agy -p) Invokes unmodified agy in headless mode, in the form its headless docs give under "Stream prompts from stdin": agy --input-format stream-json --output-format stream-json --print-timeout <N>s, with the scoped brief as one stream-json user turn on stdin. This form takes no -p flag: in streaming mode agy reads prompts only from stdin, and -p "<text>" would put the brief on argv. agy runs its own agent loop, prompt, tools, and cached credentials. Never proxies raw completions or touches ~/.gemini/ auth; inspects denied_actions even on SUCCESS; run outside strict Bash sandboxes (or via amail mcp). agy still starts your own MCP servers, and tools you pre-approved in its settings stay callable. Antigravity Terms (permit the CLI in headless mode and as a subagent of another harness; no flag named), Antigravity FAQ (names the mode agy -p), Antigravity Headless CLI Docs ("also called print mode"; documents both -p and stream-json on stdin)
Claude Code (claude -p) Invokes unmodified claude -p with a scoped task brief on stdin, --output-format json, --strict-mcp-config (none of your MCP servers start in the subagent), and --permission-mode plan (read-only default); claude manages its own local auth. Never modifies the binary or reads/replays session tokens; inspects permission_denials. Pause caveat: Anthropic's June 15, 2026 allowance is a pause on previously announced Agent SDK billing changes — toggle off anytime via subagent.allow_claude false. Anthropic Consumer Terms §3 Prohibited Use #7, Claude Help Center (June 15, 2026 update), Claude Code Legal & Compliance
Codex (codex exec) Invokes codex exec --sandbox read-only --skip-git-repo-check --json - with the scoped brief piped on stdin (closed cleanly with EOF) using whatever login the Codex CLI already has (ChatGPT plan or API key). Pins --sandbox read-only (workspace-write with --no-read-only, which keeps Codex's Git-repo check; never danger-full-access); counts against your plan's Codex limits. OpenAI documents exec for scripting but does not explicitly address third-party tools under a ChatGPT plan; use an API key (CODEX_API_KEY) if you want no ambiguity. Former codex exec docs, Codex README, Codex non-interactive docs, OpenAI Terms of Use

What a-mail Always Refuses

  • Never spawns from watchers (amail-notify.sh), hooks (amail hook-check), or gateway delivery (amail receive, amail post).
  • Never passes untrusted message text on argv (all briefs travel over UTF-8 stdin, avoiding Windows .cmd/.bat truncation and BatBadBut CVE-2024-24576), and never passes --dangerously-skip-permissions or --sandbox danger-full-access.
  • Never invokes remote @<node> targets, gateway-received (via) mail, processing//archive//outbox/ messages, recursive subagents (AMAIL_NO_INVOKE=1), or custom unlisted harnesses.
  • Never lets a read-only subagent change the bus: it runs with AMAIL_READ_ONLY=1, so any amail it reaches, by shell or through your own amail mcp, refuses to send, reply, move, close or reconfigure. Its answer is posted by the a-mail process that started it.
  • Asks the calling agent to confirm human approval (--approved / human_approved: true after Workflow 2 review) before invoking an inbox message it did not send. This is a guardrail for a cooperating agent, not an authentication boundary: the from header is self-asserted by whoever wrote the message.

See docs/SUBAGENT-POLICY.md for the quoted terms, exit codes 7 (sent but not invoked) and 8 (invoked but the reply could not be posted), and the full guardrail list.


Architecture & Mechanics

How the bus, the installer, addressing and subagent runs work, for when you need the detail.

Requirements

  • Python 3.9+ (standard library only — zero third-party runtime dependencies)
  • macOS, Linux, or Windows:
    • CLI (bin/amail), stdio MCP server (amail mcp), amail receive, and SKILL.md work across macOS, Linux, and Windows (default bus at ~/.a-mail/, i.e. %USERPROFILE%\.a-mail\ on Windows; leading UTF-8 BOMs written by PowerShell/Windows editors are stripped automatically).
    • install.sh, its Tier 2 SessionStart hooks and MCP registration work on macOS and Linux, and on Windows from Git Bash (see Installing on Windows).
    • Passive desktop notifications (launchd WatchPaths / osascript) are macOS-only and harmlessly skipped/absent on Linux and Windows.

The Bus

Messages live as Markdown files with YAML frontmatter inside a shared local bus at ~/.a-mail/ (overrideable via $AMAIL_HOME):

~/.a-mail/
├── config.json              # Registered agent IDs, optional node name, Coda & notification settings
├── inbox/
│   ├── antigravity/         # Unread mail for Antigravity
│   ├── claude/              # Unread mail for Claude Code
│   └── codex/               # Unread mail for Codex
├── outbox/
│   └── <remote-node>/       # Outbound remote mail spooled for an external gateway forwarder
├── processing/              # Currently active/endorsed tasks
├── archive/                 # Completed, rejected, or forwarded mail (organized by YYYY-MM/)
├── state/                   # Passive notifier dedup state & logs
└── bin/
    ├── amail                # Direct-Python launcher for bin/amail
    └── amail-notify.sh      # Passive OS notification watcher (macOS)

Core Components

  • SKILL.md: Canonical universal skill symlinked into each harness's skills directory (~/.gemini/config/skills/a-mail/, ~/.claude/skills/a-mail/, ~/.codex/skills/a-mail/). Enforces an untrusted-body boundary, a mandatory human approval gate, honest Coda reporting, and a strict no-secrets policy.
  • bin/amail: Zero-dependency Python 3.9+ CLI helper with atomic writes (.tmp + fsync + os.replace), deterministic IDs/timestamps, human-friendly thread_name handles, [<ui>.]<harness>[/<scope>][@<node>] addressing with alias & scope expansion, Coda telemetry, compound check/reply/close/retract/reject commands, passive wait, opt-in invoke / send --invoke for local headless CLIs (agy -p, claude -p, codex exec) in the foreground or --background, invocation status/stop, --request-id for retry-safe sends, Tier 2 hook-check, and receive for external gateways.
  • bin/amail_mcp.py (amail mcp): Zero-dependency Python stdio MCP server (second substrate alongside the CLI) exposing amail_whoami, amail_check, amail_send, amail_invoke, amail_wait, amail_invocation, amail_reply, amail_close, amail_retract, amail_reject, amail_move, amail_read, amail_list, and amail_agents (with MCP tool annotations) with automatic <ui>.<harness>[/<project>] session self-identification.
  • bin/amail-notify.sh: Strictly passive macOS notifier. Never spawns an AI harness. Parses YAML frontmatter with awk, passes values safely via argv to osascript (or terminal-notifier), and deduplicates notifications.

Installation Details

amail setup does the installing; ./install.sh finds Python 3.9 or newer and runs it from the checkout with the same options. Harnesses reach a-mail only through ~/.a-mail/ (apart from the MCP entries on Windows, below), so an upgrade leaves every harness working:

  • ~/.a-mail/bin/amail is a launcher. For a package it runs the package's own amail command (a Homebrew path through its opt link), which keeps working when the package's environment moves to a newer Python; for a checkout it runs bin/amail with the Python that ran setup.
  • Hooks and MCP entries run that launcher.
  • Each harness's skill links to ~/.a-mail/share/SKILL.md, and the notifier runs from ~/.a-mail/bin/amail-notify.sh. For a package both are copies, which setup refreshes. For a checkout both are links into it (copies on Windows), so git pull updates the skill and notifier with the CLI.
  • A checkout install runs from the checkout: after moving or deleting it, run ./install.sh from its new place (or install a package).
  • ~/.a-mail/state/install.json records the version, where a-mail was installed from (git, pip, pipx, uv, brew, or archive for an unpacked release) and the options given. amail setup --from-record repeats those options without asking; amail update runs it after each upgrade.

A second run of amail setup changes nothing and reports each step as [ok].

Installing on Windows

Run the same installer from Git Bash (it comes with Git for Windows); PowerShell and cmd.exe cannot run it. On Windows it:

  • finds Python through the py launcher or python when there is no python3, and needs 3.9 or newer;
  • writes two launchers in ~/.a-mail/bin/: amail for Git Bash and amail.cmd for cmd.exe and PowerShell, so the SessionStart hook runs whichever shell the harness uses;
  • registers the MCP server as a program, since a Windows harness starts a program and not a shell script: Python with the CLI script (python …/bin/amail mcp) for a checkout, and the package's amail.exe for an installed package;
  • links each harness's SKILL.md to ~/.a-mail/share/SKILL.md with a native symbolic link where Windows allows one (Developer Mode on, or an administrator shell), and otherwise copies it; amail update refreshes a copy when it reruns setup. uninstall.sh removes a copy as it does a link.

The notifier is macOS-only and is skipped. If Git converted line endings on checkout (core.autocrlf), .gitattributes keeps the scripts in LF so bash can run them; on a checkout made before that, run git rm --cached -r . && git reset --hard once.

What Setup Touches in Your Home Directory

Path Action
~/.a-mail/ Creates bus directories, default config.json (if missing), the direct-Python bin/amail launcher, a copy of the notifier (bin/amail-notify.sh), a copy of the skill (share/SKILL.md) and the setup record (state/install.json)
~/.gemini/config/skills/a-mail/SKILL.md Links to ~/.a-mail/share/SKILL.md (if ~/.gemini/config exists or --all-harnesses)
~/.claude/skills/a-mail/SKILL.md Links to ~/.a-mail/share/SKILL.md (if ~/.claude exists or --all-harnesses)
~/.codex/skills/a-mail/SKILL.md Links to ~/.a-mail/share/SKILL.md (if ~/.codex exists or --all-harnesses)
~/.gemini/config/hooks.json Merges passive a-mail-inbox SessionStart hook (skip with --no-hooks)
~/.claude/settings.json Merges passive SessionStart hook (skip with --no-hooks)
~/.gemini/config/mcp_config.json Merges a-mail stdio MCP server entry (skip with --no-mcp)
~/.claude.json Merges a-mail stdio MCP server entry (skip with --no-mcp)
~/.claude/settings.json Only with --sandbox-write: adds ~/.a-mail to sandbox.filesystem.allowWrite, so Claude Code's Bash sandbox lets CLI calls write to the bus
~/.codex/config.toml (or $CODEX_HOME/) If ~/.codex exists or --all-harnesses: one marked a-mail block at the end of the file with the a-mail MCP server (skip with --no-mcp), a SessionStart hook (skip with --no-hooks) and, with --sandbox-write, the a-mail home in sandbox_workspace_write.writable_roots. Codex runs the hook only after you trust it in /hooks. A part you configured yourself outside the block is skipped
~/.t3/userdata/settings.json (or $T3CODE_HOME/userdata/) Only if that folder exists: merges an a-mail MCP server entry with AMAIL_UI=t3 for T3 Code agent sessions (skip with --no-mcp)
~/Library/LaunchAgents/io.github.kelnishi.amail.notifier.plist Installs & loads passive macOS notifier (macOS only; skip with --no-notifier)

Every config edit preserves existing file permissions (such as 0600 on ~/.claude.json), creates new files as 0600, and saves a one-time 0600 <file>.a-mail.bak backup before the first edit. In Codex's TOML config, a-mail rewrites or removes only its own block, between # >>> a-mail and # <<< a-mail, and leaves the rest of the file byte for byte; with Python 3.11 or later it checks that the result parses before writing.

Installer Options

./install.sh and amail setup take the same options.

  • --home <dir>: Override a-mail home directory (default: ~/.a-mail).
  • --all-harnesses: Create and link skill directories for Antigravity, Claude Code, and Codex even if a harness directory does not exist yet.
  • --harness-dir <path>: Link SKILL.md into an additional custom harness skill directory (repeatable).
  • --notifier-mode auto|watchpaths|fswatch: Choose launchd trigger strategy (auto uses fswatch if installed, otherwise macOS native WatchPaths).
  • --no-notifier: Skip installing/loading the macOS LaunchAgent.
  • --no-load: Write the LaunchAgent plist without calling launchctl bootstrap.
  • --no-hooks: Skip configuring Tier 2 SessionStart hooks.
  • --no-mcp: Skip registering the a-mail stdio MCP server.
  • --sandbox-write: Let Claude Code's and Codex's sandboxes write to the a-mail home. Without it, sandboxed CLI calls that write to the bus (check's housekeeping, claim, send, a background wait) are refused; the MCP tools are unaffected. With it, any sandboxed command can write mail on the bus.
  • --enable-relay <name> / --disable-relay <name>: Turn a built-in relay on or off without being asked (repeatable). Without either, an interactive setup asks once per relay and a non-interactive one keeps the relay's default; a choice already in config.json is kept.
  • --dry-run: Print planned changes without modifying the filesystem.
  • --from-record (amail setup only): Repeat the options recorded in ~/.a-mail/state/install.json, without asking. Relay settings stay as config.json has them.

Updating

amail update upgrades a-mail through whatever installed it, then runs the new version's amail setup --from-record, so a release that needs a new hook or config block gets it without another install step:

Installed with amail update runs
Homebrew brew upgrade a-mail
pipx pipx upgrade a-mail-agents
uv uv tool upgrade a-mail-agents
pip, in a virtual environment <that environment's python> -m pip install --upgrade a-mail-agents
A git checkout git pull --ff-only origin main, only when the checkout is on main with no uncommitted changes

It refuses, and says why, for a checkout on another branch or with local changes, for an unpacked release, for pip outside a virtual environment, and when the tool isn't on PATH. Afterwards it reports the old and new versions and, on macOS and Linux, lists any a-mail MCP servers that started before the upgrade: they run the old code until their harness restarts them.

amail update --check     # the installed and latest versions; changes nothing (--json for scripts)
amail update --dry-run   # the upgrade and setup commands, without running them
amail update             # upgrade, then rerun setup

--check compares the installed code's version with the latest release on PyPI (which the Homebrew tap follows within a day), or with VERSION on origin/main after a fetch for a checkout, and says when amail update would refuse.

Uninstalling

./uninstall.sh          # from a checkout
amail uninstall         # the same, from the CLI

Uninstalling unloads and removes the macOS LaunchAgent, removes the harness skill links (and the custom --harness-dir links the setup record names), and strips a-mail entries from hooks.json, settings.json, mcp_config.json, ~/.claude.json, Codex's config.toml and T3 Code's settings.json, preserving file permissions. In ~/.a-mail/ it removes the launcher (bin/amail, and bin/amail.cmd on Windows), the notifier, share/SKILL.md and the setup record, after which ~/.a-mail/bin/amail is gone; your mail and config.json stay. Pass --purge to also delete ~/.a-mail/; it refuses a folder without an inbox/ beside config.json or state/, and when ~/.a-mail is a link it removes only the link.

Addressing & Routing

Every a-mail address follows a single canonical grammar:

[<ui>.]<harness>[/<scope>][@<node>]
Part Required Meaning & Examples
<ui>. No Frontend or multi-agent control plane (gemini, desktop, cli, t3, conductor, cursor, windsurf, opencode). Shorthands t3code and t3-code normalize to t3.
<harness> Yes Underlying AI harness that owns the inbox directory ~/.a-mail/inbox/<harness>/ (antigravity, claude, codex, or custom agents added with amail agents add).
/<scope> No Project or repository slug: the enclosing .git root, else a workspace env var like T3CODE_PROJECT_ROOT / CONDUCTOR_WORKSPACE_PATH, else the folder's own name. Home, / and temporary folders name no project.
@<node> No Target machine name for multi-machine forwarding (see Multi-Machine Forwarding). In an endorsement's spender only, @any means every node.

Model preferences (such as Opus or Gemini Neon) travel in the requested_model frontmatter header rather than in the address, and are set automatically by model aliases or --requested-model.

Multi-UI & T3 Code Identity (amail whoami)

All frontends for a harness share one inbox directory (~/.a-mail/inbox/antigravity/, inbox/claude/, inbox/codex/). The <ui>. prefix scopes sessions within that inbox so running the same harness in multiple apps on the same repo — for example Claude Desktop, Claude Code CLI, and T3 Code — never collides and requires no extra agent registration:

Harness Native app CLI Inside T3 Code
Antigravity desktop.antigravity/<repo> (Antigravity IDE), gemini.antigravity/<repo> (Gemini app) cli.antigravity/<repo> (agy) t3.antigravity/<repo>
Claude desktop.claude/<repo> cli.claude/<repo> t3.claude/<repo>
Codex desktop.codex/<repo> cli.codex/<repo> t3.codex/<repo>

Antigravity's three apps share one harness, so a handoff from the IDE to the CLI or the Gemini app on the same repo needs the UI to tell them apart. whoami takes it from the path of the nearest Antigravity executable:

Executable UI
anything inside the IDE's install: Antigravity.app on macOS, %LOCALAPPDATA%\Programs\antigravity\ on Windows (the IDE's language_server) desktop
the agy inside Gemini.app (macOS) gemini
any other agy or agy.exe cli

It finds that path among the parent processes, or in $ANTIGRAVITY_AGENTAPI_EXE when Antigravity's sandbox blocks ps (a shell command the agent runs). The CLI started in the IDE's terminal is the nearer process, so it stays cli. Subagent runs started by amail invoke reply as cli.antigravity too.

Platform Limit
Windows whoami does not walk parent processes, so the UI comes only from $ANTIGRAVITY_AGENTAPI_EXE. MCP amail_whoami gets the gemini default unless the MCP server inherits that variable.
Linux No IDE install path is known, so the IDE reports the gemini.antigravity default.

A harness's own app sets the UI only for that harness, while a control plane (T3 Code, Cursor, …) hosts any harness. Claude Code in the Antigravity IDE's terminal is cli.claude, not desktop.claude, and an agy started by Claude Desktop is cli.antigravity, not the IDE's desktop.antigravity.

amail whoami (and MCP amail_whoami) resolves your session identity automatically in priority order:

  1. $AMAIL_AGENT — explicit override, used verbatim.
  2. Composed <ui>.<harness>/<scope>:
    • UI: --ui / $AMAIL_UI → control-plane env vars (T3CODE_*, T3_CODE_*, CONDUCTOR_*, CURSOR_*, WINDSURF_SESSION, OPENCODE_SESSION) → MCP clientInfo → Desktop signals / parent process ancestry (an enclosing control plane, else the harness's own app: Claude.app, Codex.app or ChatGPT.app's Codex mode (the ChatGPT main executable, since its bundled codex CLI is also the one on PATH), or the nearest Antigravity executable) → $ANTIGRAVITY_AGENTAPI_EXE → harness default (gemini for antigravity, cli for claude/codex).
    • Harness: --provider → MCP clientInfo → harness env vars (ANTIGRAVITY_*, CLAUDECODE / CLAUDE_CODE_*, CODEX_*) → $AMAIL_DEFAULT_AGENT. Control-plane-global env vars such as CLAUDE_AGENT_SDK_* are ignored under wrappers so T3 Code threads don't misidentify their provider.
    • Scope: nearest enclosing .git root → explicit non-git cwd → T3CODE_PROJECT_ROOT / CONDUCTOR_WORKSPACE_PATH.

Expansion Rules (on send)

When you run amail send --to <recipient> (or MCP amail_send / /a-mail <recipient> ...), the recipient is expanded in three stages (skipped for inherited reply targets so replies return verbatim to the sender). A bare /<scope>[@<node>] first takes the sender's own harness, UI-unqualified (/other-repo from cli.claude/my-repo is claude/other-repo); the same holds wherever a-mail takes an address, such as --reply-to, expect --for, check, list and count.

  1. Alias expansion (built-in defaults + config.json["aliases"]):
    • Model aliases expand to the owning harness and set requested_model: opus → claude (Opus), sonnet → claude (Sonnet), haiku → claude (Haiku), fable → claude (Fable), neon → antigravity (Gemini Neon), gemini → antigravity (Gemini), gpt → codex (GPT), o3 → codex (o3).
    • Harness & UI shorthands: agy → antigravity, cc → claude, t3code / t3-code → t3.
    • Composable with <ui>., /<scope>, and @<node>: dotted forms like t3.opus, t3code.agy, or desktop.claude/my-repo@gpu-box preserve the UI prefix, scope, and node while expanding any aliases.
    • Built-in aliases yield automatically if you register a harness with the same name (amail agents add). Customize aliases anytime with amail aliases set <alias> <target> [--requested-model "<Name>"].
  2. Optional UI inheritance (routing.inherit_ui, default false):
    • By default, bare recipients (claude, opus) stay UI-unqualified (claude/<scope>), while prefixed recipients (t3.claude, desktop.claude, gemini.agy) target that specific UI.
    • If you work primarily inside one control plane (such as T3 Code), enable routing.inherit_ui so bare recipients automatically inherit your <ui>. prefix (override per message with --any-ui).
  3. Scope inheritance (routing.inherit_scope, default true):
    • Sending from a scoped session (e.g., t3.antigravity/my-repo) to a recipient that omits /<scope> automatically appends your /<scope> (claude/my-repo, t3.claude/my-repo, codex/my-repo@gpu-box).
    • Override per message with --broadcast to send unscoped, or disable globally with routing.inherit_scope=false.

Examples (sending from t3.antigravity/my-repo with default routing settings):

Input (--to) Expanded to requested_model Delivery
opus claude/my-repo Opus inbox/claude/ (any UI on my-repo)
t3.opus t3.claude/my-repo Opus inbox/claude/ (T3 Code only)
t3code.agy t3.antigravity/my-repo (none) inbox/antigravity/ (T3 Code only)
desktop.claude desktop.claude/my-repo (none) inbox/claude/ (Claude Desktop only)
neon/other-repo antigravity/other-repo Gemini Neon inbox/antigravity/ (other-repo scope)
codex with --broadcast codex (none) inbox/codex/ (all scopes, any UI)
claude@gpu-box claude/my-repo@gpu-box (none) outbox/gpu-box/ (remote forwarder)

Inbox Filtering & UI Isolation (on check / list)

  • UI-targeted mail (e.g., to: t3.claude/my-repo) is only shown to that UI (t3.claude); other UIs for the same harness (desktop.claude, cli.claude) hide it.
  • UI-unqualified mail (e.g., to: claude/my-repo from /a-mail Opus ...) is visible to whichever UI checks that harness when routing.receive_unqualified_ui is true (the default); replying pins the thread to that UI's <ui>.<harness>/<scope>. Set routing.receive_unqualified_ui to false for strict UI-only inboxes — with routing.hint_unqualified_inbox enabled (default true), check still surfaces a hint when bare-harness mail is waiting.
  • Scope filtering: checking <ui>.<harness>/<scope> shows unscoped mail plus matching-scope mail (hiding other repos); checking bare <harness> shows all mail in inbox/<harness>/.

Example Use Cases

  • Cross-app second opinion (Antigravity IDE → Claude Desktop): From Antigravity (desktop.antigravity/my-repo), run /a-mail Opus review the auth refactor. Opus expands to claude/my-repo with requested_model: "Opus". When you run /a-mail in Claude Desktop (desktop.claude/my-repo), it sees the unread mail, and its reply pins the thread back to desktop.antigravity/my-repo.
  • Handoff between apps on one harness (Antigravity IDE → Antigravity CLI): From the IDE (desktop.antigravity/my-repo), run /a-mail cli.agy finish the migration in the terminal. cli.agy expands to cli.antigravity/my-repo, so only an agy session on my-repo sees it; the IDE and the Gemini app hide it.
  • Keeping T3 Code threads isolated from Desktop / CLI: If you run Claude inside T3 Code (t3.claude/my-repo) alongside a separate Claude Desktop window (desktop.claude/my-repo), send /a-mail t3.opus review the migration (or /a-mail t3.agy check the failing test for T3 Antigravity). Claude Desktop ignores t3.claude mail. If you live mostly in T3 Code, enable amail config set routing.inherit_ui true so bare /a-mail opus ... stays inside t3. by default (use --any-ui whenever you want any UI to pick it up).
  • Multiple repositories open at the same time: With separate sessions on backend and frontend, sending /a-mail claude ... from backend auto-inherits /backend so your frontend session isn't distracted. To message across repos intentionally, pass the target scope explicitly: /a-mail claude/frontend update the client for the new schema.
  • Broadcasting across all repos for a harness: When a message isn't tied to a single repo (such as a shared config change or workstation note), pass --broadcast (amail send --to claude --broadcast ...) to omit /<scope> so every scoped session for that harness sees it.
  • Handing off work to another machine (@<node>): From your laptop on ml-app, run /a-mail codex@gpu-box run the full benchmark suite. Scope inheritance expands it to codex/ml-app@gpu-box, spools it into ~/.a-mail/outbox/gpu-box/, and qualifies from with @<local-node> so replies route back to your laptop once forwarded.

Routing Preferences & Custom Aliases

# Inspect or tune routing behavior
~/.a-mail/bin/amail config
~/.a-mail/bin/amail config set routing.inherit_ui true
~/.a-mail/bin/amail config set routing.receive_unqualified_ui false

# Inspect or add recipient aliases
~/.a-mail/bin/amail aliases
~/.a-mail/bin/amail aliases set review t3.claude --requested-model "Opus"

CLI Usage

# Check & read unread messages in one command
~/.a-mail/bin/amail check claude
~/.a-mail/bin/amail check claude/my-repo   # unscoped claude + my-repo scope only

# Send a new message (atomically) with thread_name and Coda telemetry
~/.a-mail/bin/amail send \
  --from antigravity \
  --to claude/my-repo \
  --thread-name api-schema \
  --subject "Review API schema" \
  --model "Gemini 4 Neon (High)" \
  --tokens-in 14200 \
  --tokens-out 2850 \
  --tokens-cached 9100 \
  --context-usage "38k / 1M (3.8%)" \
  --quota "5h window: 12% used" \
  --body-file /path/to/brief.md

# Reply (inheriting thread_id, thread_name, to, and 'Re:' subject) + archive original in one command
~/.a-mail/bin/amail reply api-schema \
  --from claude/my-repo \
  --body "## Summary\nLooks solid with two minor notes."

# Reject and archive in one command
~/.a-mail/bin/amail reject api-schema --reason "Out of scope"

# Low-level commands
~/.a-mail/bin/amail list claude
~/.a-mail/bin/amail read api-schema
~/.a-mail/bin/amail move api-schema processing
~/.a-mail/bin/amail move api-schema archive --status completed
~/.a-mail/bin/amail agents
~/.a-mail/bin/amail agents add gemini-cli

Subagent Runs

# Opt in once: the master switch, then each harness you want runnable (all off by default)
~/.a-mail/bin/amail config set subagent.enabled true
~/.a-mail/bin/amail config set subagent.allow_antigravity true
~/.a-mail/bin/amail config set subagent.allow_claude true
~/.a-mail/bin/amail config set subagent.allow_codex true

# Send and immediately invoke (read-only by default; works for neon/agy, opus/claude, codex/gpt)
~/.a-mail/bin/amail send --to neon  --subject "Review auth diff" --body "Inspect /abs/path/auth.py" --invoke --json
~/.a-mail/bin/amail send --to opus  --subject "Schema check"     --body "Inspect /abs/path/schema.sql" --invoke --json
~/.a-mail/bin/amail send --to codex --subject "Parser edge cases" --body "Inspect /abs/path/parser.py" --invoke --json

# Or invoke an existing unread local inbox message you sent (pass --approved after Workflow 2 review for other sessions' mail)
~/.a-mail/bin/amail invoke auth-review --json

# Run it in the background instead, then wait for the reply (or let it arrive while you work)
~/.a-mail/bin/amail send --to neon --subject "Long review" --body "..." --invoke --background --json
~/.a-mail/bin/amail wait long-review --json        # exit 0 replied, 7 if the run failed or was stopped
~/.a-mail/bin/amail invocation long-review --stop  # stop it; the message goes back to the inbox

# Independently disable any harness at any time if vendor policy changes
~/.a-mail/bin/amail config set subagent.allow_claude false

Background runs. --background (CLI) and the MCP default start the run in a detached worker and return at once. The run is recorded in ~/.a-mail/state/invocations/<id>.json (status running, succeeded, failed, or stopped); amail invocation <id> / amail_invocation reads it, and --stop / stop: true stops it. A run that fails, is stopped, or whose worker dies puts the message back in inbox/, and a waiting amail wait / amail_wait wakes with invocation_failed (CLI exit 7). Over MCP, amail_invoke and amail_send(invoke=true) never hold the call open for longer than timeout_ms (at most 45 s, with mode: "wait"), because MCP clients time out long tool calls. Their result's mode says how the run's process runs (always background over MCP), and call_mode echoes the async or wait the call asked for.

a-mail and T3 Code

T3 Code runs Claude, Codex, Antigravity, and other agents side by side, and has its own tools for agents it manages (delegate_task, t3_thread_send). a-mail works alongside them:

  • Addressing. a-mail recognizes T3 Code sessions (from the T3CODE_* variables, or AMAIL_UI=t3 set by install.sh) and addresses them as t3.<harness>[/<scope>]. Mail to t3.claude/my-repo reaches the T3 Code session, not a Claude Code terminal on the same repository.
  • Setup. If T3 Code is installed (~/.t3/userdata/ exists), install.sh adds amail mcp to T3 Code's mcpServers, and T3 Code agent sessions pick it up when they next start.
  • Which to use. Use delegate_task when T3 Code should start and track a child thread in its own UI. Use a-mail when the other side lives outside T3 Code (Claude Desktop, the Antigravity IDE, the Codex app, a terminal, another machine), or when a person should carry the handoff.

The UI escape hatch. An a-mail thread is a set of Markdown files under ~/.a-mail/, not a record in one app's database. Any app, or a person with a text editor, can read and answer it. A T3 Code session can hand a review to an Antigravity IDE window; a person can take a failed background run out of the inbox and finish it in whatever app they like; and moving between apps loses nothing. This is also why a subagent run that fails or is stopped puts its message back in the inbox instead of dropping it.

Shared conventions. a-mail's asynchronous calls follow the same rules as T3 Code's orchestration tools, so an agent that knows one knows the other:

T3 Code a-mail
delegate_task returns while the child works; waits are bounded amail_invoke / amail_send(invoke=true) start the run in the background and return at once; mode: "wait" waits at most timeout_ms (≤ 45 s)
t3_thread_wait: 30 s default, 45 s maximum, returns next amail_wait: 30 s default, 45 s maximum, returns next
clientRequestId makes a retried send safe request_id (--request-id on the CLI) makes a retried send safe
A message to a thread arrives as ordinary user input A message body stays fenced as untrusted data, and an agent asks a person before acting on mail it did not send (Workflow 2)

Multi-Machine Forwarding (@<node>)

Status: No public gateway forwarder exists. a-mail provides the local outbox spool and the amail receive contract (docs/RECEIVE-CONTRACT.md), so you can plug in or build your own transport.

Addresses support an optional @<node> suffix (<agent>[/<scope>]@<node>, e.g., claude/my-repo@gpu-box) for plugging in an external transport or gateway forwarder:

  1. Configure this machine's node name with ~/.a-mail/bin/amail node set <node-name> (or $AMAIL_NODE; defaults to hostname).
  2. Sending to a remote @<node> spools the .md message atomically into ~/.a-mail/outbox/<node>/ and auto-qualifies from / reply_to with @<local-node> so replies route back automatically.
  3. Your transport/gateway watches ~/.a-mail/outbox/<node>/*.md, transfers each file to <node>, and pipes it into:
    ~/.a-mail/bin/amail receive --file - --via gateway:<sending-node> --expected-node <node> --expected-from-node <sending-node> --json
    
    (amail receive writes atomically into inbox/<agent>/ and deduplicates retries by message ID. --via is required: it records the origin, and invoke never runs mail that has one. --expected-from-node refuses a message whose from names a machine other than the authenticated sender. On Windows, start python <checkout>\bin\amail rather than the amail script or its .cmd shim; see the contract.)
  4. Once delivered, the forwarder archives the sender's outbox copy:
    ~/.a-mail/bin/amail move <id> archive --status forwarded
    
  5. Optionally, the transport answers ticket lookups, so a session can spend a ticket another node's session minted (docs/ENDORSEMENTS.md).

One transport at a time carries a bus's outbox: it takes the transport lease (amail transport take), passes the lease token on list and move, and yields when the owner's transport.order ranks another above it. The contract has the negotiation and the settings. transports/ssh/ is a reference implementation over SSH; nothing installs or starts it.

Running Tests

python3 -m unittest discover -s tests -v
bash tests/test_notify.sh

CI note: GitHub Actions runs the Python unit tests on ubuntu-latest and windows-latest, and runs tests/test_notify.sh on ubuntu-latest (which covers steps 1–5 and 7–8). Step 6 of tests/test_notify.sh (macOS LaunchAgent .plist validation) runs locally on macOS rather than in CI to avoid macOS runner billing multipliers.


Contributing & Security

  • See CONTRIBUTING.md for design invariants, dev workflow, and PR guidelines.
  • See docs/SUBAGENT-POLICY.md for the opt-in subagent policy (agy -p, claude -p, codex exec), safety guardrails, and ToS citations.
  • See SECURITY.md for the security model and private vulnerability reporting.
  • Licensed under the MIT License.

Support

If a-mail saves you time juggling multiple AI coding agents, consider giving the repo a ⭐ on GitHub — it helps others discover the project!

If you'd like to support ongoing maintenance and new integrations, you can also sponsor the project via GitHub Sponsors. Thank you!

Metadata

Release files for a-mail-agents 0.13.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a-mail-agents 0.13.2
File Size Uploaded Provenance Actions
a_mail_agents-0.13.2.tar.gz 367.1 kB With provenance Details for a_mail_agents-0.13.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-mail-agents 0.13.2
File Interpreter ABI Platform Actions
a_mail_agents-0.13.2-py3-none-any.whl Python 3 none any Details for a_mail_agents-0.13.2-py3-none-any.whl

Total release size: 586.8 kB

Release files / a_mail_agents-0.13.2.tar.gz

Download URL a_mail_agents-0.13.2.tar.gz
Size 367.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ea4ae3f3519c82b85877f2fd6e8f14d57dce936bcd8451ae11b942250e3ef69b
BLAKE2b-256 checksum
How to use checksums
9ffdc81788fba6e26b17d5a9ae71359744426a0daaf52d30f79d28ddd5313a2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Release files / a_mail_agents-0.13.2-py3-none-any.whl

Download URL a_mail_agents-0.13.2-py3-none-any.whl
Size 219.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b0f5ce5724d2a165a8d5387e969b63725041e5ad4897626f91af99d0d4d6bef
BLAKE2b-256 checksum
How to use checksums
602a7ed738227d45fb4d616d7e9b423232b788dc692e5cddd2cdba1b6902319a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Security for a-mail-agents 0.13.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for a_mail_agents-0.13.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page