feat(agents): add Kilo Code external agent#38
Open
rohitg00 wants to merge 3 commits into
Open
Conversation
Implements Kilo Code as an external agent binary using Kilo's @kilocode/plugin API. The plugin subscribes to the internal event bus and forwards session.created and session.idle events to the Entire CLI hook handler, carrying the authoritative Session.Info and messages array fetched via the local Kilo SDK client. Capabilities: hooks, transcript_analyzer, transcript_preparer, token_calculator, compact_transcript. Resume command: kilo run --session <id> (or --continue). Sub-sessions are filtered to top-level by checking info.parentID. Closes entireio#16
Cross-checked against entireio/cli@ddf1a33 and the OpenCode agent implementation (cmd/entire/cli/agent/opencode/). Kilo is OpenCode fork, so the same event-bus semantics apply. Critical changes: - Hook names switch to kebab-case (session-start, turn-start, turn-end, compaction, session-end) — matches Entire's external-agent convention and the engine's hook router at cmd/entire/cli/hooks_cmd.go. - Plugin subscribes to session.status with status.type=="idle" instead of session.idle (deprecated upstream; not reliably emitted in `kilo run` mode). - Plugin now uses Bun.spawn / Bun.spawnSync directly. Sync variants used for turn-start, turn-end, and session-end so git hook ordering and process-exit teardown are correct. - Adds __ENTIRE_CMD__ placeholder substitution at install time, with --local-dev rewriting to `go run "$(git rev-parse --show-toplevel)"/cmd/entire/main.go`. - Adds turn-start (message.updated/message.part.updated for user role), compaction (session.compacted), and session-end (session.deleted + server.instance.disposed) handlers — previously absent. - Plugin dir is now `.kilo/plugins/entire.ts` (OpenCode-style plural). - Per-hook payload types (sessionInfoRaw, turnStartRaw, turnEndRaw) match OpenCode's contract; turn-end carries optional session+messages snapshot from the plugin so session_ref is populated synchronously. Capabilities and protocol shapes unchanged. All 22 unit tests pass.
Author
|
Update — cross-checked PR against Fixes pushed (commit ac27c30):
Tests: 22 unit tests pass (was 18). CodeRabbit re-run pending. Still draft because the lifecycle e2e against a real |
sessionIDFromTranscriptData previously returned an error when the
transcript blob parsed to a Session struct with an empty ID. The
external-agents-tests compliance suite (tests/transcript:
TestTranscriptPreparer_PrepareTranscript) writes a minimal valid-JSON
fixture and expects prepare-transcript to succeed gracefully — there
is nothing to refresh against when no ID is present.
Match the amp agent's behavior: return ("", nil) when the blob is
empty or parses to a Session with no ID. PrepareTranscript already
short-circuits on an empty session ID, so this becomes a no-op rather
than an error.
Compliance suite now reports 29 PASS / 6 SKIP / 0 FAIL across
hooks, mandatory, optional, subagent, and transcript suites.
Author
|
Any update on this one? @blackgirlbytes Thank you |
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.
Closes #16
Summary
Adds
entire-agent-kilo, a standalone external agent binary that teaches the Entire CLI how to work with Kilo Code. Follows the same shape asentire-agent-ampandentire-agent-kiro.Kilo Code is a fork of OpenCode and ships a
@kilocode/pluginAPI that exposes session lifecycle events on its internal event bus — the original blocker on this issue (Kilo missing hook support) is resolved.How it works
.kilo/plugin/entire.tsthat runs on Kilo's Bun runtime.eventhook bus, filtering forsession.createdandsession.idle.client.session.get+client.session.messages) and forwards a single JSON payload over stdin toentire hooks kilo <event>.session_refatomically, and emits the Entire protocol event (SessionStart/TurnEnd).info.parentIDis empty so subagent threads don't double-fire SessionStart.Capabilities
Resume command
kilo run --session <id>(orkilo run --continue).Files
agents/entire-agent-kilo/— Go module (binary entrypoint, agent core, protocol handlers, unit tests)e2e/agents/kilo.go— lifecycle adapter for the shared e2e harnessagents/entire-agent-kilo/AGENT.md— research notes + protocol mappingagents/entire-agent-kilo/README.md— install + usageREADME.md,.gitignore— register the new agent in the root layoutTest plan
go build ./cmd/entire-agent-kilogo test ./...— 18 unit tests pass (protocol handlers, hooks, transcript, compact, command_runner, types)go vet ./...cleangofmt -s -w .cleaninfo,detect,format-resume-command,parse-hook session.created,parse-hook session.idle,install-hooks,are-hooks-installed,uninstall-hooks,extract-summary,get-transcript-position,calculate-tokens,compact-transcriptkiloinstalled (mise run test:e2e:lifecycle E2E_AGENT=kilo)external-agents-tests@kilocode/sdkexports (session.get,session.messagesshapes)Notes
Draft because the lifecycle e2e against a real
kiloinstall hasn't run yet locally. The plugin TS source assumes the current@kilocode/sdkshape — happy to adjust once verified against the latest published SDK. Filing as draft for early feedback on architecture and protocol mapping before promoting to ready-for-review.Will also confirm against the original blocker upstream (Kilo-Org/kilocode#5827) once the integration is validated end-to-end.