kimi Command
kimi is the main command of Kimi Code CLI, used to start an interactive session in the terminal. When run without any arguments, it opens a new session in the current working directory; with different flags, you can resume a previous session, skip approvals, start in Plan mode, or point at custom Skills directories.
kimi [options]
kimi <subcommand> [options]Main command options
The table below lists all options supported by the kimi main command. All flags are optional — running kimi on its own is enough to enter an interactive session.
| Option | Short | Description |
|---|---|---|
--version | -V | Print the version number and exit. |
--help | -h | Show help information and exit. |
--session [id] | -S | Resume a session. With an ID, open the specified session directly; without an ID, enter the interactive picker to choose from historical sessions. |
--continue | -C | Continue the most recent session in the current working directory, without manually specifying an ID. |
--model <model> | -m | Use a model alias for this invocation. When omitted, new sessions use default_model from the config file, and resumed sessions use the session's current model. |
--prompt <prompt> | -p | Run one prompt non-interactively and stream assistant output to stdout. This mode uses auto permission for tool calls and does not open the TUI. |
--output-format <format> | Set the non-interactive output format. Supported values are text and stream-json. Only valid with --prompt; defaults to text. | |
--yolo | -y | Auto-approve ordinary tool calls, skipping approval requests; Plan mode Bash approval and Plan mode exit approval are not skipped. |
--plan | Start a new session in Plan mode, where the AI favors read-only tools for exploration and planning and can write the current plan file; Plan mode Bash is handled separately according to the permission mode. | |
--skills-dir <dir> | Load Skills from the specified directory, replacing the auto-discovered user and project directories. Can be passed multiple times to stack several directories. See Custom Skills directories below. |
-r / --resume is a hidden alias for --session; --yes and --auto-approve are hidden aliases for --yolo. They do not appear in the help output and behave identically to their official counterparts.
Note
--yolo skips human confirmation for ordinary tool calls, including file writes and shell command execution. Use it only inside trusted working directories. Plan mode exit approval is not skipped by --yolo; in Plan mode, Bash also follows the same ordinary allow rules as --yolo.
Flag conflict rules
The following combinations are rejected at startup:
--continueand--sessionare mutually exclusive: both mean "resume a previous session" and overlap in meaning.--yolocannot be combined with--continueor--session: when resuming a session, the original session's approval settings are preserved. This rule only applies to interactive mode; in--promptmode,--yolois rejected earlier because it is mutually exclusive with--prompt.--plancannot be combined with--continueor--session: Plan mode only applies to new sessions.--promptcannot be combined with--yoloor--plan: non-interactive mode always usesautopermission and does not enter Plan mode.--promptcan be combined with--continueor--session <id>with an ID; bare--sessionwithout an ID would open the interactive picker and therefore cannot be used in non-interactive mode.--output-formatcan only be used with--prompt; the interactive TUI does not support writing the full event stream as stdout JSONL.
If you need to force YOLO or Plan mode while resuming a session, switch into them from inside the interactive session via slash commands instead.
Typical usage
The most common entry point is to run kimi directly to start a fresh session in the current directory:
kimiIf the previous session was interrupted (terminal closed, network disconnected, etc.) and you want to pick up where you left off, use --continue:
kimi --continueThis automatically finds and resumes the most recent session under the current working directory. To pick a different historical session, run kimi --session to enter the interactive picker, or pass a known session ID directly:
kimi --session 01HZ...XYZWhen the task is trivial and you don't want to be interrupted by frequent approval requests, add --yolo:
kimi --yoloIf you want the AI to read the code and produce an implementation plan first, rather than immediately editing files, use --plan to enter Plan mode:
kimi --planCustom Skills directories
To load custom Skills directories, you have two options:
CLI flag
--skills-dir <dir>: Can be passed multiple times and replaces the auto-discovered user and project directories. Useful for temporary overrides or use in scripts. For example, to mount two directories at once:shkimi --skills-dir /path/to/team-skills --skills-dir ./local-skillsextra_skill_dirsinconfig.toml: Appends extra directories in the config file and stacks them with the auto-discovered ones. Suitable for persistent configuration of team-shared Skills (see Agent Skills).
Non-interactive execution
Use -p when a script or CI job needs to run one prompt:
kimi -p "Summarize the current repository status"Output uses transcript-style blocks: thinking and assistant text start with • , with continuation lines indented by two spaces. Assistant text is written to stdout; thinking, tool progress, and the To resume this session: kimi -r <id> hint are written to stderr. Prompt mode does not wait for manual approvals: ordinary tool calls, Plan approvals, and agent questions follow the auto permission policy. Static deny rules still block matching tool calls.
To switch models for a single invocation, add -m:
kimi -m kimi-code/kimi-for-coding -p "Explain the latest diff"If a script needs structured output, use JSONL:
kimi -p "List changed files" --output-format stream-jsonIn stream-json mode, each stdout line is one JSON object. Ordinary replies are emitted as assistant messages. If the model calls tools, the output first includes an assistant message with tool_calls, then the corresponding tool message, followed by later assistant messages. Thinking content is not written to JSONL; tool progress and the resume-session hint still go to stderr.
Subcommands
kimi export
Bundle a session into a ZIP file for sharing, archival, or bug reports. The exported archive contains all files under the session directory, such as context records, state files, and the session diagnostic log if that session has already produced logs/kimi-code.log.
kimi export [sessionId] [options]| Argument / Option | Short | Description |
|---|---|---|
sessionId | The ID of the session to export. When omitted, the most recent session under the current working directory is selected automatically and a confirmation is requested. | |
--output <path> | -o | Output path for the ZIP file. When omitted, writes to a default filename in the current directory. |
--yes | -y | Skip the confirmation prompt for the default session and export directly. |
--no-include-global-log | Skip bundling the active global diagnostic log, ~/.kimi-code/logs/kimi-code.log. It is included by default. |
By default, export includes files inside the target session directory. If that directory contains logs/kimi-code.log, it appears in the ZIP as logs/kimi-code.log. The global diagnostic log at ~/.kimi-code/logs/kimi-code.log is also bundled by default, because it may contain events from other sessions or projects. Add --no-include-global-log when you do not want to share it. When included, its ZIP path is logs/global/kimi-code.log; rotated files such as kimi-code.log.1 are not bundled.
When sessionId is omitted, the command first prints the session to be exported and asks for confirmation; -y skips this prompt, which is handy for scripts:
# Export the most recent session under the current working directory, skipping confirmation
kimi export -y
# Export a specific session to a custom path
kimi export 01HZ...XYZ -o ./bug-report.zip
# Exclude the global diagnostic log to avoid sharing events from other sessions
kimi export 01HZ...XYZ -o ./bug-report.zip --no-include-global-logkimi migrate
Migrate local data from an older version of kimi-cli to kimi-code. This command has no flags and runs fully interactively, guiding you through the entire migration process.
kimi migrateIf you previously used an older version of kimi-cli, run this command to migrate historical sessions, configuration, and other data to kimi-code to avoid data loss. For the full migration flow, what gets migrated, and things to watch out for, see Migrating from kimi-cli.