Skip to content

Instantly share code, notes, and snippets.

@jetnet
Last active September 16, 2026 10:09
Show Gist options
  • Select an option

  • Save jetnet/d8be5febbd9dc87db25c494fb1d7de20 to your computer and use it in GitHub Desktop.

Select an option

Save jetnet/d8be5febbd9dc87db25c494fb1d7de20 to your computer and use it in GitHub Desktop.
Kilo Code CLI - cheatsheet

Kilo Code CLI Comprehensive Cheatsheet

Updated against the current official Kilo CLI docs and CLI reference on 2026-04-12.

This sheet prefers the current Kilo terminology and file names.

  • Use agents (not legacy “modes”) in day-to-day language.
  • Use plan for architecture/planning work; it is the modern equivalent of the older “Architect” idea.
  • Treat orchestrator as deprecated.
  • Prefer kilo.jsonc / .kilo/kilo.jsonc for config today, even though some official pages still mention kilo.json, config.json, or older opencode.json(c) compatibility paths.

1. Mental model in 60 seconds

  • kilo — launch the interactive terminal UI in the current project.
  • /connect — easiest first-time provider setup from inside the interactive UI.
  • kilo run "..." — one-shot, scriptable, CI-friendly execution.
  • agents — task personas with different tool access.
  • MCP — extra tools/integrations.
  • AGENTS.md — project rules for the AI.
  • workflows — reusable slash-commands backed by Markdown files.
  • skills — reusable domain expertise packages (SKILL.md).

Built-in agents at a glance

Agent Best for Tool access
code coding, refactors, implementation full access
ask explanation, learning, safe Q&A read-only
plan design, architecture, implementation plans read-only + limited writes to .kilo/plans/
debug bug hunts, diagnostics, incident work full access
orchestrator legacy task delegation deprecated

2. Install, verify, update, remove

Install

# global install
npm install -g @kilocode/cli

# one-off run without installing globally
npx @kilocode/cli

Verify

kilo --version
kilo --help

Start

# start TUI in current directory
kilo

# start in a specific project directory
kilo /path/to/project

Update

# Kilo-native update
kilo upgrade

# pin or target a specific version
kilo upgrade v1.2.3
kilo upgrade 1.2.3

# choose install method explicitly
kilo upgrade --method npm
kilo upgrade --method brew

# npm alternative
npm update -g @kilocode/cli

Uninstall

# preview what would be removed
kilo uninstall --dry-run

# uninstall but keep config/session data
kilo uninstall --keep-config --keep-data

# force uninstall
kilo uninstall --force

Older CPUs (no AVX)

If Kilo crashes with Illegal instruction on older CPUs, use the baseline release artifact from GitHub releases instead of the default build.


3. First-time setup and authentication

Easiest first run

kilo

Inside the TUI, run:

/connect

That is the main guided entry point for adding provider credentials.

Provider/auth commands

# list configured providers
kilo auth list

# login to a provider (OAuth-capable providers)
kilo auth login

# skip provider picker
kilo auth login --provider <provider>

# skip method picker
kilo auth login --provider <provider> --method <method>

# logout from a configured provider
kilo auth logout

Provider strategy

  • Fastest start: use Kilo’s built-in provider.
  • If you need your own keys or specific vendors/models, configure providers in config or via /connect.
  • kilo auth login is especially useful for OAuth-style providers.

4. Daily-driver commands

These are the commands you will use most often.

# interactive work
kilo
kilo --model <provider/model>
kilo --agent code
kilo --agent plan --prompt "Design the migration"
kilo --continue

# one-shot task execution
kilo run "Find the failing tests and fix them"
kilo run --agent plan "Draft an implementation plan"
kilo run --agent debug "Investigate flaky test"
kilo run --model <provider/model> "Refactor the auth module"
kilo run --file logs.txt --file stacktrace.txt "Analyze these failures"

# structured / automation-friendly
kilo run --format json "Check whether the repo builds"
kilo run --auto "Update the changelog from recent commits"

# inspect sessions
kilo session list
kilo session list --all
kilo session list --format json

# inspect config / environment
kilo config check
kilo debug config
kilo debug paths

5. Top-level command map

Core runtime

Command What it does Handy flags / notes
kilo [project] start interactive TUI --model, --agent, --prompt, --continue, --session, --fork, --cloud-fork, --port, --hostname
kilo run [message] run Kilo with a message --agent, --model, --file, --format json, --auto, --continue, --session, --fork, --title, --thinking, --variant
kilo attach <url> attach to a running Kilo server --dir, --continue, --session, --fork, --cloud-fork, --password
kilo serve start headless Kilo server --port, --hostname, --mdns, --mdns-domain, --cors
kilo remote enable real-time remote relay gateway/cloud-related
kilo acp start ACP server useful when integrating external clients/tools

Providers, models, agents

Command What it does Handy flags / notes
kilo auth manage providers and credentials subcommands: list, login, logout
kilo models [provider] list available models --verbose, --refresh
kilo agent manage custom agents subcommands: create, list

MCP

Command What it does Handy flags / notes
kilo mcp manage MCP servers subcommands: add, list, auth, auth list, logout, debug

Sessions and data

Command What it does Handy flags / notes
kilo session list list sessions --max-count, --format, --all, --search
kilo session delete <id> delete a session irreversible for local history
kilo export <sessionID> export a session as JSON redirect to file
kilo import <file-or-url> import a JSON session or share URL useful for handoff/restore
kilo stats show token usage / cost stats --days, --tools, --models, --project
kilo pr <number> checkout GitHub PR branch and run Kilo fast PR review/start point

Diagnostics / admin / maintenance

Command What it does Handy flags / notes
kilo debug troubleshooting toolbox many subcommands; see below
kilo db query/migrate Kilo DB db path, db migrate, `--format json
kilo config check validate config catches warnings/errors
kilo plugin <module> install plugin and update config --global, --force
kilo help [command] full CLI reference --all, `--format md
kilo completion generate shell completions redirect into shell setup
kilo upgrade [target] upgrade Kilo --method
kilo uninstall remove Kilo --dry-run, --keep-config, --keep-data, --force

6. kilo run cheat sheet

Most useful flags

kilo run [message]
  --agent <name>
  --model <provider/model>
  --file <path>              # repeatable
  --continue                 # continue most recent session
  --session <id>             # continue a specific session
  --fork                     # fork before continuing
  --share                    # share session
  --format json              # raw JSON events
  --auto                     # autonomous/non-interactive mode
  --title [text]             # set session title
  --dir <path>               # working directory
  --attach <url>             # attach to running server
  --password <secret>        # or KILO_SERVER_PASSWORD
  --port [n]                 # local server port for this run
  --variant <name>           # provider-specific reasoning effort
  --thinking                 # show thinking blocks

