A mail agent prototype built on top of MiniMax.
It currently has two entry points:
- A local web chat interface
- An Apple iMessage bridge powered by
@photon-ai/imessage-kit
The core interaction model is not a "fixed workflow page," but rather:
- The user makes a request
- MiniMax chooses and calls the appropriate mail tools
- The tools read / search / send Gmail messages
- The agent summarizes the results, drafts a reply, and sends it after confirmation
- Frontend: Vite + React + TypeScript
- Backend: Express + TypeScript
- LLM: MiniMax Anthropic-compatible API
- Mail tools: Gmail API
- Message channel: iMessage via
@photon-ai/imessage-kit
The current agent uses an MCP-style toolset:
search_emailsread_emaillist_account_emailssend_email
MiniMax decides when to call these tools based on the user's request. Sending email still follows the safer "draft first, confirm before sending" path by default.
Copy .env.example to .env.
MINIMAX_API_KEYMINIMAX_API_BASE_URLMINIMAX_MODEL
Anthropic-style compatibility variables are also supported:
ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URLANTHROPIC_MODEL
GMAIL_CLIENT_IDGMAIL_CLIENT_SECRETGMAIL_REDIRECT_URISESSION_SECRETorJWT_SECRET
AGENT_SESSION_FILE
This file persists the Gmail session from the current web login so the backend agent can use it. The iMessage watcher does not carry browser cookies, so this is required.
IMESSAGE_AGENT_ENABLED=true|falseIMESSAGE_AGENT_DEBUG=true|falseIMESSAGE_TRIGGER_PREFIX=@mailIMESSAGE_ALLOWED_SENDERS=foo@example.com,+1234567890IMESSAGE_POLL_INTERVAL_MS=2000
imessage-kit reads ~/Library/Messages/chat.db, so you must grant Full Disk Access to the terminal or IDE running this project.
Path:
System Settings -> Privacy & Security -> Full Disk Access
Add the application you actually use to run npm run dev, such as Terminal, Warp, iTerm, Cursor, or VS Code.
npm install
npm run dev- Frontend:
http://localhost:5173or whatever port Vite switches to automatically - Backend health:
http://localhost:3001/api/health
- Start the project
- Open the local web app and connect Gmail
- Click
Activate For iMessageat the top of the page - Make sure
.envcontainsIMESSAGE_AGENT_ENABLED=true - Restart the backend
- Send a message in iMessage like this:
@mail Help me check who sent me a team request, then draft a reply first
If there is already a pending draft in the current chat, you do not need to add the prefix again in follow-up replies.
GET /api/auth/meGET /api/auth/agent-sessionPOST /api/auth/agent-session/activateDELETE /api/auth/agent-sessionPOST /api/agent/chat
GET /api/imessage/status
imessage-kitcan connect the agent to the system iMessage channel, but it is not an Apple-native iMessage App Extension.- That means it works well for an agent that sends and receives messages through iMessage, but it is not suitable for rendering the kind of custom tool card UI shown in screenshots directly inside Messages.app.
- In this repository, the web app serves as the rich UI / debugging panel, while the iMessage entry point serves as the real message channel.