kimi-code reference

Reference tables for kimi-code CLI commands, flags, config.toml and tui.toml settings, built-in subagents, and exit codes.

CLI commands and flags

Command or flag Usage Description
kimi --version, -V kimi --version Print installed Kimi Code CLI version string (such as 2.4.1).
kimi kimi Start the interactive terminal user interface in the current project directory.
kimi -p kimi -p "<prompt>" [--output-format stream-json] Execute a headless one-shot prompt; stream-json emits structured JSONL events without TUI formatting.
kimi acp kimi acp Start the Agent Client Protocol server over stdio for lmctl, Zed, or JetBrains IDEs.
/login, /mcp-config interactive slash commands Authenticate via Kimi Code OAuth or Moonshot API key, or configure MCP servers conversationally.

Configuration files (~/.kimi-code/)

File and key Example value Purpose
config.toml: default_model "mock" Select the default model key from the [models.*] table.
config.toml: [providers.<id>] type = "openai", base_url = "http://127.0.0.1:PORT/v1", api_key = "..." Register an OpenAI-compatible or custom model provider endpoint.
config.toml: [models.<id>] provider = "mock", model = "mock-agent", max_context_size = 128000 Bind a named model profile to a registered provider and context window size.
tui.toml: [upgrade] auto_install false Disable automatic background binary replacement so fork patches remain intact.
KIMI_SHELL_PATH (Windows) C:\Program Files\Git\bin\bash.exe Override the Git Bash executable path on Windows systems.

Built-in subagents and fork patches

Component Location or name Description
acp-runtime-after-reap fix packages/agent-core-v2/src/agent/runtimeBinding/agentRuntime.ts Heals stale acp:<sessionId> bindings on restore by rebinding to the host's local runtime (PR #3563).
Batched queued prompt delivery see FORK-NOTES.md Delivers all prompts queued during a busy turn together in FIFO order in the next turn (PR #4052).
Built-in subagents coder, explore, plan Isolated subagents for parallel coding, codebase exploration, and implementation planning.

Exit codes

Code Meaning
0 Headless prompt, ACP session, or TUI exited cleanly.
1 Invalid CLI flags, missing provider configuration, or upstream model request failure.