# OpenCode and Kilo Code

> Tokenade covers OpenCode and Kilo Code with a plugin that compacts tool results, a rules file and an optional LLM proxy.

Source: https://tokenade.net/en/docs/opencode-kilo · Updated: 2026-10-07

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%`).

| Agent | Plugin file | Rules 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

| Agent | Linux | macOS | Windows |
|---|---|---|---|
| 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](https://tokenade.net/en/docs/compatibility): 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](https://tokenade.net/en/docs/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:

```bash
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

```bash
tokenade healthcheck
```

The plugin rows tell you whether the plugin is loading:

```text
  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:

```bash
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

```bash
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](https://tokenade.net/en/docs/upgrade-uninstall).

## Related

- [Supported agents and compatibility](https://tokenade.net/en/docs/compatibility)
- [The LLM proxy](https://tokenade.net/en/docs/llm-proxy)
- [Output compaction and the stash](https://tokenade.net/en/docs/compaction)
- [Other agents](https://tokenade.net/en/docs/other-agents)
- Article: [Reduce OpenCode token usage](https://tokenade.net/en/articles/reduce-opencode-token-usage)
- Article: [OpenCode vs Kilo Code](https://tokenade.net/en/articles/opencode-vs-kilo-code)