Common patterns

# one-shot code fix
kilo run "Fix TypeScript errors in src/auth"

# planning only
kilo run --agent plan "Design a blue/green deploy strategy"

# debugging specialist
kilo run --agent debug --file crash.log "Root-cause this crash"

# machine-readable output
kilo run --format json "Check whether the repo builds cleanly"

# attach extra files
kilo run --file README.md --file docs/spec.md "Summarize the implementation gaps"

# continue the latest session and keep going
kilo run --continue "Now add tests"

Global flags that apply broadly

--help, -h
--version, -v
--print-logs
--log-level DEBUG|INFO|WARN|ERROR

7. Interactive slash commands

These work inside the interactive TUI.

Session commands

Slash command Aliases Purpose
/sessions /resume, /continue switch session
/new /clear new session
/share — share session
/unshare — stop sharing
/rename — rename session
/timeline — jump to a message
/fork — fork from a message
/compact /summarize compact session
/undo — undo previous message
/redo — redo message
/copy — copy transcript
/export — export transcript
/timestamps /toggle-timestamps show/hide timestamps
/thinking /toggle-thinking show/hide thinking blocks

Agent/model/MCP commands

Slash command Purpose
/models switch model
/agents switch agent
/mcps enable/disable MCP servers

Provider/system commands

Slash command Aliases Purpose
/connect — add/connect a provider
/status — view status
/themes — switch theme
/help — show help
/editor — open external editor
/exit /quit, /q exit the app

Kilo Gateway commands (when connected)

Slash command Aliases Purpose
/profile /me, /whoami view gateway profile
/teams /team, /org, /orgs switch organization/team
/remote — toggle remote mode

Built-in local review commands

Slash command Purpose
/init create/update AGENTS.md for the project
/local-review review current branch vs base
/local-review-uncommitted review staged + unstaged changes

8. Agents, models, providers

Switch agents

# interactive
/agents

# command line
kilo --agent code
kilo --agent plan
kilo run --agent debug "Investigate the memory leak"

When to pick which agent

  • Use code when you want maximum flexibility.
  • Use ask when you want explanations without file edits or command execution.
  • Use plan for architecture/design work and implementation planning.
  • Use debug when you want systematic diagnosis and narrowing down causes.
  • Avoid building new workflows around orchestrator; it is deprecated.

Keyboard shortcut

Inside the current Kilo-based CLI/IDE family:

  • Cmd+. (macOS) / Ctrl+. (Windows/Linux) — cycle agents
  • add Shift to cycle in reverse

Models

# list all models
kilo models

# filter by provider
kilo models openai
kilo models anthropic

# include metadata such as costs
kilo models --verbose

# refresh models cache
kilo models --refresh

Providers

# guided connection inside TUI
/connect

# auth from CLI
kilo auth list
kilo auth login
kilo auth login --provider <provider>
kilo auth logout

Provider notes

  • The built-in Kilo provider is the fastest path to “it just works”.
  • Kilo supports many provider categories: direct labs, gateways, local/self-hosted backends, and more.
  • The VS Code extension and CLI share provider settings via the same underlying config files.

9. Sessions, continuation, sharing, export/import

Continue existing work

# resume most recent session for current workspace
kilo --continue
kilo -c

# continue a specific session
kilo --session <session-id>
kilo run --session <session-id> "Continue from here"

# fork before continuing
kilo --session <session-id> --fork
kilo run --session <session-id> --fork "Try an alternative approach"

Session-management commands

# list sessions
kilo session list
kilo session list --max-count 20
kilo session list --all
kilo session list --search auth
kilo session list --format json

# delete one
kilo session delete <session-id>

Export / import / sharing

# export to a local file
kilo export <session-id> > session.json

# import back from a file
kilo import session.json

# import from a share URL
kilo import '<share-url>'

Inside TUI:

/share
/unshare
/export
/copy

Notes

  • --continue is workspace-oriented and resumes the most recent relevant session.
  • In older docs/examples you may still see cloud/local fork wording; the modern CLI still exposes --fork and --cloud-fork where relevant.

10. Non-interactive / CI / automation

Use kilo run for automation.

# autonomous pipeline-style run
kilo run --auto "Update generated docs and fix lint violations"

# structured logs/events for tooling
kilo run --format json "Run a repo health check"

# select org in CI
KILO_ORG_ID=<org-id> kilo run "Do the release prep"

Practical CI flags

Flag Use
--auto non-interactive autonomous mode
--format json machine-readable event stream
--file attach artifacts/logs/specs
--agent force a specialist persona
--model pin a model for reproducibility
--title label the session in history

Exit codes

Code Meaning
0 success
1 init/execution failure
124 timeout

Environment variables for automation

# override active provider
export KILO_PROVIDER=<provider-id>

# built-in Kilo provider overrides
export KILOCODE_MODEL=<value>

# generic provider-field style override
export KILO_API_KEY=<value>

# choose organization/team for non-interactive runs
export KILO_ORG_ID=<org-id>

Practical caution

Treat --auto as powerful. In real CI, keep permissions conservative and test in a disposable repo first.


11. Serve, attach, remote, ACP

Headless server + attach workflow

# terminal A: start a server
kilo serve --port 4096

# terminal B: attach to it
kilo attach http://127.0.0.1:4096

If a password is configured, use:

export KILO_SERVER_PASSWORD='secret'
kilo attach http://127.0.0.1:4096 --password "$KILO_SERVER_PASSWORD"

Important 7.2.x note for VS Code / VSCodium extension users

If you are trying to attach to the server spawned by the new VS Code / VSCodium extension, be aware of a current auth mismatch in the codebase:

  • the server defaults to Basic Auth username kilo unless KILO_SERVER_USERNAME is set
  • kilo attach currently builds the Basic Auth header with username opencode
  • the extension launches kilo serve --port 0 and injects a generated password, but not a username override

That means attach can return Unauthorized even when the password is correct. See Appendix C for the full breakdown and workarounds.

kilo run --attach

You can also send a one-shot task to a running server:

kilo run --attach http://127.0.0.1:4096 "Review the current repo state"

Remote mode

Remote connections let Cloud Agent / Kilo Gateway interact with your local CLI session.

Inside an authenticated TUI session:

/remote

Requirements for remote mode

  • connected to Kilo Gateway
  • same Kilo account on CLI and Cloud Agent
  • local CLI must keep running and stay online

