AI agents

Kimi Code CLI

Slash Commands

Slash commands are typed inside the interactive TUI. They are different from terminal commands (kimi ...) — see Terminal Commands (kimi). Some commands only work while the agent is idle; commands marked “always available” can also be used while the agent is streaming. /help (aliases /h, /?) lists keyboard shortcuts and all commands in-app.

Full command table

Account & configuration

CommandWhat it doesWhen to use it
/loginLog in: Kimi Code via OAuth device-code flow, or Kimi Platform via API keyFirst run, switching accounts, expired credentials
/logoutClear credentials of the current accountSwitching accounts or decommissioning a machine
/providerInteractive provider manager (view/add/remove providers)Adding a third-party or self-hosted model provider
/modelSwitch the LLM model for the current sessionTrying a different model mid-session
/secondary-model (alias /subagent-model)Set default model for subagents (writes [secondary_model] default_model)Cheaper/faster model for subagent work
/settings (alias /config)Settings panel in the TUIAdjusting preferences without editing TOML
/experiments (alias /experimental)Experimental features panelOpting into preview features
/permissionSelect the permission modeSwitching between Always Ask / Ask When Needed / Never Ask
/editorConfigure the external editor launched by Ctrl-GComposing long prompts in your editor
/themeSwitch the terminal UI color themeReadability/preference

Session management

CommandWhat it doesWhen to use it
/new (alias /clear)Start a fresh session, discarding current contextMoving to an unrelated task
/sessions (alias /resume)Browse and restore historical sessionsPicking up earlier work
/tasks (alias /task)Browse the background task listChecking on long-running background work
/forkFork the current session preserving full history (you stay in the current session)Trying a divergent approach without losing state
/title [<text>] (alias /rename)Show or set the session title (max 200 chars)Organizing the session list
/compact [<instruction>]Compact context; optional instruction hints what to preserveContext window filling up on a long session
/undo [<count>]Undo recent prompts (selector without arg); rolls back todo list and plan-mode state, not code changesReverting a bad direction
/reloadReload session applying latest config.toml and tui.toml without restartAfter editing config files
/reload-tuiReload only tui.toml UI preferencesAfter editing TUI settings
/initAnalyze the codebase and generate AGENTS.mdFirst session in a new project
/export-md [<path>] (alias /export)Export the session as MarkdownSharing or archiving a conversation
/export-debug-zipExport the session as a debug ZIP (same as kimi export)Bug reports and support
/copyCopy the last assistant message to the clipboardPasting a result elsewhere
/add-dir [<path>]Add an extra workspace directory; no arg or list lists dirs; can remember per-project in .kimi-code/local.tomlWorking across multiple repos/packages
/webOpen the current session in the web UI (connect to a running server or start one)Sharing a session or using the browser UI

Modes & run control

CommandWhat it doesWhen to use it
/yolo (alias /yes)Permission list with “Ask When Needed” preselected; Enter confirmsRoutine edits auto-run; risky actions still ask
/autoPermission list with “Never Ask” preselectedFully unattended runs
/plan [on|off]Toggle Plan mode; explicit on/off forces; toggling alone doesn’t create a plan filePlanning before executing
/plan clearClear the current planStarting the plan over
/swarm on|offToggle swarm modeEnabling multi-subagent fan-out
/swarm <task>Enable swarm mode and send the task as a prompt; auto-turns-off after normal completionOne-shot parallel fan-out
/goal [...]Start/manage goal mode (see deep-dive below)Persistent multi-turn objectives

Information & status

CommandWhat it doesWhen to use it
/help (aliases /h, /?)Keyboard shortcuts + all commandsAny time you’re lost
/btw [question]Side conversation in a forked sub-agent without affecting the main turnQuick question mid-task
/usageToken usage, context consumption, quotaWatching budget/context
/statusSession runtime state: version, model, cwd, permission modeDebugging configuration
/mcpList MCP servers and connection statusVerifying MCP setup
/pluginsInteractive plugin manager (also slash subcommands)Installing/managing plugins
/versionCLI versionReporting bugs, checking updates
/feedback (alias /bug)Submit feedback with optional logs/codebase contextReporting issues
/exit (aliases /quit, /q)Exit the CLI (not available while busy)Done for the day

Skill commands

Built-in skills ship as /<name> (no skill: prefix; idle-only): /mcp-config, /custom-theme, /update-config, /check-kimi-code-docs, /import-from-cc-codex, /sub-skill (plus /sub-skill.review, /sub-skill.consolidate). External skills are invoked as /skill:<name> [extra text]; see Skills.


Deep-dives

/login

What it does

Opens the platform selector and logs you in: Kimi Code (OAuth) via the RFC 8628 device-code flow, or Kimi Platform API key.

When to use it

On first run, when credentials expire, or when switching between the OAuth subscription account and an API-key account.

Example

/login
# → pick "Kimi Code (OAuth)" → complete the device-code flow in the browser

Notes

  • /logout clears the current account’s credentials.
  • There is also a non-interactive shell equivalent: kimi login (exit 0 on success, 1 on cancel/failure).
  • OAuth credentials and MCP authorizations are not migrated by kimi migrate; re-run /login after migrating from the legacy CLI.

Official source

/model

What it does

Switches the LLM model used for the current session from an interactive list.

When to use it

To move between the flagship and high-speed tiers mid-session, or to test a newly configured provider model without restarting.

Example

/model
# → interactive selector lists configured model aliases

Notes

  • Only changes the current session; the persistent default is default_model in config.toml (or -m/--model at launch).
  • Available API model IDs include k3, k3-256k, kimi-for-coding (K2.7 Code) and kimi-for-coding-highspeed.

