kimi-code/docs/en/customization/plugins.md
qer 5ef66ddfed
feat(tui): redesign /plugins as a tabbed panel (#1025)
* feat(tui): redesign /plugins as a tabbed panel

Split the /plugins manager into Installed / Official / Third-party /
Custom tabs. The Official and Third-party marketplace catalogs load
lazily, so /plugins opens instantly and keeps working offline, with
fetch failures shown inline instead of closing the panel. The tab strip
is shared with the /model provider tabs via the new renderTabStrip
helper.

* fix(tui): show untiered marketplace entries and update badges

Address Codex review feedback on the /plugins tab redesign:

- Untiered marketplace entries (no `tier` field) now appear on the
  Third-party tab instead of being invisible in both marketplace tabs.
- Installed plugins whose marketplace version is newer than the local
  version render an `update <local> → <latest>` badge again, and
  up-to-date plugins show `installed · v<version>` — restoring the
  update visibility the pre-redesign marketplace UI had.

* fix(tui): decode Space for installed-plugin toggle

In terminals that send printable keys via Kitty/CSI-u sequences (e.g. VS
Code's integrated terminal), the Space key arrives as a printable char
rather than a Key.space match, so the Installed-tab Space toggle silently
stopped working. Check both matchesKey(Key.space) and the decoded
printable char to match the MCP selector and other dialogs.

* fix(tui): open custom marketplaces on the Third-party tab

When `/plugins marketplace <source>` points at a custom catalog whose
entries omit `tier`, those entries are classified into the Third-party
tab. Opening on Official left the visible tab empty and Enter could not
install anything, unlike the old marketplace picker which showed all
entries from the supplied source. Open on Third-party when a custom
source is supplied; the default catalog still lands on Official.

* docs(plugins): drop open-url wording and hyphenate Shift-Tab

Address Codex review feedback:

- The marketplace Enter action is install/update only (open-url rows were
  removed), so say "install or update" instead of "open or install" and
  drop the leftover changeset sentence about setup URLs.
- Use `Shift-Tab` (hyphen) instead of `Shift+Tab` to match the docs
  typography convention.

* fix(tui): keep marketplace selection valid while loading

When the Official/Third-party catalog is still loading, `entries` is empty
and pressing ↓ computed `Math.min(-1, selectedIndex + 1)` = -1. The later
Enter then read `entries[-1]` and the first install silently did nothing.
Clamp the index to 0 while there are no entries.

* fix(tui): count tab separators in tab-strip fit check

renderTabStrip declared a strip to fit whenever the sum of tab cell widths
fit, but the returned string also inserts single spaces between tabs via
`segments.join(' ')`. At widths around 43-45 columns for a four-tab strip
this declared a fit while the joined line was wider, so the trailing tab
got truncated instead of showing the `<`/`>` scroll markers. Count the
inter-tab separators in both the full-fit check and the scrolling window
fit check.

* docs(plugins): fix Kimi Datasource redirect anchor

The datasource.md redirect pointed at ./plugins.html#kimi-datasource, but
plugins.md no longer has a `## Kimi Datasource` heading — it is now
`## Official Plugins`. Update the en/zh redirect targets and fallback
links to #official-plugins / #官方插件 so the link lands on an existing
anchor.

* docs(plugins): restore concise Kimi Datasource section

The `## Official Plugins` section had replaced the original
`## Kimi Datasource` section, leaving the datasource.md redirect pointing
at a missing anchor and the Datasource capabilities/usage unreachable.
Restore a concise `## Kimi Datasource` section (intro + OAuth login +
install steps + usage) in both en and zh so the #kimi-datasource anchor
is valid again and the content is reachable.

* docs(plugins): restore Installing-from-GitHub subheading

The tab-redesign rewrite had dropped the `### Installing from GitHub` /
`### 从 GitHub 安装` subheading and its lead sentence, leaving only the
four URL forms. Restore the heading and lead sentence in both en and zh.

* docs(plugins): expand Kimi Datasource and tidy marketplace docs

- Condense the Official / Third-party / Custom tab overview and trust-badge note

- Trim the custom marketplace JSON section to the minimal id + source shape

- Move and expand the Kimi Datasource section with install, usage, and coverage

* docs(plugins): fix heading style and drop Next steps section

- Use sentence case for the Datasource headings (How to use, What you can do)

- Rename the Datasource caveat heading to Billing and limitations / 计费与限制 to avoid a duplicate Notes / 注意事项 anchor

- Remove the Next steps section, which linked back to the on-page Datasource anchor

* fix(tui): repaint plugins panel from current theme palette

The /plugins panel and MCP selector captured a palette snapshot at construction. In auto theme mode, applyResolvedAutoTheme swaps currentTheme.palette and re-renders without remounting the open panel, so it kept stale colors until closed.

Read currentTheme.palette during render instead, drop the colors opt from both components and their call sites, and add a regression test that switches palettes on a mounted panel.

* fix(tui): repaint model tab strip from current theme palette

TabbedModelSelectorComponent cached a palette snapshot in opts and used it only for the tab strip. In auto theme mode the inner model list repaints from currentTheme but the strip kept the old colors until the dialog was closed.

Read currentTheme.palette on the render path instead, drop the colors opt and its three call sites, and add a regression test that switches palettes on a mounted selector and asserts the strip repaints. This removes the last palette snapshot among editor-replacement dialogs.
2026-06-24 13:12:28 +08:00

11 KiB

Plugins

Plugins package reusable Kimi Code CLI capabilities into installable units — they can add Agent Skills, automatically load a specified Skill at session start, and declare MCP servers to provide real tool capabilities. They are ideal for sharing workflows with a team, connecting to external services, or installing extensions from the official marketplace.

Kimi Code CLI applies a conservative loading strategy for plugins: installing a plugin does not execute any Python, Node.js, shell, hook, or command scripts it contains.

Installation and Management

Run /plugins in the TUI to open the plugin manager. It is a single panel with four tabs — Installed (manage what you have), Official (Kimi-maintained marketplace plugins), Third-party (marketplace plugins from other publishers), and Custom (install from a URL) — switched with Tab / Shift-Tab. Common keys:

Key Action
Tab / Shift-Tab Switch between the Installed / Official / Third-party / Custom tabs
Space Enable or disable the selected installed plugin (Installed tab)
D Remove the selected installed plugin (Installed tab)
M Manage MCP servers for the selected plugin (Installed tab)
R Reload installed.json and all manifests (Installed tab)
Enter Installed tab: view plugin details · Official/Third-party tab: install or update · Custom tab: install
Esc Go back or cancel

You can also use slash commands directly:

Command Description
/plugins Open the interactive plugin manager
/plugins list List installed plugins
/plugins install <path-or-url> Install from a local directory, zip URL, or GitHub repository URL
/plugins marketplace [source] Browse the official marketplace, or pass a custom marketplace JSON path or URL
/plugins info <id> View plugin details and diagnostics
/plugins enable <id> Enable a plugin
/plugins disable <id> Disable a plugin
/plugins remove <id> Remove a plugin (requires confirmation)
/plugins reload Reload installed.json and all plugin manifests
/plugins mcp enable <id> <server> Enable an MCP server declared by a plugin
/plugins mcp disable <id> <server> Disable an MCP server declared by a plugin

The Official and Third-party tabs list marketplace plugins by tier; the Custom tab installs from a URL. Marketplace catalogs load when you switch to those tabs. Each install shows a trust badge: kimi-official (from an official address), curated (from a curated address), or third-party (everything else).

Installing from GitHub

Use /plugins install <url> to install directly from a GitHub repository. Four URL forms are supported:

  • https://github.com/<owner>/<repo>: Install the latest release; falls back to the default branch if no release exists
  • https://github.com/<owner>/<repo>/tree/<ref>: Install a specific branch, tag, or short commit SHA
  • https://github.com/<owner>/<repo>/releases/tag/<tag>: Pin to a specific tag
  • https://github.com/<owner>/<repo>/commit/<sha>: Pin to a specific commit

Network requests only go through github.com redirects and codeload.github.com downloads; api.github.com is not called.

Notes

  • Plugin changes apply after /reload or in new sessions. After installing, enabling/disabling, or removing a plugin, run /reload or /new; the current session will not update.
  • Local installations are copied to $KIMI_CODE_HOME/plugins/managed/<id>/, and the CLI always runs from this managed copy. Editing the original source directory after installation has no effect; you must reinstall.
  • Removing a plugin only deletes the installation record; the managed copy and original source files remain on disk.
  • Plugins are currently installed per-user and apply to all projects; project-level installation scope is not yet supported.

Custom marketplace JSON

Pass a custom marketplace JSON path or URL to /plugins marketplace <source>, or set KIMI_CODE_PLUGIN_MARKETPLACE_URL to override the default catalog. Each entry in the plugins array needs an id and a source (local path, zip URL, or GitHub URL):

{
  "version": "2",
  "plugins": [
    {
      "id": "my-plugin",
      "displayName": "My Plugin",
      "source": "./my-plugin"
    }
  ]
}

Kimi Datasource

Kimi Datasource is the official Kimi Code data plugin. It lets you query financial market data, macroeconomic indicators, corporate registration records, academic literature, and Chinese laws and regulations in natural language — no manual API calls or data account registration required.

Installation

You must first complete OAuth login with a Kimi Code account via /login. The plugin relies on local credentials to access data services.

  1. Run /plugins and select Official
  2. Find Kimi Datasource and press Enter to install
  3. After installation completes, run /reload or /new to activate the plugin

The current latest version is v3.2.0. The plugin does not update automatically — to upgrade to a newer version, repeat the installation steps above.

How to use

Once installed, describe your need in natural language and Kimi Code will automatically invoke the data capabilities. You can also explicitly trigger the data query skill with /skill:kimi-datasource.

What you can do

Live market research: Want to run a quantitative analysis on a stock? Pull three years of daily closing prices, MACD, and KDJ signals in a single query — no third-party data platforms needed.

Cross-country macro comparison: Studying supply-chain shifts across China, India, and Vietnam? Get complete GDP growth, trade volume, and demographic time-series from World Bank data spanning 50+ years, all in one go.

Pre-contract risk check: Need to vet a counterparty fast? Type the company name and instantly get business registration, equity structure, litigation disputes, and credit blacklist status — right when you need it.

Literature review acceleration: Tracing the research arc of RLHF? Get the most-cited papers, key authors, and core findings in seconds, so your literature review outline takes shape in half the time.

On-the-spot legal lookup: Stuck on which statute governs a residence-right contract dispute? Pinpoint the relevant Civil Code articles — full text, authority level, and validity — then pull a few comparable precedents to back them up, without digging through statute databases.

Coverage

Category Scope
Stock market data A-shares, HK, US, and major global markets — real-time/historical prices, technical indicators, financial statements, stock screening
Macroeconomic data World Bank data for 189 countries, 50+ years of time series (GDP, trade, population, climate, and more)
Corporate data Business registration, equity chain, legal risk, and related-entity graph for mainland Chinese companies
Academic literature Millions of papers across physics, mathematics, CS, quantitative finance, economics — including preprints
Legal Chinese laws, regulations, and judicial cases — semantic/keyword search and detail lookup for statutes across all authority levels (constitution, laws, judicial interpretations, departmental rules), plus ordinary and authoritative case search

Billing and limitations

  • Data queries are billed per call and consume Kimi Code account credits
  • The plugin provides read-only queries; no write or trading functionality is available
  • Technical indicators and real-time prices are only available during active trading hours
  • AI-generated output is for reference only and does not constitute investment or business advice

Plugin Manifest

A plugin is a directory or zip file containing a manifest. The manifest can be placed at either of the following locations:

<plugin_root>/kimi.plugin.json
<plugin_root>/.kimi-plugin/plugin.json

When both files exist, kimi.plugin.json takes precedence.

Example:

{
  "name": "kimi-finance",
  "version": "1.0.0",
  "description": "Finance data and analysis workflows for Kimi Code CLI",
  "skills": "./skills/",
  "sessionStart": {
    "skill": "using-finance"
  },
  "interface": {
    "displayName": "Kimi Finance",
    "shortDescription": "Market data and financial analysis workflows"
  }
}

Supported fields:

Field Description
name Required; serves as the plugin id. Must match [a-z0-9][a-z0-9_-]{0,63}
version, description, keywords, author, homepage, license Display metadata
interface Fields shown in /plugins: displayName, shortDescription, longDescription, developerName, websiteURL
skills One or more ./ paths; must be within the plugin root directory. When omitted, the SKILL.md in the root directory is treated as a single Skill root
sessionStart.skill Loads the specified plugin Skill into the main Agent when a new or resumed session starts
skillInstructions Additional instructions appended whenever a Skill from this plugin is loaded
mcpServers MCP server declarations; enabled by default, can be disabled from /plugins

Unsupported runtime fields such as tools, commands, hooks, apps, inject, and configFile appear as diagnostics and are ignored.

Skills and Session Start

Plugin Skills use the same SKILL.md format as ordinary Agent Skills. A typical directory structure:

my-plugin/
  kimi.plugin.json
  skills/
    using-my-plugin/
      SKILL.md
    another-workflow/
      SKILL.md

sessionStart.skill loads a plugin Skill into the main Agent at session start, making it suitable for initialization instructions, workflow rules, or mapping terminology from other tools to Kimi Code CLI. It only injects text; it does not execute code.

Regardless of how a Skill is loaded (sessionStart.skill, /skill:<name>, or automatic model invocation), skillInstructions appears alongside that plugin's Skill.

MCP Servers in Plugins

When a plugin needs real tool capabilities, it can declare mcpServers in its manifest, reusing the MCP schema.

Stdio server (local command):

{
  "mcpServers": {
    "finance": {
      "command": "uvx",
      "args": ["kimi-finance-mcp"]
    }
  }
}

HTTP server (remote service):

{
  "mcpServers": {
    "docs": {
      "url": "https://example.com/mcp"
    }
  }
}

For stdio servers, command can be a command on PATH or a path starting with ./ within the plugin root directory. cwd likewise must start with ./ and be within the plugin root directory; otherwise the server is ignored.

Plugin MCP servers start after /reload or in new sessions. To enable or disable a server:

/plugins mcp disable kimi-finance finance
/reload

/plugins mcp enable kimi-finance finance
/reload

Security Model

Plugins have a limited loading scope. The following operations do not occur during installation or session startup:

  • Command-type plugin tools, hooks, and legacy tool runtimes are not executed
  • All paths must remain within the plugin root directory after symbolic link resolution
  • MCP servers of enabled plugins start after /reload or in new sessions and can be disabled at any time from /plugins
  • Broken manifests or unsafe paths appear in /plugins info <id> diagnostics and do not affect other sessions