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-cliis being phased out — data moved from~/.kimi/to~/.kimi-code/andkimi migrateimports 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
| File | What it covers |
|---|---|
| Slash Commands | Every 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 Flags | Launch flags: -p, -c, -S, -m, -y, --auto, --plan, --skills-dir, --agent, --add-dir |
| Configuration | config.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 Subagents | Built-in and custom subagents, the Agent/AgentSwarm tools, model pool |
| Skills | Skill files, SKILL.md structure, /skill:<name> invocation, built-in skills |
| MCP: Connecting Servers to Kimi Code | Connecting MCP servers: /mcp-config, mcp.json, example |
| Permissions and Approvals | Always Ask / Ask When Needed / Never Ask modes, permission rules, safety warnings |
| Workflows | Mini-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:
- https://www.kimi.com/code/docs/en/
- https://www.kimi.com/code/docs/en/kimi-code-cli/guides/getting-started.html
- https://www.npmjs.com/package/@moonshot-ai/kimi-code
- https://github.com/MoonshotAI/kimi-code
AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.