返回 CodeWhale
PLUGINS.md
根目录 / docs / PLUGINS.md
1 # Installing plugins
2
3 > 阅读简体中文版:[zh_hans/PLUGINS.md](zh_hans/PLUGINS.md)。
4
5 To create a bundle, start with [Write your first Codewhale plugin](PLUGIN_AUTHORING.md)
6 and its runnable Skills example.
7
8 This is the walkthrough for the `/plugin install` on-ramp.
9 [PLUGIN_BUNDLES.md](PLUGIN_BUNDLES.md) remains the contract for the bundle
10 format (`plugin.json`, compatible `kimi.plugin.json` or
11 `.claude-plugin/plugin.json`, or legacy `plugin.toml`), discovery, validation, and
12 the trust/enable lifecycle — this document covers how bits get onto disk in
13 the first place.
14
15 Everything you add to Codewhale is a plugin. A skill, an MCP connector and a hook
16 are each a plugin, or part of one, and each has a kind: Skill, Connector, Hook,
17 Command. A skill you set up by hand is a plugin of the kind Skill, a server you
18 configure is a plugin of the kind Connector, and a hook you configure is a plugin
19 of the kind Hook. They are managed under Plugins →
20 Skills, Connectors and Hooks in the terminal, and Customize › Skills, Connectors and
21 Hooks on the desktop. Their files, trust rules and commands (`/skills`, `/mcp`,
22 `/hooks`) do not change. Kind labels also appear on the
23 parts inside a plugin bundle's detail. "Connection" is the word for a model
24 provider or another agent; it is not a kind of plugin.
25
26 ## Choose what to add
27
28 | What you need | Use | Starting point |
29 | --- | --- | --- |
30 | Reusable instructions that work through your existing tools | A plugin that adds a skill | `/skills`, then `/skill <name>`; [Skills](SKILLS.md) |
31 | A reviewed bundle of workflows, tools, commands or agent profiles | A plugin bundle | `/plugin marketplace list`; [first-party catalog](https://github.com/codewhale-hq/codewhale-plugin-marketplace) |
32 | Tools or context from a particular local process or remote service | A plugin that adds an MCP connector | `/mcp`; [MCP setup](MCP.md) |
33
34 A plugin can combine skills, Markdown commands, Fleet agent profiles, hooks,
35 MCP servers and AI-provider declarations. Tools come from an MCP server or an
36 experimental native plugin; there is no generic application-UI component in
37 the bundle manifest. Computer Use's Mac helper and Chromewhale's browser
38 extension have their own setup after plugin review.
39
40 An MCP connector is one of two kinds: a local process over stdio, or a remote URL over
41 Streamable HTTP. Legacy SSE is available when the server still supports it.
42 User-configured remote servers can use environment-backed credentials or the
43 host's OAuth login. Plugin-contributed remote servers require explicit
44 environment-backed credentials when authentication is needed; their interactive
45 OAuth path is not supported. Installing a plugin does not connect an
46 account or establish that a service works.
47
48 A local stdio server runs with your operating-system user's access. Requested
49 filesystem roots in a plugin manifest do not sandbox that process.
50
51 For example, configure [Cloudflare's public documentation server](https://developers.cloudflare.com/changelog/post/2026-10-22-cloudflare-mcp-servers-retire-sse/)
52 directly, or install the `cloudflare-docs` plugin when you also want its skill:
53
54 ```sh
55 codewhale mcp add cloudflare-docs --url https://docs.mcp.cloudflare.com/mcp
56 codewhale mcp connect cloudflare-docs
57 codewhale mcp tools cloudflare-docs
58 ```
59
60 Choose one setup for that server. `connect` is a diagnostic connection; it does
61 not attach tools to an already running session. In an existing terminal session,
62 run `/mcp reload` after changing configuration.
63
64 ## Bundle compatibility
65
66 | Format | Supported boundary |
67 | --- | --- |
68 | Native `plugin.json` or legacy `plugin.toml` | Reviewed declarative adapters above; [manifest contract](PLUGIN_BUNDLES.md) |
69 | Claude `.claude-plugin/plugin.json` | Skills, commands, agent profiles and MCP subset; hooks, LSP, custom MCP paths and plugin-root expansion are rejected; [compatibility details](CLAUDE_PLUGIN_COMPAT.md) |
70 | `kimi.plugin.json` | Compatible skills, commands, agents and MCP declarations; unsupported runtime fields fail closed |
71 | Local DSH package | Explicit preview and exact-hash import through `/plugin import dsh`; experimental native runtime, not blanket DSH compatibility or release qualification; [current evidence and limits](DSH_PLUGIN_COMPAT.md) |
72
73 Native TypeScript plugins require `extension_host = true` under `[features]`
74 and fresh capability review. LSP, requested filesystem roots and lifecycle mutation
75 remain inventory-only. Third-party DSH plugins' complete workflows are not established by
76 an import succeeding. An imported DSH plugin's UI is served only on the seats the Engine admits ([details](DSH_PLUGIN_COMPAT.md#plugin-ui-dshclient)). Other applications' plugin
77 directories and credentials are not borrowed.
78
79 `/plugin suggest <task>` is a local, read-only companion: it ranks already
80 installed bundles (name, keywords, description, bundled skill names, declared
81 hosts) and available marketplace catalogs, including the bundled snapshot and
82 catalogs you have added with `/plugin marketplace add`.
83 It explains the match and gives the next review, enable, or catalog-install
84 step, but never installs, trusts, or enables a bundle on its own.
85
86 ## How Codewhale offers plugins
87
88 Codewhale is helpful about plugins, not pushy. The rules:
89
90 - **One proactive surface.** Sending a task can show one quiet toast when the
91 prompt matches an installed-but-idle plugin or a catalog candidate you do
92 not have yet, for example `/plugin trust supabase` or
93 `/plugin marketplace install <catalog> supabase`. Nothing appears while you
94 type, and nothing is appended to your message to advertise plugins.
95 - **One switch.** With `contextual_tips` off, no plugin guidance appears
96 anywhere. Required notices and your own `/plugin` commands still work.
97 - **One budget.** Plugin offers share the per-session guidance budget with
98 other tips. In the interactive TUI the model can call
99 `request_plugin_install` once per session to ask you to review a plugin the
100 task needs; a second call fails. Exec, ACP, and runtime-API sessions do not
101 get the tool.
102 - **Built-ins are never advertised.** Inspect existing bundles in `/plugin list`
103 and Plugins before installing another copy. Older CLI releases embedded
104 Computer Use as a built-in; current releases install it from the catalog.
105 See [Computer Use across versions](PLUGIN_MARKETPLACE.md#computer-use-across-versions).
106 - **Specific terms only.** Generic words (accessibility, browser, chrome,
107 docs, screenshot, web, wiki, …) and Codewhale's own vocabulary (agent, code,
108 data, MCP, model, session, tool) never trigger an offer, so asking why an
109 MCP server is stuck does not suggest a vendor's plugin. Distinctive names,
110 phrases and domains still do. The matcher and the marketplace's
111 `check-marketplace.mjs` share one stoplist.
112 - **Only what runs here.** Plugins whose `when.os` excludes this OS are not
113 offered.
114 - **Review before acting.** A model-requested row offers Review. Its button
115 opens the existing Plugins inventory: Installed for an installed bundle,
116 Marketplace for a suggestion that is not installed. Nothing is installed,
117 trusted, or enabled by that click. Choose the inventory's explicit action;
118 trust still reviews the exact installed content before activation.
119 - **Reversible dismissal.** Esc clears a non-empty draft first, then hides the
120 row for this session only. "Don't suggest again" is the explicit,
121 persisted choice. `/plugin dismissals` lists both kinds, and
122 `/plugin dismissals reset [<name>]` lets suggestions offer a plugin again.
123 - **Discovery is passive.** Find new plugins in these docs,
124 `/plugin marketplace list`, Plugins, and the browser guide below.
125
126 Codewhale does not invent a remote plugin URL; missing plugins are suggested
127 only from available catalogs. On-disk bundle changes still toast
128 `/plugin reload` on send and between turns.
129
130 ## Browser: pick one
131
132 Several options can drive a browser. They differ in whose browser it is and
133 what it can see.
134
135 | Option | Whose browser | Good for |
136 | --- | --- | --- |
137 | `chrome-devtools` MCP (`/mcp recommendations`) | A Chrome it drives, which can include signed-in pages | DevTools-level inspection and performance work |
138 | Playwright MCP (`/mcp recommendations`) | A fresh, isolated profile with `--isolated` | Scripted flows and testing without your identity |
139 | Computer Use browser tools (off until reviewed) | One it launches, in a profile of its own | Browser steps inside a wider desktop task |
140 | Chromewhale (developer preview, `codewhale-hq/codewhale-plugin-marketplace`) | Yours, already open, in your own Chrome profile; load unpacked | Reading or acting on the tab you are looking at, one granted site at a time |
141
142 None of these is offered to you proactively. Add the one that fits the job.
143
144 ## Sources
145
146 `codewhale install <spec>`, `codewhale plugins install <spec>`, and
147 `/plugin install <spec>` use the same installer.
148 The shell entry does not start a model or require model credentials. Both keep
149 bundles disabled and untrusted until you explicitly review and enable them.
150
151 ```sh
152 codewhale install git:github.com/example/plugin@v1.0.0
153 codewhale install npm:@example/plugin@1.0.0
154 codewhale install ./local-plugin
155 ```
156
157 Git shorthand supports GitHub archives only; refs must be a single safe segment.
158 Use the existing HTTPS archive URL plus `#path=...` for a nested bundle.
159 Npm requires an exact version and a native plugin manifest in the tarball.
160 No git hooks, npm lifecycle scripts, dependency installation or Pi executable
161 extensions run. A ref names the requested revision, not an integrity signature;
162 review still binds the exact downloaded bytes. Tags can move: pin a commit for
163 immutable GitHub selection. Updates of version-pinned sources retain that version.
164 Network approval and archive safety checks are unchanged.
165
166 The original source forms remain available:
167
168 ```text
169 /plugin install ./path/to/bundle # local directory (copied)
170 /plugin install github:owner/repo # GitHub archive of the default branch
171 /plugin install https://example.com/x.tar.gz # direct tarball URL
172 ```
173
174 There is no registry index and no `git clone` in v1 — tarball-only fetching
175 keeps the size cap and no-symlink guarantees of the installer. Downloads are
176 gated by the per-domain network policy: an unknown host returns a
177 "needs approval" error naming the host (`/network allow <host>`, then retry),
178 a denied host aborts without touching disk. Allowing a host never lets a
179 download reach a local or private address: every request and redirect refuses
180 loopback, private, link-local and cloud-metadata destinations, including a host
181 name that resolves to one.
182
183 The fetched tree must contain **exactly one** bundle root — a directory
184 holding a `plugin.json`, compatible `kimi.plugin.json`,
185 `.claude-plugin/plugin.json`, or legacy `plugin.toml` manifest. Kimi bundles are accepted when they use Codewhale-compatible Skills,
186 commands, agents, and MCP declarations; unsupported Kimi runtime fields fail
187 closed instead of being silently ignored. Bundles land in
188 the user plugins root at `~/.codewhale/plugins/<name>/`, where `<name>` is the
189 manifest's plugin name.
190
191 Claude bundles keep their metadata in `.claude-plugin/plugin.json` and their
192 components at the bundle root. The importer supports skills, commands, agents,
193 and MCP servers declared inline or in root `.mcp.json` (flat server map or an
194 `mcpServers` wrapper). Claude `http` transport maps to Streamable HTTP. Relative
195 sources in a `.claude-plugin/marketplace.json` catalog resolve from the marketplace
196 repository root. The whole bundle remains subject to the same review hashes and
197 path checks as native plugins.
198
199 Remote MCP headers can name credentials without embedding them: exact
200 `Bearer ${ENV_NAME}` authorization values become `bearer_token_env_var`, and
201 exact `${ENV_NAME}` header values become `env_headers`. Import reads no credential
202 values. Literal credentials and compound templates are rejected.
203
204 This is a compatible subset: hooks, LSP declarations, custom MCP file paths, and
205 `${CLAUDE_PLUGIN_ROOT}` expansion are rejected with an explanation; no partial
206 plugin is installed. Installing a remote MCP declaration does not complete its
207 authentication. Plugin-contributed remote servers retain the existing explicit
208 credential requirements; this importer does not enable plugin OAuth.
209
210 ## The guided flow
211
212 Installing never activates anything. The command places the bits, then drops
213 you straight into the standard capability review:
214
215 ```text
216 /plugin install github:someone/neat-plugin
217 → Installed plugin 'neat-plugin' to ~/.codewhale/plugins/neat-plugin.
218 It is disabled and untrusted. Review its requested authority below…
219 <full inventory, permissions, MCP authority render>
220 /plugin trust neat-plugin <content-hash>.<capability-hash>
221
222 /plugin trust neat-plugin <paste the token> # records the hash-bound receipt
223 /plugin enable neat-plugin # activates for this workspace
224 ```
225
226 This is the same review render and confirmation token as `/plugin trust
227 <name>` — trust is the strict hash-bound receipt flow, not an advisory marker.
228 If the bundle's content or declared capabilities change, the receipt stops
229 matching and the plugin goes inactive until you review again.
230
231 ## Update and uninstall
232
233 ```text
234 /plugin update <name> # re-download, byte-compare, atomic swap if changed
235 /plugin disable <name> # required before uninstall
236 /plugin uninstall <name> # deletes the bundle and prunes its state entry
237 ```
238
239 - `update` re-downloads the recorded source. Identical bytes are a no-op; a
240 changed bundle is swapped atomically and its trust receipt is automatically
241 invalidated (the hash no longer matches), so re-review is forced before the
242 plugin can activate again. For a local install, it stages a fresh copy of the
243 recorded source directory; keep that authoring directory available. Editing
244 the installed copy does not update its source. See the
245 [local authoring loop](PLUGIN_AUTHORING.md#4-iterate-and-review-changes).
246 - `update` retains the recorded repository revision, npm version, archive URL
247 and bundle selector. Refreshing a catalog does not retarget that source. To
248 select a newer catalog pin, follow
249 [Changing an installed pin](PLUGIN_MARKETPLACE.md#changing-an-installed-pin).
250 - `uninstall` refuses enabled plugins (disable first), deletes the bundle
251 directory, and removes its persisted trust/enablement entry.
252
253 ## Shell CLI
254
255 Run the full plugin lifecycle from a shell without starting a session:
256
257 ```sh
258 codewhale plugins install <spec> [--json]
259 codewhale plugins show <name> [--json]
260 codewhale plugins status [name] [--json]
261 codewhale plugins trust <name> [--review-token TOKEN --yes] [--json]
262 codewhale plugins enable <name> [--json]
263 codewhale plugins disable <name> [--json]
264 codewhale plugins update <name> [--json]
265 codewhale plugins uninstall <name> [--yes] [--json]
266 codewhale plugins revoke <name> [--json]
267 codewhale plugins restage <name> [--json]
268 ```
269
270 - `install` uses the same installer as `codewhale install <spec>` and leaves the
271 bundle disabled and untrusted.
272 - `show` prints the same capability review as `trust` without prompting or
273 changing trust state.
274 - `update` re-reads the recorded source and reports `updated to <version>` or
275 `already current` (or the network-approval message when a host needs
276 approval).
277 - `uninstall` disables an enabled plugin first, then removes it. In a terminal
278 it asks `Remove <name> <version>? [y/N]` unless `--yes` is given; without a
279 terminal or with `--json`, `--yes` is required.
280
281 ## Safety rules
282
283 - Every install carries an `.installed-from` provenance marker. The installer
284 **refuses to overwrite or delete** a bundle that lacks it — hand-placed
285 bundles under `~/.codewhale/plugins/` are never clobbered.
286 - Tarballs are size-capped and extracted into a private staging directory
287 first; path traversal (`..`, absolute paths) and symlinks/hard links inside
288 the bundle are rejected, and the destination only appears via an atomic
289 rename after every check passes.
290 - Install pre-checks the name against builtin and workspace bundles so a
291 higher-precedence bundle cannot silently shadow (or be shadowed by) the
292 install.
293 - Newly installed bits are always **disabled and untrusted**; enablement only
294 ever happens through the explicit trust review above.
295
295 lines MARKDOWN