The connector hooks into Cline’s event system and captures structured data from each task. This page documents what events are captured and how they map to Infinium traces.
Hook Events
The connector listens for these Cline hook events:
| Event | When It Fires | What’s Captured |
|---|---|---|
TaskStart | A new task begins | Task description, model (provider + slug), workspace root, Cline version |
TaskResume | A previous task is resumed | Same as TaskStart |
UserPromptSubmit | User sends a follow-up prompt in the task | Prompt text |
PreToolUse | Before a tool executes | Tool name, parameters |
PostToolUse | After a tool completes | Tool result, success flag, durationMs |
PreCompact | Cline is about to compact the conversation | Conversation length, estimated tokens |
TaskComplete | Task finished successfully | Final task text — triggers trace send |
TaskCancel | Task was cancelled | Triggers trace send |
Nested JSON Payload
Unlike most other Claude-family tools, Cline sends nested JSON. Each hook event carries a sub-object keyed by the hook name:
{
"hookName": "PostToolUse",
"taskId": "cline-t-abc123",
"timestamp": "2026-04-18T10:00:05Z",
"clineVersion": "3.36",
"workspaceRoots": ["/home/user/project"],
"userId": "u-1",
"model": {"provider": "anthropic", "slug": "claude-sonnet-4"},
"postToolUse": {
"tool": "execute_command",
"parameters": {"command": "npm test"},
"result": "All 42 tests passed",
"success": true,
"durationMs": 3200
}
}
The connector normalizes hookName → hook_event_name and taskId → session_id internally so downstream logic matches the other connectors.
Stdout Response
Cline requires every hook invocation to write a JSON response on stdout. The connector always writes:
{"cancel": false, "contextModification": null, "errorMessage": null}
If this response is missing or malformed, Cline will hang. The connector guarantees a response is always written, even on error.
How Events Become Traces
A full task lifecycle looks like this:
Task:
TaskStart → "Fix the login validation bug"
UserPromptSubmit → "Verify with: npm test"
PreToolUse → execute_command("npm test")
PostToolUse → {result: "passed", success: true, durationMs: 3200}
TaskComplete → "Fix the login validation bug"
↓
Trace sent to Infinium
The trace is sent on TaskComplete (or TaskCancel). One trace per task.
Trace Structure
Each trace sent to Infinium contains:
Top-Level Fields
| Field | Source | Example |
|---|---|---|
name | Task text (truncated to 30 chars) | "Fix the login bug" |
description | Task text (full) | "Fix the login validation bug" |
duration | Task timing | 15.2 (seconds) |
input_summary | First prompt / task text | "Fix the login validation bug" |
output_summary | Last assistant response (if present) | "Fixed and tests pass" |
Execution Steps
Each trace includes an ordered list of steps:
| Step Type | Action | Fields |
|---|---|---|
| User prompt | user_prompt | description, input_preview, output_preview |
| Tool call | tool_use | description (e.g. "Tool: execute_command"), input_preview, output_preview, duration_ms |
| Tool failure | tool_use with error | error.error_type = "ToolError", error.message, error.recoverable = true |
Environment Context
Every trace includes environment metadata:
| Tag | Value |
|---|---|
model | Combined provider/slug (e.g. anthropic/claude-sonnet-4) |
model_provider | Just the provider (anthropic, openai, etc.) |
session_id | Cline task identifier |
working_directory | Workspace root |
cline_version | Cline extension version |
framework | "cline" |
LLM Usage
On flush, the connector reads Cline’s ui_messages.json (in VS Code’s global storage for the saoudrizwan.claude-dev extension) and attaches cumulative token usage to the trace:
| Field | Source |
|---|---|
prompt_tokens | Sum of tokensIn across api_req_started entries |
completion_tokens | Sum of tokensOut |
api_calls_count | Number of api_req_started entries |
provider | From model.provider |
model | From model.slug |
cache_reads, cache_writes | Surfaced in custom_tags (no dedicated SDK field) |
total_cost | Surfaced in custom_tags |
Tool Names
The connector understands Cline’s common tool set and normalizes their display:
execute_command, shell, read_file, readFile, write_to_file, writeFile, replace_in_file, editFile, search_files, grep, list_files, browser_action.
Error Tracking
PostToolUse events with success: false are captured as structured errors:
| Field | Description |
|---|---|
error_type | "ToolError" |
message | Cline’s result text (truncated) |
recoverable | true |
Data Truncation
To keep payloads manageable, the connector truncates:
- Prompt text: First 200 characters (configurable via
CONNECTOR_MAX_INPUT_PREVIEW) - Tool output preview: First 300 characters (configurable via
CONNECTOR_MAX_OUTPUT_PREVIEW) - Payload size: Progressive truncation if the total payload exceeds ~950KB
Full data is never sent — only summaries that give Maestro enough context to evaluate quality.