Official source

/new

What it does

Starts a fresh session, discarding the current conversation context. Alias: /clear.

When to use it

When switching to an unrelated task, or when accumulated context is hurting answer quality and you don’t want /compact.

Example

/new

Notes

  • Only available while the agent is idle.
  • Sessions started later with /new use the default agent even if the original session was launched with --agent/--agent-file.
  • To keep the old session around, use /fork first, or /sessions to return to it later.

Official source

/sessions

What it does

Opens a browser of historical sessions so you can restore one, with full history. Alias: /resume.

When to use it

To pick up earlier work in the same project directory without re-explaining context.

Example

/sessions
# → interactive list; select a session to restore it

Notes

  • Shell equivalents: kimi -c (most recent in cwd), kimi -S [id] / kimi --session [id] (selector or direct ID), and kimi session list.
  • Resuming restores the bound agent and the saved permission/plan mode (flags can override the saved mode).
  • Sessions live under ~/.kimi-code/sessions/<workDirKey>/<sessionId>/; do not hand-edit.

Official source

/compact

What it does

Compacts the conversation context to free up context-window space. An optional instruction tells the compaction what to preserve.

When to use it

On long sessions when the context window is nearly full (also happens automatically when the threshold [loop_control] reserved_context_size is reached).

Example

/compact keep the failing test output and the refactoring plan

Notes

  • Prompts sent before the last compaction cannot be undone with /undo.
  • Ctrl-O toggles the compaction summary view.
  • Only available while the agent is idle.

Official source

/plan

What it does

Toggles Plan mode; /plan on / /plan off force a state; /plan clear clears the current plan. In Plan mode the agent researches and writes a plan file instead of editing code.

When to use it

Before a non-trivial change, so you can review and approve the approach before any file is touched.

Example

/plan on
Refactor the auth module to support OAuth2
# → agent drafts a plan; you approve, revise, or reject it
/plan clear

Notes

  • Toggling alone doesn’t create a plan file; the plan is produced during the turn.
  • In Plan mode, Write/Edit are restricted to the plan file and TaskStop is blocked; exiting plan mode requires user confirmation even in Ask When Needed mode.
  • Shift-Tab is the keyboard toggle. Start a session directly in Plan mode with kimi --plan or default_plan_mode = true.

Official source

/yolo

What it does

Opens the permission list with Ask When Needed (formerly “YOLO”) preselected; Enter confirms. Routine edits and commands run automatically; risky actions, questions, and plan-mode exits still ask.

When to use it

For long, low-risk tasks in a trusted directory where per-action approval would be tedious. See the safety warning in Permissions and Approvals.

Example

/yolo
# → permission list appears with "Ask When Needed" preselected → Enter

Notes

  • Still asks for sensitive files (.env, SSH keys), dangerous commands (shutdown, rm -rf), and Plan-mode exits.
  • Shell equivalent: kimi -y / kimi --yolo (hidden aliases --yes, --auto-approve).
  • Docs warn to use it only in trusted working directories.

Official source

/goal

What it does

Starts and manages goal mode: a persistent objective (max 4000 characters) that the agent keeps pursuing across auto-continuing turns until complete, paused, or blocked.

Subcommands: /goal or /goal status (show goal/status/elapsed/turns/tokens), /goal pause, /goal resume (idle only), /goal cancel, /goal replace <objective> (idle only), /goal next <objective> (queue an upcoming goal), /goal next manage (interactive queue manager).

When to use it

For long autonomous runs with a clear finish line — e.g. “migrate all tests to vitest and stop when the suite passes”.

Example

/goal Migrate src/ to TypeScript. Stop when `npm run typecheck` passes with no errors.
/goal status
/goal next Update the README build instructions

Notes

  • Write the stop condition into the objective itself; there is no stop-limit flag.
  • Subcommand words (status, pause, resume, cancel, replace, next) only parse as subcommands in first position; use /goal -- <text> to bypass.
  • In kimi -p only creation forms work; prompt mode exits 0 (complete), 3 (blocked), or 6 (paused).
  • The queue is persisted in the session’s upcoming-goals.json.

Official source

/init

What it does

Analyzes the current codebase and generates an AGENTS.md project-instructions file.

When to use it

First session in a project, so every future session gets build/test commands and conventions injected into the system prompt. See Project Instructions (AGENTS.md).

Example

/init
# → reviews the generated AGENTS.md, then commits it to the repo

Notes

  • Idle-only command.
  • Review the generated file before committing — it becomes reference data in every system prompt.

Official source

/mcp

What it does

Lists configured MCP servers and their connection status.

When to use it

To verify a newly added server connected, or to diagnose a missing tool. Companion skill command /mcp-config adds/edits/deletes servers; details in MCP: Connecting Servers to Kimi Code.

Example

/mcp
# → server list with per-server connection status

Notes

  • Servers added mid-session only join new sessions; deleting a server mid-session leaves it listed as removed and its calls fail.
  • MCP tools appear as mcp__<server>__<tool> alongside built-in tools.

Official source

/permission

What it does

Opens the permission-mode selector: Always Ask (default), Ask When Needed, or Never Ask.

When to use it

To change how much the agent can do without asking — see the full mode comparison and warnings in Permissions and Approvals.

Example

/permission
# → select "Always Ask" / "Ask When Needed" / "Never Ask"

Notes

  • /yolo and /auto are shortcuts that preselect the latter two modes.
  • The persistent default is default_permission_mode in config.toml (manual/yolo/auto).
  • Config values kept the old names when the modes were renamed in 0.41.0.

Official source


Last verified: 2026-09-07

Official sources:

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