Skip to content

KAS backend: standalone hook files (.kiro/hooks/*.json) never run in dashboard sessions, while kiro-cli chat --agent-engine v3 runs the same files #26568

Open

Description

@wowzoo

Existing issues

  • I searched open issues and this is not already reported.

Related, but none of them covers this case:

This report is about the KAS backend and the v3 JSON hook files that KAS itself reads.

KiroCrew version

0.11.0

Release channel

Not sure

How is it installed?

Desktop app

Platform

Not platform-specific

What happened

On the KAS backend, hooks from standalone hook files do not run in a dashboard session. This applies to the project's <project>/.kiro/hooks/*.json and to the user's ~/.kiro/hooks/*.json. The sessions I tested showed no notice in the chat. Crew's turn loop does not fire them either, because it fires only the agent spec's hooks field (ACP_BACKENDS_CREW_FIRES_SPEC_HOOKS). So these files run nowhere.

Opening the same project in a terminal with kiro-cli chat --agent-engine v3 runs them: all five probe triggers, the AI-DLC hooks and the user-level hooks. That terminal session uses the same kiro-cli 2.37.0 (KAS 0.66.70) and the same files.

Expected: a dashboard KAS session runs the same hooks that the same agent runs under kiro-cli chat --agent-engine v3. Failing that, the session should say that they will not run.

Impact: AWS AI-DLC v2 (tested with 2.11.2) ships its five hooks as standalone .kiro/hooks/aidlc-*.json files. As #5462 describes, its human-approval gates depend on the UserPromptSubmit hook aidlc-record-human-turn. In the dashboard KAS sessions I tested, that hook did not run, so those gates cannot see that the person replied. This is the #5462 symptom, now on KAS. I did not run a full gated workflow end to end. If KAS becomes the default backend, any AI-DLC user of the dashboard would be affected.

Evidence. Counts are ContextualHookInvoked records in each session's ~/.kiro/sessions/<hash>/<sess>/messages.jsonl. All five sessions record agentMode: "aidlc" and reference the same project (in B0 and B2 only through rootPaths; see the table):

Session Opened by _meta.kiro.customAgents workspacePaths Hooks run
A terminal kiro-cli chat (v3 session store, kiro-cli 2.36.0; terminal inferred from the absence of Crew-injected context) — project 17
C terminal kiro-cli chat --agent-engine v3 (2.37.0) — project 12
B dashboard, KAS (2.37.0) 1 entry (aidlc) project 0
B2 dashboard, KAS, new chat (2.37.0) 1 entry ~/.kiro/crew/workspace 0
B0 dashboard, KAS (started around the 2.36.0 → 2.37.0 auto-update) 1 entry ~/.kiro/crew/workspace 0
  • C's 12 hooks are 4 project probe hooks, 4 AI-DLC hooks and 4 from a user-level ~/.kiro/hooks/*.json. In B, B2 and B0 the user-level file ran 0 times too, so this is not only about project files.
  • C shows that the same engine (kiro-cli 2.37.0 / KAS 0.66.70) runs these files when it is started from the terminal. What differs is the dashboard ACP path, not the engine version.
  • In B, both the KAS process's cwd and the session's workspacePaths are the project, and it still ran 0 hooks.
  • The workspace is trusted: ~/.kiro/workspace-roots/<hash>/permissions.yaml has workspaceTrusted: true.
  • The difference I can see in session.json is that every dashboard session (B, B2, B0) carries the agent in _meta.kiro.customAgents and has no modeId, executionTarget or settings. Both terminal sessions (A, C) carry modeId: "aidlc", executionTarget and a settings block, and no customAgents. I cannot tell from outside whether customAgents is the cause or just one symptom of "the client is Crew".

What the 0.11.0 source says:

  • acp/types.py (KAS_CLIENT_CAPABILITIES): hooks stays undeclared because "Kiro Crew's own turn loop already fires every hook event this surface can serve for a KAS session". In practice that covers spec hooks only.
  • agent_sdk/backends_routing.py (ACP_BACKENDS_CREW_FIRES_SPEC_HOOKS): "KAS takes its agent over the wire and the customAgents schema has no slot for them". acp/kas_agents.py lists "hooks" in UNSUPPORTED_SPEC_KEYS.
  • Exercise the ACP hooks wire shapes against a live KAS agent once #13223 says announcing hooks would make KAS "stop loading the user's own .kiro/hooks/*.json". That reads as if KAS loads them while the capability is unannounced, but in a customAgents session it runs none of them.

Steps to reproduce

Environment: KiroCrew 0.11.0 desktop app, macOS 26.7.2, kiro-cli 2.37.0 (KAS 0.66.70). The project's .kiro/settings/cli.json sets "chat.agentEngine": "v3". Note that plain kiro-cli chat on 2.37.0 starts the v2 engine. There it could not find the project agent and also ran 0 hooks, so the --agent-engine v3 flag in step 4 matters.

Starting state: a trusted project (workspaceTrusted: true) with a Markdown agent in .kiro/agents/*.md that has no hooks field. Mine is .kiro/agents/aidlc-aidlc.md with frontmatter name: aidlc.

  1. Add .kiro/hooks/zz-probe.json to that project. This is a simplified version of the probe I used; mine also logged $PWD and capped stdin at 600 bytes:

    {
      "version": "v1",
      "hooks": [
        {
          "name": "probe-prompt",
          "trigger": "UserPromptSubmit",
          "action": {
            "type": "command",
            "command": "/bin/sh -c 'echo \"$(date +%T) UserPromptSubmit parent=$(ps -o comm= -p $PPID)\" >> /tmp/probe.log; cat >> /tmp/probe.log; echo >> /tmp/probe.log'"
          },
          "timeout": 10
        }
      ]
    }

    Optionally, add the same entry for SessionStart, PreToolUse, PostToolUse and Stop. Run the command once by hand to confirm it can write, then empty /tmp/probe.log before each session below.

  2. Select the KAS backend: Settings → Agent Harness → Kiro Agent (agent.acp_backend: kas). Open a new chat on that project with that agent and ask it to run date. I did not test a built-in agent.

  3. /tmp/probe.log gets no lines.

  4. Empty /tmp/probe.log. In a terminal, run cd <project> && kiro-cli chat --agent-engine v3, check that the status line shows the agent aidlc, and ask it to run date.

  5. /tmp/probe.log now has an entry for each trigger you added. Asking for date covers all five, because the turn includes a tool call and ends with Stop. Each entry shows parent=…/kiro-cli/node, so KAS ran it. Each stdin carries session_id, hook_event_name and cwd, plus prompt or tool_name / tool_input.

Observed in both dashboard KAS sessions I measured on 2.37.0. In B, an existing chat, I waited for the hook file to be picked up and then made several tool calls, a prompt and a turn end. B2 was a new chat that ran date once.

Relevant log output

Searching the gateway log for "hook" finds no line about these sessions or these files. The relevant difference between a dashboard session (B) and a terminal session (C) in session.json → _meta.kiro:

B (dashboard KAS):  { "customAgents": [ { "id": "aidlc", "description": "...", "prompt": "...", "tools": ["read","write","shell","invoke_sub_agent","orchestrate_subagent"] } ] }
C (terminal v3):    { "modeId": "aidlc", "executionTarget": { "kind": "local" }, "settings": { ... } }

Anything else

Possible approaches. Either of the first two would make the hooks run. The third only makes the gap visible until then.

  1. Have Crew's turn loop also fire standalone hook files for KAS sessions: the session project's .kiro/hooks/*.json and ~/.kiro/hooks/*.json, with the trigger, stdin and exit-code handling Crew already applies to spec hooks. Project files should only run in a trusted workspace. Tying them to KAS's workspace-trust decision may address the trust concern raised on Support project-level .kiro/hooks/*.kiro.hook (event-triggered hooks) in KiroCrew #1487.
  2. Complete the deferred wire path from Exercise the ACP hooks wire shapes against a live KAS agent once #13223: announce hooks and answer _kiro/hooks/list, _kiro/hooks/sessionStart and _kiro/hooks/executeHook (already in acp/kas_wire.py) from those files.
  3. Meanwhile, extend the feat(hooks): tell a claude or codex session its agent hooks do not run #19165 notice to KAS, so a new session says when standalone hook files exist that this backend will not run.

Separately: a new dashboard KAS chat records workspacePaths: ["~/.kiro/crew/workspace"] and lists the project only in rootPaths (B0, B2). If project hook discovery uses workspacePaths, project hooks could stay blocked even after fix 1 or 2. I have not verified this.

Workaround today: run AI-DLC from a terminal with kiro-cli chat --agent-engine v3.

Also observed (happy to file separately):

  • On agent.acp_backend: kiro, a project-local Markdown agent (.kiro/agents/*.md) is not among the advertised modes; the list holds only user-level agents. The session is refused with Agent mode 'aidlc' is not available on this session. The failed runtime was already gone when I looked. Its sibling runtimes run as kiro-cli acp --agent <view> with no --agent-engine flag and cwd ~/.kiro/crew/workspace.
  • The gateway logs Skipping oversized confined skill file: <project>/.kiro/skills/aidlc/SKILL.md for a 63,612-byte project skill, so the skill body is dropped. I found no trace of this outside that log line, and I could not find the size cap.

Activity

  1. added
    tier:T1
    on Oct 31, 2026
  2. KiroCrewCaptain commented on Oct 31, 2026

    @KiroCrewCaptain
    Collaborator

    Thanks for the report. This issue has been triaged by Crew Captain and will be assigned to a maintainer, who will follow up here.

  3. chenmingwei23 commented on Oct 31, 2026

    @chenmingwei23
    Contributor

    A draft PR for part of this is up: #26873.

    It makes the user's own standalone ~/.kiro/hooks/*.json files run in a dashboard Kiro Agent (KAS) session, through the same hook path (and the same gates) the backend already uses, so they behave the way kiro-cli chat --agent-engine v3 runs them. Only command actions on the known triggers run; anything else is skipped.

    The project half — <project>/.kiro/hooks/*.json — still does not run, and the PR does not change that. A project hook is a command from a checkout, and running it needs a workspace-trust decision that is a maintainer call rather than something this change should make on its own. For now a session with such project files shows a short notice saying they are withheld.

  4. bolichen97 commented on Nov 5, 2026

    @bolichen97
    Contributor

    [operator: bolichen97] Picking this up since it has been quiet for a while; @chenmingwei23 shout here if you are still on it.

  5. bolichen97 commented on Nov 5, 2026

    @bolichen97
    Contributor

    [operator: bolichen97] #26873 makes your own ~/.kiro/hooks/*.json files run in a dashboard KAS session. The project half, <project>/.kiro/hooks/*.json, still does not run: running a command from a checkout needs a design sign-off from a maintainer, so this issue stays open for it.

    We keep this request open so that others can find it. It is not on the current plan. If you need it too, add a thumbs-up reaction to this issue; we look at the most requested items first.

  6. added
    parked
    on Nov 5, 2026
  7. CaiYirun commented on Nov 7, 2026

    @CaiYirun

    +1 on the project half. Adding a concrete case where this is a blocker, not a nice-to-have.

    Impact. Our team commits .kiro/hooks/*.json to the repo as a mandatory part of the development process: a PreToolUse guard that blocks hand-editing generated files and risky commands such as oxlint --fix, and a Stop hook that lints and format-checks the files changed in each turn. In a Crew session (0.12.0, KAS backend) none of the project hooks run, so for anyone working through Crew the team's guardrails are silently absent. kiro-cli and the IDE run the same files after a workspace-trust prompt, so behaviour differs by tool.

    Cause. acp/session_mcp.py::_project_mcp_trusted() always returns False, and its docstring says that stays so until a consent exists. Nothing in settings or the dashboard changes the answer.

    Workaround we use. Copy the hooks into ~/.kiro/hooks/ (which #26873 makes run) and call the repo scripts with a relative path guarded by if [ -f ./scripts/... ]. Two gotchas worth documenting:

    • A regex matcher such as ^(execute_bash|fs_write)$ is silently dropped (log: matcher contains disallowed characters or is too long, skipping). Only [A-Za-z0-9_.*-] is accepted, so each tool needs its own entry.
    • It has to be done by hand by every team member and can drift from the repo copy.

    What would unblock us. A per-project consent in the dashboard (like the project-skills consent), or a config list such as agent.trusted_project_dirs, so a user can explicitly allow .kiro/hooks for a checkout they trust. Happy to test a build.

  8. wowzoo commented on Nov 11, 2026

    @wowzoo
    Author

    Re-measured on 0.12.1 (backend BUILD 20261026), macOS 26.7.3 arm64, kiro-cli 3.2.0, with AI-DLC's kiro-ide hooks (2.11.3 and a 2.11.4 preview):

    • Project hook files still run 0 times in a dashboard session. aidlc doctor says "AIDLC hooks have not run in this project yet", and with AI-DLC's hook debug on, no hook record is written. This holds on agent.acp_backend: kas and on kiro. With a kiro-cli that offers v3, the kiro pick runs on KAS anyway (KIRO_SELECTION_BACKEND, docs/coming-from-kiro-cli.md), so there is no backend to fall back to.
    • The fallback this issue asked for now holds: each session opens with the notice "This project has hook files in .kiro/hooks that do not run in this session: …".
    • User-level files do run now (fix(kas): run the user's ~/.kiro/hooks/*.json files on the KAS backend #26873). Copying AI-DLC's hook files into ~/.kiro/hooks made Crew fire AgentSpawn, UserPromptSubmit and Stop. That is still not a workaround for AI-DLC, for two reasons:
    • So AI-DLC in a dashboard chat still stops at its first /aidlc request (it keeps the request and asks to continue under kiro-cli --v3).
  9. wowzoo commented on Nov 23, 2026

    @wowzoo
    Author

    Rechecked on 2026-11-22 with Kiro Crew 0.13.1 (desktop, macOS), KAS, kiro-cli 3.5.0 and AI-DLC 2.11.4. In a fresh project the selected folder agent declares no inline hooks; its five v1 hook files are under .kiro/hooks/. The chat showed the standalone hook-files notice, offered no Turn on, and ran zero project hooks, so AI-DLC kept the first /aidlc request for a restart before the workflow began. Could the folder consent and command preview added in 0.13 also cover standalone <project>/.kiro/hooks/*.json files? (Putting the same hooks in the agent file is not an option for us: Kiro IDE ignores an agent that declares hooks.) This run stopped before any hook command ran, so it did not retest #35290.

  10. wowzoo commented on Nov 27, 2026

    @wowzoo
    Author

    @bolichen97 Here is a concrete design that extends 0.13's folder consent, using the fingerprint and checked scan now on main, so it can be judged before anyone writes code. Line numbers are at main 74aab4b.

    Where it stands. Crew lists a checkout's standalone .kiro/hooks/*.json files for the session notice (project_hook_file_names, agent_sdk/spec_hooks.py:801) but never loads them; user_hook_files (:886) reads only the user hooks directory. Since #33578, Crew does read a per-folder decision for commands from a checkout, project_hooks_consent.hooks_enabled (project_hooks_consent.py:257): the owner's Turn on / Turn off, else kiro-cli's saved workspace trust, else off. #40099 binds a Crew on to a fingerprint of the hooks it approved, and consented_project_hooks (:269) returns the hooks from the same scan it checked, which its caller fires.

    Proposal. Let that same decision cover a folder's standalone hook files too, and keep every check those hooks already meet.

    1. Consent. Add each standalone file's name and hooks array to the scan behind the fingerprint (_scan, :128), and fire the files from the hooks consented_project_hooks returns for that checked scan. A folder without standalone files then keeps its on, and one with them asks again. A grant that still has no fingerprint should not adopt files it never covered; today a first read adopts the current scan (:206-213).
    2. Loading. Convert the files through the document path user_hook_files uses (command actions on the five triggers, the _MAX_SPEC_HOOKS cap, the per-digest cache), confined to the checkout. Fire them with the standalone-file payload that ~/.kiro/hooks files get, under a governance name of their own, so a checkout file cannot match a rule written for a personal hook. Unlike that loader, which skips a file it cannot parse, a consented file that cannot be read or parsed should block tool calls, as unreadable agent spec hooks do today (dashboard/chat_turn/turn_spec_hooks.py:1011). On channel turns they should behave like a folder agent's own hooks, not like ~/.kiro/hooks files, which a turn without the Hooks page's hooks leaves out of its observer events (messaging/tool_hooks.py:86).
    3. Notice. Keep the 11-22 Dismiss notice whenever the files are withheld in a session. Offer the Turn on / Turn off row (ProjectHooksNotice) for a folder with standalone files even when the selected agent declares no hooks; today that row needs a folder agent with non-empty hooks (agent_sdk/kas_project_hooks.py:87). The preview should list the commands from both sources, and when kiro-cli's trust starts them, the once-per-folder notice with Turn off should say so.
    4. Approval. Withhold auto-approval for these files' PreToolUse matchers only in sessions on their own checkout. pre_tool_hook_matchers (acp/kas_agents.py:1367) takes no checkout today, so a session in another folder must not inherit them. The same holds for sub-agent, channel and task-runner turns.
    5. Cron. The same rule as a folder agent's own hooks in cron tabs (feat: run folder agent hooks on human turns in cron tabs #39439, feat: run folder sub-agent hooks on human turns in cron tabs #41308, and the 2026-11-15 decision), including its exceptions.

    Out of scope: hook PATH (#35290, #41132), hashing the scripts a hook runs, and Windows paths (#27853). The matcher grammar stays a separate point, as you said in #34395, but it is the next thing AI-DLC's own files would hit: its guard and sub-agent matchers are regular expressions (one is 203 characters), and the converter accepts only names and globs up to 200 characters (agent_materialization/kiro_hooks.py:49), so those two hooks would be dropped even with consent. I measured that drop on 0.13.1 when I copied the same hooks into a folder agent.

    What I measured meanwhile. With a lab AI-DLC harness that uses only what 0.13.1 offers today (a folder agent with hooks, Turn on, sub-agents through invoke_sub_agent), an express and a feature workflow each ran once to the build-and-test gate in a KAS dashboard chat. So the hook path works; this proposal is about letting the shipped Kiro distribution use it without a KiroCrew-only layout.

    One question. A Crew on is bound to the hook definitions, but kiro-cli's trust is saved per path, so under kiro-cli's trust alone an edited file would run without a new click. #33578 accepted that for the selected agent's own hooks. Should kiro-cli's saved trust also start standalone hook files, including when the selected agent declares no hooks, or should these files need an explicit Turn on in Crew?

  11. sssjjf commented on Nov 27, 2026

    @sssjjf

    In the latest version(0.13.1) of Kirovcrew, this issue still exists. When I set a project level hook, in the Kirocrew dashboard session, this hook will never run and display information “This project has hook files in .kiro/hooks that do not run in this session: Crew cannot read this backend's workspace-trust decision, so it does not run commands from a project checkout. Your own ~/.kiro/hooks files still run.“
    I think it is very necessary to trust project level hooks and unify the behavior of kiro cli, kiro ide, and kirocrew

  12. added
    P2
    on Nov 27, 2026
  13. buluoray commented on Dec 4, 2026

    @buluoray
    Contributor

    Draft fix for the project half: #46918. A folder's own .kiro/hooks/*.json files run on KAS after Turn on for that folder in Crew; kiro-cli's trust alone does not start them. With AI-DLC's five Kiro hook files, SessionStart, UserPromptSubmit and Stop run after Turn on. Its PreToolUse guard and sub-agent log hook use regex matchers, which are still dropped: tracked in #46900.

  14. buluoray commented on Dec 4, 2026

    @buluoray
    Contributor

    Decision on the KAS project hook files notice (#26568, #46918). This supersedes in part the 2026-11-22 ruling on #37944 (#37944 (comment)).

    • On KAS, a folder's own .kiro/hooks/*.json files run under the same trust as a project agent file's hooks (feat(kas): run a folder agent's own hooks when the folder is turned on or trusted in kiro-cli #33578, decision C): the owner's Turn on in Kiro Crew, bound to a fingerprint of the hooks, or kiro-cli's trust of the folder. This matches kiro-cli, which runs them in a trusted folder.
    • On KAS the "hook files in .kiro/hooks that do not run in this session" notice is no longer written; its sentence is no longer true there. The folder hooks row (Turn on / Turn off, Show commands) lists the hook files too, in its existing states, with agent file dropped and the verb agreeing with the subject (gives for one source, give for two). Rows already in a chat's history keep their Dismiss link.
    • When a turned-on folder has a hook file Kiro Crew cannot read, the folder is blocked: its tool calls are refused with the project's .kiro/hooks files could not be read, and the row reads Kiro Crew can't read {path}, so tool calls here are blocked. Turn off to unblock. kiro-cli is not affected. It offers only Turn off.
    • Known limit, as in decision C: an agent that can write kiro-cli's trust record can turn a folder's hooks on without a click. mcp.protect_kiro_permission_rules keeps the agent's file-edit tools from writing that record.

    Rows before and after: https://github.com/user-attachments/assets/48ef1292-a4ff-4457-b70c-06f535379005, https://github.com/user-attachments/assets/889e2901-2409-487e-b5fc-582a3ba908cd. Blocked row: https://github.com/user-attachments/assets/5c68d0b9-4594-45b6-91c2-e39b4114d0c3, https://github.com/user-attachments/assets/ee282591-3fbe-48a8-b30c-fd996cf47a85.

  15. buluoray commented on Dec 4, 2026

    @buluoray
    Contributor

    Follow-up to #26568 (comment): the blocked row's wording in #46918 changed after that review.

    • The row now reads Kiro Crew can't read {path}: {reason}. Tool calls here are blocked until it can. kiro-cli is not affected. {path} is the first file that did not read, relative to the folder; {reason} is the operating system's short reason (for example Permission denied), and the : {reason} part is left out when there is none.
    • The refusal a tool call gets now reads the project's {path} could not be read: {reason}.
    • Turn off stays as a control, but the row no longer points to it: it names the cause, and the folder unblocks by itself once the file reads again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2parkedtier:T1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions