Skip to main content
The send command allows you to send text messages or files to running agent sessions. It includes smart busy detection, automatic retry, and delivery confirmation.

Syntax

Arguments

string
required
Session name to send the message to
string[]
Message text (space-separated words)
You must provide either a message argument or the --file option.

Options

string
Send contents of a file instead of a message
flag
Don’t wait for session to become idle before sending
number
default:"600"
Max seconds to wait for idle (default: 600)

Basic Usage

How It Works

The send command follows this workflow:
  1. Session Lookup - Resolves session name to tmux target
  2. Busy Detection - Checks if agent is currently processing
  3. Wait for Idle - Polls every 5 seconds until agent is idle
  4. Clear Input - Clears any partial input (Ctrl+U)
  5. Send Message - Injects text into the tmux session
  6. Submit - Sends Enter to submit the message
  7. Verify Delivery - Confirms agent received and is processing
The command uses agent-specific patterns to detect activity. For Claude Code, it looks for the prompt and spinner.

Busy Detection

Before sending, the command checks if the agent is busy:
Activity states:
  • Active - Agent is processing (prompt visible, spinner)
  • Idle - Agent is waiting for input
  • Working - Agent is executing tools
The command waits for the agent to reach “idle” before sending.
Busy detection prevents your message from interrupting ongoing work or being lost.

Delivery Confirmation

After sending, the command verifies delivery:
Or if the agent is busy:
Or if delivery can’t be confirmed:

Retry Logic

If the message isn’t acknowledged:
  1. Wait 2 seconds
  2. Send Enter again
  3. Repeat up to 3 times
This handles cases where the agent didn’t see the message the first time.

Sending Files

Use --file to send the contents of a file:
The entire file content is sent as a single message.
Large files may exceed the agent’s input limit. Keep files under a few thousand lines.

Skip Waiting

Use --no-wait to send immediately without checking if the agent is busy:
Use --no-wait for urgent messages where you can’t afford to wait. The message may queue if the agent is busy.

Custom Timeout

Set a custom wait timeout:
If the timeout expires:
The message is sent even if the agent is still busy.

Message Handling

Short Messages

Short single-line messages (under 200 characters) are sent directly:

Long Messages

Long messages or multi-line messages are sent via tmux buffer:

Multi-Line Messages

Messages with newlines:
Use --file for complex multi-line messages to preserve formatting:

Common Issues

Session Does Not Exist

Solution: Check the session name:

No Message Provided

Solution: Provide a message or use --file:

Cannot Read File

Solution: Verify the file exists:

Timeout Waiting

Solution: The agent is busy for longer than expected. Options:
  • Increase timeout: --timeout 1200 (20 minutes)
  • Send anyway with --no-wait
  • Check if agent is stuck: tmux attach -t ao-int-1234

Message Not Confirmed

Solution: The agent didn’t acknowledge the message. Check manually:
The message may still be visible in the terminal history.

Examples

Simple Message

Follow-Up Instruction

Send Review Feedback

Urgent Message

Batch Messages

Interactive Script

Scripted Workflow

Exit Codes

  • 0 - Message sent successfully
  • 1 - Error (session not found, no message, file not found)

Next Steps

Status

Check if your message was processed

Session Management

List and manage sessions

Dashboard

Monitor sessions in real-time