kimi-code/apps/kimi-code
Haozhe 794714ebef
fix(agent-core-v2): gate plugin changes behind session baselines and reminders (#2702)
* fix(agent-core-v2): gate plugin changes behind session baselines and reminders

- capture a per-session MCP server baseline (ISessionMcpHandle.isBaselineServer)
  so servers added mid-session (plugin install, mcp.json edit) never register
  tools in live sessions; they take effect on /new, /reload, or resume, while
  removed servers stay tombstoned and fail calls with a removal notice
- stop rebuilding the system prompt on plugin-source catalog changes: the
  frozen skill listing and plugin sections cannot move anyway, and the rebuild
  only churned the ${now} timestamp, invalidating the provider prompt cache
- freeze the Agent tool description's catalog profile list once the session
  catalog has loaded, keeping the tools payload byte-stable across mutations
- append a plugin_change system reminder to live sessions on plugin mutations
  (new IPluginService.onDidMutate; explicit reloadPlugins does not raise it)
- revert the TUI hint to "Run /new or /reload to apply plugin changes." and
  update the plugin/MCP docs and changesets to the corrected contract

* fix(agent-core-v2): import LifecycleScope from app/scopes in sessionOutcomeMirror

#2666 imported LifecycleScope from #/_base/di/scope, which does not export
it (it lives in #/app/scopes), breaking the package build and typecheck on
main.

* fix(agent-core-v2): close the mutation-driven session-start refresh and overlay baseline leaks

Codex review on the PR found two contract leaks:

- a plugin mutation re-pulls the plugin skill source, and the existing
  catalog listener answered with a fresh plugin_session_start reminder —
  injecting the newly installed plugin's instructions into the live session
  alongside (and contradicting) the plugin_change notice. The session-start
  refresh now skips mutation-driven catalog changes (one per mutation,
  counted; explicit reloads keep the old refresh behavior).
- a session created with ephemeral mcpServers kept its MCP baseline open
  until the overlay connect finished; a workspace server added in that
  window (plugin install, config edit) leaked into the live session through
  the merged view. The overlay handle's baseline now freezes on the
  workspace manager's initial load, with the ephemeral names baseline by
  construction.

* fix(agent-core-v2): drop duplicate LifecycleScope import in sessionOutcomeMirror test

---------

Signed-off-by: Haozhe <yanghaozhe@moonshot.ai>
2026-08-06 21:11:03 +08:00
..
dist-web chore: sync web dist from code-app (#2697) 2026-08-06 19:58:01 +08:00
scripts fix(cli): stabilize built-in capability installation (#2601) 2026-08-05 14:55:04 +08:00
src fix(agent-core-v2): gate plugin changes behind session baselines and reminders (#2702) 2026-08-06 21:11:03 +08:00
test fix(agent-core-v2): gate plugin changes behind session baselines and reminders (#2702) 2026-08-06 21:11:03 +08:00
.gitignore feat(minidb): persistent index generations and lifecycle hardening (#2604) 2026-08-04 20:38:42 +08:00
AGENTS.md feat(cli): unify TUI dialog interaction and visuals (#363) 2026-06-03 19:31:07 +08:00
CHANGELOG.md ci: release packages (#2592) 2026-08-05 16:21:32 +08:00
package.json ci: release packages (#2592) 2026-08-05 16:21:32 +08:00
README.md docs: mention Windows Git Bash requirement (#419) 2026-06-04 17:04:02 +08:00
tsconfig.dev.json feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
tsconfig.json feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
tsdown.config.ts chore: drop #/ import array fallbacks and custom resolution plugins (#1594) 2026-07-13 16:37:35 +08:00
tsdown.native.config.ts chore: drop #/ import array fallbacks and custom resolution plugins (#1594) 2026-07-13 16:37:35 +08:00
tsdown.worker.config.ts feat(minidb): persistent index generations and lifecycle hardening (#2604) 2026-08-04 20:38:42 +08:00
vitest.config.ts chore: use raw query imports for prompt sources (#682) 2026-06-12 11:47:44 +08:00

@moonshot-ai/kimi-code

The Starting Point for Next-Gen Agents

npm License Docs

What is Kimi Code CLI

Kimi Code CLI is an AI coding agent that runs in your terminal. It can read and edit code, run shell commands, search files, fetch web pages, and choose the next step based on the feedback it receives. It works out of the box with Moonshot AI's Kimi models and can also be configured to use other compatible providers.

Install

The recommended install path is the official script. It does not require Node.js to be installed first.

  • macOS / Linux:
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
  • Windows (PowerShell):
irm https://code.kimi.com/kimi-code/install.ps1 | iex

On Windows, install Git for Windows before first launch because Kimi Code CLI uses the bundled Git Bash as its shell environment. If Git Bash is installed in a custom location, set KIMI_SHELL_PATH to the absolute path of bash.exe.

Then run it with a new Terminal session:

kimi --version

Alternative: npm

If you prefer npm, use Node.js 22.19.0 or later:

npm install -g @moonshot-ai/kimi-code

Or with pnpm:

pnpm add -g @moonshot-ai/kimi-code

For upgrade and uninstall instructions, see the Getting Started guide.

Quick Start

Open a project and start the interactive UI:

cd your-project
kimi

On first launch, run /login inside Kimi Code CLI and choose either Kimi Code OAuth or a Kimi Platform API key. After login, try a first task:

Take a look at this project and explain the main directories.

Key Features

  • Single-binary distribution. Install with one command — no Node.js setup, no PATH gymnastics, no global module conflicts.
  • Blazing-fast startup. The TUI is ready in milliseconds, so opening a session never feels heavy.
  • Polished TUI. A carefully tuned interface designed for long, focused agent sessions.
  • Video input. Drop a screen recording or demo clip into the chat — let the agent watch instead of typing out what's hard to describe in words.
  • AI-native MCP configuration. Add, edit, and authenticate Model Context Protocol servers conversationally via /mcp-config — no hand-editing JSON.
  • Subagents for focused, parallel work. Dispatch built-in coder, explore, and plan subagents in isolated context windows; the main conversation stays clean.
  • Lifecycle hooks. Run local commands at key points — gate risky tool calls, audit decisions, fire desktop notifications, wire into your own automation.

Documentation

Repository & Issues

License

MIT