Loading image...Kiro

Product

  • About Kiro
  • IDE
  • CLI
  • Web
  • Mobile
  • Pricing
  • Downloads

For

  • Enterprise
  • Startups
  • Students

Community

  • Overview
  • Ambassadors
  • Discord
  • Events
  • Powers
  • Shop
  • Showcase

Resources

  • Docs
  • Blog
  • Changelog
  • FAQs
  • Report a bug
  • Suggest an idea
  • Billing support

Social

Site TermsLicenseResponsible AI PolicyLegalPrivacy PolicyCookie Preferences
Loading image...Kiro
  • CLI
  • IDE
  • Web
  • Mobile
  • Enterprise
  • Pricing
  • Docs
SIGN INDOWNLOADS
Loading image...Kiro

Get Started

InstallationAuthenticationYour first project

Models

OverviewAvailable modelsReasoning effort

Features

How Kiro works
Specs
Steering
Hooks
MCP
Permissions
Custom agents
Agent Skills
Powers
CompactionKiroignoreCheckpoints and rewind
Built-in tools
Configuration scopes

IDE 1.x

What's new in 1.0
Setup & First Run
Editor
Chat
Experimental
Troubleshooting0.x reference

CLI

What's new in 3.0
Setup & First Run
Terminal UI
Chat
Headless modeACPAuto complete
Experimental
2.x reference

Web - Preview

Setup & First RunIdentity Center
Connect your repositories
Working with the agent
Autonomous modeAutomations
Sandbox

Mobile - Preview

Overview

Commands and Reference

CLI commandsSlash commandsBuilt-in toolsExit codesSettingsIDE keyboard shortcuts

Billing

OverviewManaging your subscriptionUpgrading your planDowngrading your planCancelling your planPurchasing add-on creditsManaging your paymentsManaging usage notificationsManaging your taxesContacting billing supportDeleting your accountRelated questions

Enterprise

ConceptsOnboarding quickstart
Connecting your identity provider
Subscribe your teamManage subscriptions
Governance
Monitor and track
SettingsManaged updatesBillingIAMSupported regions

Privacy and Security

OverviewData protectionCode referencesCompliance validationInfrastructure securityIAM permissionsFirewalls, proxies, and data perimetersVPC endpoints (AWS PrivateLink)

Guides

Overview
Language support
Learn by playing

Migration

Migrating from Q DeveloperMigrating from VSCodeUpgrading from Q CLI
  1. Docs
  2. CLI
  3. 2.x reference

CLI 2.x reference


This page documents CLI 2.x behavior for users who haven't yet migrated to 3.0. For the current format, see the Features documentation.

Hooks

In CLI 2.x, hooks were embedded directly in the agent configuration file rather than in standalone files.

Format

json
{ "hooks": { "agentSpawn": [{"command": "echo 'starting'", "matcher": ".*"}], "preToolUse": [{"command": "npm run lint", "matcher": "Write|Edit"}], "fileEdited": [{"command": "prettier --write", "matcher": "\\.ts$"}] } }

Each trigger name maps to an array of hook definitions. Each definition has:

FieldDescription
commandShell command to execute
matcherRegex pattern for filtering (what it matches depends on the trigger)

Available triggers

TriggerFires whenmatcher matches
agentSpawnAgent is activatedNot evaluated
userPromptSubmitUser submits a promptNot evaluated
preToolUseBefore a tool executesTool name
postToolUseAfter a tool executesTool name
fileEditedAfter a file is writtenFile path
fileCreatedAfter a new file is createdFile path
agentStop / stopSession endsNot evaluated

Hook communication

Hooks receive context as JSON via STDIN and communicate results through exit codes:

  • Exit code 0: Hook succeeded. STDOUT is captured.
  • Exit code 2: (preToolUse only) Block tool execution. STDERR is returned to the agent.
  • Other exit codes: Hook failed. STDERR is shown as a warning.

