Agent hooks support various trigger types, each designed for specific automation scenarios. Understanding these types helps you choose the right approach for your workflow needs.
Not all hook triggers are available on every surface. Some triggers are specific to the IDE (task execution) or CLI (agent spawn). The table below shows what's supported where.
| Trigger | IDE | CLI | Web |
|---|---|---|---|
| Prompt Submit | ✓ | ✓ | — |
| Agent Stop | ✓ | ✓ | — |
| Agent Spawn | — | ✓ | — |
| Pre Tool Use | ✓ | ✓ | — |
| Post Tool Use | ✓ | ✓ | — |
| File Create | ✓ | ✓ | — |
| File Save | ✓ | ✓ | — |
| File Delete | ✓ | ✓ | — |
| Pre Task Execution | ✓ | — | — |
| Post Task Execution | ✓ | — | — |
| Legacy Manual Hook | Legacy only | — | — |
Triggers when the user submits a prompt.
When using the shell command action, the user prompt can be accessed via the USER_PROMPT environment variable.
Use Cases:
Triggers when the agent has completed its turn and finished responding to the user.
This is useful for running post-processing tasks like code compilation, testing, formatting, or cleanup after the agent's response.
Use Cases:
Runs when the agent is first activated. No tool context is provided.
{ "hook_event_name": "agentSpawn", "cwd": "/current/working/directory", "session_id": "abc123-def456-789" }
Exit Code Behavior:
Use Cases:
Triggers when the agent is about to invoke a tool. Can validate and block tool usage.
In the Tool name field, provide the names of the specific tools for which this hook should execute. You can specify multiple entries. The following built-in categories are supported:
You can also use prefix filters to target tools by source:
Prefixes starting with @ are matched by regex, so you can use patterns like @mcp.*sql.* to match specific MCP tools by name.
You can ask Kiro for the names of the available tools.
Use Cases:
Triggers after the agent has invoked a tool, with access to tool results.
For details on the Tool name field, refer to the Pre Tool Use section above.
Use Cases:
Triggers when the agent creates new files matching specific patterns in your workspace.
Use Cases:
Triggers when the agent saves or modifies files matching specific patterns.
Use Cases:
Triggers when the agent deletes files matching specific patterns.
Use Cases:
Triggers before a spec task begins execution, when its status changes to in_progress.
Use Cases:
Triggers after a spec task completes execution, when its status changes to completed.
Use Cases:
Manual Hooks created in IDE 0.x continue to appear in the Agent Hooks panel with a legacy label. Enabled legacy manual Hooks remain runnable using the play button next to the Hook name or Start Hook in the Hook view.
Legacy manual Hooks don't have a v1 trigger equivalent, and you can't create a new Manual-trigger Hook. For a new on-demand workflow, create a manually included Steering file; it runs as a /<filename> slash command.
For MCP tools, the tool name includes the full namespaced format including the MCP server name:
{ "hook_event_name": "preToolUse", "cwd": "/current/working/directory", "session_id": "abc123-def456-789", "tool_name": "@postgres/query", "tool_input": { "sql": "SELECT * FROM orders LIMIT 10;" } }
This applies to both Pre Tool Use and Post Tool Use hooks when targeting MCP server tools.
Hook types