Data Flow
How data moves through the Intentra CLI system.
Event Lifecycle
1. Hook Trigger
AI tool detects action completion and fires hook:
{
"event": "ai_action_complete",
"tool": "cursor",
"action": "chat",
"tokens": 1250
}2. Event Normalization
CLI receives hook event and normalizes it:
- Validates event format
- Maps tool-specific fields to unified schema
- Adds timestamp and metadata
Normalized event:
{
"id": "evt_abc123",
"source": "cursor",
"action": "chat",
"tokens": {
"input": 500,
"output": 750
},
"timestamp": "2024-01-15T10:30:00Z"
}3. Local Storage
Events stored in SQLite buffer:
INSERT INTO events (id, source, action, tokens_in, tokens_out, timestamp)
VALUES ('evt_abc123', 'cursor', 'chat', 500, 750, '2024-01-15T10:30:00Z');4. Scan Aggregation
Periodic aggregation groups events into scans:
- Events within 30 seconds = one scan
- Detects patterns (retry loops, etc.)
- Calculates totals and estimates
5. Optional Sync
If sync is enabled, scans are queued and sent:
POST /v1/scans
Authorization: Bearer <token>Latency Budget
| Stage | Target |
|---|---|
| Hook to CLI | <10ms |
| Normalization | <5ms |
| SQLite write | <10ms |
| Total | <25ms |
The hook never blocks the IDE - events are captured asynchronously.
Offline Operation
All data is stored locally first:
- Works without internet connection
- Sync queue persists during offline periods
- Automatic retry when connection restored