Repository navigation
Conversation
Kiro IDE agent hooks -> shared hook-to-OTLP emitter. New kiro_ide adapter: SessionStart/SessionEnd -> session, UserPromptSubmit/Stop -> turn (keyless), Pre/PostToolUse -> FIFO-paired tool spans (ERROR when tool_response.success is false), Pre/PostTaskExec -> spec task, PostFile* -> file events. Prints nothing on stdout (Kiro adds hook stdout to the agent context). Payload shapes follow kiro.dev/docs/hooks and the payload builder shipped in Kiro IDE 1.2.37; hook templates match its v1 hook-file schema. Adds the .kiro/hooks templates, install.sh, run_e2e.sh, the docs page and nav entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…H-8286) Remove gating hooks, preserve state across SessionEnd, guard shell commands, and add missing-emitter/resume coverage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use the global emitter path in the user template and keep the fail-open guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…/th-8286-kiro-ide Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pen turn (TH-8286) - Every shipped command (project and user hook file, page snippet) is the canonical subshell guard `(python3 -B <emit.py> kiro_ide <Trigger> 2>/dev/null || true)` with the trigger on argv: exit 0 and no output when the emitter or python3 is missing, and the payload reaches python3 on stdin or as a trailing heredoc (the bare `|| true` form fed a heredoc to `true`; the project file also had a doubled `|| true || true`). - tests/test_kiro_ide_hooks_config.py runs every shipped command through sh/zsh/bash/dash with the payload on stdin and as a heredoc: emitter missing, python3 missing, installed (project and --user from another workspace); asserts exit 0, empty stdout, payload received verbatim, no __pycache__, plus the unparenthesized-heredoc regression. - SessionEnd (Kiro runtime unload, same session id reloaded later) now also closes a still-open turn (kiro.turn.ended_by=SessionEnd) so its tool spans never point at a parent that is never exported; session state and turn numbering are kept. Tests: reload continues at turn-2 under the same root, mid-turn SessionEnd, spec-task retry keeps both attempts, error text with a path and user name absent by default. - install.sh refuses when the Kiro CLI recipe's hook file is in the project or ~/.kiro/hooks (both surfaces load both files), refuses a foreign same-named file, says when an existing hook file is stale, documents uninstall; env-file wording softened. - Page: guard explained (exit 2 / Stop exit 1 / stdout to context), Windows cmd.exe caveat, matcher in the snippet, stale Pre/Post timing and user_decision text removed, SessionEnd and incomplete-turn rows match the code, CLI warning covers --user and both directions, Uninstall section. - Fixture: dropped PreToolUse/PreTaskExec lines the recipe never registers; run_e2e.sh HOOK_TRANSPORT=stdin|heredoc runs the installed commands. - Merged the foundation head 9b77d51 (emit.py prints nothing on failure). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rofile (TH-8286) Kiro CLI sessions that use an agent profile running the Kiro CLI recipe's hooks (its --agent-profile setup) also load the Kiro IDE hook file, so they would be exported twice. The installer cannot know where that agent is used, so it warns and names the profile in ~/.kiro/agents (or $KIRO_HOME/agents) or the project's .kiro/agents. This is the reverse order of the Kiro CLI installer's new --agent-profile refusal. Test and page updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Kiro, live-agent verification (TH-8286) Co-Authored-By: Claude Opus 5.5 <[email protected]>
nik13
marked this pull request as ready for review
October 21, 2026 22:18
Resolve src/lib/navigation.ts by keeping main's catalog-driven Integrations sidebar; the page is listed through src/lib/integrations.mjs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
This branch has not been deployed
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.
Summary
Kiro IDE agent session tracing (TH-8286), on the shared hook-to-OTLP emitter from #912.
examples/coding-agents/hook-to-otlp/adapters/kiro_ide.py+ contract tests + hook-config tests + fixture (tests/fixtures/kiro_ide/session.jsonl)examples/coding-agents/kiro-ide/(.kiro/hooks/fi-hook-to-otlp.jsonproject and global templates,install.sh,run_e2e.sh)src/pages/docs/integrations/coding-agents/kiro-ide.mdx, nav entry after// coding-agents:kiro-ideSpan tree:
Kiro IDE session->Kiro IDE turn(UserPromptSubmit..Stop) -> completed tool spans (PostToolUse; ERROR whentool_response.successis false),Spec task(PostTaskExec),File created/saved/deleted. Observe-only: the gating triggersPreToolUseandPreTaskExecare not registered, so tool and spec-task spans have no duration. The adapter prints nothing on stdout (Kiro adds hook stdout to the agent context).Every shipped command is the canonical guarded subshell, with the trigger on argv:
Exit 0 and no output when the emitter or python3 is missing (Kiro blocks a prompt on exit 2 and keeps the agent working on a Stop exit 1), and the payload reaches python3 on stdin or as a trailing heredoc.
Checked against the real Kiro IDE 1.2.37 (macOS arm64, installed under the workspace, not /Applications)
kiro.kiro-agentextension builds{session_id, hook_event_name, cwd}plusprompt/tool_name/tool_input/tool_response/spec_name/task_name/task_success/file_path/reasonper trigger; the fixture follows that builder.spawn(command, {shell: true})(/bin/sh -con macOS/Linux,cmd.exeon Windows, which the page marks untested), cwd = the first workspace folder, payload on stdin. Exit-code handling read from the bundle: exit 2 on UserPromptSubmit/PreToolUse/PreTaskExec blocks, Stop exit 1 means "keep working", exit-0 stdout on SessionStart/UserPromptSubmit goes to the agent context.version: "v1",hooks[]with name/trigger/matcher/action{type:command,command}/timeout).SessionEndas unavailable in the IDE. The 1.2.37 extension fires it, but on session runtime teardown (chat closed, window reloaded, app quit; the loader logs "loaded session runtime teardown"), and reloads the same session id later. So it is not mapped to a terminal session end: it closes a still-open turn (kiro.turn.ended_by=SessionEnd) and keeps the session state, and a reopened chat continues in the same trace at the next turn number.How to run
E2E evidence (local Future AGI)
Round 2 (2026-10-15, head of this PR):
run_e2e.shinstalled the recipe into a temp project withinstall.shand ran the shipped hook-file commands through$SHELL -c, payload on stdin and as a heredoc. Every hook exit 0, empty stdout.Project
th8103-coding-kiro-ide, traces85f34d04-3c45-79cb-2570-474f4a8e8dd6(stdin) ande1a51bfe-940c-3d1c-de01-cfa21ad6569c(heredoc), both:Unit tests: full suite 83 OK (core + Cursor + Kiro IDE, incl. 11 hook-config/installer tests across sh/zsh/bash/dash). Docs build and audit-links pass (0 broken nav/content links).
Privacy proof
/Users/paths, 0 occurrences of the local user name or host name. A test feeds a failed tool response with a path and user name and asserts it is absent by default (status message is the fixed "tool reported failure").FI_HOOK_CAPTURE_CONTENT=1(projectth8103-coding-kiro-ide-content, tracec2c355ce-c5e6-3689-fcc9-567c5025e170, heredoc transport): prompt on the turn's input, tool input/output and the failed tool's response present.cwdand theUSER_PROMPTenv var are never read or exported.Verification (2026-10-20)
How others support Kiro: Langfuse (hooks; IDE, CLI) and Arize Phoenix (CLI hooks, page) trace Kiro via hooks; no page found for the other vendors. Same mechanism as this PR.
.kiro/hooks/*.jsonschema and payloads) ran this recipe's commands: projectth8103-livefill-th8286tracesd703c81e-7824-12a4-dd9a-e960367542d3(5 spans) and2af17236-3ebc-574f-176e-5f2a4daa3a06(7 spans, incl. File created/saved, fs_write);fi_verifyPASS. Content opt-in projectth8103-livefill-th8286-contenttracefcc83d74-665f-419d-a673-81bce429a0f7, PASS./Users/, user and host name,input.value; opt-in: markers present, user name 0.Caught error reading: ENOENT ...), not{success:false}; the adapter now marks it ERROR with the fixed message (new test; suite 84 OK).PostTaskExec,SessionEndteardown,sh -cfrom the workspace folder) stay doc/extension-derived. Pushed 6291fa6; docs build + audit-links pass.Limitations (on the page)
No model, tokens, cost, model-call spans, tool call ids or tool duration in this observe-only recipe; manual saves do not fire file hooks; Kiro Web/cloud sessions do not run hooks; enterprise daily OTel metrics are not used. Kiro CLI V3 also loads
.kiro/hooks/and~/.kiro/hooks/, so CLI sessions in a project with this file (or anywhere after--user) are labelled Kiro IDE. The installer refuses when the Kiro CLI recipe's hook file (#928) is in the project or in~/.kiro/hooks/, since both files would fire in every session, and warns when a Kiro CLI agent profile runs the Kiro CLI emitter (CLI sessions using that agent load this file too). Native Windows is not tested.Review fixes
Round 1 (9f04e51, c575f98): PreToolUse/PreTaskExec dropped; SessionEnd no longer terminal; spec tasks completion-only; troubleshooting and "tested with" wording.
Round 2 (this push):
( ... 2>/dev/null || true)with-Band the trigger on argv in both templates and the page (the project file also had a doubled|| true || true).tests/test_kiro_ide_hooks_config.py: every shipped command through sh/zsh/bash/dash, payload on stdin and as a heredoc; emitter missing, python3 missing, installed project and--user(run from another workspace); exit 0, empty stdout, payload verbatim, no__pycache__; regression showing the unparenthesized form loses a heredoc payload; installer refusal and stale-file cases.user_decisiontext removed, SessionEnd and incomplete-turn rows match the code, CLI warning covers--userand both directions, softened env-file wording, Uninstall section.Round 3 (e134c66): #928's
install.sh --agent-profilenow refuses when this recipe is in~/.kiro/hooks(a session that uses an agent profile still loads every standalone hook file). For the reverse order, this installer now warns when a Kiro CLI agent profile in~/.kiro/agents(or$KIRO_HOME/agents, nested,.jsonor.md) or the project's.kiro/agentsruns the Kiro CLI emitter, and names the profile. It warns rather than refuses because it cannot know where the agent is used. New test (fails against the round-2 installer); the page's "Kiro CLI in the same project" warning says the same.Optional follow-up (not a merge blocker)
Tracker status: DONE (replicated), since the real Kiro CLI 2.31.1 session above ran this recipe's hook file. Optional: sign in to Kiro IDE once and run one IDE chat with the installed hook file, to confirm one trace with session -> turn -> tool spans, prompt absent by default, and when
SessionEndfires (chat close vs app quit). The page already states the IDE app itself was not run.🤖 Generated with Claude Code