Repository navigation
feat(cli): deliver kiro post tool use and stop hooks - #1363
Merged
Merged
Conversation
Map PostToolUse and Stop in the Kiro profile and read both in host-kiro, from payloads captured on kiro-cli 3.6.0. Stop continues the turn with a block decision; nothing is printed after a tool call, whose output the model was not seen reading. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A script paired across events (memory, artifacts) shared one hook name under two triggers, and whether Kiro keys hooks by name is unprobed. The name now carries the trigger. Pin the guards on a write with no path or no text, and reword the Kiro payload limits to what the kept model output shows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… hook name source Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ss agents and hook matchers Co-Authored-By: Claude Opus 5.5 <[email protected]>
… tools A PostToolUse script no longer runs after every Kiro tool: the matcher is translated to the tags Kiro selects by, one hook per tag. The adapter lists the file of a str_replace edit and the command of an execute_bash call, from payloads captured on kiro-cli 3.6.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 task
…ok shape Kiro tokenized a plugin matcher and restated the file-write names the shared shape already holds. Export both from plugin-hooks-shape and keep only the name-to-tag entries Kiro owns, each now guarded on its own. Cite the vendor docs for the Stop block and the hook key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…de's tool names Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-tool-hooks' into feat/kiro-post-tool-and-stop-hooks
…ugh one shared reader A plugin ships only plain `|` lists, so the regular expression branch and the empty and star cases go; the reader is case-insensitive as the bridges are, and the skipped-group warning has one builder other hosts reuse. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tever their case Kiro's tag map is profile data like agy's rename map, one reader selects tools for both hosts and reads a name in any case, one builder words the unmatched-matcher warning. A Kiro str_replace edit now carries what it put and what it replaced. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ro-post-tool-and-stop-hooks Kiro reads a matcher through the shared hostToolNamesMatching and warns through the shared matcherNamesNoToolWarning, with no copy of either. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd-stop-hooks # Conflicts: # scripts/__tests__/fixtures/hook-payloads/README.md
blafourcade
marked this pull request as ready for review
November 25, 2026 19:02
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What & why
Delivers Kiro's
PostToolUseandStophooks, not onlySessionStart. Refs #1347.🛠️ How it works
SessionStart,PostToolUse,Stop.host-kiro.cjslists the written file forfs_writeandstr_replace, carries the command ofexecute_bash, and continues the turn atStopwith a{"decision":"block","reason":...}on stdout (documented for the Agent Stop trigger, https://kiro.dev/docs/hooks/types/).|matcher as a regex, so the plugin string cannot go through verbatim): Write, Edit and Delete becomewrite, Bash, Shell and PowerShell becomeshell. A name Kiro has no tool for selects nothing and the hook is skipped with a warning. The matcher is read through the shared plugin hook shape; Kiro holds only its name-to-tag entries.<plugin>-<trigger>-<script>, with-writeor-shellappended for a matched PostToolUse hook.scripts/__tests__/fixtures/hook-payloads/kiro-PostToolUse.json(fs_write,read_file,execute_bash,str_replace),kiro-Stop.json.path.resolveof a relative path, and thefs_write-without-text branch. Not from a Kiro capture.docs/COMPATIBILITY.mdis not edited here. The PR that owns it takes the replacement text for its Kiro lines, so this PR does not close the issue.🧪 How to verify
make validatepnpm exec lefthook run pre-commit --all-filescd cli && pnpm exec lefthook run pre-push(9925 passed, 1 expected fail, 15 skipped; the OpenCode event-bridge flake failed once, rerun green)cd cli && pnpm build(bundle 881.7 KB, budget 897 KB, +2.5 KB over 879.2 KB)Test-first: the matcher, edit and shell tests were written first and failed on the missing matcher, the unlisted edited file and the missing command. Mutations of the shell tag, the trigger guard, the tag dedupe, and each name-to-tag entry (
edit,delete,powershell) turn their own test red.Limits, not coded as workarounds:
PostToolUsehook did not reach the model (every shape tried, two models). A fix needed after a write is not deliverable on this host.delete_file,fs_appendandexecute_pwshappear only in the vendor docs: no payload captured, so Delete and PowerShell matcher names rest on the docs' tool families.stopActiveis always false: no payload field marks a continuation. No Stop loop was seen on 3.6.0..kiro/hooks/*.jsonand is unprobed; its docs say hook stdout reaches the agent.PostToolUseandStop. Two identical hooks in two files both ran; the home plus project case is unprobed.✅ I certify
🤖 Generated with Claude Code