Learn Kiro CLI in 10 DaysDay 3: Session Management & Terminal Power
books.chapter 3Learn Kiro CLI in 10 Days

Session Management

Kiro CLI automatically saves conversations as sessions that you can resume later. Context is preserved per project directory, allowing you to seamlessly pick up where you left off.

How Auto-Save Works

Conversations are automatically saved to a local SQLite database (~/.kiro/) after every turn. Sessions are organized by directory, with each assigned a UUID.

This means launching kiro-cli in the same project directory lets you continue from your previous conversation.

Resuming Sessions

# Resume the most recent session
kiro-cli chat --resume

# Choose from a session list
kiro-cli chat --resume-picker

# List all sessions
kiro-cli chat --list-sessions

# Delete a specific session
kiro-cli chat --delete-session <SESSION_ID>

Resume from within a chat session:

> /chat resume

Exporting and Importing Sessions

Save and load conversations as JSON files for sharing or backup:

> /chat save ~/my-session.json

> /chat load ~/my-session.json

Use the -f flag to overwrite an existing file.

Custom Storage

Use shell scripts for custom storage backends:

> /chat save-via-script ./save-to-git.sh

> /chat load-via-script ./load-from-git.sh

Save scripts receive session JSON via stdin; load scripts output session JSON to stdout. For example, you could use Git Notes to attach sessions to commits.

flowchart TB
    subgraph Lifecycle["Session Lifecycle"]
        Create["Create Session<br/>Launch kiro-cli"]
        AutoSave["Auto-Save<br/>Every turn to SQLite"]
        Resume["Resume<br/>--resume / --resume-picker"]
        Export["Export<br/>/chat save"]
        Import["Import<br/>/chat load"]
    end
    Create --> AutoSave
    AutoSave --> Resume
    AutoSave --> Export
    Import --> AutoSave
    Resume --> AutoSave
    style Lifecycle fill:#3b82f6,color:#fff

Translate Command

translate converts natural language into shell commands. You don't need to remember command syntax β€” just describe what you want to do.

Basic Usage

kiro-cli translate "list all files in the current directory and subdirectories"

The suggested command (e.g., find . -type f) appears with options:

  • Enter: Execute the command
  • Edit: Modify before executing
  • Regenerate: Generate a different command
  • Ask another question: Ask something else
  • Cancel: Cancel

Multiple Suggestions

Generate multiple alternatives with the -n option (max 5):

kiro-cli translate -n 3 "find Python files modified in the last week"

Practical Examples

# File operations
kiro-cli translate "find files larger than 100MB"
kiro-cli translate "delete all .log files"

# Git operations
kiro-cli translate "list branches not merged into main"
kiro-cli translate "show the last 5 commits on one line each"

# Process management
kiro-cli translate "find and kill the process using port 3000"
kiro-cli translate "show top 10 processes by memory usage"

# Networking
kiro-cli translate "check DNS records for a domain"
kiro-cli translate "check if something is listening on port 8080"

# AWS
kiro-cli translate "list S3 bucket contents"
kiro-cli translate "show running EC2 instances"

Autocomplete

Kiro CLI provides two AI-powered completion features for terminal commands.

Dropdown Menu

As you type, a dropdown menu appears to the right of your cursor showing available options, subcommands, and arguments.

  • Arrow keys to navigate
  • Tab or Enter to select
# Configuration
kiro-cli settings autocomplete.disable false  # Enable
kiro-cli settings autocomplete.disable true   # Disable

Inline Suggestions (Ghost Text)

Gray ghost text appears as you type, suggesting the rest of your command. This works independently from the dropdown menu.

  • β†’ (right arrow) or Tab to accept
  • Continue typing to ignore
# Manage inline suggestions
kiro-cli inline enable    # Enable
kiro-cli inline disable   # Disable
kiro-cli inline status    # Check status

Supported Tools

Autocomplete works with hundreds of CLI tools:

Category Tools
Version Control git (branches, hashes, paths)
Containers docker, kubectl
Package Managers npm, yarn, pnpm, pip, gem
Infrastructure terraform, aws
Language Tools python, go, rustc
System ls, find, grep, chmod, apt, brew

Theming

Customize the dropdown appearance:

kiro-cli theme dark     # Dark theme
kiro-cli theme light    # Light theme
kiro-cli theme system   # Follow system setting
kiro-cli theme --list   # List available themes

Practical Workflows

Daily Development

# 1. Navigate to project and resume last session
cd my-project
kiro-cli chat --resume

# 2. Need a command? Use translate
kiro-cli translate "check Docker container status"

# 3. Hit an error? Pipe it directly
docker logs my-container 2>&1 | kiro-cli "What's causing this error?"

CI/CD Integration

# Analyze test results
npm test 2>&1 | kiro-cli chat --no-interactive --trust-all-tools \
  "Analyze the test results and report failure causes and fixes."

# Security audit
npm audit --json | kiro-cli chat --no-interactive \
  "Analyze this security audit and report high-severity vulnerabilities."

Summary

Topic Details
Auto-save Every turn saved to SQLite, organized per directory
Resume --resume (latest) / --resume-picker (select)
Export /chat save / /chat load for JSON format
Translate kiro-cli translate "natural language" for command conversion
Autocomplete Dropdown + inline suggestions for input completion
Theming kiro-cli theme dark/light/system

In Day 4, you'll learn the concepts and basics of creating custom agents.