Kiwi Code Docs

Explore the .kiwi Directory

What's inside ~/.kiwi and .kiwi — configuration, tokens, checkpoints, and runtime state.

Explore the .kiwi Directory

Kiwi Code stores its data in two locations: ~/.kiwi/ (your home directory) for global state, and .kiwi/ (in your project) for repo-specific data.

~/.kiwi/ — Global Configuration

This directory holds authentication, settings, runtime state, and checkpoints. It's created automatically on first use.

~/.kiwi/
├── tokens.json          # Auth tokens
├── settings.json        # TUI preferences (theme, etc.)
├── kiwi_tui.log         # TUI application log
├── runtimes/            # Runtime process tracking
│   ├── by-run/          # Active runtimes keyed by run ID
│   │   └── <run_id>/
│   │       ├── pid      # Process ID
│   │       ├── log      # Runtime output log
│   │       └── meta.json
│   └── pending/         # Runtimes waiting for a run
│       └── <uuid>/
└── runs/                # Checkpoint data per conversation
    └── <run_id>/
        ├── rewind.json  # Prompt history + file snapshots
        ├── latest.json  # Latest code state
        └── Snapshots/   # Saved file contents

Key Files

tokens.json

Your authentication tokens. Created by kiwi login. Shared between the TUI, CLI, and runtime.

{
  "access_token": "eyJ...",
  "refresh_token": "...",
  "token_type": "Bearer",
  "expires_at": "2026-07-07T00:00:00"
}

Permissions are set to 0600 (owner read/write only). Tokens refresh automatically — you rarely need to touch this file.

settings.json

Your TUI preferences, like the active theme. Updated when you use /theme set.

{
  "theme": "kiwi-black"
}

runtimes/

Tracks running kiwi-runtime processes. Each conversation gets its own runtime with a PID file and log. The TUI uses this to:

  • Reuse existing runtimes when you resume a conversation
  • Detect and clean up stale runtimes
  • Show the cleanup prompt when you quit

runs/

Checkpoint data for each conversation. Stores file snapshots so you can /rewind to any previous state.


.kiwi/ — Project Directory

This directory lives inside your git repository and holds repo-specific data.

your-project/
└── .kiwi/
    └── worktrees/           # Git worktrees for isolated AI work
        ├── add-auth/        # Worktree: branch "add-auth"
        │   ├── src/
        │   ├── .git/
        │   └── ...
        └── fix-tests/       # Worktree: branch "fix-tests"
            └── ...

worktrees/

Created when you use worktree mode (kiwi -w). Each worktree is an isolated copy of your repo on its own branch. The AI works here without touching your main checkout.


Environment Variables

Override default paths and behavior:

VariablePurposeDefault
KIWI_HOME_DIROverride ~/.kiwi location~/.kiwi
KIWI_DISABLE_REEXECDisable process re-execution

Cleaning Up

# Remove all checkpoint data (free disk space)
rm -rf ~/.kiwi/runs/

# Remove a specific conversation's data
rm -rf ~/.kiwi/runs/<run_id>/

# Remove all worktrees
rm -rf .kiwi/worktrees/
git worktree prune

# Full reset (you'll need to log in again)
rm -rf ~/.kiwi/

Don't delete tokens.json while Kiwi is running

If you need to reset auth, use kiwi logout instead of manually deleting the file. This avoids race conditions with running runtimes.

On this page