Step-by-step guide to run unchanged OpenCode plugins on MiMo Code or Kilo Code using the public npm package @opencode-compat/ocp.
OCP does not fork plugins and does not patch host source. You install OCP once, install your plugins with the host CLI, then run ocp setup so each plugin’s install tree resolves @opencode-ai/plugin / @opencode-ai/sdk through the OCP facades.
| Requirement | Notes |
|---|---|
| Bun ≥ 1.2 | Required to run the ocp CLI (#!/usr/bin/env bun) |
| npm | Used by ocp setup to reify install-tree overrides |
| A supported host | MiMo Code (mimo) or Kilo Code (kilo / kilocode) on your PATH |
Confirm the host binary:
mimo --version # MiMo
# or
kilo --version # Kilo- Install the OCP umbrella CLI from npm.
- Install your OpenCode plugin(s) with the host (
mimo plugin/kilo plugin). - Run
ocp setup --mode npmfor that host. - Restart / re-open the host and verify models/plugins load.
Important: On MiMo and Kilo each npm plugin lives in an isolated cache dir. Listing OCP in the host plugin array alone does not intercept other plugins’ @opencode-ai/* imports. Always run ocp setup after installing or upgrading plugins.
bun add -g @opencode-compat/ocp
ocp --help
# or: ocp doctor --host mimoThis installs the ocp binary and pulls the bridge packages (facade-*, adapter, …) as transitive dependencies.
cursor-opencode-provider is a stock OpenCode plugin. Install it unchanged with the host — do not use a host-specific fork.
# Install the plugin into global MiMo config + cache
mimo plugin -g cursor-opencode-provider
# Point that install tree at the public OCP facades and apply provider shims
ocp setup --host mimo --mode npmMiMo updates ~/.config/mimocode/mimocode.json (or your MIMOCODE_HOME layout). Example:
{
"$schema": "https://mimo.xiaomi.com/mimocode/config.json",
"plugin": [
"cursor-opencode-provider"
]
}Plugin files land under:
~/.cache/mimocode/packages/cursor-opencode-provider@latest/
# Install the plugin into global Kilo config + cache
kilo plugin -g cursor-opencode-provider
# Point that install tree at the public OCP facades
ocp setup --host kilo --mode npmKilo records the plugin in its global config (commonly ~/.config/kilo/opencode.json). Example:
{
"$schema": "https://app.kilo.ai/config.json",
"plugin": [
"cursor-opencode-provider"
]
}Plugin files land under:
~/.cache/kilo/packages/cursor-opencode-provider@latest/
Omit -g to install into the current project instead of global config:
mimo plugin cursor-opencode-provider
ocp setup --host mimo --mode npm
# or
kilo plugin cursor-opencode-provider
ocp setup --host kilo --mode npmFor the detected (or --host) plugin install root, setup:
- Writes install-tree overrides so:
@opencode-ai/plugin→npm:@opencode-compat/facade-plugin@…@opencode-ai/sdk→npm:@opencode-compat/facade-sdk@…
- Deep-patches each child plugin
package.json(required on MiMo/Kilo). - Runs
npm install(reify) whennode_modulesalready exists so the overrides link. - Writes in-place provider entry shims (default) for LanguageModel / stream adoption on hosts that need it (notably MiMo). Use
--no-provider-shimto skip. - Absolute-path /
file://plugins listed in the host config: symlinks@opencode-ai/{plugin,sdk}→ OCP facades inside each checkout (install-tree overrides never reach those). Use--no-absolute-pluginsto skip.
Useful flags:
ocp setup --host mimo --mode npm --dry-run # preview only
ocp setup --host kilo --mode npm --version 0.1.2 # pin facade train (default today)
ocp setup --dir ~/.cache/mimocode/packages --mode npm # explicit install root--version pins the @opencode-compat/facade-* specs written into overrides. The CLI default is the current OCP package train (today 0.1.5). To pin an older published train, pass e.g. --version 0.1.0.
Outside this monorepo, always prefer --mode npm so overrides resolve from the public registry (not local file: paths).
If the host plugin array points at a checkout (absolute path or file://…/dist/index.js), that package resolves @opencode-ai/* from its own node_modules, not the host cache. ocp setup (default --absolute-plugins) rewrites those deps to the facades. Re-run setup after adding or moving such entries.
This matters for catalog plugins such as opencode-gateway-provider: they call @opencode-ai/sdk/v2/client during the classic config hook. On MiMo/Kilo the stock client re-enters in-process GET /api/model and deadlocks; the OCP facade polyfills the catalog from models.dev instead. Keep the plugin unmodified — do not fork it for the host.
ocp doctor --host mimo # or --host kiloMiMo smoke
mimo models # expect cursor/* when Cursor auth/cache is availableConfirm shim files exist after setup (MiMo):
~/.cache/mimocode/packages/cursor-opencode-provider@latest/node_modules/cursor-opencode-provider/dist/
index.js # OCP shim
index.ocp-original.js # stock entry backup
ocp-lm-runtime.js
Kilo smoke
kilo models # expect plugin models when auth/cache is availableHosts may restore stock files on install/upgrade. Always re-run setup:
mimo plugin -g cursor-opencode-provider -f # or kilo …
ocp setup --host mimo --mode npm # or --host kilo- Listing
@opencode-compat/ocpinplugin: optional bootstrap only. Layer A still requires the overrides fromocp setup. - Absolute /
file://plugin paths: covered byocp setupabsolute-plugin wiring (see §3). npm cache installs still need the install-tree overrides. - Do not override
@opencode-ai/pluginstraight to@mimo-ai/plugin/@kilocode/plugin— that skips OCP. - Do not install per-host forks such as
cursor-kilocode-providerfor OCP; keep the stock npm package. - ZCode is not an OCP install target for
@opencode-ai/pluginpackages (marketplace ABI differs). - Maintainers publishing
@opencode-compat/*: seedocs/guides/npm-publish.md. - Host internals / Promise v2 sidecars: see
docs/hosts/mimo.mdanddocs/hosts/kilo.md.
bun add -g @opencode-compat/ocp
mimo plugin -g cursor-opencode-provider
ocp setup --host mimo --mode npm
ocp doctor --host mimo
mimo modelsbun add -g @opencode-compat/ocp
kilo plugin -g cursor-opencode-provider
ocp setup --host kilo --mode npm
ocp doctor --host kilo
kilo models