packages/kilo-docs/pages/code-with-ai/platforms/cli.md
{% callout type="warning" title="Version Notice" %} This documentation applies only to Kilo version 1.0 and later. Users running versions below 1.0 should upgrade before proceeding. {% /callout %}
Orchestrate agents from your terminal. Plan, debug, and code fast with keyboard-first navigation on the command line.
The Kilo Code CLI uses the same underlying technology that powers the IDE extensions, so you can expect the same workflow to handle agentic coding tasks from start to finish.
Source code & issues (Kilo CLI 1.0): Kilo-Org/kilocode · Report an issue
{% partial file="install-cli.md" /%}
Change directory to where you want to work and run kilo:
# Start the TUI
kilo
# Check the version
kilo --version
# Get help
kilo --help
/connectAfter installation, run kilo and use the /connect command to add your first provider credentials. This is the interactive way to configure API keys for model providers.
Upgrade the Kilo CLI:
kilo upgrade
Or use npm:
npm update -g @kilocode/cli
{% partial file="cli-commands-table.md" /%}
For detailed help on every command and subcommand, see the CLI Command Reference.
| Flag | Description |
|---|---|
--help, -h | Show help |
--version, -v | Show version number |
--print-logs | Print logs to stderr |
--log-level | Log level: DEBUG, INFO, WARN, ERROR |
| Command | Aliases | Description |
|---|---|---|
/sessions | /resume, /continue | Switch session |
/new | /clear | New session |
/share | - | Share session |
/unshare | - | Unshare session |
/rename | - | Rename session |
/timeline | - | Jump to message |
/fork | - | Fork from message |
/compact | /summarize | Compact/summarize session |
/undo | - | Undo previous message |
/redo | - | Redo message |
/copy | - | Copy session transcript |
/export | - | Export session transcript |
/timestamps | /toggle-timestamps | Show/hide timestamps |
/thinking | /toggle-thinking | Show/hide thinking blocks |
| Command | Description |
|---|---|
/models | Switch model |
/agents | Switch agent |
/mcps | Toggle MCPs |
| Command | Description |
|---|---|
/connect | Connect/add a provider - entry point for new users to add API credentials |
| Command | Aliases | Description |
|---|---|---|
/status | - | View status |
/themes | - | Switch theme |
/help | - | Show help |
/editor | - | Open external editor |
/exit | /quit, /q | Exit the app |
| Command | Aliases | Description |
|---|---|---|
/profile | /me, /whoami | View your Kilo Gateway profile |
/teams | /team, /org, /orgs | Switch between Kilo Gateway teams |
/remote | - | Toggle remote mode for Cloud Agent access |
| Command | Description |
|---|---|
/init | Create/update AGENTS.md file for the project |
/local-review | Review code changes |
/local-review-uncommitted | Review uncommitted changes |
Review your code locally before pushing — catch issues early without waiting for PR reviews. Local code reviews give you AI-powered feedback on your changes without creating a public pull request.
| Command | Description |
|---|---|
/local-review | Review current branch changes vs base branch |
/local-review-uncommitted | Review uncommitted changes (staged + unstaged) |
Configuration is managed through:
/connect command for provider setup (interactive)~/.config/kilo/: use kilo.jsonc for provider, model, permission, and MCP settings. Restart the CLI after editing. See Using MCP in Kilo Code for MCP config format.kilo auth for credential managementThe CLI's interactive mode supports slash commands for common operations. The main commands are documented above in the Interactive Slash Commands section.
{% callout type="tip" %} Confused about /newtask vs /smol in the IDE? See the Using Agents documentation for details. {% /callout %}
Kilo Code uses the permission config to decide whether a given action should run automatically, prompt you, or be blocked.
Each permission rule resolves to one of:
"allow" — run without approval"ask" — prompt for approval"deny" — block the actionYou can set permissions globally (with *), and override specific tools.
{
"$schema": "https://app.kilo.ai/config.json",
"permission": {
"*": "ask",
"bash": "allow",
"edit": "deny"
}
}
You can also set all permissions at once:
{
"$schema": "https://app.kilo.ai/config.json",
"permission": "allow"
}
For most permissions, you can use an object to apply different actions based on the 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"
}
}
}
Rules are evaluated by pattern match, with the last matching rule winning. A common pattern is to put the catch-all "*" rule first, and more specific rules after it.
Permission patterns use simple wildcard matching:
* matches zero or more of any character? matches exactly one characterYou can use ~ or $HOME at the start of a pattern to reference your home directory. This is particularly useful for external_directory rules.
~/projects/* → /Users/username/projects/*$HOME/projects/* → /Users/username/projects/*~ → /Users/usernameUse external_directory to allow tool calls that touch paths outside the working directory where Kilo was started. This applies to any tool that takes a path as input (for example read, edit, glob, grep, and many bash commands).
{
"$schema": "https://app.kilo.ai/config.json",
"permission": {
"external_directory": {
"~/projects/personal/**": "allow"
}
}
}
Any directory allowed here inherits the same defaults as the current workspace. Since read defaults to "allow", reads are also allowed for entries under external_directory unless overridden. Add explicit rules when a tool should be restricted in these paths, such as blocking edits while keeping reads:
{
"$schema": "https://app.kilo.ai/config.json",
"permission": {
"external_directory": {
"~/projects/personal/**": "allow"
},
"edit": {
"~/projects/personal/**": "deny"
}
}
}
In Ask and Plan modes, external_directory allow rules can still permit reads outside the workspace. They do not enable writes or mutating commands that those modes deny, and explicit external_directory deny rules still win.
Aliases: /t and /history can be used as shorthand for /tasks
The Kilo CLI is a fork of OpenCode and supports the same configuration options. The CLI you install with npm install -g @kilocode/cli (Kilo CLI 1.0) is built from Kilo-Org/kilocode. For comprehensive configuration documentation, see the OpenCode Config documentation.
| Scope | Path |
|---|---|
| Global | ~/.config/kilo/opencode.json or opencode.jsonc (Windows: config dir may vary; same filenames) |
| Project | ./opencode.json or ./.opencode/ in project root |
Project-level configuration takes precedence over global settings.
{
"$schema": "https://app.kilo.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"provider": {
"anthropic": {
"options": {
"apiKey": "{env:ANTHROPIC_API_KEY}"
}
}
}
}
Common configuration options include:
model - Default model in provider_id/model_id format (e.g., "anthropic/claude-sonnet-4-20250514")provider - Provider-specific settings (API keys, base URLs, custom models)mcp - MCP server configurationpermission - Tool permission settings (allow or ask)instructions - Paths to instruction files (e.g., ["CONTRIBUTING.md", ".cursor/rules/*.md"])formatter - Code formatter configuration (true, false, or formatter-specific entries)lsp - Language server configuration (true, false, or server-specific entries)disabled_providers / enabled_providers - Control which providers are available{% callout type="tip" %}
Using a model that's not in the built-in list? You can register any model by adding it under provider.<provider_id>.models in your config file. See Custom Models for full details and examples.
{% /callout %}
Set formatter or lsp to true to use built-in defaults, or false to disable the feature completely:
{
"formatter": true,
"lsp": false,
}
Both keys also accept object configuration for specific tools or language servers. Custom LSP server entries must include an extensions array unless the entry disables a built-in server:
{
"lsp": {
"my-language-server": {
"command": ["my-lsp", "--stdio"],
"extensions": [".foo"],
},
},
}
The TUI gives Ctrl+Z to input undo on Windows because native Windows terminals do not support POSIX terminal suspend. On Windows, input_undo defaults to ctrl+z,ctrl+-,super+z and terminal_suspend is disabled. On macOS and Linux, terminal_suspend defaults to ctrl+z.
Some terminals don't send modifier keys with Enter by default. Windows Terminal requires a one-time configuration to forward Shift+Enter as an escape sequence that Kilo can read.
Open your settings.json at:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
Add this entry to the root-level actions array:
"actions": [
{
"command": {
"action": "sendInput",
"input": "\u001b[13;2u"
},
"id": "User.sendInput.ShiftEnterCustom"
}
]
Add this entry to the root-level keybindings array:
"keybindings": [
{
"keys": "shift+enter",
"id": "User.sendInput.ShiftEnterCustom"
}
]
Save the file and restart Windows Terminal or open a new tab. Shift+Enter will now insert a newline in the Kilo prompt instead of submitting the message.
Kilo telemetry is enabled by default and can be disabled with experimental.openTelemetry = false:
{
"experimental": {
"openTelemetry": false,
},
}
If OTEL_EXPORTER_OTLP_ENDPOINT is set, the CLI exports OpenTelemetry traces and logs to that OTLP HTTP endpoint. You can also pass OTEL_EXPORTER_OTLP_HEADERS as comma-separated key=value pairs and OTEL_RESOURCE_ATTRIBUTES as comma-separated resource attributes. Request spans include http.method, http.path, route params such as session.id and message.id, and internal params under the opencode.* namespace.
Use {env:VARIABLE_NAME} syntax in config files to reference environment variables:
{
"provider": {
"openai": {
"options": {
"apiKey": "{env:OPENAI_API_KEY}"
}
}
}
}
For full details on all configuration options including compaction, file watchers, plugins, and experimental features, see the OpenCode Config documentation.
Interactive mode is the default mode when running Kilo Code without the --auto flag, designed to work interactively with a user through the console.
In interactive mode Kilo Code will request approval for operations which have not been auto-approved, allowing the user to review and approve operations before they are executed, and optionally add them to the auto-approval list.
When running in interactive mode, command approval requests show hierarchical options:
[!] Action Required:
> ✓ Run Command (y)
✓ Always run git (1)
✓ Always run git status (2)
✓ Always run git status --short --branch (3)
✗ Reject (n)
Selecting an "Always run" option will:
allow rule under permission.bash in your global configKilo only saves the pattern you select. Approving a specific command does not approve redirected variants or broader command patterns unless that broader option is shown and selected.
Autonomous mode allows Kilo Code to run in automated environments like CI/CD pipelines without requiring user interaction.
# Run in autonomous mode with a message
kilo run --auto "Implement feature X"
When running in autonomous mode:
Autonomous mode respects your auto-approval configuration. Operations which are not auto-approved will not be allowed.
In autonomous mode, when the AI asks a follow-up question, it receives this response:
"This process is running in non-interactive autonomous mode. The user cannot make decisions, so you should make the decision autonomously."
This instructs the AI to proceed without user input.
0: Success (task completed)124: Timeout (task exceeded time limit)1: Error (initialization or execution failure)# GitHub Actions example
- name: Run Kilo Code
run: |
kilo run "Implement the new feature" --auto
Resume your last conversation from the current workspace using the --continue (or -c) flag:
# Resume the most recent session from this workspace
kilo --continue
kilo -c
This feature:
Example workflow:
# Start a session
kilo
# > "Create a REST API"
# ... work on the task ...
# Exit with /exit
# Later, resume the same session
kilo --continue
# Conversation history is restored, ready to continue
Limitations:
Remote Connections let you access your local CLI sessions from the Cloud Agents web interface. Requires Kilo Gateway connection.
Toggle during a session:
/remote
Requires connection to Kilo Gateway. The /remote command appears only when authenticated.
Enable by default:
Add to ~/.config/kilo/config.json:
{
"remote_control": true
}
Once enabled, start a CLI session and open Cloud Agents. Your local session appears in the dashboard. See Cloud Agent Remote Connections for details.
{% callout type="warning" title="Security Warning" %} Anyone with access to your Kilo account can send messages to your computer when remote mode is enabled. {% /callout %}
The CLI supports overriding config values with environment variables. The supported environment variables are:
KILO_PROVIDER: Override the active provider IDkilocode provider: KILOCODE_<FIELD_NAME> (e.g., KILOCODE_MODEL → kilocodeModel)KILO_<FIELD_NAME> (e.g., KILO_API_KEY → apiKey)If you belong to a Kilo organization (Team or Enterprise), you can route CLI requests through that organization. The process differs slightly between interactive and non-interactive usage.
In an interactive CLI session, use the /teams command to select an organization from your membership list.
Your selection is persisted locally so it carries over to future sessions.
kilo run)There is no --org or --team flag on kilo run. Instead, the organization is determined from the following sources, in order of priority (highest first):
KILO_ORG_ID environment variable — Best for non-interactive and CI environments.
Persisted selection from the last /teams pick — If you've run an interactive session and selected an organization via /teams, that selection is stored in the CLI auth file and reused automatically.