Security warning

Remote mode means anyone with access to your Kilo account can send messages to the machine while remote mode is enabled.

ACP

kilo acp

Use ACP when another client/tool needs to talk to Kilo via Agent Client Protocol.


12. Configuration (kilo.jsonc)

Recommended file locations today

Scope Recommended path Notes
Global ~/.config/kilo/kilo.jsonc applies to all projects
Project ./kilo.jsonc simple root-level config
Project (cleaner) ./.kilo/kilo.jsonc takes priority over ./kilo.jsonc if both exist

Important filename note

Official Kilo pages are currently inconsistent:

  • newer settings/docs pages favor kilo.jsonc
  • the MCP CLI page says kilo.json is recommended and also accepts kilo.jsonc / config.json
  • older compatibility docs still mention opencode.json / opencode.jsonc

Recommendation: use kilo.jsonc / .kilo/kilo.jsonc unless you specifically need compatibility with another documented path.

Minimal sample config

{
  "$schema": "https://app.kilo.ai/config.json",

  "model": "provider/model",

  "permission": {
    "*": "ask",
    "bash": {
      "*": "ask",
      "git *": "allow",
      "npm test*": "allow",
      "rm *": "deny"
    },
    "edit": {
      "*": "ask",
      ".env*": "deny"
    },
    "external_directory": {
      "~/projects/shared/**": "allow"
    }
  },

  "instructions": [
    "./docs/coding-standards.md"
  ],

  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp",
      "enabled": true
    }
  },

  "skills": {
    "paths": ["~/my-skills"]
  }
}

Secrets and variable substitution

Prefer environment variables (or file indirection) over hardcoding secrets.

{
  "provider": {
    "anthropic": {
      "options": {
        "apiKey": "{env:ANTHROPIC_API_KEY}"
      }
    },
    "openai": {
      "options": {
        "apiKey": "{file:~/.secrets/openai-key}"
      }
    }
  }
}

Extra config tips

  • CLI and VS Code extension share the same underlying config.
  • Restart the CLI after editing config files.
  • Use env vars for API keys and secrets, especially if config is committed to git.
  • There is an experimental config area; treat it as unstable.

13. Permissions cheat sheet

Kilo decides whether an action runs automatically, asks, or is blocked.

Three actions

  • allow — run without approval
  • ask — prompt first
  • deny — block

Simplest configs

{
  "$schema": "https://app.kilo.ai/config.json",
  "permission": "allow"
}
{
  "$schema": "https://app.kilo.ai/config.json",
  "permission": {
    "*": "ask",
    "bash": "allow",
    "edit": "deny"
  }
}

Granular rules by tool input

{
  "$schema": "https://app.kilo.ai/config.json",
  "permission": {
    "bash": {
      "*": "ask",
      "git *": "allow",
      "npm *": "allow",
      "rm *": "deny",
      "grep *": "allow"
    },
    "edit": {
      "*": "deny",
      "packages/web/src/content/docs/*.mdx": "allow"
    }
  }
}

Matching rules

  • * = zero or more characters
  • ? = exactly one character
  • last matching rule wins
  • common pattern: put a catch-all "*" first, then more specific rules later

Home expansion

You can use either of these at the start of a path pattern:

  • ~
  • $HOME

