AI agents

Kimi Code CLI

Kimi Code CLI Cheatsheet

Kimi Code CLI (@moonshot-ai/kimi-code) is Moonshot AI’s terminal AI coding agent. It runs in your terminal, reads and modifies code, executes shell commands, searches files, fetches web pages, and plans autonomously. It is written in TypeScript, distributed via npm, and runs on Node.js (the install script provides a single-binary distribution that does not require Node.js).

Naming: Kimi Code is the membership/subscription service (it ships this CLI and a VS Code extension). Kimi Code CLI is the terminal client. The older Python-based kimi-cli is being phased out — data moved from ~/.kimi/ to ~/.kimi-code/ and kimi migrate imports the old data.

Install

# macOS / Linux (recommended; no Node.js needed)
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

# Windows (PowerShell; requires Git for Windows installed first)
irm https://code.kimi.com/kimi-code/install.ps1 | iex

# npm alternative (requires Node.js 22.19.0+)
npm install -g @moonshot-ai/kimi-code

First run and login

cd your-project
kimi            # start the interactive TUI

On first use, run /login inside the TUI and pick a method:

  • Kimi Code (OAuth) — device-code flow (RFC 8628)
  • Kimi Platform API key

/logout clears the credentials of the current account. kimi login performs the OAuth login non-interactively from the shell.

Quick start

kimi                      # interactive TUI
kimi -p "summarize this repo"   # one-shot non-interactive prompt
kimi -c                   # resume most recent session in this directory
kimi --plan               # start in Plan mode

Upgrade with kimi upgrade (or npm install -g @moonshot-ai/kimi-code@latest). Uninstall by deleting the binary or with npm uninstall -g @moonshot-ai/kimi-code.

In this section

FileWhat it covers
Slash CommandsEvery in-TUI /command, plus deep-dives on the most important ones
Terminal Commands (kimi)kimi terminal subcommands: login, acp, web, doctor, export, migrate, upgrade, provider, session list
CLI FlagsLaunch flags: -p, -c, -S, -m, -y, --auto, --plan, --skills-dir, --agent, --add-dir
Configurationconfig.toml, tui.toml, mcp.json, project local.toml, env vars, KIMI_CODE_HOME, precedence
Project Instructions (AGENTS.md)AGENTS.md locations, /init, SYSTEM.md, example instructions file
Agents and SubagentsBuilt-in and custom subagents, the Agent/AgentSwarm tools, model pool
SkillsSkill files, SKILL.md structure, /skill:<name> invocation, built-in skills
MCP: Connecting Servers to Kimi CodeConnecting MCP servers: /mcp-config, mcp.json, example
Permissions and ApprovalsAlways Ask / Ask When Needed / Never Ask modes, permission rules, safety warnings
WorkflowsMini-workflows: explore a codebase, build a feature, debug, refactor, review

For cross-tool comparisons see Feature Matrix; for cross-tool walkthroughs see Example: Understand a new repository.


Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.