Overview
Block until a message arrives or an event matches filters. Used by agents to receive messages and by scripts to wait for specific conditions.Basic Usage
Timeout
Timeout in seconds (positional or Quick check mode: Timeout ≤ 1 second becomes 0.1s poll
--timeout flag)Default: 86400 seconds (24 hours)Output Formats
Output messages as JSON (one per line)Output format:
Default Output
Human-readable format with intent/thread context:Filter Mode
Wait for events matching filter conditions. Supports allhcom events filter flags:
Event Type Filters
Event type:
message, status, lifeFilter by agent name
Message Filters
Message sender name
Messages mentioning target
Message intent:
request, inform, ackThread name
Status Filters
Agent status:
listening, active, blocked, inactiveStatus context (supports wildcard
*)Activity Filters
Shell command patternSupports patterns:
contains- default^prefix- starts with$suffix- ends with=exact- exact match*glob- glob pattern
File write/edit eventsSupports glob patterns:
File edit collisions (two agents edit same file within 30s)
Lifecycle Filters
Lifecycle action:
created, started, ready, stopped, batch_launchedTime Filters
Events after timestamp (ISO-8601)
Events before timestamp (ISO-8601)
Custom SQL
Raw SQL WHERE clause against
events_v viewCombined with filter flags using AND logic.Shortcuts
Wait for agent to go idle (listening status)Equivalent to:
--agent NAME --status listeningWait for agent to be blocked (needs approval)Equivalent to:
--agent NAME --status blockedExamples
Basic Message Waiting
Workflow Coordination
Message Monitoring
Activity Monitoring
Status Changes
JSON Output for Scripts
Filter Combinations
Exit Codes
- 0 - Message/event received
- 1 - Timeout or error
- 130 - Interrupted (SIGTERM)
Behavior
Message Delivery
- Sets agent status to
listeningduring wait - Advances read cursor when messages arrive
- Returns immediately if unread messages exist
- Wakes instantly on new messages (TCP notify + relay)
Heartbeat
Updateslast_stop timestamp periodically so stale cleanup doesn’t disconnect the agent.
Lookback Window
Filter mode checks last 10 seconds for recent matches before waiting.Status Updates
- listening → active when message received
- adhoc tools: marked inactive on timeout
Remote Sync
With relay enabled:- Long-polls MQTT for remote events (25s)
- Short TCP select for local notifications (1s)
- TCP select wakes on notification (30s)
- No TCP: frequent polling (100ms)
Notes
- Requires
hcom startfor identity - Filter mode uses temporary subscription (auto-cleanup)
- Multiple filter flags combine with AND logic
- Supports
events_vSQL view (computed columns) - Quick timeout ≤1s becomes 0.1s poll mode
- SIGTERM triggers clean shutdown with exit code 130