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.
In CLI 2.x, hooks were embedded directly in the agent configuration file rather than in standalone files.
{ "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:
| Field | Description |
|---|---|
command | Shell command to execute |
matcher | Regex pattern for filtering (what it matches depends on the trigger) |
| Trigger | Fires when | matcher matches |
|---|---|---|
agentSpawn | Agent is activated | Not evaluated |
userPromptSubmit | User submits a prompt | Not evaluated |
preToolUse | Before a tool executes | Tool name |
postToolUse | After a tool executes | Tool name |
fileEdited | After a file is written | File path |
fileCreated | After a new file is created | File path |
agentStop / stop | Session ends | Not evaluated |
Hooks receive context as JSON via STDIN and communicate results through exit codes:
.kiro/hooks/*.json filesagentSpawn → SessionStart)version: "v1" schema with name, description, enabled, and timeout fieldsPreTaskExec, PostTaskExec, PostFileDelete, Manual{{filePath}} template variable available for file-related triggersstop hook gained Block Decision support (return {"decision": "block"} to continue the session)For the full migration guide, see Hooks migration.
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.
kiro-cli --trust-all-tools kiro-cli --trust-tools shell,write
| Command | Description |
|---|---|
/tools | Show 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-all | Trust all tools (equivalent to /acceptall) |
/tools reset | Reset all runtime permissions to defaults |
{ "toolsSettings": { "shell": { "allowedCommands": ["git *", "npm *"], "deniedCommands": ["rm -rf *", "sudo *"] }, "read": { "allowedPaths": ["src/**"], "deniedPaths": ["*.env"] } } }
| Setting | Description |
|---|---|
allowedCommands | Regex patterns for auto-approved shell commands |
deniedCommands | Regex patterns for blocked shell commands |
allowedPaths | Regex patterns for auto-approved file paths |
deniedPaths | Regex patterns for blocked file paths |
autoAllowReadonly | Auto-approve read-only shell commands (e.g., git status) |
denyByDefault | Block all tools unless explicitly allowed |
When the agent requested a shell command, a tiered picker appeared:
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.
When the agent needed to access a file outside the working directory:
Press (↑↓) to navigate (⏎) to select scope > Specific paths → ~/.config/app/settings.json Complete directory → ~/.config/app Entire Tool → *
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.* → *, \.ts$ → *.ts)autoAllowReadonly removed — explicitly list allowed commandsdenyByDefault removed — use exclude patterns instead/tools commands still available for session-level managementFor the full migration guide, see Permissions migration.
In CLI 2.x, compaction behavior was the same as 3.0:
/compact for manual trigger/chat resumecompaction.excludeMessages and compaction.excludeContextWindowPercentNo changes in 3.0 for this feature.
In CLI 2.x, agent configs were JSON-only with embedded toolsSettings and hooks.
.kiro/agents/my-agent.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?" }
.md files with YAML frontmatter + body as system prompt)toolsSettings removed — replaced by permissions field with capability-based ruleshooks moved to standalone .kiro/hooks/*.json filesexcludedTools, includeMcpJson, includePowers, permissions, welcomeMessageread, write, shell, web, @mcp, @builtin, *)resources field now supports skill:// URIs in addition to file://For the current format reference, see Custom agents.
CLI 2.x reference