Events
Kilo Code emits its activity as EventFormat::Kilo. It runs with
kilo run --format 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.
Raw event stream
Section titled “Raw event stream”Each non-empty line is one complete JSON object carrying a top-level type.
Kilo Code is built on OpenCode’s runtime, so it emits the same step-oriented
stream: step boundaries bracket the model’s turns, and reasoning, text, tool
use, and errors carry the activity within them.
The session id is captured from the first sessionID, session_id, or
sessionId field seen.
A tool_use record is self-contained. It carries the tool name, its input, and
a terminal status in one record, so no request/response correlation is needed. A
status of completed, success, done, or ok marks the call successful;
error, failed, failure, cancelled, or canceled marks it failed. Any
other status leaves success undetermined.
Normalized mapping
Section titled “Normalized mapping”| Raw record | Normalized event |
|---|---|
step_start | consumed |
step_finish | consumed; carries this step’s token usage, emitted as a per-turn usage event and summed into the run’s metrics |
reasoning | reasoning when it carries text, otherwise consumed |
text | agent message when it carries text, otherwise consumed |
tool_use | the events its tool classifies to (see Tool mapping) |
error | error |
| any other type | unknown |
A tool_use whose tool name is unrecognized also becomes an unknown event, and
a line that fails to parse as JSON becomes a
warning, so the stream stays lossless.
Tool mapping
Section titled “Tool mapping”Kilo Code extends the OpenCode tool set with a semantic-search tool. Tool names are matched case-insensitively:
| Kilo tool | Event |
|---|---|
codesearch | search |
read | read |
write, edit | write |
apply_patch | one write per file named by the patch markers |
grep, glob | search |
bash | command, or a recognized file operation |
background_process | command when the input carries a command line, otherwise consumed |
task, agent_manager | orchestration when the spawned agent or session is identified, otherwise unknown |
skill | skill |
lsp | search when it carries a query or symbol, otherwise unknown |
todo, todowrite, todoread | consumed; the agent’s internal task list |
| any other tool | unknown |