Repository navigation
feat: add Kilo Code support (CLI, VS Code and JetBrains) - #2495
Open
vasiliy-mikhailov wants to merge 10 commits into
Open
vasiliy-mikhailov wants to merge 10 commits into
vasiliy-mikhailov wants to merge 10 commits into
Conversation
… agents; find sessions in channel DBs Prepare the OpenCode integration for OpenCode forks (Kilo Code) that load the same plugin and use the same SQLite schema under different names: - presets/opencode.rs: per-agent names and paths move into `OpenCodeFamily` (tool, data dir, DB file name, storage env var); the preset parses through `parse_family`. Behavior for OpenCode is unchanged. - The SQLite lookup now also considers per-channel DBs (`opencode-<channel>.db`) next to `opencode.db` and picks the one containing the session, so builds that write channel DBs no longer record the model as "unknown". Cost is one directory listing plus one indexed query per candidate DB, in the checkpoint process only (no git calls, nothing on the daemon ingestion path). - agent-support/opencode/git-ai.ts: new `__GIT_AI_PRESET__` placeholder. A copy that only substitutes the binary path keeps working as the OpenCode plugin. - mdm/agents/opencode.rs: `OpenCodePluginAgent` trait (name, id, process names, detection, legacy plugin paths) with one shared HookInstaller impl; OpenCodeInstaller keeps its legacy ~/.config/opencode/plugin/ cleanup. Tests: channel-DB model resolution (integration), preset substitution and default (plugin test), installer placeholder substitution (unit). Co-Authored-By: Claude Opus 5.5 <[email protected]>
A binary path containing the preset token kept its literal text only if the path is substituted last. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kilo Code is an OpenCode fork: its CLI, its VS Code extension (which spawns a bundled `kilo serve`) and its JetBrains plugin (which downloads a pinned CLI and runs `kilo serve`) all load global plugins from ~/.config/kilo/plugins/ through the OpenCode V1 plugin API and store sessions in an OpenCode-schema SQLite DB under ~/.local/share/kilo. So Kilo reuses the OpenCode integration: - presets: `kilo` preset = the OpenCode preset with KILO_FAMILY (tool "kilo", kilo.db / kilo-<channel>.db, GIT_AI_KILO_STORAGE_PATH). The CLI and the JetBrains backend write channel DBs; the VS Code extension forces kilo.db. - mdm: KiloInstaller implements OpenCodePluginAgent, writing the shared plugin with preset "kilo" to ~/.config/kilo/plugins/git-ai.ts. Detected via the kilo binary, its config/data dirs, .kilo/.kilocode, or the Kilo Code extension in VS Code-family editors. - streams: "kilo" uses the OpenCode transcript reader. - attribution_recovery: Kilo commit-agent markers. Tests: preset parsing and bash classification, kilo.db resolution, installer install/check/uninstall and extension-only detection, plus integration tests for direct checkpoints with model, the installed plugin through the V1 hook API, the CLI's channel DB, and an AI insert above known-human lines. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d legacy and KILO_DB databases - Install, check and uninstall the plugin under $XDG_CONFIG_HOME/<agent>, where Kilo and OpenCode load it (xdg-basedir), falling back to ~/.config. - Detect Kilo Code for JetBrains from its plugin dir, before its managed kilo backend first runs. - Read Kilo sessions from a KILO_DB override and from a pre-rename opencode-<channel>.db in Kilo's data dir, as Kilo itself does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vasiliy-mikhailov
force-pushed
the
feat/kilo-code
branch
from
November 25, 2026 04:28
b0bda18 to
ff84145
Compare
Older releases wrote ~/.config/opencode/plugins/git-ai.ts regardless of XDG_CONFIG_HOME. Treat that copy as a legacy path: check reports it as installed but outdated, install removes it, and uninstall removes and reports it alongside the current plugin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
….config Legacy cleanup compared raw paths, so a symlinked XDG dir made the active plugin look like a leftover copy and install unlinked it. Compare file names and resolved parent dirs instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…detection - Installer tests clear and restore XDG_CONFIG_HOME, so they never write to or delete from the real config dir; drop a test that read the live env. - Detect the Kilo Code extension only from 7.0, the first version built on the Kilo CLI that loads plugins; stop treating `.kilocode` as a Kilo install. - Find Kilo's data dir with the preset's resolver, which honors XDG_DATA_HOME. - Install reports the leftover plugin files it removes (dry run included) instead of "already up to date"; install and uninstall share the removal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Install's cleanup of old plugin copies is best effort again: a copy that can't be removed (e.g. in a read-only dotfiles dir) is logged and left alone, and the active plugin is still written. Uninstall still fails loudly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kilo detection only checked the plugins dirs of IDEs found in the standard install locations, so an IDE unpacked elsewhere (e.g. ~/apps/idea) was missed. List the per-user JetBrains/Google config dirs directly instead, reusing the existing per-platform plugins-dir layout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`DirEntry::file_type` doesn't follow links, so a version dir moved to another drive and linked back was skipped. Use `Path::is_dir`, which follows links and still drops plain files and broken links. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
|
Hi! Could a maintainer please approve the workflow runs for #2495 (Kilo Code support)? It's from a fork, so CI is waiting on "Approve and run" (all runs show What's already checked:
The PR builds on #2494 (OpenCode-family refactor), which also needs approval. Thanks! |
Author
|
@svarlamov @acunniffe could one of you approve the workflow runs for #2495 and #2494 when you have a moment? Both are from a fork, so CI is waiting on "Approve and run". Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Kilo Code by reusing the OpenCode integration, as suggested on #1254 (this supersedes the earlier attempts #762, #1254 and #1466). Kilo is an OpenCode fork: its CLI, its VS Code extension (spawns a bundled
kilo serve) and its JetBrains plugin (downloads a pinned CLI and runskilo serve) all load global plugins from~/.config/kilo/plugins/through the OpenCode V1 plugin API and keep sessions in an OpenCode-schema SQLite DB under~/.local/share/kilo.kilo= the OpenCode preset withKILO_FAMILY(toolkilo,kilo.db/kilo-<channel>.db,GIT_AI_KILO_STORAGE_PATH). The CLI and the JetBrains backend write channel DBs (kilo-rc.db); the VS Code extension forceskilo.db.KiloInstaller(83 lines incl. tests) implementsOpenCodePluginAgentand writes the shared plugin with presetkiloto~/.config/kilo/plugins/git-ai.ts. Detection:kilobinary,~/.config/kilo,~/.local/share/kilo,.kilo/.kilocode, or thekilocode.kilo-code-*extension in VS Code-family editors.kilouses the OpenCode reader. Recovery: Kilo commit-agent markers.Tests (TDD)
kilo, bash classification,kilo.dbresolution, installer install/check/uninstall and extension-only detection.tests/integration/kilo.rs): direct checkpoints attribute lines tokilowith the session's model; the installer-generated plugin through the V1 hook API; the CLI's channel DB; an AI insert above known-human lines keeps them human.Locally:
cargo test --lib(2559 passed), integrationopencode kilo install attribution_recovery bash_tool streams_e2e e2e_user_scenarios simple_additions(335 passed),cargo fmt --check,cargo clippy --all-targets -D warnings(Rust 1.93).End-to-end (real model, real IDEs, in Docker)
DeepSeek-V4.1-Flash through an OpenAI-compatible gateway; a human types in the IDE, Kilo edits through its own UI, then
git ai blame/git ai statsare checked per line:kilo::deepseek-v4.1-flashkilo::deepseek-v4.1-flashh_…, Kilo liness_…kilo run(CLI 7.8.28)opencode::deepseek-v4.1-flashNote: in those runs the human's lines had no known-human checkpoint and sat right after the AI block at EOF, so post-commit edge recovery (
docs/bash-attribution-recovery-plan.md) credited them to the AI, as designed. With a known-human checkpoint (JetBrains run, and the new integration test) they stay human.Also seen, pre-existing and unrelated to this PR: Kilo 7.8.x and OpenCode 1.19.6 log
[git-ai opencode] failed to initialize plugin: … 'ctx.tool.hook'from the plugin's V2setup()path; the V1 hooks still fire, so attribution works.🤖 Generated with Claude Code