How It Works
The preset model, the init/add/update/restore lifecycle, merge semantics, conflict resolution, and backups.
The Preset Model
A preset is a self-contained collection of Kiro IDE configuration files. Each preset targets a specific development context (frontend, backend, mobile, etc.) and includes everything a working setup needs:
- Agents (AI assistant personas with specialized knowledge)
- Skills (reusable capability modules)
- Commands (slash-command templates)
- Hooks (automation scripts triggered by IDE events)
- Workflows (always-on steering documents)
- Steering files (context-aware coding conventions)
- Settings, MCP server config, statusline scripts, spec templates
Self-Contained Policy
Every preset is fully independent. There is no shared runtime dependency
between presets. If two presets include an agent with the same name (e.g.,
code-reviewer.md), each carries its own copy tailored to its domain.
This means:
- Installing one preset never requires another.
- Removing a preset has no side effects on others.
- Updates to one preset cannot break another.
- The tradeoff is increased package size, but it eliminates coupling.
Lifecycle
1. Init
npx kiro-kit init- Interactive multi-pick prompt shows every available preset.
- User selects one or more presets (space to toggle,
afor all). - CLI displays file count summary and asks for confirmation.
- For each file in the selected presets:
- If target does not exist: write it.
- If target exists with identical content: skip (no-op).
- If target exists with different content: trigger conflict resolution.
- Merge MCP servers into
.kiro/settings/mcp.json(user-priority). - Merge settings into
.kiro/settings.json(array dedup, last-write-wins). - Write tracking file (
.kiro/.kiro-kit.json) last. - Print summary and exit.
2. Add
kiro-kit add backendSame as init but for a single preset added to an existing workspace. If
.kiro/ does not exist, delegates to the full init flow automatically.
3. Update
kiro-kit update- Read tracking file to find installed presets and their versions.
- Compare against current bundled preset versions.
- Identify changed files (content hash mismatch).
- Apply conflict resolution for each changed file.
- Bump version in tracking file.
If no presets are installed, exits cleanly. If network is unreachable (for future remote preset support), warns and exits without error.
4. Restore
kiro-kit restore- List available backup timestamps from
.kiro/.backup/. - Select the most recent (or a specific
--timestamp). - Copy all backed-up files back to their original relative paths.
- Backups are never deleted after restore (idempotent, safe to retry).
Merge Semantics
MCP Servers (.kiro/settings/mcp.json)
- User-priority: if a server name already exists, the user's definition is kept unchanged.
- New servers from the preset are added.
- No servers are ever removed.
- Cross-preset conflicts (same server name, different definition) produce a warning.
Settings (.kiro/settings.json)
- Array fields (
hooks.PreToolUse,hooks.PostToolUse, etc.): entries are concatenated and deduplicated by thecommandfield. User entries come first. - Non-array fields (
statusLine,includeCoAuthoredBy): last-write-wins with a warning if the value differs from the existing one. - User-only fields: any field the user added manually that is not in the preset schema is preserved untouched.
Hook Files
- Deduplicated by filename (case-sensitive).
- If a hook file already exists with different content, it goes through the standard conflict resolution flow.
- User-created hooks (not in any preset manifest) are never touched.
Conflict Resolution UX
When a file exists with different content and no --force or --skip-existing
flag is set, the CLI presents four options:
? File .kiro/agents/code-reviewer.md already exists with different content.
> overwrite - Replace existing file (backup will be saved)
skip - Keep existing file
view diff - Show unified diff and ask again
overwrite all - Replace this and all remaining conflicting files- overwrite: backs up the existing file, then writes the new version.
- skip: leaves the existing file untouched.
- view diff: displays a colored unified diff, then re-prompts.
- overwrite all: sets a session flag so all subsequent conflicts are auto-overwritten (with backup).
Backups are stored at .kiro/.backup/<YYYYMMDD-HHmmss-mmm>/<relative-path>.
Backup Strategy
- Every overwritten file is backed up before replacement.
- Backups preserve the full relative path structure.
- Timestamps are lexicographically sortable.
- Backups are never automatically deleted.
kiro-kit restorecopies files back from a backup timestamp.kiro-kit restore --listshows available backup points.
Tracking
.kiro/.kiro-kit.json maintains the installation state:
- Which presets are installed and their versions.
- Every file written, with its target path, source preset, and content hash.
- Timestamps for install and last update.
This file is written only after all file operations complete successfully, reducing the risk of inconsistent state on interruption.