Agent Messaging System Guide
March 24, 2026 ยท View on GitHub
This guide explains how to use the Agent Messaging Protocol (AMP) to enable communication between AI agents. AMP is an open standard for AI agent communication, providing secure, cryptographically signed messaging between agents.
Overview
AI Maestro implements AMP v1.0 and can act as both a local provider and federate with external providers like CrabMail. This enables powerful workflows like:
- Agent Coordination: Frontend agent requests API from backend agent
- Task Delegation: Orchestrator agent assigns work to specialist agents
- Progress Updates: Long-running tasks broadcast status to other agents
- Context Sharing: Agents share code, findings, or decisions
๐ฏ Two Operational Modes
AI Maestro's messaging system works in two ways, depending on your AI agent:
Mode 1: Skills Mode - Natural Language (Claude Code Only) โจ
Best for: Claude Code sessions with the agent-messaging skill installed
How it works: Just describe what you want in natural language. Claude automatically uses the appropriate tools.
You: "Send a message to backend-architect asking about the API endpoint status"
Claude: *Automatically calls amp-send with proper parameters*
โ
Message sent to backend-architect
Visual Example:
Claude Code automatically loads the skill when you mention messaging
No commands needed - just describe what you want
Advantages:
- โ Zero command memorization
- โ Context-aware (Claude knows your session name)
- โ Natural conversation flow
- โ Automatically formats messages correctly
- โ Progressive disclosure (skill loads only when relevant)
Requirements:
- Claude Code with skills support
- Agent-messaging skill installed at
~/.claude/skills/agent-messaging/ - AMP CLI tools installed (via
./install-plugin.sh)
Mode 2: Manual Mode - Command-Line (Universal) ๐ง
Best for: Any AI agent (Aider, Cursor, custom scripts, shell scripts) or direct usage
How it works: Use shell commands directly to send and receive messages.
amp-send backend-architect \
"API endpoint status" \
"What's the status of the /api/users endpoint?"
Visual Example:
Direct command-line usage - works with any agent
Command-line tools for checking messages
Advantages:
- โ Works with ANY AI agent (not just Claude Code)
- โ Works in shell scripts and automation
- โ Full control over all parameters
- โ No dependencies on Claude Code
- โ Direct filesystem access
Requirements:
- AMP CLI tools installed in
~/.local/bin/(via./install-plugin.sh) - PATH configured to include
~/.local/bin/ - Agent identity initialized (
amp-init --auto)
Which Mode Should You Use?
Are you using Claude Code with skills installed?
โ
โโ YES โ Use Skills Mode โจ
โ (Natural language, zero commands)
โ
โโ NO โ Use Manual Mode ๐ง
(Universal, works with any agent)
The rest of this guide shows BOTH modes for each operation, so you can use whichever fits your setup.
Visual Communication Flow
Here's what agent-to-agent communication looks like in action:
Complete Workflow Example
Step 1: Agent receives notification of incoming message
Step 2: Agent opens inbox to review message details
Step 3: Agent composes and sends reply
Result: Complete agent-to-agent communication without human intervention
Key insight: Whether using Skills Mode (natural language) or Manual Mode (commands), the underlying communication system is identical. Messages are stored persistently, searchable, and structured.
Message Storage Location
AMP messages are stored in: ~/.agent-messaging/
~/.agent-messaging/
โโโ config.json # Agent configuration
โโโ keys/
โ โโโ private.pem # Ed25519 private key (NEVER share!)
โ โโโ public.pem # Ed25519 public key
โโโ messages/
โ โโโ inbox/ # Received messages
โ โโโ sent/ # Sent messages
โโโ registrations/ # External provider registrations
Note: AMP uses cryptographic signing (Ed25519) to ensure message authenticity. Your private key signs outgoing messages, and recipients verify signatures using your public key.
Message Format
Messages are stored as JSON files:
{
"id": "msg-1736614200-abc123",
"from": "frontend-developer",
"to": "backend-architect",
"timestamp": "2025-01-11T14:30:00Z",
"subject": "Need API endpoint for user authentication",
"priority": "high",
"status": "unread",
"content": {
"type": "request",
"message": "I'm building the login form and need a POST /api/auth/login endpoint",
"context": {
"component": "LoginForm.tsx",
"requirements": [
"Accept email and password",
"Return JWT token on success",
"Return 401 on invalid credentials"
]
}
},
"inReplyTo": null
}
How to Use Messaging in Claude Code Sessions
Method 1: Via Dashboard UI
- Open the Messages Tab: In the AI Maestro dashboard, select a session and click the "Messages" tab
- Compose a Message: Click "Compose" and fill in:
- To: Target session name (e.g.,
backend-architect) - Subject: Brief description
- Priority: low | normal | high | urgent
- Type: request | response | notification | update
- Message: Your message content
- To: Target session name (e.g.,
- Send: Click "Send Message"
- Check Inbox: Switch to the recipient session and view messages in the Messages tab
Method 2: Programmatically (Using Files)
Agents can read/write messages directly by accessing the file system.
Checking for New Messages
Use the AMP CLI tools:
# Check inbox for new messages
amp-inbox
# Quick unread count
amp-inbox --unread
# Read a specific message
amp-read <message-id>
Sending a Message Programmatically
Use the AMP CLI or API:
# Using AMP CLI (recommended)
amp-send backend-architect "Need login API endpoint" "Please implement POST /api/auth/login endpoint"
# Using curl with the AMP API
curl -X POST http://localhost:23000/api/v1/route \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"to": "backend-architect@local.aimaestro.local",
"subject": "Need login API endpoint",
"payload": {
"type": "request",
"message": "Please implement POST /api/auth/login endpoint"
}
}'
Method 2.5: Using AMP CLI Tools (Recommended)
AI Maestro provides AMP CLI tools for message sending. These tools implement the Agent Messaging Protocol.
amp-init
Initialize your agent identity (required once).
Usage:
amp-init --auto # Auto-generate agent name from tmux session
amp-init my-agent # Specify agent name explicitly
amp-send
Send a message to another agent.
Usage:
amp-send <recipient> <subject> <message>
Examples:
# Simple message
amp-send backend-architect "Need API endpoint" "Please implement POST /api/users"
# With priority
amp-send --priority high backend-architect "Urgent request" "Production issue!"
# Reply to a message
amp-reply <message-id> "Your reply here"
Output:
Message sent successfully
To: backend-architect@local.aimaestro.local
Subject: Need API endpoint
ID: msg_abc123
amp-inbox
Check your inbox for messages.
Usage:
amp-inbox # List all messages
amp-inbox --unread # List unread only
Example output:
๐ฌ Inbox (3 messages)
1. [UNREAD] From: frontend-developer
Subject: Need API endpoint
Time: 2025-01-17T14:30:00Z
Priority: high
2. [READ] From: orchestrator
Subject: Task assignment
Time: 2025-01-17T12:00:00Z
Use 'amp-read <id>' to read a message
amp-read
Read a specific message.
Usage:
amp-read <message-id>
amp-reply
Reply to a message.
Usage:
amp-reply <message-id> "Your reply message"
amp-status
Check your agent status and registrations.
Usage:
amp-status
Output:
Agent: backend-architect
Address: backend-architect@myorg.aimaestro.local
Public Key: (Ed25519) abc123...
Registrations:
- local.aimaestro.local (active)
Method 3: Using the API
The dashboard exposes REST endpoints for messaging:
# Send a message
curl -X POST http://localhost:23000/api/messages \
-H "Content-Type: application/json" \
-d '{
"from": "frontend-developer",
"to": "backend-architect",
"subject": "Need API endpoint",
"priority": "high",
"content": {
"type": "request",
"message": "Please implement POST /api/auth/login"
}
}'
# List messages for an agent
curl "http://localhost:23000/api/messages?agent=backend-architect"
# Get unread count
curl "http://localhost:23000/api/messages?agent=backend-architect&action=unread-count"
# Mark as read
curl -X PATCH "http://localhost:23000/api/messages?agent=backend-architect&id=msg-123&action=read"
Method 4: Instant tmux Notifications
For urgent, real-time notifications that need immediate attention (different from persistent file-based messages).
send-tmux-message.sh
Send instant notifications directly to another session's terminal.
Usage:
send-tmux-message.sh <target_session> <message> [method]
Parameters:
target_session(required) - Target session namemessage(required) - Notification textmethod(optional) - display | inject | echo (default: display)
Methods:
-
display - Popup notification (default, non-intrusive)
send-tmux-message.sh backend-architect "Check your inbox!"Shows a temporary popup in the target session's status line (auto-dismisses after ~5 seconds).
-
inject - Inject as comment in terminal history
send-tmux-message.sh backend-architect "Urgent: API down!" injectAppears in the terminal history as an executed command. More visible than display.
-
echo - Echo to terminal output with formatting
send-tmux-message.sh backend-architect "CRITICAL: Check logs!" echoDisplays formatted message box in terminal output. Most visible but also most intrusive.
Comparison with File-Based Messages:
| Feature | send-tmux-message.sh | amp-send |
|---|---|---|
| Speed | Instant (< 10ms) | Delayed (~100ms, requires API) |
| Persistence | Temporary | Permanent (stored in file) |
| Visibility | High (appears in terminal) | Medium (requires checking inbox) |
| Best for | Urgent alerts | Detailed communication |
| Structured data | No | Yes (priority, type, context) |
| Searchable | No | Yes (via API or files) |
When to use instant notifications:
- โ Urgent issues requiring immediate attention
- โ Quick "FYI" alerts ("build complete", "tests passing")
- โ Making sure file-based message gets seen
- โ Production emergencies
When to use file-based messages:
- โ Detailed requests with context
- โ Messages that need to be referenced later
- โ Structured communication (priority, type)
- โ Non-urgent communication
Combined approach (urgent + detailed):
# 1. Get their attention immediately
send-tmux-message.sh backend-architect "๐จ Urgent: Check inbox NOW!"
# 2. Provide full details in file-based message
amp-send backend-architect \
"Production: API endpoint failing" \
"POST /api/users returning 500 errors. Started at 14:30. Logs show database timeout. ~200 users affected." \
urgent \
notification
Security note: Messages are shell-escaped with printf '%q' to prevent command injection.
Agent Workflow Examples
Example 1: Request-Response Pattern
This example shows how two agents coordinate on a feature. We'll show both Skills Mode and Manual Mode.
Skills Mode (Claude Code) โจ
Frontend Agent (session: project-frontend-ui):
User: "Build a login form"
Claude (Frontend):
1. Designs login form component
2. Realizes it needs an API endpoint
3. You: "We need to request an API endpoint from the backend agent"
Claude: "I'll send a message to the backend agent requesting this."
*Automatically sends structured message*
4. Continues with UI work while waiting
Frontend agent requesting API endpoint using natural language
Backend Agent (session: project-backend-api):
User: "Check for messages and work on any requests"
Claude (Backend):
1. You: "Do I have any messages?"
Claude: "Let me check your inbox..."
*Automatically calls amp-inbox*
2. Finds message from frontend agent
3. Reads requirements
4. Implements /api/auth/login endpoint
5. You: "Reply to the frontend agent that the endpoint is ready"
Claude: *Automatically sends response with details*
Backend agent checking for incoming requests
Backend agent sees the incoming request
Backend agent reviews message details
Frontend Agent (continues):
Claude (Frontend):
1. You: "Check if backend agent replied"
Claude: *Checks inbox, finds response*
2. Updates LoginForm to call the new endpoint
3. Tests integration
Frontend agent receives confirmation from backend
Manual Mode (Universal) ๐ง
Frontend Agent (session: project-frontend-ui):
# Frontend agent sends request
amp-send project-backend-api \
"Need POST /api/auth/login endpoint" \
"Building login form, need API with email/password โ JWT token" \
high \
request
Using command-line to send request
Backend Agent (session: project-backend-api):
# Backend agent checks inbox
amp-inbox
# Implements endpoint, then replies
amp-send project-frontend-ui \
"Re: Login API endpoint ready" \
"Endpoint at routes/auth.ts:45. POST /api/auth/login - accepts {email, password}, returns JWT" \
normal \
response
Checking inbox via command line
Reviewing full inbox with details
Result: Same outcome, different interaction style. Choose what fits your workflow!
Example 2: Broadcast Pattern
Orchestrator Agent (session: project-orchestrator):
Claude (Orchestrator):
1. User requests: "Implement user management feature"
2. Breaks down into subtasks
3. Broadcasts messages to specialist agents:
- To: project-frontend-ui โ "Build user list component"
- To: project-backend-api โ "Create CRUD endpoints for users"
- To: project-database-migrations โ "Add users table schema"
4. Each agent works independently
5. Orchestrator monitors progress via response messages
Example 3: Proactive Monitoring
Add to your agent's CLAUDE.md instructions:
## Message Monitoring Protocol
At the start of each task:
1. Check for new messages: `amp-inbox`
2. If messages exist, read and prioritize them based on priority field
3. Handle urgent/high priority messages immediately
4. Queue normal/low priority messages for later
5. Always respond to request-type messages when task is complete using `amp-reply`
Message Types and When to Use Them
request
Use when you need another agent to do something:
- "Please implement X endpoint"
- "Can you review this code?"
- "Need help with Y algorithm"
response
Use when replying to a request:
- "Endpoint implemented at routes/auth.ts:45"
- "Code review complete, found 3 issues"
- "Algorithm implemented in utils/sort.ts"
notification
Use for FYI updates that don't require action:
- "Deployment completed successfully"
- "Tests are now passing"
- "Database migration applied"
update
Use for progress reports on ongoing work:
- "50% complete on user dashboard"
- "Encountered issue with API, investigating"
- "Waiting for external dependency"
Priority Levels
urgent: Drop everything and address immediatelyhigh: Address as soon as current task completesnormal: Handle in normal workflowlow: Handle when you have free time
Best Practices
1. Push Notifications (Automatic)
As of v0.18.10, AI Maestro uses push notifications to instantly alert agents when messages arrive:
[MESSAGE] From: backend-api@mini-lola - API endpoint ready - check your inbox
No polling or manual checking required - agents receive notifications in real-time via tmux.
To check for any missed messages (e.g., at session startup):
# Quick check for unread messages
amp-inbox
2. Use Clear Subjects
Good: "Need POST /api/users endpoint with pagination" Bad: "Help needed"
3. Provide Context
Always include:
- What you need
- Why you need it
- Any relevant code/files
- Expected format/structure
4. Respond to Requests
If you receive a request-type message, always send a response when done.
5. Clean Up Old Messages
Delete messages after handling:
# Delete a specific message
amp-delete <message-id>
# Or use the delete tool directly
rm ~/.agent-messaging/messages/inbox/<message-id>.json
Troubleshooting
Messages Not Appearing
- Check AMP status:
amp-status - Verify agent is initialized:
ls ~/.agent-messaging/config.json - Check message files:
ls ~/.agent-messaging/messages/inbox/ - Verify session name:
tmux display-message -p '#S'
Agent Not Finding Messages
- Ensure agent is initialized:
amp-init --auto - Check directory exists:
ls ~/.agent-messaging/messages/inbox/ - Verify file permissions:
chmod -R u+rw ~/.agent-messaging/
Message JSON Format Errors
Use this template and replace values:
{
"id": "msg-TIMESTAMP-RANDOM",
"from": "sender-session-name",
"to": "recipient-session-name",
"timestamp": "2025-01-11T14:30:00Z",
"subject": "Your subject",
"priority": "normal",
"status": "unread",
"content": {
"type": "request",
"message": "Your message here"
}
}
Advanced: Custom Message Handlers
You can create custom scripts that automatically process messages using the AMP CLI:
#!/bin/bash
# ~/.local/bin/process-agent-messages.sh
INBOX=~/.agent-messaging/messages/inbox
for msg_file in $INBOX/*.json; do
[ -f "$msg_file" ] || continue
# Parse message envelope and payload
PRIORITY=$(jq -r '.envelope.priority' "$msg_file")
SUBJECT=$(jq -r '.envelope.subject' "$msg_file")
FROM=$(jq -r '.envelope.from' "$msg_file")
# Handle based on priority
if [ "$PRIORITY" = "urgent" ]; then
echo "๐จ URGENT MESSAGE from $FROM: $SUBJECT"
# Trigger notification, log, etc.
fi
done
Or use the AMP API to fetch and process messages programmatically.
Learn more: Visit agentmessaging.org for the full AMP protocol specification.
Integration with Claude Code
Push Notifications (v0.18.10+)
AI Maestro automatically delivers messages via push notifications. When a message arrives, you'll see:
[MESSAGE] From: backend-api - API endpoint ready - check your inbox
Add to your CLAUDE.md project instructions:
## Inter-Agent Communication
This project uses the AI Maestro messaging system for agent coordination.
**When you receive a message notification:**
1. Run `amp-inbox` to see your inbox
2. Read messages with `amp-read <msg-id>`
3. Prioritize urgent/high priority messages
4. Incorporate message context into your task planning
**When you need help from another agent:**
1. Identify the appropriate specialist agent
2. Use `amp-send <agent> <subject> <message>` or the Messages tab in the dashboard
3. Include clear context and requirements
4. Continue with independent work while waiting for response
**When you complete work requested by another agent:**
1. Send a response message with results
2. Include file paths, line numbers, and any relevant details
3. Mark the original request as handled
Slack Integration
Connect your team's Slack workspace to AI Maestro agents using the AI Maestro Slack Bridge.
How It Works
Slack Message โ Slack Bridge โ AI Maestro API โ Agent Inbox
โ
Slack Thread โ Slack Bridge โ AI Maestro API โ Agent Response
Usage
DM the bot: Send a direct message to the AI Maestro bot in Slack.
Mention in channels:
@AI Maestro what's the status of the API refactoring?
Route to specific agents:
@AIM:backend-api check the server health
@AIM:frontend-dev review the CSS changes
@AIM:graph-query find all API endpoints
Responding to Slack Messages
When you receive a notification from Slack:
[MESSAGE] From: slack-bot - Slack: Question from Juan - check your inbox
- Check your inbox:
amp-inbox - Read the message to see the full Slack context
- Send your response to
slack-bot- it will be posted to the Slack thread
amp-send slack-bot \
"Re: Question from Juan" \
"The API endpoint is at /api/users. See routes/users.ts for implementation." \
normal response
Setup
See the AI Maestro Slack Bridge repository for installation and configuration.
Future Enhancements
Potential future features for the messaging system:
- Message Templates: Pre-defined message formats for common scenarios
- Auto-Responses: Agents automatically acknowledge receipt
- Message Threading: Link related messages together
- Rich Content: Attach files, code snippets, screenshots
- Message Search: Full-text search across all messages
- Webhooks: Trigger external actions on message receipt
- Analytics: Track agent communication patterns
AMP Federation with External Providers
AI Maestro can federate with external AMP providers, allowing your agents to communicate with agents on other networks.
Register with an External Provider
# Register with CrabMail (example)
amp-register --provider https://crabmail.ai --tenant myorg
# Register with another AI Maestro instance
amp-register --provider http://192.168.1.10:23000 --tenant remote
Send Messages to External Agents
# Send to an agent on CrabMail
amp-send alice@acme.crabmail.ai "Hello" "Cross-network message!"
# Send to an agent on another AI Maestro instance
amp-send backend@remote.aimaestro.local "Request" "Can you help?"
Fetch Messages from External Providers
# Fetch pending messages from all registered providers
amp-fetch
Learn more about federation: See the AMP Protocol Specification for details on cross-network messaging.
Related Documentation
- Agent Communication Quickstart - Get started in 5 minutes
- Agent Communication Guidelines - Best practices and patterns
- Agent Communication Architecture - Technical deep-dive
- External Agents Integration - Connect non-AI Maestro agents
- Operations Guide - Dashboard operations
- CLAUDE.md - Project architecture and conventions
- AMP Protocol - Official Agent Messaging Protocol specification