amq-cli

Coordinate agents via the AMQ CLI for file-based inter-agent messaging. Use when you need to send messages to another agent (Claude/Codex), receive messages from partner agents, set up co-op mode between Claude Code and Codex CLI, or manage agent-to-agent communication in any multi-agent workflow. Triggers include "message codex", "talk to claude", "collaborate with partner agent", "AMQ", "inter-agent messaging", or "agent coordination".

$ 설치

git clone https://github.com/avivsinai/agent-message-queue /tmp/agent-message-queue && cp -r /tmp/agent-message-queue/.claude/skills/amq-cli ~/.claude/skills/agent-message-queue

// tip: Run this command in your terminal to install the skill


name: amq-cli description: Coordinate agents via the AMQ CLI for file-based inter-agent messaging. Use when you need to send messages to another agent (Claude/Codex), receive messages from partner agents, set up co-op mode between Claude Code and Codex CLI, or manage agent-to-agent communication in any multi-agent workflow. Triggers include "message codex", "talk to claude", "collaborate with partner agent", "AMQ", "inter-agent messaging", or "agent coordination". metadata: short-description: Inter-agent messaging via AMQ CLI

AMQ CLI Skill

File-based message queue for agent-to-agent coordination.

Prerequisites

Requires amq binary in PATH. Install:

curl -fsSL https://raw.githubusercontent.com/avivsinai/agent-message-queue/main/scripts/install.sh | bash

Verify: amq --version

Quick Reference

# Set once per session - commands work from any directory
export AM_ROOT=.agent-mail AM_ME=claude   # or: AM_ME=codex

amq send --to codex --body "Message"           # Send
amq drain --include-body                       # Receive (recommended)
amq reply --id <msg_id> --body "Response"      # Reply
amq watch --timeout 60s                        # Wait for messages
amq list --new --priority urgent               # Filter messages

Note: With env vars set, all commands work from any subdirectory.

Co-op Mode (Autonomous Multi-Agent)

In co-op mode, agents work autonomously. Message your partner, not the user.

Shared Workspace

Both agents work in the same project folder. Files are shared automatically:

  • If partner says "done with X" → check the files directly, don't ask for code
  • If partner says "see my changes" → read the files, they're already there
  • Don't send code snippets in messages → just reference file paths

Only use messages for: coordination, questions, review requests, status updates.

SituationAction
BlockedMessage partner
Need reviewSend kind: review_request with file paths
Partner doneRead files directly (they're local)
DoneSignal completion
Ask user only forcredentials, unclear requirements

Setup

Run once per project:

curl -sL https://raw.githubusercontent.com/avivsinai/agent-message-queue/main/scripts/setup-coop.sh | bash
export AM_ROOT=.agent-mail AM_ME=claude   # or: codex

Wake Notifications (Experimental)

Start a background waker before your CLI to receive notifications when messages arrive:

amq wake &
claude

When messages arrive, you'll see a notification injected into your terminal (best-effort):

AMQ: message from codex - Review complete. Run: amq drain --include-body

Then run amq drain --include-body to read messages.

Inject Modes: The wake command auto-detects your CLI type:

  • --inject-mode=auto (default): Uses raw for Claude Code/Codex, paste for others
  • --inject-mode=raw: Plain text + CR (best for Ink-based CLIs like Claude Code)
  • --inject-mode=paste: Bracketed paste with delayed CR (best for crossterm CLIs)

If notifications require manual Enter, try --inject-mode=raw.

Priority Handling

PriorityAction
urgentInterrupt, respond now
normalAdd to TODOs, respond after current task
lowBatch for session end

Commands

Send

amq send --to codex --body "Quick message"
amq send --to codex --subject "Review" --kind review_request --body @file.md
amq send --to claude --priority urgent --kind question --body "Blocked on API"
amq send --to codex --labels "bug,parser" --body "Found issue in parser"
amq send --to codex --context '{"paths": ["internal/cli/"]}' --body "Review these"

Receive

amq drain --include-body         # One-shot, silent when empty
amq watch --timeout 60s          # Block until message arrives
amq list --new                   # Peek without side effects

Filter Messages

amq list --new --priority urgent              # By priority
amq list --new --from codex                   # By sender
amq list --new --kind review_request          # By kind
amq list --new --label bug --label critical   # By labels (can repeat)
amq list --new --from codex --priority urgent # Combine filters

Reply

amq reply --id <msg_id> --body "LGTM"
amq reply --id <msg_id> --kind review_response --body "See comments..."

Dead Letter Queue

amq dlq list                        # List failed messages
amq dlq read --id <dlq_id>          # Inspect failure details
amq dlq retry --id <dlq_id>         # Retry (move back to inbox)
amq dlq retry --all [--force]       # Retry all
amq dlq purge --older-than 24h      # Clean old DLQ entries

Upgrade

amq upgrade                    # Self-update to latest release
amq --no-update-check ...      # Disable update hint for this command
export AMQ_NO_UPDATE_CHECK=1   # Disable update hints globally

Other

amq thread --id p2p/claude__codex --include-body   # View thread
amq presence set --status busy --note "reviewing"  # Set presence
amq cleanup --tmp-older-than 36h                   # Clean stale tmp

Message Kinds

KindReply KindDefault PriorityUse
review_requestreview_responsenormalCode review
review_responsenormalReview feedback
questionanswernormalQuestions
answernormalAnswers
decisionnormalDesign decisions
brainstormlowOpen discussion
statuslowFYI updates
todonormalTask assignments

Labels and Context

Labels tag messages for filtering:

amq send --to codex --labels "bug,urgent" --body "Critical issue"

Context provides structured metadata:

amq send --to codex --kind review_request \
  --context '{"paths": ["internal/cli/send.go"], "focus": "error handling"}' \
  --body "Please review"

Conventions

  • Handles: lowercase [a-z0-9_-]+
  • Threads: p2p/<agentA>__<agentB> (lexicographic)
  • Delivery: atomic Maildir (tmp -> new -> cur)
  • Never edit message files directly

References

Read these when you need deeper context:

  • references/coop-mode.md — Read when setting up or debugging co-op workflows between agents
  • references/message-format.md — Read when you need the full frontmatter schema (all fields, types, defaults)