Docs / Agents

OpenCode and Kilo Code

Updated

TL;DR — `tokenade install` drops `tokenade.ts` into `~/.config/opencode/plugin/` (OpenCode) or `~/.config/kilo/plugins/` (Kilo Code). Both agents load it at start, with no config edit. Restart the agent, then check `tokenade healthcheck`.

OpenCode and Kilo Code (a fork of OpenCode) are covered by a Tokenade plugin. Each agent automatically loads every file in its plugin folder at start, so tokenade install only has to drop one file there: no config edit and no enable list. The plugin folds tool results (command output, file reads, MCP results) before the model reads them.

What install writes

The plugin folders follow the XDG convention on every OS: $XDG_CONFIG_HOME if set, otherwise ~/.config (on Windows, ~ is %USERPROFILE%).

AgentPlugin fileRules file
OpenCode~/.config/opencode/plugin/tokenade.ts~/.config/opencode/AGENTS.md
Kilo Code~/.config/kilo/plugins/tokenade.ts~/.kilo/rules/tokenade.md

Both agents get the same plugin. The rules file teaches the agent the tokenade commands (code search, document reading, web search…).

Upgrades rewrite the plugin file whenever a Tokenade install is already present there, so fixes reach you without re-running install. The presence of tokenade.ts is what marks the plugin as installed.

Where each agent keeps its MCP config

AgentLinuxmacOSWindows
OpenCode~/.config/opencode/opencode.json~/Library/Application Support/opencode/opencode.json%APPDATA%\opencode\opencode.json
Kilo Code~/.config/kilo/kilo.json~/Library/Application Support/kilo/kilo.json%APPDATA%\kilo\kilo.json

MCP results are folded by the plugin itself, as tool results, so Tokenade does not rewrite the mcp entries in these files.

What they get

From the compatibility matrix: command output, web search, MCP results, code search, re-read dedup, documents and media, and secret redaction are covered. Context optimisation is partial with the plugin alone and full with the LLM proxy.

tokenade install sets up the LLM proxy for an agent only where it adds a feature. When it does, it points the agent's provider at a local address (127.0.0.1, port 8787 or the next free one) in the same opencode.json / kilo.json, checks the proxy answers, and puts the file back exactly as it was if it does not. Undo it with:

tokenade llm-proxy uninstall --agent opencode
tokenade llm-proxy uninstall --agent kilo-code

After installing

Restart OpenCode or Kilo Code so it loads the new plugin. Then run a session with a noisy command.

Verify

tokenade healthcheck

The plugin rows tell you whether the plugin is loading:

OK opencode plugin active — tool-result compaction firing
-- kilo-code plugin installed but no saving was ever recorded for it — start kilo-code once; if it stays silent the bridge is not loading (shell-proxy compaction still applies)

The second line is normal right after install, before you start the agent. If it stays after a real session, the agent is not loading its plugin folder: check that the file exists and that the agent version supports plugins. Also useful:

tokenade llm-proxy status # whether a proxy is set up for these agents, and what it adds
tokenade gain --by-source # savings split by source

Remove

tokenade uninstall --dry-run
tokenade uninstall

Uninstall deletes both tokenade.ts files, reverts any LLM proxy setting, and strips the rules sections. To install for only one of them: tokenade install --only opencode or tokenade install --only kilo-code. See Upgrade and uninstall.