> ## Documentation Index
> Fetch the complete documentation index at: https://kiro.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration guide

> Step-by-step guide to migrate from Kiro CLI 2.x to V3

Follow these steps in order to upgrade from CLI 2.x to V3.

## 1. Start V3 and keep V2 sessions available

Start a V3 session in the workspace you want to migrate:

```bash
kiro-cli --v3
```

V3 uses a different session store from V2. Existing V2 sessions are not converted or deleted when you try V3. Run `kiro-cli chat --v2 --resume-picker` when you need to return to a V2 session; use `/sessions`, `--resume`, or `--resume-id` to continue V3 sessions.

If you need an external record of an important conversation, open it with the harness that created it and run `/chat save <path>`. Treat the exported file as an archive unless you have verified that the target harness can load it.

## 2. Run `/upgrade-agent`

From the V3 session, run the conversion and review its diagnostics before editing files manually:

```text
> /upgrade-agent
> /upgrade-agent diagnostics
```

The command backs up selected profiles, converts compatible permission and Hook fields, and reports anything that needs manual attention. Complete those manual steps from the report. Run `/upgrade-agent` again after changing V2 trust settings so the generated V3 rules stay current. If the selection menu shows an out-of-sync agent, review [Upgrading agent configs](https://kiro.dev/docs/cli/v3/upgrade-agent.md) before rebuilding it because that action overwrites manual V3 edits.

### Review migrated Hooks

`/upgrade-agent` converts an object-form `hooks` map to a flat array of Hook documents. It preserves legacy camelCase trigger strings as accepted compatibility aliases. Use PascalCase when you hand-author or revise the migrated definitions. Move Hooks that should run independently of a profile into standalone `.kiro/hooks/*.json` files, and update the five CLI lifecycle triggers:

| CLI 2.x | CLI V3 |
|---------|--------|
| `agentSpawn` | `SessionStart` |
| `userPromptSubmit` | `UserPromptSubmit` |
| `preToolUse` | `PreToolUse` |
| `postToolUse` | `PostToolUse` |
| `stop` | `Stop` |

CLI V3 also supports `PostFileCreate`, `PostFileSave`, and `PostFileDelete` for agent-made file changes, plus `PreTaskExec` and `PostTaskExec` around spec task execution. Manual Hooks are a legacy IDE 0.x feature. See [Hooks migration](https://kiro.dev/docs/cli/v3/hooks-migration.md) for the current CLI schema, matcher behavior, global Hook location, and a complete before-and-after example.

## 3. Review converted permissions

Review the `permissions` rules created by `/upgrade-agent`, then apply any remaining changes below. Resolve every warning before using the migrated profile in CI.

For CI pipelines, `--trust-all-tools` grants session-wide approval. For narrower headless approval, `--trust-tools` accepts exact V3 tool IDs. You can also create `~/.kiro/settings/permissions.yaml` with capability-specific `allow` rules in your CI environment.

**Session overrides that remain in V3:**

```bash
kiro-cli chat --v3 --no-interactive --trust-all-tools "Run the CI task"
kiro-cli chat --v3 --no-interactive --trust-tools=read_file,grep_search "Review this repository"

/tools trust-all
```

In V3, `--trust-tools` is honored only with `--no-interactive`; the interactive terminal UI ignores it. CLI 2.x accepts its own tool names.

**New approach** (`~/.kiro/settings/permissions.yaml` for user scope):

```yaml
rules:
  - capability: shell
    match: ["git *", "npm *", "npx *"]
    effect: allow

  - capability: fs_write
    match: ["src/**", "tests/**"]
    effect: allow

  - capability: fs_read
    effect: allow

  - capability: mcp
    match: ["my-server/*"]
    effect: allow
```

For the full reference — behavioral changes, scope definitions, and pattern conversion table — see [Permissions migration →](https://kiro.dev/docs/cli/v3/permissions.md).

## 4. Review remaining agent config fields

`/upgrade-agent` preserves supported profile fields and converts known `tools` and `toolsSettings` entries. Review its output and diagnostics before using the profile:

- The `tools` field now uses category tags or direct selectors. Step 6 maps common CLI 2.x names by destination.
- `toolsSettings` and `allowedTools` become capability-based `permissions.rules`.
- Profiles can remain JSON or use Markdown with YAML frontmatter and a body system prompt.
- Fields such as `excludedTools`, `includeMcpJson`, `includePowers`, `resources`, `permissions`, and `welcomeMessage` are optional.

**Migrating `toolsSettings` to `permissions`:**

| V2 `toolsSettings` | V3 `permissions` rule |
|--------------------|----------------------|
| `execute_bash.allowedCommands: ["^git status$"]` | `` |
| `execute_bash.deniedCommands: ["^rm -rf"]` | `` |
| `execute_bash.denyByDefault: true` | `` |
| `fs_read.allowedPaths: ["src/**"]` | `` |
| `fs_read.deniedPaths: [".env"]` | `` |
| `fs_write.allowedPaths: ["src/**"]` | `` |

> **Note:** V2 `allowedCommands` and `deniedCommands` used regex patterns. V3 permissions use globs: remove anchors such as `^` and `$`, replace `.*` with `*`, and rewrite complex regexes as multiple rules.

See [Agent config changes](https://kiro.dev/docs/cli/v3/agent-config.md) for complete JSON and Markdown examples, current fields, embedded MCP servers, and format guidance. If the profile contains Hooks, review their converted array or move profile-independent automation to a standalone file as described in [Hooks migration](https://kiro.dev/docs/cli/v3/hooks-migration.md).

## 5. Replace the CLI 2.x AWS tool with an MCP server

The CLI 2.x structured AWS tool (`use_aws`, preferred alias `aws`) is not a V3 built-in. Configure an AWS MCP server instead. The managed remote AWS MCP entry in the [MCP server registry](https://kiro.dev/docs/mcp/servers.md) uses this configuration:

**`.kiro/settings/mcp.json`:**

```json
{
  "mcpServers": {
    "aws-mcp": {
      "url": "https://aws-mcp.us-east-1.api.aws/mcp",
      "disabled": false
    }
  }
}
```

Review the server's IAM access before using it, and use the registry for current setup options.

## 6. Update tool references by destination

V3 uses different identifiers for agent-profile selection, permission policy, and runtime matching. Do not substitute one namespace for another.

### Agent-profile `tools` entries

The `tools` field accepts category tags and selected direct tool IDs:

| Accepted CLI 2.x names | V3 selector | Selector kind |
|------------------------|-------------|---------------|
| `fs_read`, `fsRead`, `read`, `grep`, `glob`, `code`, `introspect` | `read` | Category tag |
| `fs_write`, `fsWrite`, `write` | `write` | Category tag |
| `execute_bash`, `execute_cmd`, `executeCmd`, `shell` | `shell` | Category tag |
| `web_fetch`, `web_search` | `web` | Category tag |
| `agent_crew`, `use_subagent`, `subagent` | `subagent` | Category tag |
| `knowledge` | `knowledge` | Direct tool ID |

`/upgrade-agent` rewrites the CLI 2.x task-list names (`task`, `todo`, `todo_list`) to `todo_list`, but CLI V3 has no task-list tool, so that entry selects nothing. Remove it from the converted profile.

### Permission rules

The `capability` field uses operation classes, not profile tags or tool IDs:

| CLI 2.x tool family | V3 permission capability |
|---------------------|--------------------------|
| `fs_read`, `fsRead`, `read`, `grep`, `glob`, `code`, `introspect` | `fs_read` |
| `fs_write`, `fsWrite`, `write` | `fs_write` |
| `execute_bash`, `execute_cmd`, `executeCmd`, `shell` | `shell` |
| `web_fetch` | `web_fetch` |
| `web_search` | `web_search` |
| `agent_crew`, `use_subagent`, `subagent` | `subagent` |

`knowledge` has no generated per-tool capability mapping. Define rules for the operations the workflow actually performs instead of inventing a capability name.

### Hook matchers and serialized runtime references

V3 `PreToolUse` and `PostToolUse` matchers accept a tool selector (a V3 tool ID, a category tag, `@builtin`, `@mcp`, `@<server>`, `@<server>/<tool>`, or a `*`/`?` wildcard) or a regular expression. A matcher that contains regex metacharacters is evaluated only as an unanchored regex against the internal tool ID. `/upgrade-agent` rewrites known CLI 2.x names to the matching tag; use this table when you hand-author a matcher:

| CLI 2.x matcher | V3 Hook matcher |
|-----------------|-----------------|
| `fs_read`, `fsRead`, `read` | `read` (tag; also covers `grep_search`, `file_search`, `code`, `introspect`) or `^(read_file\|list_directory)$` |
| `grep` | `grep_search` |
| `glob` | `file_search` |
| `fs_write`, `fsWrite`, `write` | `write` (tag) or `^(fs_write\|fs_append\|str_replace\|delete_file)$` |
| `execute_bash`, `execute_cmd`, `executeCmd`, `shell` | `shell` (tag) or `execute_bash` (also matches `execute_pwsh`) |
| `web_fetch` | `web_fetch` |
| `web_search` | `remote_web_search` |
| `code` | `code` |
| `introspect` | `introspect` |
| `use_aws`, `aws` | No V3 built-in; match the configured MCP tool with `@<server>/<tool>` or its internal `mcp_<server>_<tool>` ID |

The headless `--trust-tools` flag uses exact internal V3 tool IDs in a comma-separated list, not selectors or regexes—for example, `--trust-tools=read_file,grep_search`. See the [tool catalog](https://kiro.dev/docs/tools.md) for profile tags and built-in IDs, [Permissions](https://kiro.dev/docs/permissions.md) for capabilities, and [Hook types](https://kiro.dev/docs/hooks/types.md#pre-tool-use) for matcher behavior.

## 7. Validate your migration

1. From your shell, validate each migrated agent configuration:

   ```bash
   kiro-cli agent validate --path .kiro/agents/my-agent.json
   ```

2. Start or return to a V3 session in the migrated workspace. Run `/config` and `/hooks` to confirm Kiro loaded the expected agents, permissions, and Hooks.

3. Exercise representative commands to verify the approval behavior you intended.

Resolve every conversion warning or validation error before using the configuration in CI.

## Next steps

- [Permissions migration](https://kiro.dev/docs/cli/v3/permissions.md) — detailed guidance on migrating trust flags to `permissions.yaml`
- [Hooks migration](https://kiro.dev/docs/cli/v3/hooks-migration.md) — full trigger mapping and new format reference
