Message Types
hcom supports two message scopes:Broadcast
Sent to all active agents (no @mentions)
Mentions
Sent to specific agents via @mention or explicit targets
Message Structure
Messages are stored as JSON events in the database:Message Intents
Intents provide semantic context:- request
- inform
- ack
Expect a response from the recipient.Creates request-watch subscription to notify sender when recipient goes idle.
Scope Computation
Target Matching
Target matching uses 3-tier priority:- Full name prefix match (with tag):
api-lunamatchesapi-luna - Tag prefix match:
api-matches all with tagapi - Base name prefix match:
lunamatchesapi-luna
Underscore Blocking
Underscore prevents accidental prefix matches:Cross-Device Matching
Remote agents have device suffix:Message Delivery
Delivery Flow
Delivery Modes
- TCP Push (PTY)
- Hook Polling (Stop)
- CLI Polling (listen)
PTY agents have delivery threads that listen on notify ports:Latency: < 100ms
Filtering
Messages are filtered during delivery:Message Formatting
Hook Injection Format
Messages injected into agent context:- Envelope:
[intent:thread #id]or[new message #id] - Sender: Display name (with tag if set)
- Recipient: Display name + others count
- Text: Message content
- Hints: Config hints appended
Multiple Messages
Batch formatting:Remote Messages
Remote events include device ID:Read Receipts
Track message delivery and read status:Local Instances
Read via deliver events:Remote Instances
Read via timestamp comparison:Read Receipt Display
Request-Watch Subscriptions
Automatic response tracking forrequest intent:
Threading
Group related messages:Bundles
Attach structured context to messages:- Files (metadata + content)
- Transcript ranges (with detail levels)
- Event ranges (filtered log)
- Chaining (extends previous bundle)
Validation
Message Validation
Scope Validation
Strict failure on unknown targets:System Mention Protection
Performance
Message Delivery Latency
- PTY agents: < 100ms (TCP notify + injection)
- Polling agents: 30s average (Claude hook interval)
- Cross-device: < 500ms (MQTT publish + sync)
Throughput
- Events/sec: 1000+ (SQLite WAL mode)
- Concurrent agents: 50+ (tested)
- Message queue: Unlimited (event log is append-only)
Optimization
- Indexes:
(type, instance),(timestamp),(id) - FTS5: Full-text search on message content
- Views:
events_vfor JSON extraction caching - Notify batching: Single TCP wake per batch