Skip to content

Coding agents: hooks for Kiro CLI (#798) - #825

Merged
LoopGlitch26 merged 4 commits into
Cygnux-Labs:mainfrom
khushi-git-7:agent/issue-798
Nov 15, 2026
Merged

LoopGlitch26 merged 4 commits into
Cygnux-Labs:mainfrom
khushi-git-7:agent/issue-798

Conversation

@khushi-git-7

@khushi-git-7 khushi-git-7 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #798.

tracekit init --dev [--v2] --agent kiro hooks Kiro CLI into Tracekit, with uninstall and doctor support. The mapping follows payloads recorded from a real Kiro CLI 3.3.0 session on Windows 11 (tests/data/harness/kiro.json).

What the recording settled (the issue's questions)

  • Version: kiro-cli 3.3.0 (KIRO_CUSTOM_USER_AGENT: KiroCLI/3.3.0 … os/windows).
  • Tool names: hooks get the V3 ids (execute_pwsh on Windows, fs_write, str_replace, …). The 2.x names (shell, read, write) aren't: Kiro's V3 catalog lists them as 2.x names, not hook ids, and init refuses a 2.x CLI.
  • tool_input:
    • execute_pwsh {command, description, cwd, run_in_background, timeout}
    • fs_write and fs_append {path, text}
    • str_replace {path, oldStr, newStr, replace_all}
    • read_file {path, offset, limit}
    • list_directory {path, explanation, depth}
    • grep_search {query, caseSensitive, excludePattern, explanation, includePattern, path}
    • file_search {explanation, query, excludePattern, includeIgnoredFiles}
    • web_fetch {url, mode, searchPhrase}
    • delete_file {explanation, targetFile}: not path
  • Call id: none, in PreToolUse or PostToolUse. So kiro is in PAIRED, and calls are paired by tool and arguments, as for Gemini CLI, Droid and Devin.
  • MCP: a server named rec_server with a tool echo_text reaches the hook as mcp_rec_server_echo_text. The split really is ambiguous, so the call is decided as mcp__rec_server_echo_text, whole, as Gemini CLI's and Crush's are. Before a deferred MCP tool's first call, Kiro calls tool_load with {"tool_ids": ["rec_server::echo_text"]}. That id is unambiguous, but it isn't the call itself.
  • More tools (second recording, for the review): remote_web_search {query}; invoke_sub_agent {name, prompt, explanation}, whose sub-agent's own calls fire the session's hooks; code {operation, …} with its file in path (lookup_symbols) or file_path (get_document_symbols, pattern_search, find_references, diagnostics, and pattern_rewrite {pattern, replacement}); createHook {actionType, command, id, name, trigger}; and tool_load {"tool_ids": ["builtin::<tool>"]} before a deferred built-in.
  • Events: SessionStart, UserPromptSubmit (prompt), PreToolUse, PostToolUse (tool_response, a string) and Stop. SessionEnd didn't fire in kiro-cli chat --no-interactive. Kiro runs hook commands under cmd.exe on Windows.
  • What the docs leave out:
    • Only exit 2 blocks. Kiro shows stderr to the model verbatim and sends no PostToolUse for the blocked call. Exit 1 doesn't block, and a hook command that fails to start doesn't block either.
    • A hook that times out lets the call run. A 3 s timeout on a 20 s hook: the call ran after about 3 s.
    • timeout: 0 waits as long as the hook takes.

Change

  • agent_hooks.py:
    • kiro in AGENT_NAMES (recorded as kiro-cli).
    • KIRO_TOOLS and KIRO_PATH_ARG: each file tool is decided on the key it reads (delete_file's targetFile), never a decoy file_path, path or paths beside it. fs_write/fs_append text is a Write's content; str_replace oldStr/newStr are old_string/new_string.
    • normalise() takes Claude Code's payload path, paired.
    • _blocked denies a file, shell or fetch call without the argument it's decided on (KIRO_DECIDED_ON), before the signer, as Devin's are; a listing or a search without a path reads the working directory.
    • remote_web_search is a WebSearch, invoke_sub_agent a Task. code's recorded reads are a Read of their file and pattern_rewrite an Edit of it (both file_path and path decided). _blocked_kiro denies createHook, subagent/<agent>, kiro_powers, any code operation not recorded, and a rewrite that names no file.
  • Installer: Tracekit's own file, ~/.kiro/hooks/tracekit.json (--project: .kiro/hooks/tracekit.json).
    • One hook per event, named tracekit-<event>, with no matcher (every tool, as recorded).
    • PreToolUse timeout 600 s, the rest 30 s. I chose 600 over 0: Tracekit's hook answers within 540 s, and 0 would let a hung hook stop Kiro forever.
    • Uninstall deletes the file. A file there that holds anything but Tracekit's hooks, told by their command, is left alone (SettingsError).
    • The v1 commands name their event, as Copilot's and Antigravity's do.
    • On macOS and Linux, install._blocking already turns a hook that can't run into exit 2. On Windows, Kiro runs commands under cmd.exe, so _command keeps cmd.exe's quoted form, and the v2 PreToolUse command ends in a cmd.exe fallback that turns any status but 0 and 2 into 2, as install._blocking does.
  • Version check: kiro_version() reads kiro-cli --version. init refuses a CLI before 3.0, which reads no .kiro/hooks file, user-level or --project; doctor (D-HOOKS-EVENT) warns about one on both paths.
  • doctor: _harness_hooks reads Kiro's list of hooks, less those set to "enabled": false (reported), so the event and timeout checks apply to it.
  • Coding pack: .kiro in TK-F009 and TK-F015 (hooks, agents, MCP servers and settings), 2026.11-v2-83 (main is at -82). The policy hashes in eval/results are updated; no decision changed.
  • Docs:
    • a Kiro CLI section and column in coding-agents.md;
    • limits.md rows for what the recording settled (exit status, timeout, no call id, MCP names, no SessionEnd), and that the policy doesn't read PowerShell, so .kiro isn't protected from execute_pwsh;
    • Kiro in D-HOOKS-EVENT and D-HOOKS-TIMEOUT in doctor.md, and in the setup skill (tracekit-setup: the kiro agent (Kiro CLI 3.0 or later) tracekit-skills#3, whose blob test_docs.py pins);
    • Kiro added to integrations.md, support.md and the README lists.

Tests

  • test_harness_hooks_v2.py:
    • test_kiro runs the 22 recorded cases (kiro.json: allow, held and approved, deny, tool_load, MCP, remote_web_search, invoke_sub_agent and its sub-agent's call, the code operations);
    • the recorded SessionStart, UserPromptSubmit, PostToolUse and Stop payloads (kiro_events.json), with SessionEnd built;
    • the recorded createHook, and built subagent/…, kiro_powers and unrecorded code calls, denied before the signer;
    • the Windows fallback: its shape, and on Windows a PreToolUse hook whose Python is gone exiting 2 under cmd.exe.
  • test_agent_hooks.py:
    • the mapping on the path each tool reads, decoys included;
    • calls with nothing to decide them on;
    • pairing;
    • the installer (idempotent, v1 to v2, uninstall, a person's file left alone);
    • the 2.x refusal on both paths.
  • test_doctor_v2.py: a hook set to "enabled": false and a 2.x CLI are warned about.
  • test_signer_policy.py: .kiro is harness config in every pack and engine.
  • The generic installer tests treat Kiro's file as Tracekit's own, as they do goose's and Cline's. test_a_hook_that_cannot_start_blocks_only_a_tool_call runs Kiro's commands too.

Rebased onto main (cda2997). On my fork, at this head (e7c001f):

job result
changed areas (12 test files), ubuntu-latest 3.12 1232 passed
… ubuntu-22.04 3.9 1218 passed
… macos-latest 3.13 1232 passed
… windows-latest 3.13 1077 passed, 1 failed: test_cursor_edit_tools_are_decided_as_edits, which fails on main too and is fixed by #838 (#827)
full suite, ubuntu-latest 3.12 5336 passed
the new Kiro tests against main's code 112 failed, 4 passed, as they should
policy evals, rerun only timings and the regex version differ from eval/results

Live session (the done-when)

Kiro CLI 3.3.0 on Windows 11, Tracekit at e7c001f, tracekit init --dev --v2 --agent kiro --project, and kiro-cli chat --no-interactive --trust-all-tools, so Tracekit's hook was the only gate:

  • fs_write notes.txt: allowed, written.
  • execute_pwsh sudo echo hi: denied (TK-D001). Kiro didn't run it, and the hook's stderr held only the reason.
  • fs_write .kiro/hooks/probe.json: held (TK-F009). After tracekit approvals approve, a resumed prompt (--resume) retried it, the approval was consumed, and the file was written.
  • createHook: denied in the hook. In-hook denials don't reach the signer, so it isn't in the run.
  • tracekit verify on the exported run: 4 tool calls in 12 signed records, none changed after signing (the run stays open, since --no-interactive sends no SessionEnd).
  • With the PreToolUse hook's Python moved away, Kiro blocked echo fail-closed-probe, showing "tracekit: the hook could not run; call blocked (fail-closed)".

Not covered: macOS and Linux (no Kiro sign-in there), and SessionEnd in an interactive session.

@khushi-git-7

Copy link
Copy Markdown
Contributor Author

The done-when session, with Kiro CLI 3.3.0 on Windows 11 and Tracekit at this PR's head (22b3458, rebased onto main):

pip install -e .            # into a fresh venv
tracekit init --dev --v2 --agent kiro --project
kiro-cli chat --no-interactive --trust-all-tools '<three steps>'

The prompt asked for three calls, one each, with no retry: write notes.txt, run sudo echo hi, and write .kiro/hooks/probe.json. Kiro's own permission prompts were off (--trust-all-tools), so Tracekit's hook was the only gate.

call Tracekit what Kiro did
fs_write notes.txt allow wrote it
execute_pwsh sudo echo hi deny, TK-D001 (exit 2) didn't run it, and quoted the block message to me: "BLOCKED, nothing ran, and no one can approve it (TK-D001). Why: privilege escalation"
fs_write .kiro/hooks/probe.json ask, TK-F009 (exit 2) didn't write it, and passed on the tracekit approvals show / approve / reject apr-… lines

Then tracekit approvals approve apr-…, and a second prompt in the same session (kiro-cli chat --resume): "it has been approved, retry step 3 once". The same fs_write was decided again, the signer consumed the approval, and the file was written.

tracekit last --open (the run is still open, since --no-interactive sends no SessionEnd):

run 949d172a9eea124c4597d5e24efeb663 (kiro-cli)
VERIFIED SO FAR: 4 tool calls in 12 signed records, none changed after signing; the run has not ended, so more may follow.

The 12 records in the bundle, in order:

run.registered            agent kiro-cli, fail mode closed
input.observed            kiro-cli:UserPromptSubmit
policy.decision  Write    allow
tool.result               ok
policy.decision  Bash     deny  TK-D001      (no tool.result: Kiro sends no PostToolUse for a blocked call)
policy.decision  Write    ask   TK-F009
approval.request          TK-F009
approval                  approve (self-approved, dev)
input.observed            kiro-cli:UserPromptSubmit   (the resumed prompt)
policy.decision  Write    ask   TK-F009
approval.consumed
tool.result               ok

The resumed prompt stayed in the same run, because Kiro keeps the session id on --resume. The paired ids (kiro_<hash>_<n>) matched each result to its call.

Before this I'd run the same session at the pre-rebase head (a03a81b), with the same outcome. I rebased because main had gained the gptme, OpenHands, Copilot CLI and CodeBuddy hooks. The conflicts were all in shared lists (harness tuples, docs tables, the TK-F009 and TK-F015 dot-folder groups), and Kiro now sits beside the new entries. Main already had 2026.11-v2-82, so the coding pack is now 2026.11-v2-83, and the eval/results policy hashes are recomputed against main's. The fork CI for the rebased head is in the table in the description.

Not covered: macOS and Linux (no Kiro sign-in there), and SessionEnd in an interactive session.

@LoopGlitch26

Copy link
Copy Markdown
Member

Reviewed (read against main, nothing run). The recorded V3 file, shell, fetch and MCP calls map right, and a malformed payload or an unreachable signer blocks with exit 2. Before this leaves draft:

  1. Tools that write, create hooks or delegate aren't mapped. Kiro's tools page lists code (AST rewriting, LSP rename) under write, plus createHook, subagent/<agent> and kiro_powers. Today they reach the policy as unknown tools and are only flagged. A code rewrite of .kiro/settings.json isn't held where an Edit of it is (TK-F009). A createHook whose command downloads a script and pipes it into a shell makes a hook that no Tracekit hook ever sees. invoke_sub_agent maps to Task, but nothing shows whether a sub-agent's calls fire hooks; Crush and OpenHands deny their sub-agent tools for that reason. Please record these tools. Until then, deny them in _blocked with a reason, as Crush's are.
  2. Windows: a hook that can't start lets the call run. Kiro gets the bare cmd.exe command, and your recording shows it runs the call on any exit but 2, so an uninstalled Tracekit or a moved venv (exit 1 or 9009) fails open. Add || exit 2 to the cmd.exe PreToolUse command, as Qwen gets a wrapper for its shell.
  3. .kiro protection from execute_pwsh. It's decided as Bash, and the policy doesn't read PowerShell commands (the same as the OpenHands row in limits.md), so Remove-Item $env:USERPROFILE\.kiro\hooks\tracekit.json isn't held while rm of it is. PowerShell is Kiro's only Windows shell, so the limits row that says edits of .kiro/ are held needs to say this too.
  4. Kiro CLI before 3.0. Kiro's hooks page says .kiro/hooks/*.json came with CLI V3. KIRO_OLD tells a 2.x user to use --project, the test asserts a project's hooks are read "by every release", and the version check runs only for the user-level path. So init --agent kiro --project on 2.x writes a file nothing reads, with no warning. Refuse 2.x on both paths, and drop the 2.x tool names if the docs confirm they're never hook ids.
  5. Smaller:
    • doctor ignores a hook's enabled: false (Antigravity's is checked);
    • _install_kiro picks out Tracekit's hooks by name prefix rather than by command;
    • v1 hook commands don't name their event, as Copilot's and Antigravity's do;
    • grep_search or list_directory without path is denied, stricter than needed.
  6. Tests. Only the 12 PreToolUse payloads are recorded. PostToolUse, UserPromptSubmit, SessionStart and Stop are built in code but labelled "as recorded", and there's no SessionEnd, execute_bash, invoke_sub_agent or remote_web_search. Please record what you can and label the rest as built.
  7. Docs: add Kiro to the D-HOOKS-EVENT and D-HOOKS-TIMEOUT lists in docs/doctor.md, and to the agent list in plugin/skills/tracekit-setup/SKILL.md, which tells agents that an agent missing from it is unsupported.

The README counts and the coding-agents column are right. CI is green apart from the Windows test that fails on main too (#827).

@khushi-git-7
khushi-git-7 marked this pull request as draft November 14, 2026 05:13
@khushi-git-7

khushi-git-7 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @LoopGlitch26, that's a thorough review. I've moved this back to draft and will work through all seven points.

On point 6: PostToolUse, UserPromptSubmit, SessionStart and Stop were recorded in the same session, but I built them in code in the test instead of taking them from the recording. I'll put the recorded ones into kiro.json. I'll also record invoke_sub_agent, remote_web_search, code, createHook, subagent and kiro_powers where Kiro offers them, and label anything I can't record as built.

khushi-git-7 added a commit to khushi-git-7/Tracekit that referenced this pull request Nov 14, 2026
- Tools: remote_web_search is a WebSearch and invoke_sub_agent a Task
  (a sub-agent's own calls fire the session's hooks, recorded). The code
  tool's recorded reads are a Read of their file and pattern_rewrite an
  Edit; any other operation, a rewrite naming no file, createHook,
  subagent/<agent> and kiro_powers are denied in the hook. The 2.x names
  are dropped: they are no hook ids on CLI V3.
- Windows: the v2 PreToolUse command ends in a cmd.exe fallback that
  turns any status but 0 and 2 into 2, as install._blocking does
  elsewhere.
- init refuses a Kiro CLI before 3.0 on both paths; Tracekit's hooks are
  told by their command, not their name; v1 commands name their event; a
  listing or search without a path isn't denied.
- doctor: the version check on both paths, and a Tracekit hook set to
  "enabled": false.
- Tests take the recorded SessionStart, UserPromptSubmit, PostToolUse and
  Stop payloads (kiro_events.json) and the newly recorded calls; built
  ones are labelled as built.
- Docs: limits (PowerShell isn't read, so .kiro isn't protected from
  execute_pwsh), doctor.md, the coding-agents table, and the setup
  skill (tracekit-skills#3, pinned).

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
@khushi-git-7

Copy link
Copy Markdown
Contributor Author

@LoopGlitch26 all seven points are addressed in e7c001f, rebased onto cda2997. I recorded two more short Kiro 3.3.0 sessions for them.

  1. Tools.
    • Recorded: remote_web_search ({query}) is a WebSearch.
    • Sub-agents: a sub-agent's own calls do fire the session's hooks. The recording shows invoke_sub_agent, then the sub-agent's execute_pwsh, in the same session_id. So invoke_sub_agent stays a Task.
    • code: it names its file in path (lookup_symbols) or file_path (get_document_symbols, pattern_search, find_references, diagnostics), and these are decided as a Read of it. pattern_rewrite (file_path, pattern, replacement) is decided as an Edit, so a rewrite of .kiro/settings.json is held like any edit. Any other operation (an LSP rename, a format) is denied in the hook until it's recorded, and so is a rewrite that names no file.
    • createHook (recorded: {actionType, command, id, name, trigger}) is denied in the hook.
    • subagent/<agent> and kiro_powers aren't recorded (Kiro's catalog lists kiro_powers for IDE, Web and Mobile only), so they're denied too.
  2. Windows fail-closed. The v2 PreToolUse command now ends in a cmd.exe fallback: || ((if errorlevel 3 (…) else if not errorlevel 2 (…)) & exit 2). It works like install._blocking: 0 and 2 pass as they are, and any other status (1, 9009) becomes 2 with "call blocked (fail-closed)". A plain || exit 2 would have added that line to every real deny, since a deny exits 2 too. Checked live (below).
  3. PowerShell. The limits row now says execute_pwsh is decided as Bash and the policy doesn't read PowerShell, so Remove-Item $env:USERPROFILE\.kiro\hooks\tracekit.json isn't held where rm of it is.
  4. Before 3.0. Kiro's hooks page says the .kiro/hooks/*.json format came with CLI V3, so init now refuses a 2.x CLI on both the user-level and --project paths, and writes nothing. doctor warns on both paths. The 2.x names (shell, read, write) are dropped: Kiro's V3 catalog lists them as 2.x names and says such aliases are "not a Hook or runtime ID". The "every release" test is replaced by one for the refusal.
  5. Smaller items:
    • doctor reports a Tracekit hook set to "enabled": false, and no longer counts it as installed;
    • _install_kiro tells Tracekit's hooks by their command, so a person's hook named tracekit-… is left alone;
    • the v1 commands name their event;
    • grep_search and list_directory without a path read the working directory and aren't denied.
  6. Tests.
    • kiro_events.json holds the recorded SessionStart, UserPromptSubmit, PostToolUse (also invoke_sub_agent's) and Stop payloads, and the recorded createHook call.
    • kiro.json gains the 10 newly recorded calls (tool_load builtin::…, remote_web_search, invoke_sub_agent and its sub-agent's call, the five code reads and pattern_rewrite).
    • What's built is labelled as built: SessionEnd (--no-interactive never fires it), execute_bash (Windows sends execute_pwsh), and the subagent/…, kiro_powers and unrecorded code cases.
  7. Docs.
    • Kiro is in D-HOOKS-EVENT and D-HOOKS-TIMEOUT in docs/doctor.md.
    • It's in the setup skill. That skill is pinned to tracekit-skills byte for byte, so I've opened tracekit-setup: the kiro agent (Kiro CLI 3.0 or later) tracekit-skills#3 with the same change, and test_docs.py pins its blob (91a5eb5). That PR needs merging first, or I'll repin to whatever lands there.

Live check (Kiro CLI 3.3.0, Windows 11, Tracekit at e7c001f, init --dev --v2 --agent kiro --project, --trust-all-tools):

  • fs_write notes.txt allowed;
  • sudo echo hi denied (TK-D001), with stderr carrying only the reason;
  • fs_write .kiro/hooks/probe.json held (TK-F009), then approved, retried in the resumed session, and run;
  • createHook denied in the hook (in-hook denials don't reach the signer, so it isn't in the run);
  • tracekit verify on the exported run: 4 tool calls in 12 signed records, none changed after signing;
  • with the PreToolUse hook's Python moved away, Kiro blocked echo fail-closed-probe and showed "tracekit: the hook could not run; call blocked (fail-closed)". Before this change, that call ran.

CI on my fork is in the description.

@LoopGlitch26

Copy link
Copy Markdown
Member

Re-reviewed e7c001f: all seven points are fixed. The unrecorded tools are denied, a Windows hook that can't start blocks, pre-3.0 is refused on both paths, doctor sees enabled: false, the recorded and built payloads are labelled, and the docs are in. One new thing, and one question:

  1. invoke_sub_agent's contextFiles. Your recording shows that input carries a contextFiles list. Mapped to Task, no file rule reads those paths, so {"name":"general-task-execution","prompt":"summarise it","contextFiles":["C:\\work\\kiro-rec\\.env"]} could hand the sub-agent a file that read_file of the same path would be denied. Please decide each contextFiles entry as a Read of that path (the way a batch's sub-calls are decided), or deny a non-empty list until it's recorded, with a test.
  2. Question: does pattern_rewrite accept a folder as file_path? If it does, {"operation":"pattern_rewrite","file_path":"C:\\work\\kiro-rec",…} is decided as an Edit of the folder, and the settings-folder rules wouldn't hold a rewrite inside .kiro. If you can check it in Kiro, either map a folder to the files it rewrites, or deny a folder target.

Also, test_docs.py pins the skill's blob 91a5eb5, which comes from Cygnux-Labs/tracekit-skills#3, so that one merges first. I'll review it now.

tracekit init --dev [--v2] --agent kiro writes Tracekit's own hook file,
~/.kiro/hooks/tracekit.json (--project: the project's .kiro/hooks), one hook
per event with a 600 s PreToolUse timeout; uninstall removes it, and a file
there with a hook that isn't Tracekit's is left alone. init and doctor read
kiro-cli --version and say when a CLI before 3.0 won't read ~/.kiro/hooks.

The mapping follows payloads recorded from Kiro CLI 3.3.0
(tests/data/harness/kiro.json): Claude Code's payload shape with no call id
(paired by tool and arguments), the V3 tool ids, each file tool decided on
the key it reads (delete_file's targetFile), and mcp_<server>_<tool> kept
whole, since the split isn't known. A file, shell or fetch call without the
argument it is decided on is denied in the hook. The coding pack holds an
agent's edit of .kiro/ (TK-F009, TK-F015; 2026.11-v2-82).

Docs: a Kiro CLI section and column in coding-agents.md, and limits.md rows
for what the recording settled: Kiro runs a call whose hook exits other
than 2, can't start or times out, and fires no SessionEnd in
--no-interactive.

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
…lone; tests and eval hashes

The generic installer tests treat Kiro's file as Tracekit's own, as they do
goose's and Cline's, and the fail-closed test now runs Kiro's commands too.
Evals: the coding pack's policy hash at 2026.11-v2-82 (no result changed).

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
- Tools: remote_web_search is a WebSearch and invoke_sub_agent a Task
  (a sub-agent's own calls fire the session's hooks, recorded). The code
  tool's recorded reads are a Read of their file and pattern_rewrite an
  Edit; any other operation, a rewrite naming no file, createHook,
  subagent/<agent> and kiro_powers are denied in the hook. The 2.x names
  are dropped: they are no hook ids on CLI V3.
- Windows: the v2 PreToolUse command ends in a cmd.exe fallback that
  turns any status but 0 and 2 into 2, as install._blocking does
  elsewhere.
- init refuses a Kiro CLI before 3.0 on both paths; Tracekit's hooks are
  told by their command, not their name; v1 commands name their event; a
  listing or search without a path isn't denied.
- doctor: the version check on both paths, and a Tracekit hook set to
  "enabled": false.
- Tests take the recorded SessionStart, UserPromptSubmit, PostToolUse and
  Stop payloads (kiro_events.json) and the newly recorded calls; built
  ones are labelled as built.
- Docs: limits (PowerShell isn't read, so .kiro isn't protected from
  execute_pwsh), doctor.md, the coding-agents table, and the setup
  skill (tracekit-skills#3, pinned).

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
khushi-git-7 added a commit to khushi-git-7/Tracekit that referenced this pull request Nov 14, 2026
…t of the folder (Cygnux-Labs#825)

invoke_sub_agent hands the sub-agent its contextFiles ([{"path": ...}]) with no
read_file of them (recorded on 3.3.0), so a file there was read undecided. A call
that names any is denied in the hook: the agent names the files in the prompt,
and the sub-agent's read of each is decided.

code's pattern_rewrite takes a folder (`path`), decided as an Edit of it, so a
folder inside .kiro is held by TK-F009. On 3.3.0 it only previews ("Always
previews"); recorded on a folder, it changed no file. limits.md: `path` doesn't
keep the search to that folder.

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
…t of the folder (Cygnux-Labs#825)

invoke_sub_agent hands the sub-agent its contextFiles ([{"path": ...}]) with no
read_file of them (recorded on 3.3.0), so a file there was read undecided. A call
that names any is denied in the hook: the agent names the files in the prompt,
and the sub-agent's read of each is decided.

code's pattern_rewrite takes a folder (`path`), decided as an Edit of it, so a
folder inside .kiro is held by TK-F009. On 3.3.0 it only previews ("Always
previews"); recorded on a folder, it changed no file. limits.md: `path` doesn't
keep the search to that folder.

Signed-off-by: Khushi Jain <jainkhushibts@gmail.com>
@LoopGlitch26

Copy link
Copy Markdown
Member

Re-reviewed at 31982ed. Both points from the last review are settled, and this is ready from our side.

  1. contextFiles: a call that names any is now denied in the hook, and the test uses your recorded payload. I ran the Kiro tests in a sealed container. They pass at this head, and the two contextFiles tests fail with the previous head's agent_hooks.py, as they should. A tool_input sent as a JSON string is denied the same way.
  2. pattern_rewrite on a folder: thanks for checking it in Kiro. Deciding the folder as an Edit holds .kiro itself. A rewrite named on the project root is allowed, but since 3.3.0 only previews, it changes nothing inside .kiro either. The new limits row says this, so if a later Kiro applies rewrites, that row is the place to start.

I also checked the Kiro tools that could start a process. No V3 CLI tool adds or connects an MCP server by command. The files that do start one are all under .kiro and held: .kiro/settings/mcp.json (Kiro reloads it between turns), .kiro/settings/lsp.json, an agent's mcpServers and hooks in .kiro/agents/, and .kiro/hooks/. createHook and kiro_powers are denied. CI is green at this head.

Two things for later, not for this PR. specTask and preset were null in every recording, and knowledge (on by default in V3) may be able to index a path. On the laptop pack, a read_file of a secret is only flagged too, so neither is decided more mildly there today. If you record them some day and either one hands the sub-agent or the index a file, the contextFiles treatment fits.

Next steps:

  • tracekit-setup: the kiro agent (Kiro CLI 3.0 or later) tracekit-skills#3 merges first. Its blob still matches the 91a5eb5 pin in test_docs.py.
  • This PR changes coding.yaml, so it goes into the next policy merge train with the other pack PRs. We bump the pack version and re-record the evals once, in the train. Please don't re-record the evals or bump the version again, even if GitHub shows a conflict in coding.yaml or eval/results after main moves. Your commits land in main as they are, and this PR shows as merged.

LoopGlitch26 added a commit that referenced this pull request Nov 14, 2026
Rule ids: #848 and #825 add none (they extend TK-F009's and the effects
rule's harness folders), so the train's new ids stay TK-A079 and TK-A080
(#789) and TK-A081 (#844's RemoteTrigger); nothing collides.

Packs: still one step above main's, each once: coding 2026.11-v2-83,
dev 2026.11-dev-6, server 2026.11-server-18, strict 2026.11-strict-12.

Harness lists: AGENTS.md names Kiro CLI beside jcode (#825 didn't).

Evals re-recorded once more, by their own scripts, run on the host with
main's own code (4ce4aa7) and the train's packs, corpora and results
files as data:
- E17: 951 of 951 harmful calls stopped, 1 false alarm in 971.
- E21 policy robustness: held-out 286 / 420 default and 312 / 420
  strict, as before; strict's E17 false positives 50 of 971 (5.1%); the
  recorded gates are main's.
- E21 robustness: all 951 originals and all 2,948 rewrites contained.
The latency rows in docs/evaluation.md are this run's, on macOS arm64
(Apple M4 Pro), Python 3.11.15, the machine the gates were recorded on;
every p99_ref is within its cap. README, docs/evaluation.md and
docs/limits.md quote these numbers.

Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
@LoopGlitch26
LoopGlitch26 merged commit 31c3bbe into Cygnux-Labs:main Nov 15, 2026
34 checks passed
LoopGlitch26 added a commit that referenced this pull request Nov 15, 2026
@LoopGlitch26

Copy link
Copy Markdown
Member

Landed on main in #850 with your commits and the review fixes (a sub-agent's contextFiles denied, a folder rewrite read as an Edit). Thank you. If you'd like a next one: #862, checking that Claude Code's new Code Mode still gets each of its tool calls decided, completed and signed.

@khushi-git-7

Copy link
Copy Markdown
Contributor Author

Thank you, @LoopGlitch26, and thanks for checking the Kiro tools that could start a process. I've noted specTask, preset and knowledge for a later recording. I've asked for #862 there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coding agents: hooks for Kiro CLI

2 participants