Examples:

  • ~/projects/*
  • $HOME/projects/*

Allowing work outside the current repo

Use external_directory for paths outside the working directory.

{
  "$schema": "https://app.kilo.ai/config.json",
  "permission": {
    "external_directory": {
      "~/projects/personal/**": "allow"
    }
  }
}

If you want read access but still forbid edits there:

{
  "$schema": "https://app.kilo.ai/config.json",
  "permission": {
    "external_directory": {
      "~/projects/personal/**": "allow"
    },
    "edit": {
      "~/projects/personal/**": "deny"
    }
  }
}

Interactive approvals

When Kilo asks for approval in interactive mode, it can offer increasingly broad “always allow” choices, letting you build rules incrementally without manually editing config.


14. MCP (Model Context Protocol)

Use MCP to add external tools/data sources.

Manage from CLI

kilo mcp list
kilo mcp add
kilo mcp auth
kilo mcp auth list
kilo mcp logout <server>
kilo mcp debug <server>

Inside the TUI:

/mcps

MCP config example: local server

{
  "mcp": {
    "my-local-server": {
      "type": "local",
      "command": ["npx", "-y", "my-mcp-command"],
      "enabled": true,
      "environment": {
        "API_KEY": "{env:MY_API_KEY}"
      },
      "timeout": 5000
    }
  }
}

MCP config example: remote server

{
  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer {env:CONTEXT7_TOKEN}"
      },
      "timeout": 5000
    }
  }
}

Practical examples

{
  "mcp": {
    "Figma Desktop": {
      "type": "remote",
      "url": "http://127.0.0.1:3845/mcp"
    },
    "mcp_everything": {
      "type": "local",
      "command": ["npx", "-y", "@modelcontextprotocol/server-everything"]
    }
  }
}

MCP tool permissions

MCP tools use the same permission system as built-ins.

Permission keys are namespaced as:

{server}_{tool}

Example:

{
  "permission": {
    "github_*": "ask",
    "github_create_pull_request": "allow"
  }
}

Context caution

Each enabled MCP server can add tools and context overhead. Keep only the ones you actually use.


15. AGENTS.md, custom instructions, custom agents, workflows, skills

AGENTS.md

What it is

A project-level Markdown file that tells Kilo how to behave in your repo.

Preferred filenames

  1. AGENTS.md (recommended)
  2. AGENT.md (fallback)

Use uppercase.

Placement

my-project/
├── AGENTS.md
├── src/
│   └── backend/
│       └── AGENTS.md
└── docs/
    └── AGENTS.md

Behavior notes

  • root AGENTS.md applies to the project
  • subdirectory AGENTS.md adds more specific rules for that subtree
  • subdirectory rules take precedence when they conflict
  • Kilo treats AGENTS.md / AGENT.md as write-protected; changes require explicit approval

Fast creation

Inside TUI:

/init

Additional instructions

Global instructions file:

~/.config/kilo/AGENTS.md

Extra instruction sources can be set via config:

{
  "instructions": [
    "./docs/coding-standards.md",
    "./teams/frontend-rules.md",
    "https://example.com/team-instructions.md"
  ]
}

Practical precedence (useful mental model)

From highest to lower-priority instruction sources:

  1. agent-specific prompt in config
  2. project instructions in kilo.jsonc
  3. project AGENTS.md
  4. global instructions
  5. skills (loaded on demand)

Custom agents

Create interactively

kilo agent create

Useful flags:

kilo agent create \
  --path ./.kilo/agents \
  --description "Review code for security and maintainability" \
  --mode subagent \
  --tools read,glob,grep \
  --model provider/model

List available agents

kilo agent list

Custom agent modes

Mode Meaning
primary appears as a directly selectable agent
subagent only invoked by Task tool / mentions
all can be both

Define via config

{
  "agent": {
    "code-reviewer": {
      "description": "Reviews code for best practices and potential issues",
      "mode": "subagent",
      "model": "provider/model",
      "prompt": "You are a strict code reviewer.",
      "permission": {
        "edit": "deny",
        "bash": "deny"
      }
    }
  }
}

Define via Markdown files

Preferred directories:

  • global: ~/.config/kilo/agents/
  • project: .kilo/agents/

Example:

---
description: Reviews code quality and best practices
mode: subagent
model: provider/model
permission:
  edit: deny
  bash: deny
---

You are a careful reviewer. Focus on security, correctness, performance, and maintainability.

Workflows (slash-command automation)

Workflows are Markdown files stored as slash-commands.

Directories

  • global: ~/.config/kilo/commands/
  • project: .kilo/commands/

Example

File:

.kilo/commands/submit-pr.md

Invoke in TUI as:

/submit-pr

Minimal workflow file

---
description: Submit a pull request with checks
agent: code
---

1. Run tests
2. Summarize changes
3. Prepare the PR body
4. Ask for final confirmation if required

Frontmatter fields

Field Meaning
description shown in command picker
agent agent to use
model model override
subtask run as subagent session when true

Available capabilities

Workflows can use built-in tools such as read, glob, grep, edit, write, bash, webfetch, plus MCP tools.


Skills (SKILL.md)

Skills are reusable expertise packages. The model decides whether to use a skill primarily from the skill’s description, so naming and description quality matter.

Where Kilo loads skills from

Scope Path
Global (macOS/Linux) ~/.kilo/skills/
Global (Windows) C:\Users\<you>\.kilo\skills\
Project .kilo/skills/
Compatibility .claude/skills/, .agents/skills/
Extra paths via skills.paths
Remote URLs via skills.urls

Example directory

~/.kilo/skills/
└── api-design/
    └── SKILL.md

Minimal SKILL.md

---
name: api-design
description: REST API design best practices and conventions
---

# API Design Guidelines

Use resource-oriented URLs, explicit error models, versioning rules, and consistent pagination.

Important rules

  • name should match the parent directory name
  • new/changed skills are picked up at the start of a new session (or kilo run)
  • project skills override global skills with the same name
  • Kilo loads compatibility dirs for other tools unless disabled

Extra skill config

{
  "skills": {
    "paths": ["~/shared-skills", "./company-skills"],
    "urls": ["https://example.com/skills/api-design/SKILL.md"]
  }
}

Disable external compatibility skill dirs

export KILO_DISABLE_EXTERNAL_SKILLS=true

16. Debugging, inspection, and self-diagnosis

Config / environment / paths

kilo config check
kilo debug config
kilo debug paths

LSP debugging

kilo debug lsp diagnostics path/to/file.ts
kilo debug lsp symbols Auth
kilo debug lsp document-symbols file:///abs/path/to/file.ts

Ripgrep debugging

kilo debug rg tree --limit 200
kilo debug rg files --query auth --glob '*.ts' --limit 50
kilo debug rg search 'TODO|FIXME' --glob '*.ts' --glob '*.tsx' --limit 100

File-system debugging

kilo debug file status
kilo debug file read package.json
kilo debug file list src
kilo debug file search auth
kilo debug file tree .

Skills / projects / snapshots / agents

kilo debug skill
kilo debug scrap
kilo debug snapshot track
kilo debug snapshot patch <hash>
kilo debug snapshot diff <hash>
kilo debug agent <name>
kilo debug wait

Database helpers

kilo db path
kilo db 'select * from sessions limit 5;'
kilo db 'select * from sessions limit 5;' --format json
kilo db migrate

Self-document the CLI

# full markdown reference generated by the CLI itself
kilo help --all --format md > kilo-cli-reference.md

# single command help
kilo help run
kilo help mcp

17. TUI / keyboard hints

Kilo-documented shortcut

  • Cmd+. / Ctrl+. — cycle agents
  • add Shift for reverse cycling

OpenCode-compatible TUI defaults (advanced note)

Kilo CLI inherits a lot from OpenCode. In practice, these TUI defaults are often useful to know:

  • Ctrl+P — command list
  • Tab / Shift+Tab — cycle agents
  • Enter — submit prompt
  • Shift+Enter, Ctrl+Enter, Alt+Enter, or Ctrl+J — newline in prompt
  • Esc — interrupt running session
  • Ctrl+A / Ctrl+E — line start / line end
  • Ctrl+B / Ctrl+F — move left / right
  • Ctrl+W — delete previous word
  • Ctrl+K / Ctrl+U — delete to end / start of line
  • PageUp / PageDown — message paging
  • leader key defaults to Ctrl+X in OpenCode-style tui.json

If Shift+Enter does not work

Some terminals do not send modifier+Enter cleanly. On Windows Terminal especially, you may need a custom sendInput mapping for shift+enter.


18. Quick recipes

Start a clean interactive coding session

kilo --agent code --model <provider/model>

Do architecture work without broad edit access

kilo --agent plan --prompt "Design a data migration plan"

Analyze logs from CI

kilo run --agent debug --file ci.log --file junit.xml "Find the root cause and suggest a minimal fix"

Run local review before pushing

Inside TUI:

/local-review

Continue yesterday’s work

kilo -c

Review sessions across all repos

kilo session list --all --format json

Get model list with metadata

kilo models --verbose --refresh

Validate config after editing

kilo config check && kilo debug config

Export a useful session snapshot

kilo export <session-id> > handoff.json

Use a workflow command

/submit-pr

19. Gotchas and field notes

  • Prefer kilo.jsonc today. Official pages are not fully harmonized yet.
  • plan is the modern architecture/planning agent. If you see “Architect” in older docs, map it mentally to plan.
  • orchestrator is deprecated. Build new setups around code, plan, debug, and custom subagents.
  • Secrets do not belong in checked-in config. Use {env:...} or {file:...}.
  • Skills are loaded at session start. After adding/modifying a skill, start a new session.
  • Remote mode is powerful. Enable it intentionally and understand the account-level risk.
  • MCP servers can bloat context. Fewer enabled servers usually means a cleaner experience.
  • AGENTS.md is uppercase. agents.md is not the recommended file name.
  • Project .kilo/ config wins over root kilo.jsonc when both are present.
  • Old wording still appears. For example, some command help/docs still refer to “opencode server” or “modes”.

20. Official references

Kilo docs

  • CLI overview: https://kilo.ai/docs/code-with-ai/platforms/cli
  • CLI command reference: https://kilo.ai/docs/code-with-ai/platforms/cli-reference
  • Settings / config files: https://kilo.ai/docs/getting-started/settings
  • Setup & authentication: https://kilo.ai/docs/getting-started/setup-authentication
  • Using agents: https://kilo.ai/docs/code-with-ai/agents/using-agents
  • Custom subagents: https://kilo.ai/docs/customize/custom-subagents
  • Workflows: https://kilo.ai/docs/customize/workflows
  • AGENTS.md: https://kilo.ai/docs/customize/agents-md
  • Custom instructions: https://kilo.ai/docs/customize/custom-instructions
  • Skills: https://kilo.ai/docs/customize/skills
  • MCP in CLI: https://kilo.ai/docs/automate/mcp/using-in-cli
  • Kilo provider: https://kilo.ai/docs/ai-providers/kilocode
  • AI providers overview: https://kilo.ai/docs/ai-providers
  • GitHub repo / README: https://github.com/Kilo-Org/kilocode

OpenCode compatibility references (useful because Kilo CLI is fork/compatible in several areas)

  • OpenCode config: https://opencode.ai/docs/config/
  • OpenCode keybinds: https://opencode.ai/docs/keybinds/

21. One-page command memory jogger

# install / update
npm install -g @kilocode/cli
npx @kilocode/cli
kilo upgrade

# start / continue
kilo
kilo /path/to/project
kilo -c
kilo --session <id>

# one-shot tasks
kilo run "..."
kilo run --agent plan "..."
kilo run --agent debug --file log.txt "..."
kilo run --format json "..."
kilo run --auto "..."

# providers / models
/connect
kilo auth list
kilo auth login
kilo models --verbose --refresh

# sessions / data
kilo session list --all --format json
kilo export <id> > session.json
kilo import session.json
kilo stats --days 7 --models

# review / debug
/local-review
kilo config check
kilo debug config
kilo debug paths
kilo debug skill

# server / remote / attach
kilo serve --port 4096
kilo attach http://127.0.0.1:4096
/remote

# MCP / customization
/mcps
kilo mcp list
kilo agent create
/init

Appendix A. Environment variables (full table)

Source basis: current core flag definitions in packages/opencode/src/flag/flag.ts, current shared auth store in packages/opencode/src/auth/index.ts, current XDG paths in packages/opencode/src/global/index.ts, and the current VS Code / VSCodium server launcher in packages/kilo-vscode/src/services/cli-backend/server-manager.ts.
This is the current source-derived list, not a stability guarantee. Quite a few experimental/internal vars are intentionally undocumented and may change.

A1. Core and commonly useful KILO_* variables

Variable Type What it controls Notes
KILO_CONFIG string explicit config file path use when you want one specific config file
KILO_CONFIG_CONTENT string inline config payload useful for wrappers / tests / generated configs
KILO_CONFIG_DIR string override config directory root affects config discovery, not the auth data file
KILO_TUI_CONFIG string explicit TUI config path advanced override
KILO_CLIENT string client identity defaults to cli; extension sets vscode
KILO_PERMISSION string permission override / preset selector advanced / partly internal
KILO_SERVER_PASSWORD string Basic Auth password for kilo serve used by attach if --password is omitted
KILO_SERVER_USERNAME string Basic Auth username for kilo serve server default is kilo
KILO_DISABLE_PROJECT_CONFIG boolean ignore project-local config files useful for debugging config precedence
KILO_DISABLE_DEFAULT_PLUGINS boolean disable bundled/internal plugins advanced troubleshooting
KILO_DISABLE_EXTERNAL_SKILLS boolean disable compatibility/external skill dirs blocks automatic loading from external compatibility paths
KILO_DISABLE_LSP_DOWNLOAD boolean skip bundled LSP downloads useful in locked-down environments
KILO_DISABLE_MODELS_FETCH boolean skip refreshing the model catalog offline / deterministic runs
KILO_MODELS_URL string alternate model catalog URL advanced / internal override
KILO_MODELS_PATH string local model catalog file path advanced / offline override
KILO_DISABLE_AUTOUPDATE boolean disable self-update checks / flow useful on pinned installs
KILO_ALWAYS_NOTIFY_UPDATE boolean always show update notification useful for testing updater UX
KILO_DISABLE_PRUNE boolean disable cleanup / pruning tasks advanced / internal maintenance
KILO_DISABLE_TERMINAL_TITLE boolean stop Kilo from changing terminal title terminal UX preference
KILO_SHOW_TTFD boolean show first-response timing diagnostic TTFD = time to first delta / first streamed output
KILO_ENABLE_EXPERIMENTAL_MODELS boolean expose experimental models catalog / picker behavior
KILO_DISABLE_AUTOCOMPACT boolean disable automatic context compaction advanced context debugging
KILO_DISABLE_CLAUDE_CODE boolean disable Claude-compat layer wholesale also disables Claude-compat prompt + skills toggles
KILO_DISABLE_CLAUDE_CODE_PROMPT boolean disable Claude-compat prompt layer only ignored if KILO_DISABLE_CLAUDE_CODE=true
KILO_DISABLE_CLAUDE_CODE_SKILLS boolean disable Claude-compat skill layer only ignored if KILO_DISABLE_CLAUDE_CODE=true
KILO_ENABLE_QUESTION_TOOL boolean enable the interactive question tool extension sets this to true
KILO_GIT_BASH_PATH string explicit Git Bash path on Windows Windows-only troubleshooting helper
KILO_DISABLE_EMBEDDED_WEB_UI boolean disable embedded web UI advanced / internal
KILO_DB string custom database path advanced override for kilo.db
KILO_DISABLE_CHANNEL_DB boolean disable channel DB features advanced / internal
KILO_SKIP_MIGRATIONS boolean skip DB migrations only for careful debugging/testing
KILO_STRICT_CONFIG_DEPS boolean strict config dependency validation advanced config debugging
KILO_SESSION_RETRY_LIMIT integer retry ceiling for session operations positive integer only
KILO_PLUGIN_META_FILE string plugin metadata file path advanced / internal
KILO_FAKE_VCS string fake VCS adapter / override mainly testing / advanced tooling
KILO_PURE boolean internal “pure” runtime mode dynamic getter; mostly tooling/tests
KILO_TEST_HOME string override home directory for tests defined in Global.Path.home; mainly test isolation

A2. Experimental / internal KILO_* variables

Variable Type What it controls Notes
KILO_EXPERIMENTAL boolean master experimental switch enables a family of experimental behaviors
KILO_EXPERIMENTAL_FILEWATCHER boolean experimental filewatcher backend source-derived
KILO_EXPERIMENTAL_DISABLE_FILEWATCHER boolean disable experimental filewatcher source-derived
KILO_EXPERIMENTAL_ICON_DISCOVERY boolean experimental icon discovery source-derived
KILO_EXPERIMENTAL_DISABLE_COPY_ON_SELECT boolean disable copy-on-select behavior defaults vary by platform
KILO_ENABLE_EXA boolean enable Exa integration source-derived / experimental
KILO_EXPERIMENTAL_EXA boolean legacy/alias Exa experimental toggle source-derived
KILO_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS integer default timeout for bash tool executions positive integer only
KILO_EXPERIMENTAL_OUTPUT_TOKEN_MAX integer fallback max output-token cap positive integer only
KILO_EXPERIMENTAL_OXFMT boolean experimental oxfmt formatting integration source-derived
KILO_EXPERIMENTAL_LSP_TY boolean experimental ty / typing integration source-derived
KILO_EXPERIMENTAL_LSP_TOOL boolean experimental LSP tool integration source-derived
KILO_DISABLE_FILETIME_CHECK boolean disable file mtime safety check advanced / internal
KILO_EXPERIMENTAL_PLAN_MODE boolean experimental / legacy plan-mode flag source-derived
KILO_EXPERIMENTAL_WORKSPACES boolean experimental multi-workspace support source-derived
KILO_EXPERIMENTAL_MARKDOWN boolean-ish markdown handling toggle enabled by default unless explicitly set to false / 0
KILO_AUTO_SHARE boolean automatic share behavior source-derived; currently undocumented

A3. Extension-injected runtime metadata (when the VS Code / VSCodium extension spawns kilo serve)

Variable Type Set by Purpose
KILO_CLIENT=vscode string extension server launcher marks the process as VS Code-backed
KILO_SERVER_PASSWORD=<random hex> string extension server launcher per-server Basic Auth password
KILO_ENABLE_QUESTION_TOOL=true boolean/string extension server launcher enables the question tool
KILOCODE_FEATURE=vscode-extension string extension server launcher feature/platform tag
`KILO_TELEMETRY_LEVEL=all off` string extension server launcher
KILO_APP_NAME=kilo-code string extension server launcher app label
KILO_EDITOR_NAME=<VS Code / VSCodium name> string extension server launcher editor branding
KILO_PLATFORM=vscode string extension server launcher platform marker
KILO_MACHINE_ID=<editor machine id> string extension server launcher editor runtime identifier
KILO_APP_VERSION=<extension version> string extension server launcher extension version marker
KILO_VSCODE_VERSION=<editor version> string extension server launcher editor version marker
KILO_DISABLE_CLAUDE_CODE=true boolean/string extension server launcher (conditional) set when the extension disables Claude compatibility

A4. Provider credentials: Kilo does not reserve one env var name per provider

Kilo config files support {env:VARIABLE_NAME} references, so provider/MCP credentials do not have to use Kilo-specific names. In practice, people often use names like these:

Example env var Typical use
OPENAI_API_KEY OpenAI-compatible provider auth
ANTHROPIC_API_KEY Anthropic auth
MY_PROVIDER_API_KEY custom provider defined in provider.<id>
CONTEXT7_TOKEN / MY_API_KEY MCP headers or other external tools

Example:

{
  "provider": {
    "openai": {
      "options": {
        "apiKey": "{env:OPENAI_API_KEY}"
      }
    }
  },
  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "Authorization": "Bearer {env:CONTEXT7_TOKEN}"
      }
    }
  }
}

Appendix B. Where auth-browser credentials and provider settings are stored

Short answer

There are two different storage classes in the current CLI / extension architecture:

  1. Config files (kilo.jsonc) for non-secret settings:
    • global: ~/.config/kilo/kilo.jsonc
    • project: kilo.jsonc or .kilo/kilo.jsonc
  2. Auth data (auth.json) for credentials handled by auth flows / provider auth storage:
    • stored at path.join(Global.Path.data, "auth.json")
    • written with file mode 0600

So your command

find ~/.config/kilo -name "*auth.json"

can return nothing even when auth exists, because auth.json is stored under the data dir, not the config dir.

What that means on Linux

Current source resolves Kilo paths through xdg-basedir:

  • config dir = XDG config location + /kilo
  • data dir = XDG data location + /kilo

On many Linux systems that means the files are usually here:

~/.config/kilo/kilo.jsonc
~/.local/share/kilo/auth.json

But the actual location can differ if your editor/terminal sets XDG variables differently.

Where settings from the auth browser usually end up

For things added through the current extension/CLI settings UI or auth browser:

  • provider definitions / model lists / base URLs / non-secret settings live in kilo.jsonc when applicable
  • stored credentials / tokens / API-key auth objects live in auth.json

This is why you may see the provider in Kilo, but not find a plaintext API key inside kilo.jsonc. The official settings docs also explicitly warn not to keep secrets in config and recommend environment variables for credentials.

Useful search commands

find ~/.config/kilo ~/.local/share/kilo -maxdepth 2 \
  \( -name 'kilo.json*' -o -name 'opencode.json*' -o -name 'auth.json' \) -print

printf 'XDG_CONFIG_HOME=%s\n' "${XDG_CONFIG_HOME:-<unset>}"
printf 'XDG_DATA_HOME=%s\n'   "${XDG_DATA_HOME:-<unset>}"

Extra gotchas

  • The extension shares config with the CLI, but it still runs a bundled CLI backend under the editor.
  • KILO_CONFIG_DIR changes config discovery, not the auth data path.
  • KILO_TEST_HOME exists in source as a home-dir override, but it is mainly for testing/tooling.
  • If you launched VSCodium from a desktop launcher instead of the shell, its effective XDG environment may differ from your terminal's.

Appendix C. Why kilo attach http://localhost:4096 returned Unauthorized against the extension server

What is happening

Your repro strongly matches a current client/server auth mismatch in the source:

  • kilo serve checks Basic Auth with:
    • password = KILO_SERVER_PASSWORD
    • username = KILO_SERVER_USERNAME ?? "kilo"
  • kilo attach builds the Basic Auth header as:
    • username = opencode
    • password = the supplied --password or KILO_SERVER_PASSWORD
  • the current VS Code / VSCodium extension launches the bundled CLI as:
    • kilo serve --port 0
    • injects a generated KILO_SERVER_PASSWORD
    • sets several metadata env vars
    • but does not set KILO_SERVER_USERNAME

So the extension-managed server expects:

kilo:<password>

while attach currently sends:

opencode:<password>

That is enough to produce Unauthorized even when the password is correct.

Why port 4096 made sense

Current serve code tries port 4096 first when started with --port 0, then falls back to a random free port only if needed. So your lsof output on port 4096 is perfectly plausible and not suspicious.

Practical workarounds

Workaround 1: launch the editor with a matching username override

Because the extension forwards ...process.env into the spawned kilo serve process, you can launch VSCodium from a shell like this:

export KILO_SERVER_USERNAME=opencode
codium .

Then the spawned server should expect the same username that kilo attach currently sends.

Workaround 2: run your own attachable server manually

# terminal A
export KILO_SERVER_USERNAME=opencode
export KILO_SERVER_PASSWORD='replace-me'
kilo serve --port 4096

# terminal B
export KILO_SERVER_PASSWORD='replace-me'
kilo attach http://127.0.0.1:4096

Workaround 3: use kilo run --attach against your own server

export KILO_SERVER_USERNAME=opencode
export KILO_SERVER_PASSWORD='replace-me'
kilo serve --port 4096

kilo run --attach http://127.0.0.1:4096 "Review the current repo state"

Important limitation right now

The current attach CLI exposes a password option, but not a username option. So with the extension-managed server you cannot fully fix this from the attach side alone; the clean workaround is to change the server username via environment before the server starts.


Appendix D. Hooks vs Claude: what Kilo can and cannot do today

Short answer

Kilo currently does not expose first-class session lifecycle hooks comparable to Claude's Start / Stop / SessionEnd style hooks.

There is an open feature request asking Kilo to expose session lifecycle hooks / APIs specifically so external tools can detect session start/end, read transcripts, inspect file changes, and run custom workflows when sessions complete.

What Kilo does have instead

Kilo gives you several customization mechanisms, but they are not lifecycle callbacks:

  • AGENTS.md / custom instructions for persistent behavior rules
  • workflows (.kilo/commands/*.md) for slash-command prompt templates
  • custom subagents with their own model + prompt + permissions
  • skills (SKILL.md) for reusable task-specific capability packs
  • config / rules / permissions in kilo.jsonc

Can Kilo do a true “block session close until handoff exists” hook?

Natively: no, not today.

You can get advisory behavior with instructions + workflows, but not a guaranteed synchronous stop hook that intercepts session close in the same way your Claude example does.

Best Kilo-native approximation for a handoff reminder

1) Put the policy in AGENTS.md

Create or extend your project AGENTS.md:

# Session handoff policy

For any task lasting more than ~15 minutes, or any task ending with open TODOs,
blockers, partial implementation, or unmerged work:

1. Before concluding, ask whether to write a handoff note.
2. If the user agrees, write it to `.kilo/handoffs/YYYY-MM-DD-HHMM-<slug>.md`.
3. Include:
   - task summary
   - files changed
   - tests run / not run
   - blockers
   - next steps
   - rollback notes / risky areas
4. Never claim a handoff exists unless the file was actually written.

2) Add a /handoff workflow

Create .kilo/commands/handoff.md:

---
description: Write a handoff note for the current session
agent: general
---

Write a handoff note to `.kilo/handoffs/YYYY-MM-DD-HHMM-session-handoff.md`.

Required sections:
- Summary
- Files changed
- Commands/tests run
- Open issues / blockers
- Recommended next step
- Risks / rollback notes

If the directory does not exist, create it.
Do not say the handoff was written unless the write succeeded.

Then you can invoke it with:

/handoff

3) Use an external wrapper if you need hard enforcement

If you need real “block on exit until condition is met” behavior, do it outside Kilo:

  • wrapper script around kilo
  • editor task / shell function
  • CI or git-hook style validation
  • a small daemon that checks for a recent handoff file before allowing your own workflow to finish

That is currently the only reliable way to reproduce the exact semantics of a Claude Stop hook.


Appendix E. Reviewer-loop workflow: one model implements, another reviews

What is possible today

Yes, Kilo can do the multi-agent / multi-model part:

  • the main workflow can run with one model
  • a custom reviewer subagent can run with a different model
  • the main agent can repeatedly call the reviewer and revise based on feedback

What is not hard-guaranteed

Current Kilo workflows are Markdown-based instruction files, not a procedural DSL with strict loops/conditionals/hooks. So a “repeat until approved, max 10 tries” workflow is best-effort when implemented purely inside Kilo.

For a hard gate, use an external driver script that calls Kilo repeatedly and parses the reviewer verdict.

E1. Reviewer subagent example

Create .kilo/agents/code-reviewer.md:

---
description: Strict reviewer that returns APPROVED or BLOCKED
mode: subagent
model: openai/gpt-5.3-codex   # replace with the exact provider/model ID from `kilo models`
temperature: 0.1
permission:
  edit: deny
  bash: deny
---

You are a strict code reviewer.

Review the current workspace state against the task you are given.

Output format:
- first line: `APPROVED` or `BLOCKED`
- second line: one-sentence verdict
- then sections:
  - Blocking issues
  - Non-blocking suggestions
  - Minimal acceptance checklist

Only return `APPROVED` if there are zero blocking issues.

If you already have a custom reviewer agent installed, just replace code-reviewer with that agent's name.

E2. Main workflow example

Create .kilo/commands/implement-with-review.md:

---
description: Implement with mandatory reviewer loop (max 10 rounds)
agent: code
model: anthropic/claude-opus-4.6   # replace with the exact provider/model ID from `kilo models`
---

# Mandatory implementation + review loop

Goal: complete the user's task, but do not finish until the `code-reviewer`
subagent approves or 10 rounds are exhausted.

Execution contract:
1. Work in rounds numbered 1..10.
2. In each round:
   - inspect the current task state and reviewer feedback
   - make the smallest reasonable edits
   - run focused validation for the touched area
   - delegate a review pass to `code-reviewer`
3. The reviewer must respond with `APPROVED` or `BLOCKED` on the first line.
4. If the reviewer returns `BLOCKED`:
   - summarize the blocking items into a concise TODO list
   - fix them
   - continue to the next round
5. If the reviewer returns `APPROVED`:
   - stop iterating
   - produce a final summary with changed files, tests run, and residual risks
6. If round 10 ends without approval:
   - stop
   - report that approval was not reached
   - list the remaining blockers and the best next step

Important rules:
- Never claim approval unless the reviewer explicitly returned `APPROVED`.
- Keep reviewer feedback concrete and file-specific.
- Prefer focused tests over expensive full-suite runs unless the change requires it.
- If useful, persist reviewer results under `.kilo/reviews/round-<n>.md`.

Invoke it with:

/implement-with-review

E3. Why this works

  • workflows can choose an agent and a model
  • custom subagents can define their own model, mode, and permission
  • subagents run in isolated sessions and return results to the parent agent

That makes “Opus implements, GPT-5.3-codex reviews” a valid Kilo pattern.

E4. Hard-enforced variant (external wrapper)

If you want the 10-round approval loop to be truly enforced, use a wrapper script like this:

#!/usr/bin/env bash
set -euo pipefail

TASK="${*:?pass the task text}"
mkdir -p .kilo/reviews

for round in $(seq 1 10); do
  kilo run --agent code --model anthropic/claude-opus-4.6 \
    "Round ${round}/10. Task: ${TASK}. If .kilo/reviews/latest.md exists, fix every blocking item in it before doing anything else."

  kilo run --agent code-reviewer \
    "Review the current workspace for task: ${TASK}. First line must be APPROVED or BLOCKED." \
    > .kilo/reviews/latest.md

  if grep -q '^APPROVED\b' .kilo/reviews/latest.md; then
    echo "Approved in round ${round}"
    exit 0
  fi
done

echo "Reviewer never approved after 10 rounds" >&2
exit 1

This variant is not as ergonomic as a native hook/loop engine, but it gives you the deterministic “do not finish until approved or attempts exhausted” behavior.


Appendix F. Known model-picker / /models caveats

What the docs say

Current docs distinguish between session model selection and persistent per-agent model defaults:

  • in VS Code, /models opens the picker for the current session; docs say precedence is session override → per-agent config → global config → recent models → Kilo Auto
  • in CLI/TUI, /models / the picker switches models interactively, but the documented precedence is --model → per-agent config → last used in session → global config → recent models → first available

That means a model configured directly on an agent can still dominate in some situations, especially in CLI precedence.

Practical takeaway

If you expected /models to permanently rewrite the agent's default model, that is not what the docs currently promise. The persistent/default place to change an agent model is:

  • Settings → agent/model configuration
  • kilo.jsonc
  • a custom agent markdown file in .kilo/agents/ or ~/.config/kilo/agents/

Why your observation may still indicate a real bug

There are current open issues around model/agent coupling in the new extension, including:

  • #6377: changing “Model Override” in the new extension does not stay specific to the selected agent
  • #8305: switching agents can also change models implicitly, leading to unexpected cost/behavior

So if /models appears to do nothing, or the choice reverts unexpectedly, it can be one of two things:

  1. documented precedence (for example, the agent itself is pinned to a model)
  2. a current model-selection bug / rough edge in the new extension UX

Fast sanity checks

# inspect the resolved config
kilo debug config

# inspect one agent's resolved config
kilo debug agent <agent-name>

Also inspect whether the relevant agent has an explicit model: in:

  • ~/.config/kilo/kilo.jsonc
  • project kilo.jsonc
  • .kilo/kilo.jsonc
  • ~/.config/kilo/agents/*.md
  • .kilo/agents/*.md

Appendix G. kilo attach vs kilo --attach vs VS Code extension backend

This is a real current sharp edge.

Observed behavior

  • kilo serve protects HTTP endpoints with Basic Auth when KILO_SERVER_PASSWORD is set.
  • Server-side username is KILO_SERVER_USERNAME if present, otherwise default is kilo.
  • kilo attach http://... currently uses opencode:<password> for the Basic Auth header.
  • kilo --attach http://... / kilo run --attach http://... currently uses ${KILO_SERVER_USERNAME:-kilo}:<password>.
  • The current VS Code / VSCodium extension does not attach to an arbitrary external server. It bundles its own bin/kilo, spawns kilo serve --port 0, captures the ephemeral port from stdout, and connects over HTTP + SSE.
  • The extension client currently authenticates to its own backend as kilo:<password>.

Practical consequence

This creates a mismatch matrix:

Client Username it sends today
kilo attach <url> opencode
kilo --attach <url> / kilo run --attach <url> ${KILO_SERVER_USERNAME:-kilo}
VS Code extension client kilo
kilo serve server expectation ${KILO_SERVER_USERNAME:-kilo}

Why kilo attach can 401 while kilo --attach works

If the server was started by the extension, it normally expects:

kilo:<password>

So:

kilo attach http://127.0.0.1:4096

may fail with Unauthorized, while:

kilo --attach http://127.0.0.1:4096

works, because --attach follows the server default username (kilo) and the attach subcommand currently does not.

Why the extension can get stuck on connecting to server...

If you launch VSCodium/VS Code with:

export KILO_SERVER_USERNAME=opencode

then the extension-spawned backend inherits that environment and its kilo serve process expects:

opencode:<password>

But the extension client still authenticates as:

kilo:<password>

So the backend starts, but the extension keeps failing auth / health checks and may sit in a reconnect loop showing:

connecting to server...

Fast diagnosis

Find the extension-managed backend:

pgrep -fla '/extensions/kilocode.kilo-code-.*/bin/kilo serve --port 0'

Inspect its environment:

pid=<PID>
strings /proc/$pid/environ | grep '^KILO_SERVER_'

If you see:

KILO_SERVER_USERNAME=opencode

that is the smoking gun.

Safe reset

Start VSCodium/VS Code with a clean env for server auth vars:

env -u KILO_SERVER_USERNAME -u KILO_SERVER_PASSWORD codium

or, in the current shell:

unset KILO_SERVER_USERNAME
unset KILO_SERVER_PASSWORD
codium

Then let the extension spawn its own backend again.

Important limitation

At least in the current rebuilt extension line, there is no documented/obvious setting that tells the extension to reuse your already-running external kilo serve endpoint. Treat the extension backend and manual kilo --attach as separate client flows.

If it still loops even with clean env

Then the likely causes move to extension-side startup/reconnect bugs, for example:

  • extension misses the printed port if the startup line is split across stdout chunks
  • extension reconnects against a dead backend after process death / stale SSE state

In that case, inspect extension host logs and the spawned kilo serve stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment