Repository navigation
Closed
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Kiro CLI, the terminal coding agent that succeeds Amazon Q Developer CLI, runs command hooks around tool calls, and a PreToolUse hook can block the call (hooks, hook types, actions, tools). Tracekit has no Kiro support yet.
What the docs say (read 2026-11-13):
- Where hooks are set. A JSON file per hook set in a project's
.kiro/hooks/, and in~/.kiro/hooks/from CLI V3:{"version": "v1", "hooks": [{"name", "trigger", "matcher", "action": {"type": "command", "command": "..."}, "timeout"}]}.timeoutis in seconds, 60 by default.0turns the timeout off. On CLI V3, hooks can also be inline in an agent config (.kiro/agents/,~/.kiro/agents/, keyhooks), as a flat array without theversionwrapper. - Triggers:
PreToolUse,PostToolUse,UserPromptSubmit,Stop,SessionStart(aliasAgentSpawn),SessionEnd,PreCompact,PostCompactand others. - Blocking. The command gets the session context as JSON on stdin. Exit 0 lets the call run. Any other exit code blocks a
PreToolUsecall and sends stderr to the agent. The docs show these stdin fields:hook_event_name,cwd,session_id,tool_name,tool_input. They don't say whether there is a tool call id, or what happens on a timeout. - Tools. Built-in tool ids include
execute_bash(execute_pwshon Windows),read_file,list_directory,file_search,grep_search,fs_write,fs_append,str_replace,delete_file,web_fetch,remote_web_searchandinvoke_sub_agent. MCP tools reach hooks asmcp_<server>_<tool>. The docs don't give thetool_inputfields of the shell and file tools. CLI 2.x used other names (read,write,shell; built-in tools), and the migration notes say the old names still work.
Things to design around
- The timeout. A held call waits up to
APPROVAL_WAIT_S = 540seconds for a person (tracekit/integrations/claude_code.py:102), and Kiro's default timeout is 60. Init has to write atimeoutabove 540 (or0, no timeout) in the hook file. Find out in step 1 what Kiro does when a hook times out; if the call then runs, that goes indocs/limits.md. - Call ids. If
PreToolUseandPostToolUsecarry no shared call id, pair them with_paired_ids(tracekit/agent_hooks.py:511) and addkirotoPAIRED(line 736), as Gemini CLI, Droid, Antigravity, Devin and Cline do. - MCP names.
mcp_<server>_<tool>can't be split cleanly when the server name has a_in it. Record what Kiro sends for such a server in step 1, and don't guess the split. - Kiro's own config. An agent that edits
.kiro/hooks/or.kiro/agents/can turn Tracekit's hook off..kirobelongs in the harness-config rules of the coding pack,TK-F009andTK-F015(tracekit/policy2/packs/coding.yaml, the(codex|gemini|opencode|…|cline)group of both patterns), with a pack version bump. Several open PRs change that pack right now, so take the line numbers and version from main when you open the PR.
Task
- Record real
PreToolUse,PostToolUseand session events from Kiro CLI on macOS or Linux (the stdin JSON; redact anything private) as cases intests/data/harness/kiro.json, next to the other harnesses' files there (codex.json,qwen.json, …). In the PR, give the Kiro CLI version, thetool_inputofexecute_bash,fs_write,fs_append,str_replace,delete_fileand an MCP call, whether a call id is there, what a hook timeout does, and which tool names (the V3 ids or the 2.x ones) hooks receive. - Add
kirotoAGENT_NAMES(tracekit/agent_hooks.py:87), map its tools intool()(line 318), under the names step 1 recorded:execute_bashandexecute_pwshtoBash,read_filetoRead,fs_writeandfs_appendtoWrite,str_replacetoEdit,delete_fileto a delete the policy sees,web_fetchtoWebFetch, andmcp_<server>_<tool>to the MCP form the other harnesses use. Map its events innormalise()(line 551). tracekit init --dev [--v2] --agent kiro,uninstallanddoctor: write Tracekit's hook file in~/.kiro/hooks/(config_path, line 1029;install, line 1575), with Tracekit's own name so uninstall removes only that file. Kiro loads~/.kiro/hooks/only from CLI V3, so init and doctor check the installed version (kiro-cli --versionor what step 1 finds) and say so on an older one.- Tests in
tests/test_agent_hooks.py(the mapping, the installer and uninstall), and the recorded cases throughcases("kiro")(tests/test_harness_hooks_v2.py:36). - A column in
docs/coding-agents.md, anddocs/limits.mdrows for what Kiro's hooks can't see.
Done when: in a real Kiro CLI session (name the version in the PR), a denied call is blocked and the model sees the reason, a held call waits for tracekit approvals approve, the session's calls show up in tracekit last, and make test passes.
Comment here to claim it. Commits need a DCO sign-off (git commit -s).
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed
Activity
khushi-git-7 commentedon Nov 13, 2026
I'd like to take this one.
Plan, following the task list:
tests/data/harness/kiro.json. The PR will report:tool_inputof each tool you listed, and of an MCP call (I'll use a server with a_in its name, to see whatmcp_<server>_<tool>looks like);timeoutand a hook that sleeps past it;Nothing gets mapped before that.
kirotoAGENT_NAMES, map the tools intool()and the events innormalise(), under the recorded names. If there is no shared call id, pair the calls with_paired_idsand addkirotoPAIRED. MCP names are split only as far as the recordings show is safe.init --dev [--v2] --agent kiro,uninstallanddoctor. The hook file goes in~/.kiro/hooks/under Tracekit's own name, with atimeoutaboveAPPROVAL_WAIT_S, plus a version check that names CLI V3..kirotoTK-F009andTK-F015, with the pack version bump, both taken from main when I open the PR.test_agent_hooks.pyand throughcases("kiro"), thecoding-agents.mdcolumn and thelimits.mdrows.One question before I start. My machine is Windows 11, where Kiro CLI has run natively since 2.0, with
execute_pwshin place ofexecute_bash. I can record a real session there. I don't have macOS, and recording on Linux would mean setting up WSL. Would Windows recordings work for step 1 and the done-when session? Or do you need at least the Linux side, in which case I'll set up WSL first?#722's (2) and (3) carry on in parallel; they're on a separate branch.
LoopGlitch26 commentedon Nov 13, 2026
It's yours, and recording first is the right order. Put the recorded payloads in
tests/data/harness/kiro.json(as the other harnesses do) with the Kiro CLI version, and note anything the docs leave out that the recording settles. #722 can wait for this or run alongside it, whichever suits you.verify: fork-only workflow for Cygnux-Labs#798
khushi-git-7 commentedon Nov 13, 2026
Draft PR: #825. The recorded payloads are in
tests/data/harness/kiro.json(Kiro CLI 3.3.0, Windows 11). The PR lists what the recording settled that the docs leave out: only exit 2 blocks; a failed, unstartable or timed-out hook lets the call run; no call id;delete_filenames its filetargetFile; MCP names aremcp_<server>_<tool>withtool_loadbefore them; noSessionEndin--no-interactive. It stays a draft until the live session with Tracekit in the hooks is done.Coding agents: hooks for Kiro CLI (Cygnux-Labs#798)
verify: fork-only workflow for Cygnux-Labs#798
Coding agents: hooks for Kiro CLI (Cygnux-Labs#798)
verify: fork-only workflow for Cygnux-Labs#798
Coding agents: hooks for Kiro CLI (Cygnux-Labs#798)
verify: fork-only workflow for Cygnux-Labs#798
verify: fork-only workflow for Cygnux-Labs#798