What changed in 3.0

  • Hooks moved from embedded agent config to standalone .kiro/hooks/*.json files
  • Trigger names changed to PascalCase (e.g., agentSpawn → SessionStart)
  • New version: "v1" schema with name, description, enabled, and timeout fields
  • New triggers added: PreTaskExec, PostTaskExec, PostFileDelete, Manual
  • {{filePath}} template variable available for file-related triggers
  • stop hook gained Block Decision support (return {"decision": "block"} to continue the session)

For the full migration guide, see Hooks migration.

Permissions and tool trust

In CLI 2.x, tool permissions were managed through CLI flags, slash commands, and per-tool settings in agent config. In 3.0, this is replaced by structured permissions.yaml files.

CLI flags

bash
kiro-cli --trust-all-tools kiro-cli --trust-tools shell,write

Slash commands

CommandDescription
/toolsShow current permission status for all tools
/tools trust <tool>Trust a specific tool for the session
/tools untrust <tool>Revert a tool to per-request confirmation
/tools trust-allTrust all tools (equivalent to /acceptall)
/tools resetReset all runtime permissions to defaults

Per-tool settings in agent config (toolsSettings)

json
{ "toolsSettings": { "shell": { "allowedCommands": ["git *", "npm *"], "deniedCommands": ["rm -rf *", "sudo *"] }, "read": { "allowedPaths": ["src/**"], "deniedPaths": ["*.env"] } } }
SettingDescription
allowedCommandsRegex patterns for auto-approved shell commands
deniedCommandsRegex patterns for blocked shell commands
allowedPathsRegex patterns for auto-approved file paths
deniedPathsRegex patterns for blocked file paths
autoAllowReadonlyAuto-approve read-only shell commands (e.g., git status)
denyByDefaultBlock all tools unless explicitly allowed

Shell command trust levels (interactive)

When the agent requested a shell command, a tiered picker appeared:

text
Press (↑↓) to navigate (⏎) to select scope > Full command → git pull --rebase Partial command → git pull * Base command → git * Entire Tool → *

Trusted patterns persisted for the session and were stored as regex in allowedCommands.

Read and write path trust levels (interactive)

When the agent needed to access a file outside the working directory:

text
Press (↑↓) to navigate (⏎) to select scope > Specific paths → ~/.config/app/settings.json Complete directory → ~/.config/app Entire Tool → *

What changed in 3.0

  • toolsSettings replaced by permissions.yaml with capability/match/effect rules
  • --trust-all-tools still works as a session-scope override but permissions.yaml is preferred
  • Regex patterns replaced by glob patterns (.* → *, \.ts$ → *.ts)
  • Separate per-tool deny was independent; now deny-always-wins across all scopes
  • autoAllowReadonly removed — explicitly list allowed commands
  • denyByDefault removed — use exclude patterns instead
  • Interactive trust levels and /tools commands still available for session-level management

For the full migration guide, see Permissions migration.

Compaction

In CLI 2.x, compaction behavior was the same as 3.0:

  • /compact for manual trigger
  • Automatic trigger when context window overflows
  • Creates a new session with compacted context; resume original via /chat resume
  • Configurable via compaction.excludeMessages and compaction.excludeContextWindowPercent

No changes in 3.0 for this feature.

Custom agent config

In CLI 2.x, agent configs were JSON-only with embedded toolsSettings and hooks.

Format

.kiro/agents/my-agent.json:

json
{ "name": "my-agent", "description": "A development agent", "prompt": "file://resources/MY_PROMPT.md", "model": "claude-sonnet-4", "tools": ["fs_read", "fs_write", "execute_bash", "grep", "glob", "code"], "toolsSettings": { "execute_bash": { "allowedCommands": ["^git status$", "^cargo build[^&;]*$"], "deniedCommands": ["^rm -rf"], "denyByDefault": false }, "fs_read": { "allowedPaths": ["src/**", "docs/**"], "deniedPaths": [".env", "secrets/**"] }, "fs_write": { "allowedPaths": ["src/**"], "deniedPaths": ["*.lock"] } }, "resources": ["file://AGENTS.md"], "hooks": { "agentSpawn": [{ "command": "git status", "description": "Add git context" }] }, "welcomeMessage": "Hello! How can I help?" }

What changed in 3.0

  • Markdown format added (.md files with YAML frontmatter + body as system prompt)
  • toolsSettings removed — replaced by permissions field with capability-based rules
  • hooks moved to standalone .kiro/hooks/*.json files
  • New fields: excludedTools, includeMcpJson, includePowers, permissions, welcomeMessage
  • Tags system — tool names simplified to short categories (read, write, shell, web, @mcp, @builtin, *)
  • resources field now supports skill:// URIs in addition to file://

For the current format reference, see Custom agents.

Page updated: August 4, 2026
Delegate
Web - Preview