ā” EXECUTION WORKFLOW FOR CLAUDE
When this command is invoked, you should execute these steps systematically.
Use TodoWrite to track progress through multi-phase workflows.
CORE BEHAVIOR: Read agent messages, surface necessary actions, and prepare follow-ups. DO NOT just read messages and stop.
SIMPLE WORKFLOW:
- Fetch unread agent messages (metadata only: subject, sender, date) - max 20 messages
- Classify based on subject/sender (urgent, action needed, low-priority)
- Take actions for each message (AUTOMATED - analyze and respond):
- Draft replies for urgent/action items (max 5 replies)
- Extract action items and tasks
- Mark messages as read
- Report findings
- Report what you did with counts and any urgent items
IMPORTANT: This processes inter-agent messages from MCP Agent Mail, not email. Agents communicate via the MCP Agent Mail server for project coordination.
PERFORMANCE RULES:
- Max 20 messages per run
- Fetch full content only for top 10 priority messages
- Use parallel MCP calls where possible
- Stop at 60 seconds if not done
šØ DETAILED EXECUTION WORKFLOW
Phase 1: šÆ Message Discovery & Retrieval (LIGHTWEIGHT - METADATA ONLY)
Action Steps:
- Check MCP Agent Mail Server Availability: Verify MCP Agent Mail server is configured and accessible
- Retrieve Message Metadata: Use
fetch_inbox to get ONLY metadata initially
- Limit: 20 messages maximum
- DO NOT fetch full message bodies yet (performance optimization)
- Fast Filtering: Apply urgency/priority filters to metadata only
- Check importance flags (urgent, high, normal, low)
- Check ack_required status
- Identify sender agents
Phase 2: š Message Analysis & Classification (METADATA-BASED - FAST)
Action Steps:
- Metadata Analysis: Classify using ONLY subject/sender (no full content yet)
- Urgency indicators in subject: "urgent", "asap", "deadline", "blocker"
- Sender importance: Known collaborator agents vs automated agents
- Message type: Question, status update, request, notification
- Fast Categorization: Classify into categories based on metadata:
- URGENT: Importance="urgent" or "high" + ack_required=True
- ACTION_REQUIRED: Subject ends with "?" or contains "please", "review", "request"
- STATUS_UPDATE: Sender patterns for progress reports
- LOW_PRIORITY: Notifications, automated status updates
- Priority Queue: Create ordered list (top 10 only need full content)
- Priority 1-2 (Urgent): Fetch full content immediately
- Priority 3 (Action): Fetch if under message limit
- Priority 4-5 (Info): Mark as read without fetching full content
Phase 3: š Action Execution (TARGETED - PARALLEL WHERE POSSIBLE)
Action Steps:
- Fetch Full Content: Only for top 10 priority messages (parallel MCP calls if possible)
- Use
fetch_inbox with include_bodies=True for priority messages
- Skip if message already processed
- Draft Replies: For URGENT + ACTION_REQUIRED (max 5 replies)
- Analyze message content and context
- Generate contextually appropriate draft replies using
reply_message
- Limit: 5 replies per run (avoid overwhelming recipients)
- Extract Tasks: For messages with action items (lightweight extraction)
- Extract specific tasks and deadlines from message bodies
- Create simple task list in output (don't create external tasks yet)
- Mark as Read: Mark processed messages using
mark_message_read
- Batch operation for all processed messages
- Identify Blockers: Flag any blocking issues or urgent attention items
Phase 4: š Summary & Reporting (CONCISE OUTPUT)
Action Steps:
- Concise Summary: Single-paragraph overview with counts
- Total messages scanned: X (metadata only)
- Fully processed: Y (with content analysis)
- Categories: Urgent: N, Action: M, Status: P
- Actions Taken: Bulleted list (max 10 lines)
- Replies drafted: N
- Messages marked read: M
- Tasks extracted: P
- Urgent Items: Highlight ONLY urgent items (max 3)
- Show subject + sender + brief summary
- Performance: Report execution time and efficiency
- Execution time: Xs
- MCP calls made: N (target: <10 for good performance)
š REFERENCE DOCUMENTATION
/processmsgs Command - Intelligent Agent Message Processing
Usage: /processmsgs [options]
Purpose: Automated agent message processing that reads inter-agent communications, analyzes content, and takes intelligent actions
š ļø Prerequisites
- MCP Agent Mail server configured and running
- Agent registered in the project (use
register_agent first)
- Project initialized with
ensure_project
š Command Options
/processmsgs # Process all unread agent messages
/processmsgs urgent # Process only urgent/flagged messages
/processmsgs sender:BlueLake # Process messages from specific agent
šÆ What This Command Does
Core Actions (NEVER just read):
- Reads unread agent messages using MCP Agent Mail tools
- Analyzes content for action items, urgency, importance
- Classifies messages into categories
- Drafts replies for messages requiring action
- Extracts task lists from action items
- Marks messages as read
- Reports summary of all actions taken
Anti-Pattern Prevention:
- ā Reading messages without taking action
- ā Processing without classification
- ā Analysis without follow-up
- ā
Every message processed is classified and reported, with actions taken where appropriate
ā” Performance Optimization
Lightweight & Fast Execution:
- 20 message limit: Processes max 20 messages per run (prevents timeout)
- Metadata-first: Fetches only subject/sender initially, full content on-demand
- Top 10 rule: Only fetches full content for top 10 priority messages
- Parallel calls: Uses parallel MCP tool invocation where possible
- 60s timeout: Stops processing at 60 seconds (early exit)
- 5 reply limit: Max 5 replies per run
Typical Performance:
- Execution time: 10-30 seconds for 20 messages
- MCP calls: 5-8 calls total (batch operations reduce overhead)
- Context usage: <10K tokens (metadata-focused approach)
š Workflow Integration
Typical Use Cases:
- Project Coordination: Process messages from other agents working on same project
- Task Assignment: Receive and acknowledge task assignments from coordinator
- Status Updates: Process progress reports from collaborating agents
- Question/Answer: Respond to questions from other agents
š Security & Privacy
Safe Automation Model:
- Messages are project-scoped (no cross-project access)
- Full audit trail via Git repository
- No external API calls beyond MCP Agent Mail server
- All actions are reversible
š Success Metrics
Processing Results Include:
- Total messages processed
- Categories breakdown (urgent: 2, action: 5, status: 10, etc.)
- Actions taken (replies: 3, tasks extracted: 5, marked read: 15)
- Urgent items requiring immediate attention
š Continuous Improvement
Learning Mechanism:
- Track which message types require action
- Improve classification accuracy over time
- Adapt to agent communication patterns
- Suggest better collaboration strategies
š”ļø Error Handling
Graceful Failures:
- MCP server unavailable ā Report status, suggest troubleshooting
- Agent not registered ā Provide registration instructions
- Project not initialized ā Suggest running
ensure_project
- Network issues ā Retry with exponential backoff
šØ CRITICAL: Classification-First Accountability
Every message MUST be classified and reported. Actions are required when appropriate:
- URGENT and ACTION_REQUIRED messages demand concrete follow-up (reply, task extraction, etc.)
- STATUS_UPDATE and INFORMATION messages may simply be summarized and marked read if no action is needed
- Always explain what was processed and why each item was handled that way
NEVER output: "I've read 10 messages" without detailing the disposition of each message.
š Related Skills
See .claude/skills/mcp-agent-mail.md for detailed MCP Agent Mail server setup and usage instructions.
š Examples
Basic Processing
/processmsgs
Output:
š¬ Agent Message Processing Complete
Processed: 15 messages
āā URGENT (2): Database migration blocker, Test failure in CI
āā ACTION_REQUIRED (5): Code review requests, Design feedback needed
āā STATUS_UPDATE (6): Progress reports, Task completions
āā INFORMATION (2): Notifications, FYI updates
Actions Taken:
ā
3 draft replies created (code reviews, blocker response)
ā
5 action items extracted to task list
ā
15 messages marked as read
ā
2 urgent items flagged for immediate attention
ā ļø URGENT ATTENTION REQUIRED:
1. Database migration blocked - Worker agent needs schema approval
2. CI tests failing on main branch - requires immediate investigation
Targeted Processing
/processmsgs sender:CoordinatorBot
Output:
š¬ CoordinatorBot Message Processing Complete
Processed: 5 messages from CoordinatorBot
āā Task Assignments (3)
āā Status Requests (1)
āā Deadline Reminders (1)
Actions Taken:
ā
3 task assignments acknowledged
ā
1 status update drafted
ā
1 deadline confirmed
ā
5 messages marked as read
š Integration Points
- Project Coordination: Multi-agent workflows via message passing
- Task Management: Task extraction integrates with project tracking
- Status Reporting: Progress updates to coordinator agents
- Collaboration: Inter-agent question/answer workflows
āļø Configuration
MCP Agent Mail Setup: See .claude/skills/mcp-agent-mail.md for:
- Server configuration
- Agent registration
- Project initialization
- Message sending/receiving patterns
šÆ Success Criteria
Command considered successful when:
- ā
All retrieved messages classified
- ā
Appropriate actions taken for each category (mandatory for URGENT/ACTION_REQUIRED)
- ā
Summary report generated
- ā
Urgent items clearly highlighted
- ā
User can act on provided information immediately