Skip to content

Events

Cline emits its activity as EventFormat::Cline. It runs with cline --json, which writes a line-delimited JSON stream on standard output. The harness layer parses that stream and maps it onto the normalized harness events.

Each non-empty line is one complete JSON object carrying a top-level type. Current Cline versions wrap every record in an agent_event, whose real event is nested in an event object; versions that emit a flat say/ask stream are supported as well.

The session id is captured from a sessionId, session_id, or id field. The taskId and task_id fields name the in-memory conversation rather than the session, so they are never captured.

Within an agent_event, the nested event object’s type and contentType drive the mapping. A tool call’s input arrives on its content_start, keyed by toolCallId, and is resolved when the matching content_end arrives with the call’s terminal output. A tool whose content_start was missed is still classified from the content_end alone when that record restates the toolName and input. A text or reasoning block’s streaming delta is consumed on content_start, because the matching content_end carries the complete text.

A tool’s success is read from its content_end output: a success flag, or, for a batch carried as an output array or an output.results array, every item succeeding.

Whether reasoning arrives as its own block depends on the model and the provider. A model that folds its reasoning into the visible text has that reasoning reported as part of the agent message.

Raw recordNormalized event
hook_eventconsumed
run_resultconsumed; carries the session usage totals read for metrics
agent_event → iteration_start, iteration_end, usage, doneconsumed
agent_event → content_startconsumed; records the tool input or the streaming delta
agent_event → content_end (text)agent message, from text or content
agent_event → content_end (reasoning, thinking)reasoning, from text or content
agent_event → content_end (tool)the events its tool classifies to (see Tool mapping)
say text, say completion_result, ask followupagent message when it carries text
say reasoningreasoning
say error, say api_req_failederror
an agent_event with no nested event, an unrecognized contentType, say/ask tool activity, anything elseunknown

A content_end whose text is empty emits nothing. A line that fails to parse as JSON becomes a warning, so the stream stays lossless.

A tool content_end is classified by its toolName:

Cline toolEvent
run_commands, execute_command, bashcommand, one per command in a commands array or one for a single command string
read_files, read_fileread, one per file in a files array or one for a single path
editor, write_to_file, replace_in_file, new_rulewrite
apply_patchone write per file named by the patch markers
search_files, search_codebasesearch, one per pattern in a queries array or one for a single query
list_fileslist
skills, use_skillskill
any other toolunknown