Skip to content

kiro-cli v3: SessionStart hooks run when the first prompt is sent, not when the session starts #12109

Open

Description

@peepeepopapapeepeepo

Before opening, please confirm:

Operating System

Amazon Linux 2023 (x86_64)

Kiro Version

kiro-cli 2.34.0 (agent engine V3), interactive kiro-cli chat

Bug Description

An agent's SessionStart hooks do not run when kiro-cli chat --agent <name> opens the session. They run only when the user sends the first prompt. A hook meant to prepare the session (log the start, load project status, warm a cache) therefore runs late, and does not run at all if the user only uses slash commands or ! shell escapes.

Steps to Reproduce

  1. In an empty folder, create .kiro/agents/hookagent.json:
    {"name":"hookagent","description":"two SessionStart hooks","prompt":"You are terse.","tools":["read"],
     "permissions":{"rules":[{"capability":"fs_read","effect":"allow"}]},
     "hooks":[{"name":"a","trigger":"SessionStart","action":{"type":"command","command":"echo \"$(date +%T) hook-A\" >> /tmp/hook.log"}},
              {"name":"b","trigger":"SessionStart","action":{"type":"command","command":"echo \"$(date +%T) hook-B\" >> /tmp/hook.log"}}]}
  2. Run : > /tmp/hook.log; kiro-cli chat --agent hookagent and trust the workspace.
  3. Wait 25 seconds without typing. In another terminal, run cat /tmp/hook.log. Observed: empty.
  4. Send any prompt, for example Reply with only OK., and check the log again.

Observed in one run: session ready at 08:07:32; log still empty after 25 s idle; prompt sent at 08:08:27; log then shows 08:08:28 hook-A and 08:08:28 hook-B. A second prompt adds nothing, so the hooks run once per session, but at the first prompt.

Expected Behavior

SessionStart hooks run when the session is created, before the first prompt. If first-prompt timing is intended, the hooks documentation should say so, because the trigger name says "session start".

Conversation ID

No response

Additional Context

Activity

  1. github-actions commented on Oct 25, 2026

    @github-actions

    Thanks for opening this issue and for the detailed reproduction steps! You've clearly identified that SessionStart hooks are firing on the first prompt rather than when the session is actually created, which is a meaningful distinction. A maintainer will take a look at this shortly — we appreciate you helping us make Kiro's hook behavior match what developers expect! 🙌

  2. AnilMaktala commented on Oct 26, 2026

    @AnilMaktala
    Contributor

    Thanks for raising this.

    An agent's SessionStart hooks are firing when the first prompt is sent rather than when kiro-cli chat --agent <name> opens the session. This breaks use cases where hooks are meant to prepare the session environment before any user interaction, such as logging session metadata or setting up context.

    Marking this as a bug to investigate further.

  3. added theissue type on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions