home / skills / leegonzales / aiskills / agent-mail

agent-mail skill

/AgentMail/agent-mail

This skill coordinates multi-agent work through project-local Maildir messaging, enabling task claiming, status updates, handoffs, and urgent block

npx playbooks add skill leegonzales/aiskills --skill agent-mail

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
3.3 KB
---
name: agent-mail
description: Coordinate with other AI agents via project-local Maildir messaging. Use when operating in tandem mode with Claude, Gemini, or other agents. Enables claiming tasks, reporting completion, handling blocks, and synchronizing work across terminals.
---

# Agent Mail

Project-local messaging system for multi-agent coordination. Email semantics for AI agents working together.

## When to Use

Invoke when:
- Operating in **tandem mode** with other AI agents (Claude + Gemini, multiple Claudes)
- Starting a session and need to check for messages from partners
- Claiming a task and need to notify other agents
- Completing work and need to report handoff
- Blocked and need to notify partners urgently
- Need to coordinate or synchronize work across terminals

## Pre-requisites

**Check if agent-mail is initialized:**
```bash
ls .agent-mail/  # Should exist in project root
```

**If not initialized:**
```bash
npx tsx ~/Projects/leegonzales/agent-mail/src/mail.ts init
```

## Core Rituals (MANDATORY)

### 1. Session Start

**Before ANY work**, join and check inbox:

```bash
agent-mail join claude
agent-mail check claude
```

If unread messages exist:
```bash
agent-mail read claude
```

Process all messages before proceeding.

### 2. Before Claiming Work

Notify partners before starting any task:

```bash
agent-mail broadcast claude "Claiming Task" "Claiming IE-XX. Starting now."
```

### 3. After Completing Work

Report completion immediately:

```bash
agent-mail broadcast claude "Task Complete" "IE-XX complete. Output at: path/to/result"
```

### 4. When Blocked

Notify with HIGH priority:

```bash
agent-mail send claude gemini "BLOCKED" "IE-XX blocked: reason" --priority high
```

### 5. Periodic Check-in

For long tasks (>5 minutes):

```bash
agent-mail broadcast claude "Status Update" "Still on IE-XX. 60% complete."
```

## Message Types

| Subject | Purpose |
|---------|---------|
| `Claiming Task` | Announcing you're taking a task |
| `Task Complete` | Work finished, ready for handoff |
| `BLOCKED` | Cannot proceed, need help |
| `Status Update` | Progress on long task |
| `Question` | Need clarification |
| `Answer` | Responding to question |
| `Handoff` | Explicitly passing work |
| `Sync Request` | Asking for partner status |

## Quick Reference

```bash
# Project
agent-mail init                    # Initialize in current project
agent-mail join claude             # Register as agent
agent-mail who                     # See active agents
agent-mail info                    # Project info

# Messaging
agent-mail check claude            # Peek inbox (no mark)
agent-mail read claude             # Read + mark as read
agent-mail send claude gemini "Subject" "Body"
agent-mail broadcast claude "Subject" "Body"
agent-mail reply claude <id> "Body"
agent-mail status                  # All inboxes
agent-mail history claude 10       # Message history
```

## Integration with Beads

When using beads task tracking:

1. **Claim in beads first**, then notify:
   ```bash
   bd update IE-XX --status in_progress --assignee Claude
   agent-mail broadcast claude "Claiming Task" "Claimed IE-XX in beads"
   ```

2. **Close in beads**, then notify:
   ```bash
   bd close IE-XX "Completed"
   agent-mail broadcast claude "Task Complete" "IE-XX closed"
   ```

## Examples

See `references/examples.md` for full conversation examples.

Overview

This skill provides a project-local Maildir-style messaging system for coordinating multiple AI agents working in tandem. It offers email-like semantics to claim tasks, report completion, broadcast status, and escalate blocks across terminals. The tool is optimized for workflows involving Claude, Gemini, or other agent instances. It keeps coordination local to the project to avoid external dependencies.

How this skill works

Agents join a project mailbox and use simple CLI commands to check, read, send, broadcast, reply, and view history. Messages are stored in a .agent-mail folder in the project root using Maildir conventions so every agent can inspect inboxes and mark messages. Common subjects (Claiming Task, Task Complete, BLOCKED, Status Update) standardize intent so agents can programmatically interpret and act on signals. Integrations with task trackers (like beads) make claims and closures explicit across systems.

When to use it

  • When running multiple AI agents in tandem (Claude, Gemini, etc.) within the same project.
  • At the start of a session to join and process pending messages before doing any work.
  • Before claiming a task to notify peers and avoid duplicated effort.
  • Right after finishing work to report completion and provide output locations for handoff.
  • When blocked and needing urgent help from other agents or human operators.
  • During long-running tasks to send periodic check-ins and avoid stale assumptions.

Best practices

  • Always run join and check before starting any work to clear unread messages first.
  • Broadcast claims before starting and broadcast completion immediately after finishing.
  • Use the BLOCKED subject with high priority for urgent impediments so partners can respond fast.
  • Integrate with your task tracker (beads) — claim in beads first, then broadcast the claim.
  • Keep message bodies concise and include clear identifiers (task ID, path to results, percent complete).

Example use cases

  • Two language models coordinating a dataset labeling pipeline: one agent claims a file, the other skips claimed items.
  • A generator and verifier agent: generator broadcasts completion with output path, verifier picks it up and reports issues.
  • Multiple Claude instances sharing test cases: agents broadcast status updates to avoid duplicate runs.
  • Agent hits a blocking bug in a build step and sends a BLOCKED message to request assistance from a human or another agent.
  • Long analysis job where the agent sends periodic Status Update messages every few minutes to keep collaborators informed.

FAQ

How do I initialize the messaging for a project?

Initialize by creating the .agent-mail folder in the project root using the provided init command, then join as an agent before interacting.

What subjects should I use so other agents understand my intent?

Use standard subjects like Claiming Task, Task Complete, BLOCKED, Status Update, Question, Answer, Handoff, and Sync Request to keep signals consistent.

How do I avoid conflicting work when multiple agents run concurrently?

Always announce claims with a broadcast before starting and check inboxes for unread claims; integrate with beads or your task tracker to lock tasks first.