KiloCode
Install context-mode in KiloCode as a native TypeScript plugin, sharing the fork-aware OpenCode adapter.
KiloCode is an OpenCode fork, so it loads context-mode through the same fork-aware native TypeScript plugin rather than JSON stdin/stdout hooks. The plugin keeps the bulk of raw payload bytes out of your window by routing data-heavy output into the sandbox and answering from the FTS5 knowledge base.
Like OpenCode, KiloCode exposes no real SessionStart hook. context-mode uses
the same surrogates: the experimental.chat.system.transform stage stands in for
SessionStart and restores session memory, while the chat.message stage stands
in for user-prompt capture so each request is recorded for later search.
KiloCode and OpenCode share one adapter. Behavior, surrogate hooks, and caveats match the OpenCode page — the only difference is the config filename.
Install
KiloCode has no plugin marketplace, so install the package globally first, then
point kilo.json at it.
Check the prerequisites
Install Node 22.5 or newer, or Bun. The sandbox and FTS5 knowledge base depend on a current runtime.
node --versionInstall the package
This installs the plugin entry point and the context-mode command line.
npm install -g context-modeRegister the plugin
Add the context-mode plugin to kilo.json in your project root (or
~/.config/kilo/kilo.json for a global install). The native TypeScript plugin
registers all ctx_* tools in-process, so you do not add a separate mcp
entry — doing so makes KiloCode register zero ctx_* tools (the plugin
suppresses MCP duplicates, but a legacy mcp.context-mode entry confuses the
loader).
{
"$schema": "https://app.kilo.ai/config.json",
"plugin": ["context-mode"]
}Restart KiloCode after editing the config so the plugin loads.
Configure
The native plugin already exposes the ctx_* tools in-process and sets
CONTEXT_MODE_EMBEDDED_PLUGIN_TOOLS=1 for itself, so the plugin-only config
above needs no extra environment variable. If you ever run the standalone MCP
server alongside the plugin (for example, a leftover mcp.context-mode entry),
set this variable where the spawned server can read it — an env block in the
kilo.json MCP entry, not a transient shell export — so the duplicate copy of
each tool is suppressed:
{
"$schema": "https://app.kilo.ai/config.json",
"plugin": ["context-mode"],
"mcp": {
"context-mode": {
"type": "local",
"command": ["context-mode"],
"env": { "CONTEXT_MODE_EMBEDDED_PLUGIN_TOOLS": "1" }
}
}
}For the normal plugin-only install, prefer removing the mcp entry entirely
(run context-mode upgrade) over running both. See
/docs/configuration for the full list of environment
variables, storage paths, and permission rules.
Verify
Confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, and plugin registration, then reports anything that needs attention.
context-mode doctorA clean run means the plugin is loaded and context-mode is ready to route your
next data-heavy command. In the KiloCode session you can also type ctx stats
to your agent to confirm the tools respond.
If the ctx_* tools appear empty after install, a legacy mcp.context-mode
entry from an earlier version is usually conflicting with the native plugin.
Run context-mode upgrade to reconcile the config and rewrite the server entry
— other MCP servers are preserved. Restart KiloCode once it finishes.