Event Types
hcom logs three types of events:message
Inter-agent communication
status
Agent state changes
life
Lifecycle events
Event Structure
Database Schema
Events are stored in theevents table:
Events View
Flattened view for querying:Message Events
Structure
Sender Kinds
- instance
- external
- system
Sent by a registered agent.
Message Scopes
- broadcast: Delivered to all agents
- mentions: Delivered to specific agents in
mentionsarray
Message Intents
- request: Expect response (creates request-watch subscription)
- inform: FYI, no response needed
- ack: Reply to request (requires
reply_to)
Status Events
Structure
Status Values
- listening
- active
- blocked
- inactive
Agent is idle and ready to receive messages.Common contexts:
""- Normal idle"suspended"- Background process paused"tui:not-ready"- TUI blocked
Life Events
Structure
Life Actions
- created
- ready
- stopped
- batch_launched
Instance placeholder created during launch.
Event Querying
CLI Query
Programmatic Query
Event Subscriptions
Subscribe to events for real-time notifications:Create Subscription
Subscription Format
Stored in KV table:Subscription Delivery
When event matches subscription:Event Storage
Retention
- Active session: Unlimited (append-only log)
- Archive: Previous sessions in
~/.hcom/archive/ - Cleanup: No automatic deletion (manual archive)
Compaction
Archive and reset database:Full-Text Search
FTS5 virtual table indexes searchable fields:Event Context Tracking
Tool Execution
Pre and Post hooks log tool events:File Collision Detection
Track file writes with 30s window:Performance
Query Performance
- Indexed queries: < 10ms (type, instance, timestamp)
- Full scans: < 100ms for 100k events
- FTS search: < 50ms for complex queries
Write Performance
- Event insert: < 5ms
- WAL mode: Concurrent reads during writes
- Batch insert: 1000+ events/sec
Optimization
- Use
events_vfor JSON extraction caching - Filter by indexed columns first (type, instance)
- Limit results for large datasets
- Use FTS for text search (not LIKE)