feat: add plugin system (Skills + Tools)#1503
Conversation
- Update spec doc paths from ~/.config/agents/plugins/ to ~/.kimi/plugins/ - Defer get_plugins_dir import in skill/__init__.py to avoid coupling - Always discover plugins even when --skills-dir is set - Warn when no LLM provider configured during install - Add ConfigDict(extra="ignore") to PluginSpec for forward compat - Wrap write_runtime filesystem errors in PluginError
Plugins can declare tools in plugin.json. Each tool runs as a subprocess with parameters via stdin JSON and stdout as result. Tools are loaded into the agent's toolset at startup, alongside built-in and MCP tools.
kimi plugin install now accepts: - Local directory path (existing) - .zip file (extracts, finds plugin.json) - Git URL (clones --depth 1) Also adds examples/sample-plugin/ with Python + TypeScript tools.
3b8463c to
8c0b447
Compare
… tests; fix existing test
…atomic reinstall, validation error wrapping)
…ame conflict, is_dir) - Kill subprocess on timeout instead of leaking it - Add approval flow to plugin tools (matching MCP tool pattern) - Detect and skip plugin tools that conflict with existing tool names - Use is_dir() instead of exists() for plugins path check
…chemas - Kill subprocess on asyncio.CancelledError to prevent orphaned processes - Use get_clean_env() instead of os.environ for PyInstaller compatibility - Catch exceptions during PluginTool construction to skip bad plugins instead of crashing agent startup
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40221533bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| stdin=asyncio.subprocess.PIPE, | ||
| stdout=asyncio.subprocess.PIPE, | ||
| stderr=asyncio.subprocess.PIPE, | ||
| cwd=str(self._plugin_dir), |
There was a problem hiding this comment.
Run plugin subprocesses from the session worktree
create_subprocess_exec(..., cwd=str(self._plugin_dir)) makes every plugin tool run inside ~/.kimi/plugins/<name> instead of the active repo. Any plugin that shells out to git, opens relative paths, or otherwise expects . to be the user's workspace will inspect or modify the installation directory and commonly fail with "not a git repository". The built-in command tools use runtime.session.work_dir, so plugin tools need the same worktree context while resolving their script path from the plugin directory.
Useful? React with 👍 / 👎.
| # Plugins are always discoverable, even when --skills-dir is set | ||
| plugins_path = get_plugins_dir() | ||
| if plugins_path.is_dir(): | ||
| roots.append(KaosPath.unsafe_from_local_path(plugins_path)) |
There was a problem hiding this comment.
Keep installed plugin skills below repo-local skills
discover_skills_from_roots() overwrites earlier roots with later ones, so appending ~/.kimi/plugins here gives globally installed plugin skills higher priority than .agents/skills in the current repository. When a project defines a skill with the same name as an installed plugin, the plugin silently wins and the checked-in project instructions disappear, making runs depend on host state instead of repo state. Plugin roots should not shadow repo-local skills.
Useful? React with 👍 / 👎.
Add comprehensive documentation for the plugin system: - Add changelog entries for plugin system, multi-plugin repos, and credential injection with OAuth/env var support - Create new plugins.md page (zh/en) covering installation, creation, credential injection, and tool script specifications - Update skills.md to add comparison between Skills and Plugins - Update vitepress config to include Plugins in navigation
Summary
kimi plugin install/list/remove/infoCLI commandsKey Files
src/kimi_cli/plugin/__init__.pysrc/kimi_cli/plugin/manager.pysrc/kimi_cli/plugin/tool.pysrc/kimi_cli/cli/plugin.pysrc/kimi_cli/skill/__init__.pysrc/kimi_cli/soul/agent.pydocs/plugin-spec.mdexamples/sample-plugin/Test plan
uv run kimiwith/skill:sample-plugin