a-mail-agents 0.13.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- a_mail_agents-0.13.2.dist-info/METADATA +571 -0
- a_mail_agents-0.13.2.dist-info/RECORD +22 -0
- a_mail_agents-0.13.2.dist-info/WHEEL +4 -0
- a_mail_agents-0.13.2.dist-info/entry_points.txt +2 -0
- a_mail_agents-0.13.2.dist-info/licenses/LICENSE +21 -0
- amail/SKILL.md +801 -0
- amail/__init__.py +5 -0
- amail/__main__.py +5 -0
- amail/amail-notify.sh +380 -0
- amail/amail_json_cfg.py +541 -0
- amail/amail_mcp.py +1917 -0
- amail/cli.py +11587 -0
- amail/relays/gmail/CARRIER.md +30 -0
- amail/relays/gmail/README.md +171 -0
- amail/relays/gmail/SETUP.md +23 -0
- amail/relays/gmail/a-mail-relay/SKILL.md +61 -0
- amail/relays/gmail/adapter.py +202 -0
- amail/relays/gmail/relay.json +43 -0
- amail/templates/config.default.json +48 -0
- amail/templates/io.github.kelnishi.amail.notifier.plist.tmpl +30 -0
- amail/transports/ssh/README.md +38 -0
- amail/transports/ssh/amail-ssh-transport +290 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: a-mail-agents
|
|
3
|
+
Version: 0.13.2
|
|
4
|
+
Summary: A local message bus that lets AI coding sessions (Claude Code, Codex, Antigravity) hand work to each other.
|
|
5
|
+
Project-URL: Homepage, https://github.com/kelnishi/a-mail
|
|
6
|
+
Project-URL: Changelog, https://github.com/kelnishi/a-mail/blob/main/CHANGELOG.md
|
|
7
|
+
Project-URL: Issues, https://github.com/kelnishi/a-mail/issues
|
|
8
|
+
Author: Kelvin Nishikawa
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,antigravity,claude-code,codex,mcp,messaging
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="assets/logo.svg" alt="a-mail logo" width="120" height="120" />
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<h1 align="center">a-mail</h1>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
Local-first async messaging (<code>SKILL.md</code>, CLI, and MCP) for AI coding agents — human-gated, zero-dependency, and passive by default.
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://github.com/kelnishi/a-mail/actions/workflows/test.yml"><img src="https://github.com/kelnishi/a-mail/actions/workflows/test.yml/badge.svg?branch=main" alt="Tests" /></a>
|
|
35
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/kelnishi/a-mail" alt="MIT License" /></a>
|
|
36
|
+
<img src="https://img.shields.io/badge/python-3.9%2B-3776AB?logo=python&logoColor=white" alt="Python 3.9+" />
|
|
37
|
+
<img src="https://img.shields.io/badge/dependencies-none-brightgreen" alt="No third-party dependencies" />
|
|
38
|
+
<a href="https://m8ven.ai/mcp/kelnishi-a-mail-2tnqep?s=readme"><img src="https://m8ven.ai/badge/mcp/kelnishi-a-mail-2tnqep?variant=verified" alt="M8ven Verified" /></a>
|
|
39
|
+
<a href="https://m8ven.ai/mcp/kelnishi-a-mail-2tnqep?s=readme"><img src="https://m8ven.ai/badge/mcp/kelnishi-a-mail-2tnqep" alt="M8ven Score" /></a>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
Designed for **Antigravity**, **Claude Code**, **Codex**, and any other AI coding harness supporting the `SKILL.md` standard or Model Context Protocol (MCP).
|
|
43
|
+
|
|
44
|
+
### Why a-mail?
|
|
45
|
+
|
|
46
|
+
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:
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="assets/how-it-works.svg" alt="Example of Claude Desktop (Claude Opus) sending a design-doc review request via a-mail to Antigravity (Gemini Neon)" width="100%" />
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Getting Started
|
|
55
|
+
|
|
56
|
+
You need **Python 3.9+** (standard library only) on macOS, Linux, or Windows (run the installer from Git Bash; see [Installing on Windows](#installing-on-windows)).
|
|
57
|
+
|
|
58
|
+
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:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
./install.sh --dry-run
|
|
62
|
+
./install.sh
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`install.sh` finds Python and runs `amail setup` from the checkout, so a checkout is the development install ([Installation Details](#installation-details)).
|
|
66
|
+
|
|
67
|
+
2. **Send.** In one app, ask another agent for something:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
/a-mail Neon review docs/design.md and list the risks
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The agent drafts a brief and writes it to `~/.a-mail/inbox/antigravity/`.
|
|
74
|
+
|
|
75
|
+
3. **Pick it up.** In the other app, check the inbox:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
/a-mail
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The agent summarizes the unread mail and asks you before acting on it. Once you approve, it does the work and replies.
|
|
82
|
+
|
|
83
|
+
4. **Read the reply.** Run `/a-mail` again in the first app.
|
|
84
|
+
|
|
85
|
+
5. **Update.** One command upgrades a-mail and rewires the harnesses ([Updating](#updating)):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
~/.a-mail/bin/amail update
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
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](#cli-usage)).
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Addressing
|
|
96
|
+
|
|
97
|
+
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:
|
|
98
|
+
|
|
99
|
+
| You type | It reaches |
|
|
100
|
+
| :--- | :--- |
|
|
101
|
+
| `claude` (or `cc`) | Claude Code sessions on this repository, in any app |
|
|
102
|
+
| `antigravity` (or `agy`) | Antigravity sessions on this repository |
|
|
103
|
+
| `codex` | Codex sessions on this repository |
|
|
104
|
+
| `t3.claude`, `desktop.claude` | Claude Code in that app only (T3 Code, Claude Desktop) |
|
|
105
|
+
| `claude/other-repo` | Claude Code sessions on another repository |
|
|
106
|
+
| `/other-repo` | Sessions of your own harness on another repository (`claude/other-repo` from Claude Code) |
|
|
107
|
+
| `codex@gpu-box` | Codex on another machine, through a forwarder you provide |
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
The full form is `[<ui>.]<harness>[/<scope>][@<node>]`; `amail whoami` prints your own. [Addressing & Routing](#addressing--routing) has the rules.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Invoking a Subagent
|
|
116
|
+
|
|
117
|
+
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:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
~/.a-mail/bin/amail config set subagent.enabled true
|
|
121
|
+
|
|
122
|
+
~/.a-mail/bin/amail send --to neon --subject "Review auth diff" --body "Inspect /abs/path/auth.py" --invoke
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Add `--background` to return at once, then `~/.a-mail/bin/amail wait <thread>` for the reply. [Subagent Runs](#subagent-runs) covers the rest, and [Policy](#policy) explains what a-mail will and will not do with your subscriptions.
|
|
126
|
+
|
|
127
|
+
## Approving Work Ahead of Time
|
|
128
|
+
|
|
129
|
+
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:
|
|
130
|
+
|
|
131
|
+
> Be ready: Claude in my-repo will ask you to run the test suite once its fix lands. Go ahead when it does.
|
|
132
|
+
|
|
133
|
+
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:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
~/.a-mail/bin/amail expect --for claude/my-repo --words "Run the test suite and report failures" --tickets 2 --expires 2h
|
|
137
|
+
~/.a-mail/bin/amail claim --timeout 7200 # the minter waits for any of its endorsements (in a background task)
|
|
138
|
+
~/.a-mail/bin/amail send --ticket <endorsement-id> --subject "Run tests" --body "..." # from a Claude session in my-repo
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
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](docs/ENDORSEMENTS.md) has the rules and their limits.
|
|
142
|
+
|
|
143
|
+
## Sending from a Chat (Gmail Relay)
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
- Both ends use each app's official Gmail connector. a-mail stores no Google credentials and never connects to Google itself.
|
|
148
|
+
- Drafts are never sent. Chat sessions send to code sessions, never the reverse.
|
|
149
|
+
- The relay is on by default; `install.sh` asks, and `amail config set relays.gmail.enabled false` turns it off.
|
|
150
|
+
- Run `/a-mail setup gmail` in your coding agent once. It adds the [`a-mail-relay`](relays/gmail/a-mail-relay/SKILL.md) skill to each chat app you use, so the chat knows the addresses and the draft format.
|
|
151
|
+
- ChatGPT runs the skill only in Work mode, so send from a Work-mode chat there; an ordinary ChatGPT chat stalls without loading it.
|
|
152
|
+
- In Gemini, send from a chat using Neon; Hydrogen does not follow the skill.
|
|
153
|
+
|
|
154
|
+
[relays/gmail/README.md](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](docs/RELAYS.md) describes the pattern, so you can add relays of your own in `~/.a-mail/relays/`.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Policy
|
|
159
|
+
|
|
160
|
+
a-mail moves files between agents that you drive. These rules decide when it may do more than that, and why.
|
|
161
|
+
|
|
162
|
+
### Passive by Default
|
|
163
|
+
|
|
164
|
+
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.
|
|
165
|
+
|
|
166
|
+
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`.
|
|
167
|
+
|
|
168
|
+
### Approval Ahead of Time
|
|
169
|
+
|
|
170
|
+
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](docs/ENDORSEMENTS.md#what-an-address-proves) sets out what bounds a session that states another one.
|
|
171
|
+
|
|
172
|
+
### Vendor Terms & Rationale (With Citations)
|
|
173
|
+
|
|
174
|
+
> **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.
|
|
175
|
+
|
|
176
|
+
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](docs/SUBAGENT-POLICY.md#what-the-terms-ask-and-why-we-agree-with-them) gives the reason for each.
|
|
177
|
+
|
|
178
|
+
| Harness | Permitted Subset Implemented by `a-mail` | Key Guardrails & Caveats | Primary Citations |
|
|
179
|
+
| :--- | :--- | :--- | :--- |
|
|
180
|
+
| **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](https://antigravity.google/terms) (permit the CLI in headless mode and as a subagent of another harness; no flag named), [Antigravity FAQ](https://antigravity.google/docs/faq/) (names the mode `agy -p`), [Antigravity Headless CLI Docs](https://antigravity.google/docs/cli/headless/) ("also called print mode"; documents both `-p` and stream-json on stdin) |
|
|
181
|
+
| **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](https://www.anthropic.com/legal/consumer-terms), [Claude Help Center (June 15, 2026 update)](https://support.claude.com/en/articles/15036540-use-the-claude-agent-sdk-with-your-claude-plan), [Claude Code Legal & Compliance](https://code.claude.com/docs/en/legal-and-compliance) |
|
|
182
|
+
| **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](https://github.com/openai/codex/blob/2de731490e86c11980c1c90b8a9f3fe332a118fd/docs/exec.md), [Codex README](https://github.com/openai/codex/blob/main/README.md), [Codex non-interactive docs](https://learn.chatgpt.com/docs/non-interactive-mode), [OpenAI Terms of Use](https://openai.com/policies/terms-of-use/) |
|
|
183
|
+
|
|
184
|
+
### What `a-mail` Always Refuses
|
|
185
|
+
|
|
186
|
+
- **Never** spawns from watchers (`amail-notify.sh`), hooks (`amail hook-check`), or gateway delivery (`amail receive`, `amail post`).
|
|
187
|
+
- **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`.
|
|
188
|
+
- **Never** invokes remote `@<node>` targets, gateway-received (`via`) mail, `processing/`/`archive/`/`outbox/` messages, recursive subagents (`AMAIL_NO_INVOKE=1`), or custom unlisted harnesses.
|
|
189
|
+
- **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.
|
|
190
|
+
- **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.
|
|
191
|
+
|
|
192
|
+
See [docs/SUBAGENT-POLICY.md](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.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Architecture & Mechanics
|
|
197
|
+
|
|
198
|
+
How the bus, the installer, addressing and subagent runs work, for when you need the detail.
|
|
199
|
+
|
|
200
|
+
### Requirements
|
|
201
|
+
|
|
202
|
+
- **Python 3.9+** (standard library only — zero third-party runtime dependencies)
|
|
203
|
+
- **macOS, Linux, or Windows**:
|
|
204
|
+
- **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).
|
|
205
|
+
- **`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](#installing-on-windows)).
|
|
206
|
+
- Passive desktop notifications (`launchd` `WatchPaths` / `osascript`) are **macOS-only** and harmlessly skipped/absent on Linux and Windows.
|
|
207
|
+
|
|
208
|
+
### The Bus
|
|
209
|
+
|
|
210
|
+
Messages live as Markdown files with YAML frontmatter inside a shared local bus at `~/.a-mail/` (overrideable via `$AMAIL_HOME`):
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
~/.a-mail/
|
|
214
|
+
├── config.json # Registered agent IDs, optional node name, Coda & notification settings
|
|
215
|
+
├── inbox/
|
|
216
|
+
│ ├── antigravity/ # Unread mail for Antigravity
|
|
217
|
+
│ ├── claude/ # Unread mail for Claude Code
|
|
218
|
+
│ └── codex/ # Unread mail for Codex
|
|
219
|
+
├── outbox/
|
|
220
|
+
│ └── <remote-node>/ # Outbound remote mail spooled for an external gateway forwarder
|
|
221
|
+
├── processing/ # Currently active/endorsed tasks
|
|
222
|
+
├── archive/ # Completed, rejected, or forwarded mail (organized by YYYY-MM/)
|
|
223
|
+
├── state/ # Passive notifier dedup state & logs
|
|
224
|
+
└── bin/
|
|
225
|
+
├── amail # Direct-Python launcher for bin/amail
|
|
226
|
+
└── amail-notify.sh # Passive OS notification watcher (macOS)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Core Components
|
|
230
|
+
|
|
231
|
+
- **`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.
|
|
232
|
+
- **`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.
|
|
233
|
+
- **`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.
|
|
234
|
+
- **`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.
|
|
235
|
+
|
|
236
|
+
### Installation Details
|
|
237
|
+
|
|
238
|
+
`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](#installing-on-windows)), so an upgrade leaves every harness working:
|
|
239
|
+
|
|
240
|
+
- `~/.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.
|
|
241
|
+
- Hooks and MCP entries run that launcher.
|
|
242
|
+
- 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.
|
|
243
|
+
- A checkout install runs from the checkout: after moving or deleting it, run `./install.sh` from its new place (or install a package).
|
|
244
|
+
- `~/.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.
|
|
245
|
+
|
|
246
|
+
A second run of `amail setup` changes nothing and reports each step as `[ok]`.
|
|
247
|
+
|
|
248
|
+
#### Installing on Windows
|
|
249
|
+
|
|
250
|
+
Run the same installer from **Git Bash** (it comes with Git for Windows); PowerShell and `cmd.exe` cannot run it. On Windows it:
|
|
251
|
+
|
|
252
|
+
- finds Python through the `py` launcher or `python` when there is no `python3`, and needs 3.9 or newer;
|
|
253
|
+
- 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;
|
|
254
|
+
- 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;
|
|
255
|
+
- 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.
|
|
256
|
+
|
|
257
|
+
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.
|
|
258
|
+
|
|
259
|
+
#### What Setup Touches in Your Home Directory
|
|
260
|
+
|
|
261
|
+
| Path | Action |
|
|
262
|
+
| :--- | :--- |
|
|
263
|
+
| `~/.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`) |
|
|
264
|
+
| `~/.gemini/config/skills/a-mail/SKILL.md` | Links to `~/.a-mail/share/SKILL.md` (if `~/.gemini/config` exists or `--all-harnesses`) |
|
|
265
|
+
| `~/.claude/skills/a-mail/SKILL.md` | Links to `~/.a-mail/share/SKILL.md` (if `~/.claude` exists or `--all-harnesses`) |
|
|
266
|
+
| `~/.codex/skills/a-mail/SKILL.md` | Links to `~/.a-mail/share/SKILL.md` (if `~/.codex` exists or `--all-harnesses`) |
|
|
267
|
+
| `~/.gemini/config/hooks.json` | Merges passive `a-mail-inbox` `SessionStart` hook (skip with `--no-hooks`) |
|
|
268
|
+
| `~/.claude/settings.json` | Merges passive `SessionStart` hook (skip with `--no-hooks`) |
|
|
269
|
+
| `~/.gemini/config/mcp_config.json` | Merges `a-mail` stdio MCP server entry (skip with `--no-mcp`) |
|
|
270
|
+
| `~/.claude.json` | Merges `a-mail` stdio MCP server entry (skip with `--no-mcp`) |
|
|
271
|
+
| `~/.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 |
|
|
272
|
+
| `~/.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 |
|
|
273
|
+
| `~/.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`) |
|
|
274
|
+
| `~/Library/LaunchAgents/io.github.kelnishi.amail.notifier.plist` | Installs & loads passive macOS notifier (macOS only; skip with `--no-notifier`) |
|
|
275
|
+
|
|
276
|
+
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.
|
|
277
|
+
|
|
278
|
+
#### Installer Options
|
|
279
|
+
|
|
280
|
+
`./install.sh` and `amail setup` take the same options.
|
|
281
|
+
|
|
282
|
+
- `--home <dir>`: Override a-mail home directory (default: `~/.a-mail`).
|
|
283
|
+
- `--all-harnesses`: Create and link skill directories for Antigravity, Claude Code, and Codex even if a harness directory does not exist yet.
|
|
284
|
+
- `--harness-dir <path>`: Link `SKILL.md` into an additional custom harness skill directory (repeatable).
|
|
285
|
+
- `--notifier-mode auto|watchpaths|fswatch`: Choose `launchd` trigger strategy (`auto` uses `fswatch` if installed, otherwise macOS native `WatchPaths`).
|
|
286
|
+
- `--no-notifier`: Skip installing/loading the macOS LaunchAgent.
|
|
287
|
+
- `--no-load`: Write the LaunchAgent plist without calling `launchctl bootstrap`.
|
|
288
|
+
- `--no-hooks`: Skip configuring Tier 2 `SessionStart` hooks.
|
|
289
|
+
- `--no-mcp`: Skip registering the `a-mail` stdio MCP server.
|
|
290
|
+
- `--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.
|
|
291
|
+
- `--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.
|
|
292
|
+
- `--dry-run`: Print planned changes without modifying the filesystem.
|
|
293
|
+
- `--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.
|
|
294
|
+
|
|
295
|
+
#### Updating
|
|
296
|
+
|
|
297
|
+
`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:
|
|
298
|
+
|
|
299
|
+
| Installed with | `amail update` runs |
|
|
300
|
+
| :--- | :--- |
|
|
301
|
+
| Homebrew | `brew upgrade a-mail` |
|
|
302
|
+
| pipx | `pipx upgrade a-mail-agents` |
|
|
303
|
+
| uv | `uv tool upgrade a-mail-agents` |
|
|
304
|
+
| pip, in a virtual environment | `<that environment's python> -m pip install --upgrade a-mail-agents` |
|
|
305
|
+
| A git checkout | `git pull --ff-only origin main`, only when the checkout is on `main` with no uncommitted changes |
|
|
306
|
+
|
|
307
|
+
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.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
amail update --check # the installed and latest versions; changes nothing (--json for scripts)
|
|
311
|
+
amail update --dry-run # the upgrade and setup commands, without running them
|
|
312
|
+
amail update # upgrade, then rerun setup
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
`--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.
|
|
316
|
+
|
|
317
|
+
#### Uninstalling
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
./uninstall.sh # from a checkout
|
|
321
|
+
amail uninstall # the same, from the CLI
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
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.
|
|
325
|
+
|
|
326
|
+
### Addressing & Routing
|
|
327
|
+
|
|
328
|
+
Every `a-mail` address follows a single canonical grammar:
|
|
329
|
+
|
|
330
|
+
```text
|
|
331
|
+
[<ui>.]<harness>[/<scope>][@<node>]
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
| Part | Required | Meaning & Examples |
|
|
335
|
+
| :--- | :--- | :--- |
|
|
336
|
+
| `<ui>.` | No | Frontend or multi-agent control plane (`gemini`, `desktop`, `cli`, `t3`, `conductor`, `cursor`, `windsurf`, `opencode`). Shorthands `t3code` and `t3-code` normalize to `t3`. |
|
|
337
|
+
| `<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`). |
|
|
338
|
+
| `/<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. |
|
|
339
|
+
| `@<node>` | No | Target machine name for multi-machine forwarding (see [Multi-Machine Forwarding](#multi-machine-forwarding-node)). In an endorsement's spender only, `@any` means every node. |
|
|
340
|
+
|
|
341
|
+
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`.
|
|
342
|
+
|
|
343
|
+
#### Multi-UI & T3 Code Identity (`amail whoami`)
|
|
344
|
+
|
|
345
|
+
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:
|
|
346
|
+
|
|
347
|
+
| Harness | Native app | CLI | Inside T3 Code |
|
|
348
|
+
| :--- | :--- | :--- | :--- |
|
|
349
|
+
| Antigravity | `desktop.antigravity/<repo>` (Antigravity IDE), `gemini.antigravity/<repo>` (Gemini app) | `cli.antigravity/<repo>` (`agy`) | `t3.antigravity/<repo>` |
|
|
350
|
+
| Claude | `desktop.claude/<repo>` | `cli.claude/<repo>` | `t3.claude/<repo>` |
|
|
351
|
+
| Codex | `desktop.codex/<repo>` | `cli.codex/<repo>` | `t3.codex/<repo>` |
|
|
352
|
+
|
|
353
|
+
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:
|
|
354
|
+
|
|
355
|
+
| Executable | UI |
|
|
356
|
+
| :--- | :--- |
|
|
357
|
+
| anything inside the IDE's install: `Antigravity.app` on macOS, `%LOCALAPPDATA%\Programs\antigravity\` on Windows (the IDE's `language_server`) | `desktop` |
|
|
358
|
+
| the `agy` inside `Gemini.app` (macOS) | `gemini` |
|
|
359
|
+
| any other `agy` or `agy.exe` | `cli` |
|
|
360
|
+
|
|
361
|
+
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.
|
|
362
|
+
|
|
363
|
+
| Platform | Limit |
|
|
364
|
+
| :--- | :--- |
|
|
365
|
+
| 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. |
|
|
366
|
+
| Linux | No IDE install path is known, so the IDE reports the `gemini.antigravity` default. |
|
|
367
|
+
|
|
368
|
+
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`.
|
|
369
|
+
|
|
370
|
+
`amail whoami` (and MCP `amail_whoami`) resolves your session identity automatically in priority order:
|
|
371
|
+
|
|
372
|
+
1. **`$AMAIL_AGENT`** — explicit override, used verbatim.
|
|
373
|
+
2. **Composed `<ui>.<harness>/<scope>`**:
|
|
374
|
+
- **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`).
|
|
375
|
+
- **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.
|
|
376
|
+
- **Scope**: nearest enclosing `.git` root → explicit non-git `cwd` → `T3CODE_PROJECT_ROOT` / `CONDUCTOR_WORKSPACE_PATH`.
|
|
377
|
+
|
|
378
|
+
#### Expansion Rules (on `send`)
|
|
379
|
+
|
|
380
|
+
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`.
|
|
381
|
+
|
|
382
|
+
1. **Alias expansion** (built-in defaults + `config.json["aliases"]`):
|
|
383
|
+
- **Model aliases** expand to the owning harness and set `requested_model`:
|
|
384
|
+
`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`).
|
|
385
|
+
- **Harness & UI shorthands**: `agy` → `antigravity`, `cc` → `claude`, `t3code` / `t3-code` → `t3`.
|
|
386
|
+
- **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.
|
|
387
|
+
- 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>"]`.
|
|
388
|
+
2. **Optional UI inheritance (`routing.inherit_ui`, default `false`)**:
|
|
389
|
+
- By default, bare recipients (`claude`, `opus`) stay **UI-unqualified** (`claude/<scope>`), while prefixed recipients (`t3.claude`, `desktop.claude`, `gemini.agy`) target that specific UI.
|
|
390
|
+
- 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`).
|
|
391
|
+
3. **Scope inheritance (`routing.inherit_scope`, default `true`)**:
|
|
392
|
+
- 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`).
|
|
393
|
+
- Override per message with `--broadcast` to send unscoped, or disable globally with `routing.inherit_scope=false`.
|
|
394
|
+
|
|
395
|
+
**Examples** (sending from `t3.antigravity/my-repo` with default routing settings):
|
|
396
|
+
|
|
397
|
+
| Input (`--to`) | Expanded `to` | `requested_model` | Delivery |
|
|
398
|
+
| :--- | :--- | :--- | :--- |
|
|
399
|
+
| `opus` | `claude/my-repo` | `Opus` | `inbox/claude/` (any UI on `my-repo`) |
|
|
400
|
+
| `t3.opus` | `t3.claude/my-repo` | `Opus` | `inbox/claude/` (T3 Code only) |
|
|
401
|
+
| `t3code.agy` | `t3.antigravity/my-repo` | *(none)* | `inbox/antigravity/` (T3 Code only) |
|
|
402
|
+
| `desktop.claude` | `desktop.claude/my-repo` | *(none)* | `inbox/claude/` (Claude Desktop only) |
|
|
403
|
+
| `neon/other-repo` | `antigravity/other-repo` | `Gemini Neon` | `inbox/antigravity/` (`other-repo` scope) |
|
|
404
|
+
| `codex` with `--broadcast` | `codex` | *(none)* | `inbox/codex/` (all scopes, any UI) |
|
|
405
|
+
| `claude@gpu-box` | `claude/my-repo@gpu-box` | *(none)* | `outbox/gpu-box/` (remote forwarder) |
|
|
406
|
+
|
|
407
|
+
#### Inbox Filtering & UI Isolation (on `check` / `list`)
|
|
408
|
+
|
|
409
|
+
- **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.
|
|
410
|
+
- **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.
|
|
411
|
+
- **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>/`.
|
|
412
|
+
|
|
413
|
+
#### Example Use Cases
|
|
414
|
+
|
|
415
|
+
- **Cross-app second opinion (Antigravity IDE → Claude Desktop)**:
|
|
416
|
+
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`.
|
|
417
|
+
- **Handoff between apps on one harness (Antigravity IDE → Antigravity CLI)**:
|
|
418
|
+
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.
|
|
419
|
+
- **Keeping T3 Code threads isolated from Desktop / CLI**:
|
|
420
|
+
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).
|
|
421
|
+
- **Multiple repositories open at the same time**:
|
|
422
|
+
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`.
|
|
423
|
+
- **Broadcasting across all repos for a harness**:
|
|
424
|
+
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.
|
|
425
|
+
- **Handing off work to another machine (`@<node>`)**:
|
|
426
|
+
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.
|
|
427
|
+
|
|
428
|
+
#### Routing Preferences & Custom Aliases
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
# Inspect or tune routing behavior
|
|
432
|
+
~/.a-mail/bin/amail config
|
|
433
|
+
~/.a-mail/bin/amail config set routing.inherit_ui true
|
|
434
|
+
~/.a-mail/bin/amail config set routing.receive_unqualified_ui false
|
|
435
|
+
|
|
436
|
+
# Inspect or add recipient aliases
|
|
437
|
+
~/.a-mail/bin/amail aliases
|
|
438
|
+
~/.a-mail/bin/amail aliases set review t3.claude --requested-model "Opus"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### CLI Usage
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
# Check & read unread messages in one command
|
|
445
|
+
~/.a-mail/bin/amail check claude
|
|
446
|
+
~/.a-mail/bin/amail check claude/my-repo # unscoped claude + my-repo scope only
|
|
447
|
+
|
|
448
|
+
# Send a new message (atomically) with thread_name and Coda telemetry
|
|
449
|
+
~/.a-mail/bin/amail send \
|
|
450
|
+
--from antigravity \
|
|
451
|
+
--to claude/my-repo \
|
|
452
|
+
--thread-name api-schema \
|
|
453
|
+
--subject "Review API schema" \
|
|
454
|
+
--model "Gemini 4 Neon (High)" \
|
|
455
|
+
--tokens-in 14200 \
|
|
456
|
+
--tokens-out 2850 \
|
|
457
|
+
--tokens-cached 9100 \
|
|
458
|
+
--context-usage "38k / 1M (3.8%)" \
|
|
459
|
+
--quota "5h window: 12% used" \
|
|
460
|
+
--body-file /path/to/brief.md
|
|
461
|
+
|
|
462
|
+
# Reply (inheriting thread_id, thread_name, to, and 'Re:' subject) + archive original in one command
|
|
463
|
+
~/.a-mail/bin/amail reply api-schema \
|
|
464
|
+
--from claude/my-repo \
|
|
465
|
+
--body "## Summary\nLooks solid with two minor notes."
|
|
466
|
+
|
|
467
|
+
# Reject and archive in one command
|
|
468
|
+
~/.a-mail/bin/amail reject api-schema --reason "Out of scope"
|
|
469
|
+
|
|
470
|
+
# Low-level commands
|
|
471
|
+
~/.a-mail/bin/amail list claude
|
|
472
|
+
~/.a-mail/bin/amail read api-schema
|
|
473
|
+
~/.a-mail/bin/amail move api-schema processing
|
|
474
|
+
~/.a-mail/bin/amail move api-schema archive --status completed
|
|
475
|
+
~/.a-mail/bin/amail agents
|
|
476
|
+
~/.a-mail/bin/amail agents add gemini-cli
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Subagent Runs
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# Opt in once: the master switch, then each harness you want runnable (all off by default)
|
|
483
|
+
~/.a-mail/bin/amail config set subagent.enabled true
|
|
484
|
+
~/.a-mail/bin/amail config set subagent.allow_antigravity true
|
|
485
|
+
~/.a-mail/bin/amail config set subagent.allow_claude true
|
|
486
|
+
~/.a-mail/bin/amail config set subagent.allow_codex true
|
|
487
|
+
|
|
488
|
+
# Send and immediately invoke (read-only by default; works for neon/agy, opus/claude, codex/gpt)
|
|
489
|
+
~/.a-mail/bin/amail send --to neon --subject "Review auth diff" --body "Inspect /abs/path/auth.py" --invoke --json
|
|
490
|
+
~/.a-mail/bin/amail send --to opus --subject "Schema check" --body "Inspect /abs/path/schema.sql" --invoke --json
|
|
491
|
+
~/.a-mail/bin/amail send --to codex --subject "Parser edge cases" --body "Inspect /abs/path/parser.py" --invoke --json
|
|
492
|
+
|
|
493
|
+
# Or invoke an existing unread local inbox message you sent (pass --approved after Workflow 2 review for other sessions' mail)
|
|
494
|
+
~/.a-mail/bin/amail invoke auth-review --json
|
|
495
|
+
|
|
496
|
+
# Run it in the background instead, then wait for the reply (or let it arrive while you work)
|
|
497
|
+
~/.a-mail/bin/amail send --to neon --subject "Long review" --body "..." --invoke --background --json
|
|
498
|
+
~/.a-mail/bin/amail wait long-review --json # exit 0 replied, 7 if the run failed or was stopped
|
|
499
|
+
~/.a-mail/bin/amail invocation long-review --stop # stop it; the message goes back to the inbox
|
|
500
|
+
|
|
501
|
+
# Independently disable any harness at any time if vendor policy changes
|
|
502
|
+
~/.a-mail/bin/amail config set subagent.allow_claude false
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**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.
|
|
506
|
+
|
|
507
|
+
### a-mail and T3 Code
|
|
508
|
+
|
|
509
|
+
[T3 Code](https://github.com/pingdotgg/t3code) 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:
|
|
510
|
+
|
|
511
|
+
- **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.
|
|
512
|
+
- **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.
|
|
513
|
+
- **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.
|
|
514
|
+
|
|
515
|
+
**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.
|
|
516
|
+
|
|
517
|
+
**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:
|
|
518
|
+
|
|
519
|
+
| T3 Code | a-mail |
|
|
520
|
+
| :--- | :--- |
|
|
521
|
+
| `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) |
|
|
522
|
+
| `t3_thread_wait`: 30 s default, 45 s maximum, returns `next` | `amail_wait`: 30 s default, 45 s maximum, returns `next` |
|
|
523
|
+
| `clientRequestId` makes a retried send safe | `request_id` (`--request-id` on the CLI) makes a retried send safe |
|
|
524
|
+
| 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) |
|
|
525
|
+
|
|
526
|
+
### Multi-Machine Forwarding (`@<node>`)
|
|
527
|
+
|
|
528
|
+
> **Status:** No public gateway forwarder exists. `a-mail` provides the local outbox spool and the `amail receive` contract ([`docs/RECEIVE-CONTRACT.md`](docs/RECEIVE-CONTRACT.md)), so you can plug in or build your own transport.
|
|
529
|
+
|
|
530
|
+
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:
|
|
531
|
+
|
|
532
|
+
1. Configure this machine's node name with `~/.a-mail/bin/amail node set <node-name>` (or `$AMAIL_NODE`; defaults to hostname).
|
|
533
|
+
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.
|
|
534
|
+
3. Your transport/gateway watches `~/.a-mail/outbox/<node>/*.md`, transfers each file to `<node>`, and pipes it into:
|
|
535
|
+
```bash
|
|
536
|
+
~/.a-mail/bin/amail receive --file - --via gateway:<sending-node> --expected-node <node> --expected-from-node <sending-node> --json
|
|
537
|
+
```
|
|
538
|
+
(`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.)
|
|
539
|
+
4. Once delivered, the forwarder archives the sender's outbox copy:
|
|
540
|
+
```bash
|
|
541
|
+
~/.a-mail/bin/amail move <id> archive --status forwarded
|
|
542
|
+
```
|
|
543
|
+
5. Optionally, the transport answers ticket lookups, so a session can spend a ticket another node's session minted ([`docs/ENDORSEMENTS.md`](docs/ENDORSEMENTS.md#between-nodes)).
|
|
544
|
+
|
|
545
|
+
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/`](transports/ssh/README.md) is a reference implementation over SSH; nothing installs or starts it.
|
|
546
|
+
|
|
547
|
+
### Running Tests
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
python3 -m unittest discover -s tests -v
|
|
551
|
+
bash tests/test_notify.sh
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
> **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.
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## Contributing & Security
|
|
559
|
+
|
|
560
|
+
- See [CONTRIBUTING.md](CONTRIBUTING.md) for design invariants, dev workflow, and PR guidelines.
|
|
561
|
+
- See [docs/SUBAGENT-POLICY.md](docs/SUBAGENT-POLICY.md) for the opt-in subagent policy (`agy -p`, `claude -p`, `codex exec`), safety guardrails, and ToS citations.
|
|
562
|
+
- See [SECURITY.md](SECURITY.md) for the security model and private vulnerability reporting.
|
|
563
|
+
- Licensed under the [MIT License](LICENSE).
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Support
|
|
568
|
+
|
|
569
|
+
If **a-mail** saves you time juggling multiple AI coding agents, consider giving the repo a ⭐ on [GitHub](https://github.com/kelnishi/a-mail) — it helps others discover the project!
|
|
570
|
+
|
|
571
|
+
If you'd like to support ongoing maintenance and new integrations, you can also sponsor the project via [GitHub Sponsors](https://github.com/sponsors/kelnishi). Thank you!
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
amail/__init__.py,sha256=vggqW7Bsc0wgm2SF1gp7zlzco0Ztw8p9bDZG1AYPEr0,260
|
|
2
|
+
amail/__main__.py,sha256=RpWN9Xj6cVViZ8ou4q71sCmpBVhwWvDgLQBNoQWRY_w,112
|
|
3
|
+
amail/SKILL.md,sha256=KHBl4GvQwJSG1J8yqqjrO5SbXo6S7wQ4iLChhWfB77I,60459
|
|
4
|
+
amail/amail-notify.sh,sha256=S30qMpPUYUN162tvfjUQO3jZiiJ1xv5096QUOIULljA,10766
|
|
5
|
+
amail/amail_json_cfg.py,sha256=rVNrMy9cMUtK9-xzPg1T1d5U2hEUIuQcNDECgCIvohg,19753
|
|
6
|
+
amail/amail_mcp.py,sha256=07jNPzkuTjkL69GnC3b5lMjV2rzaCd-0Vm-LXPGq1n8,86581
|
|
7
|
+
amail/cli.py,sha256=WhJrwDGS-TrprFyztjV2JGSQZ_eo8mJbidoHnyLE_Uc,505463
|
|
8
|
+
amail/relays/gmail/CARRIER.md,sha256=VDtFRMVwKy1IDIdnFkGeZofhM5C6ry09AVaAlY-233U,2353
|
|
9
|
+
amail/relays/gmail/README.md,sha256=-NQqQO19d4KM43C65Xt9-bUs3oWlfZmuQ7H_AiQTajg,14951
|
|
10
|
+
amail/relays/gmail/SETUP.md,sha256=irEDV7hmMSRV_b5ASNqaDGvyxLBjmfbiWkQq5P4soSc,2633
|
|
11
|
+
amail/relays/gmail/adapter.py,sha256=ib35G_Na46RNbWLsrtNnkNvg3DpggodIcfL5r1vfhUE,9255
|
|
12
|
+
amail/relays/gmail/relay.json,sha256=-_cTpj0OcLlMIsOFBA2R-KDNFSmnAlgmgKYHoie6R1o,1431
|
|
13
|
+
amail/relays/gmail/a-mail-relay/SKILL.md,sha256=PyWY-gvUmik_n7x_oKvHM4O0T02ak_hq-bM3FcqpXDc,3914
|
|
14
|
+
amail/templates/config.default.json,sha256=NGH0nWXMj71dZsxxg9to7A4vl6ke5g4lfMsZbGko7rg,1023
|
|
15
|
+
amail/templates/io.github.kelnishi.amail.notifier.plist.tmpl,sha256=EuP5ELemhjfRMoiB3jFmSEEFVzas5PIbubWPrKL2VPg,803
|
|
16
|
+
amail/transports/ssh/README.md,sha256=pS29frLgwQQxzC6qO9me6pjR_sS9sZgf4xgYFjMa8iw,3048
|
|
17
|
+
amail/transports/ssh/amail-ssh-transport,sha256=ipSiqJwswaROH6uCQSqFAd7f0ZOoi3TCxzVPfAZTxlo,12977
|
|
18
|
+
a_mail_agents-0.13.2.dist-info/METADATA,sha256=s4eqVGdnmhgRLAkOGDdy2mr_bVor9p9rC0yELsQvTzo,49540
|
|
19
|
+
a_mail_agents-0.13.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
20
|
+
a_mail_agents-0.13.2.dist-info/entry_points.txt,sha256=d84offR56cbxjzr-tgyK-Sk__JgPFOdHdEXhNk5eiJE,41
|
|
21
|
+
a_mail_agents-0.13.2.dist-info/licenses/LICENSE,sha256=BrjPNJ00V2dyfEojL64-4KtT8ViEoz593UTKb8w8vzU,1073
|
|
22
|
+
a_mail_agents-0.13.2.dist-info/RECORD,,
|