# Kiro CLI adapter

Shows the sessions of Kiro CLI, the program `kiro-cli`, in the notch: working, done at the end of a turn, needing you while a permission prompt waits in the terminal, what the tool in use does, its first prompt, its repository and its branch as its name, its tool calls as steps and how many subagents it runs. A permission prompt of Kiro CLI comes to Blossom first, and you can allow or reject it from the notch.
Kiro CLI reports through hooks: each hook posts its event with `curl` to a Unix socket in your own folder, `~/Library/Application Support/Blossom/kiro/socket`, where this adapter listens. Blossom launches the adapter.
The hooks are one file of Blossom's own in the global hooks folder of Kiro CLI, `~/.kiro/hooks/blossom.json`. You can try them in one folder, or install them for every session.

**This adapter was written from the documentation of Kiro and was never run against a real Kiro CLI.** What is documented and what is only supposed is in [../../documentation/roadmap/kiro.md](../../documentation/roadmap/kiro.md); the checks at the end say what to look at.

You need:

- Blossom. It includes this adapter and the Bun that runs it; from a clone, `bun run build` makes one.
- Kiro CLI 3.4.0 or later, signed in, running its V3 sessions, the default since 3.0.0. The global hooks folder is read only by V3, and the permission hook needs 3.4.0. The hooks follow [Hooks](https://kiro.dev/docs/hooks/) and [Hook types](https://kiro.dev/docs/hooks/types/) as they read on 2 December 2026.
- `curl`, which every hook runs by its full path, `/usr/bin/curl`, `ps`, which the hook of a prompt runs as `/bin/ps`, and a POSIX shell. macOS ships them. Which shell Kiro CLI runs a hook with is not documented; the hooks were tested with `sh`, `bash` and `zsh`.

## Connect from Blossom

The quickest way. Blossom finds `kiro-cli` on your Mac, and connecting it is one click: "Continue" on the second step of the introduction, with Kiro CLI checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and writes the hooks of `adapters/kiro/hooks.json` to `~/.kiro/hooks/blossom.json`, a file of its own. Kiro CLI reads every `.json` file of `~/.kiro/hooks` and runs their hooks beside those of the project, so no file of yours is touched.

When the file is missing, Blossom creates it, and the folders above it, readable by you alone. When it is there, Blossom keeps a copy of it in `~/Library/Application Support/Blossom/backups/kiro/`, named after the moment in UTC, before it writes; it writes the new content to a file next to it and moves it into place, so a failure halfway leaves the file as it was. A hook you add to the file yourself stays, before Blossom's. "Repair" in the row puts the hooks back when they are missing or not the ones this Blossom installs. "Disconnect", shown while the agent is off, takes the adapter out of Blossom and its hooks out of the file, which then holds `{"version": "v1", "hooks": []}` and stays. Blossom does not follow `KIRO_HOME`: a Kiro CLI that uses another folder does not read the file. What Blossom writes and why is in [the decision](../../documentation/decisions/connecting.md).

## Run Blossom with the adapter

From the root of the clone:

```sh
bun install && bun run bootstrap && bun run build
BLOSSOM_CONFIGURATION=adapters/kiro/configuration.json apps/macos/build/Build/Products/Debug/Blossom.app/Contents/MacOS/Blossom
```

`bootstrap` installs the toolchain the build needs; see [../../documentation/contributing.md](../../documentation/contributing.md).

The notch shows nothing until a session of Kiro CLI reports. Run one Blossom at a time: the adapter holds the socket, and the adapter of a second Blossom logs `cannot listen for the hooks of kiro cli` and exits.

### From Finder

An app opened from Finder reads `~/Library/Application Support/Blossom/configuration.json`. Name the adapter by its package, which Blossom includes, so neither a path nor Bun is needed:

```json
{ "adapters": [{ "package": "kiro" }] }
```

If the file already exists, add the adapter to its `adapters` list instead.

## Try it in one folder

Kiro CLI also reads the hooks of a project from `.kiro/hooks/*.json`. So try the hooks in a folder made for it, and nothing of yours changes:

```sh
cd "$(mktemp -d)"
mkdir -p .kiro/hooks && cp "<absolute path of the clone>/adapters/kiro/hooks.json" .kiro/hooks/blossom.json
kiro-cli
```

What you should see:

- Nothing when the session opens. The tile appears next to the notch with the first prompt, named after the first line of that prompt and the repository, `blossom · Fix the flaky notch tests`, with its branch beside it.
- No badge while it works, and the tool in use in live.
- A request panel when Kiro CLI would ask you to allow a tool: Allow or Reject there. If you answer nothing for sixty seconds, the panel leaves, the prompt shows in the terminal as usual, and the tile turns amber until the session moves on.
- The green badge when a turn ends.
- The tile gone when the session ends.

## Install by hand

For a clone without the app. The file is Blossom's own, so there is nothing to merge. The copy never overwrites a file that is there:

```sh
mkdir -p ~/.kiro/hooks && cp -n adapters/kiro/hooks.json ~/.kiro/hooks/blossom.json
```

## Remove by hand

After an install by hand; after connecting from Blossom, Disconnect does it, and removing Blossom takes out the hooks of every tool, see [Removing it](../../documentation/privacy.md#removing-it). Check that the file holds nothing but Blossom's hooks, which name the socket, and delete it:

```sh
jq -e '[.hooks[]? | select((.action.command // "") | contains("Blossom/kiro/socket") | not)] | length == 0' ~/.kiro/hooks/blossom.json && rm ~/.kiro/hooks/blossom.json
```

If `jq` prints `false`, someone added a hook of their own to the file: take out only the entries whose `action.command` names `Blossom/kiro/socket`.

## What to know

- **A permission is answered in Blossom first.** Kiro CLI runs the `PermissionRequest` hook after its permission policy and just before it would show a prompt, and only then: a call your rules allow or deny never reaches Blossom. The hook waits for your answer for sixty seconds at most; Kiro CLI gives it sixty-five. Allow lets the call run without the prompt; Reject blocks it and tells the agent `Rejected in Blossom.`. Each answer is for that one call; Kiro CLI keeps no rule from it.
- **A request shows its title, and nothing of what it would do.** Kiro documents the input of no tool but `read_file`, and says only that the `permission` of the payload carries "whichever of `capability`, `resource`, `command`, and `paths` apply", not what each holds. So the request carries no command and no change of a file for the panel, and "Show what a request would do" changes nothing for Kiro CLI.
- **A minute to answer, then the terminal.** A request not answered in Blossom within sixty seconds leaves the panel, the hook ends without a decision, and Kiro CLI shows its prompt as usual. The session then needs you until its next event. That the terminal shows nothing while the hook waits is supposed, not seen.
- **Answering in the terminal.** If Kiro CLI shows its prompt while the hook waits, and you answer there, the request leaves the panel when the tool finishes, at the end of the turn or the next prompt, or after sixty seconds at the latest.
- **What Blossom cannot answer.** Kiro CLI does not ask the hook about a policy deny, a protected path, or a prompt of your organization or its administrators; those wait for you in the terminal, and the session does not show that it needs you.
- **A session shows up with its first prompt or its first permission.** An open session with nothing typed shows nothing, and so does a session that was already running when Blossom started, until its next prompt.
- **The name comes from the first prompt and the repository.** The first line of the first prompt is the title, cut to 60 characters, and stays; a prompt that starts with `/` or `!` titles nothing. The project is the repository and the branch of its folder, read from `HEAD` and the pointers of `.git` at most once every five seconds, without running `git`. See [../../documentation/decisions/names.md](../../documentation/decisions/names.md).
- **Steps are tool calls, saying what they do.** Each call of a tool is a step, from its `PreToolUse` to its `PostToolUse`; two calls of the same tool are paired with their ends oldest first, since Kiro CLI gives a call no identifier. A step whose `tool_response` says `"success": false` is failed, and one still running when the turn ends is shown failed. A step is the verb and the name of the file of `read_file`, `fs_write`, `fs_append`, `str_replace` and `delete_file`, never its folder or its content; words for the other tools of Kiro, `Running a command` for `execute_bash` and never the command; and `Using <server>` for a tool of an MCP server. Nothing a tool printed is reported.
- **Subagents are counted while the calls that dispatch them run.** Kiro CLI has a `SubagentStop` and no start, so the count is the number of `invoke_sub_agent` calls under way. The end of a turn sets it to zero.
- **An interrupted turn.** What Kiro CLI sends when you interrupt a turn is not documented. If no `Stop` comes, the session stays working until its next prompt or its end.
- **The hooks send the whole payload, and the adapter keeps a few fields.** Each hook sends its payload as it came, with your prompt, the input and the output of tools. The adapter keeps the identifier of the session, the event, the title taken from the first line of the prompt, the name and the input of the tool, whether it failed and the folder; the input of a tool is kept only to pair a request with the call that ran, and dropped when the turn ends. The title of a permission request shows the command or the file it is for, since that is what you allow. Nothing else of your prompt or of a tool is kept, logged or sent to Blossom.
- **Only the permission hook prints, and every hook succeeds.** Kiro CLI adds what a hook of `UserPromptSubmit` prints to the context of the agent, and reads what other hooks print as a decision. Every hook but that of a permission sends everything to `/dev/null`, and every hook ends with `|| /usr/bin/true`, so with Blossom closed every tool still runs and nothing reaches the agent. The permission hook prints only what the adapter answers, with `--fail`, so an error prints nothing and Kiro CLI shows its prompt.
- **The hook of a prompt finds the terminal of its session.** Before it posts, the hook of `UserPromptSubmit` walks up its processes with `/bin/ps`, sixteen at most, for the terminal device and the processes above it, and reads the variables terminal programs and multiplexers set, such as `TERM_PROGRAM`, `__CFBundleIdentifier`, `TMUX_PANE` and `KITTY_WINDOW_ID`. Which shell and which environment Kiro CLI gives a hook are not documented: if the environment is not the one Kiro CLI started with, only the device and the processes arrive. Every variable is named with a default, so a shell that refuses unset variables runs it. It sends each value in a header only when it is short and of plain characters, and Blossom keeps it in memory, shows it nowhere, and uses it to bring that terminal forward when you ask. It adds about 50 ms to a prompt, and to no other hook. Hooks connected before this version need Repair in Settings > Agents.
- **The hooks ignore your curl configuration.** `-q` keeps `curl` from reading `~/.curlrc` and its siblings.
- **Without Blossom, Kiro CLI works as before.** With Blossom closed nothing listens on the socket: each hook gives up at once, prints nothing and ends without an error. When the adapter is alive but does not answer, every event waits one second and a permission request sixty, with no decision at the end.
- **A session whose `kiro-cli` was killed leaves within seconds, if the process is the one supposed.** Every hook names the process that started its shell, in the header `Blossom-Process`. The adapter watches a process only once two events in a row name it, and every five seconds asks the system whether it still exists. That this process is `kiro-cli` for the whole session is supposed, not seen.
- **The socket is yours alone.** It lives in a folder only your user can open. A process that runs as you can still post events to it, or listen on it while Blossom is closed and read the payloads, your prompts included, or answer a permission request. See [../../documentation/decisions/socket.md](../../documentation/decisions/socket.md).
- **Sixty-four sessions at most.** When a sixty-fifth starts, the adapter closes the one it heard from least recently.
- **The hooks find the socket through `$HOME`.** A session started with another `HOME` does not report.

### Not confirmed

Written from the documentation, never seen in a run:

1. Which shell runs a hook, and that `$PPID` is the `kiro-cli` process for the whole session.
2. That the global `~/.kiro/hooks` loads in every folder, and whether a file added while a session runs is read before the next session.
3. That `hook_event_name` is the trigger in PascalCase. The page of a camelCase alias shows `agentSpawn`; the adapter reads either.
4. What `SessionEnd` carries; the adapter needs only `session_id`.
5. The input of the tools of Kiro other than `read_file`: that a command comes in `command` and a file in `path`. If not, a step falls back to the words of its tool, and a request shows the whole input.
6. That the terminal shows no prompt while the permission hook waits, and that a hook ended by its timeout leaves the prompt as usual.
7. Whether the tools of a subagent fire the hooks of its session, and with which `session_id`.
8. That Kiro CLI reads `{"version": "v1", "hooks": []}`, as Disconnect leaves the file, without a complaint.
9. That the local command sandbox of Kiro, which wraps the commands of the agent, leaves hooks out, so they reach the socket.
10. Where the install script puts `kiro-cli` on macOS. Blossom looks in `~/.local/bin`, where it goes on Linux, in `/opt/homebrew/bin`, where Homebrew links it, and in the `PATH` of your login shell.
11. That the environment of a hook holds the variables of the terminal `kiro-cli` runs in.

## Checks by hand

The adapter was tested with its hook commands run by `sh`, `bash` and `zsh` against the socket, with payloads written from the pages of Kiro, never captured from a run. Each check below needs `kiro-cli` 3.4.0 or later, signed in. Write down what the line in italics asks.

Prepare once. To see the raw payloads first, make a folder whose hooks log what they receive, and remove it afterwards:

```sh
T=$(mktemp -d) && cd "$T" && mkdir -p .kiro/hooks && echo "$T"
jq -n --arg log "$T/events.log" '{version: "v1", hooks: (["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "PostToolUse", "Stop", "SubagentStop", "SessionEnd"] | map({name: ("log " + .), trigger: ., action: {type: "command", command: ("{ /bin/echo \"" + . + " process $PPID shell $0\"; /bin/cat; /bin/echo; } >> " + $log + " 2>/dev/null; /usr/bin/true")}}))}' > .kiro/hooks/logger.json
kiro-cli
```

1. **The payloads.** Ask `hi`, then `run the shell command ls`, allow it, and quit. *Is every event of `events.log` followed by one line of JSON with `session_id` and `hook_event_name`, and what does `hook_event_name` say? Does `UserPromptSubmit` carry `prompt`?*
2. **The shell and the process.** In a second terminal, `ps -ax -o pid,ppid,command | grep '[k]iro-cli'`. *Which shell does the log name, and is the process on every line the `kiro-cli` of the session, the same for the whole session?*
3. **The tools.** Ask Kiro CLI to write a file, edit it and delete it. *Which fields does `tool_input` carry for `execute_bash`, `fs_write`, `str_replace` and `delete_file`, and does `PostToolUse` carry `tool_response` with `success`?*
4. **A permission.** Ask `read the file /etc/hosts` with no allow rule for `read_file`. *Is there a `PermissionRequest` with `tool_name`, `tool_input` and `permission`, and does the terminal show its prompt only after the hook ends?*
5. **A subagent.** Ask for a task Kiro CLI hands to a subagent. *Do the tools inside fire `PreToolUse` with the `session_id` of the session or another one, and does `SubagentStop` follow?*
6. **An interrupt.** Ask `count from 1 to 300, one number per line` and interrupt it. *Which event follows: `Stop`, or none?*

Then run Blossom with the adapter and connect Kiro CLI, which writes `~/.kiro/hooks/blossom.json`. Delete the folder of the logger.

7. **A turn.** In a new folder, start `kiro-cli` and ask `hi`. *Does the tile appear with the prompt, titled `hi` and named after the new folder, with no badge, and turn green when the answer ends?*
8. **A tool.** Ask `run the shell command sleep 5` and allow it. *Does live show `Running a command`, does detail list it as a step, and does the tile turn green at the end?*
9. **Allow.** Ask `read the file /etc/hosts`. *Does a request panel show `read_file /etc/hosts`, with nothing in the terminal?* Allow it. *Does the read run without a prompt?*
10. **Reject.** Ask it again in a new session and reject it. *Is the call blocked, and does the agent say it was rejected?*
11. **No answer.** Ask it again and wait sixty seconds. *Does the panel leave, the prompt show in the terminal, and the tile turn amber until you answer there?*
12. **A subagent.** Ask for a task handed to a subagent. *Does peek show one running subagent while it works?*
13. **The end.** Quit `kiro-cli`. *Does the tile leave at once?* Start it again, ask `hi`, and `kill -9` its process from another terminal. *Does the tile leave within about five seconds?*
14. **Quitting Blossom.** Quit Blossom, ask `hi`, then `read the file /etc/hosts`. *Does the answer carry nothing from a hook, and does the prompt show in the terminal at once?*
15. **Disconnect.** Disconnect Kiro CLI in Settings > Agents. *Does `~/.kiro/hooks/blossom.json` hold `{"version": "v1", "hooks": []}`, does a new session no longer show, and does `/hooks` in Kiro CLI show no error for the file?*
16. **The terminal of a session.** Send a prompt from Terminal, one from iTerm and one inside tmux. *Does each prompt start as quickly as before, with no hook warning?*
