Build a coding agent session recorder with Kiro CLI hooks

For a hackathon, Ehals had Kiro CLI build a session log viewer and a recording hook, with Claude Code reviewing between runs. It cost 535 credits and the recorder failed two of five agreed checks.

Done withKiroClaude Code· Nov 24, 2026

What they did

Ehals entered the Kiroween 2026 hackathon with Session Autopsy, a static web page that replays a coding agent's session log and highlights file lines the agent asked for more than once. Kiro CLI 3.5.0 ran in headless mode and wrote the steering files, the spec, the app, the tests and two preToolUse hook scripts. Ehals set the direction. Claude Code sat between Kiro runs as reviewer: it wrote the detailed prompts for each run, ran the tests and made the commits. Before any code, the builder agent was limited to the project folder with no shell, and 23 short probe sessions tried to escape that folder with harmless marker files. One hook screened Kiro's writes for unsafe HTML, home paths and key-like strings. The second hook is the recorder: one line per tool call with time, tool, relative file names and line ranges, never commands, contents or prompts. Five pass or fail checks were written down before testing and frozen.

How it went

The build log records 27 Kiro runs and 535.14 credits in total, including probes and test sessions. The probes were all denied. The safety hook made 469 decisions and blocked only the planted test case. The recorder passed three of the five checks. It failed on order: when the agent sends several tool calls at once their hooks fire in any order, so one log named the wrong first edit, and calls to tools the agent lacks never reach the hook. It also failed to always surface its own errors, since Kiro hides a failing hook's stderr. A --check command now catches an unwritable folder or a full disk. Ehals's first write-up overstated the results and an independent recount corrected it.

Worth knowing

A preToolUse hook gets no sequence number, so it cannot reconstruct call order when the agent runs tools in parallel; test that on day one. Exit code 2 blocks the tool, so a recorder must exit 1 and will fail quietly unless you add a health check. Interactive kiro-cli chat defaults to the V3 engine, which gives agents more tools including delete_file; the recorder starts sessions with --v2. The folder limit is enforced by the app, not the OS, so Kiro could still tell whether an outside path existed.

Try it

With Kiro· 5 parts to fill in

Build [tool name], a [static web page / CLI] that [what it does], in [project folder]. Before writing any code, confirm your file tools are limited to this folder: try to read and write a harmless marker file via an absolute path, ../, a symlink and my home directory, and report which attempts were denied. Then write a spec and tests, and agree with me on [number] pass or fail checks that we will not change after seeing results. Build it in small runs. After each run, list the files you changed and the credits used. Stop when every check has a recorded pass or fail, and report failures plainly next to the install steps.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related