Skip to content

feat(agent): land the Kilo agents through the Kilo host - #15238

Merged
marius-kilocode merged 9 commits into
v2from
agents-plugin
Oct 19, 2026
Merged

marius-kilocode merged 9 commits into
v2from
agents-plugin

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #14999. Plan unit U-E2-12.

What Problem This Solves

v2 ships only the upstream agents: Build, Plan, and the General and Explore subagents. Kilo v1 ships Code, Ask, Debug, Orchestrator and Plan, with Kilo prompts and permissions. #14999 implemented them before the Kilo host existed, so it registered the plugins with marked lines in packages/core/src/plugin/internal.ts and kept the module inside core.

Why This Change Was Made

This is the first feature placed with the placement method (v2-feature-placement). The behavior of #14999 is unchanged, but it is re-homed:

  • The agent module and its prompts move from packages/core/src/kilocode/ to packages/kilo-plugin/src/agent/. KiloPlugins lists KiloAgentPlugin.Plugin; the new KiloPostPlugins lists KiloAgentPlugin.Ceiling. The host (packages/kilo-cli/src/host.ts) registers both through SdkPlugins.register and now provides Global next to Bus, because the agents read the Global paths.
  • internal.ts is upstream again (no diff to the pin 775d1d0d713).
  • The ceiling must run after ConfigAgentPlugin, which is an internal post plugin. SdkPlugins.register had no phase, so one generic seam adds it: register(plugin, { phase: "post" }), all(phase), and one line in plugin/supervisor.ts that appends the post plugins after internal.post.
  • The ceiling now runs after every internal post plugin, including the browser plugin, which appends a deny to every agent. The ceiling of feat(core): add Kilo agents #14999 matched the agent rules against [guard, ...global] as a prefix and skipped any agent with its own config rule once that tail was present (verified: the old check fails the new test). It now finds where the global rules end in the probe and keeps the appended tail last.
  • The fetch.test.ts probe change of feat(core): add Kilo agents #14999 is not needed: the server tests do not start the host, so the Kilo shell defaults are not in that agent list. The file is upstream again.
  • script/upstream/progress.ts accepts kilo_port(unattributed:<area>:<id>), so a Kilo-owned file can close an unattributed patch cell in place.

Behavior (from #14999, unchanged):

Agent Change
Code Copy of native build with ID code, as in v1. It is the default agent
build Hidden copy of Code. Code that still names build keeps working, and the list has no second Code entry. A hidden agent is never the default, so default_agent: "build" selects Code
Ask v1 prompt (CLI diagram line). Catch-all deny, the v1 read-only shell allowlist and blocklist, read/grep/glob/skill/question/webfetch/websearch, the tool and shell output directories. No edit, no subagents
Debug v1 prompt, Code permissions
Orchestrator v1 prompt. Read-only tools and subagents, no shell, no edit
Plan v1 description and read-only guard. It keeps the native Plan directory that the native Plan reminder names
Code, Debug, General v1 default shell rules: ask, except the read-only and file housekeeping allowlist
  • The cycle order is the v1 order: Code, Ask, Debug, Orchestrator, Plan.
  • A user agent with the same ID merges over the built-in, as in v1.
  • Read-only limits after config, as in v1 ("Ask" mode edits the codebase #12053): global config rules cannot open shell, edit, delegation or unknown tools in Ask and Plan, or shell in Orchestrator. Rules configured for one agent by ID come after the limits and stay the opt-in.
  • One persisted agent-switch reminder per switch, as in v1.

Differences from v1 (from #14999; one row changed):

Area v1 This PR Owner
Ask MCP tools Ask per MCP server Denied by default Follow-up
Plan edits with a per-agent rule Plan edit guard reapplied after per-agent rules A per-agent rule can widen Plan edits U-E2-13
Plan file location, plan_exit, plan prompt .kilo/plans, Kilo plan prompt Native ~/.opencode/plan and native Plan reminder U-E2-13
Explore Read-only shell, Kilo prompt Native Explore U-E2-17
Delegated subagents Plan and Ask denies carry into subagents Each subagent uses its own rules U-E2-17
External directories Ask, with an allowlist of Kilo directories Native allow for Code, Debug and General U-E2-17
agent.build config Maps to code Configures the hidden build copy. default_agent: "build" now selects Code (tested) U-E1-07
Ask diagrams in VS Code and JetBrains Mermaid Plain text (CLI variant) G2 client gating
Orchestrator "deprecated" badge Present v2 agent schema has no field for it Later
Typed displayName and source agent fields Present Not carried here; still open because organization modes need them Config box
Agent builder (/agent-builder), agent remove Present Not ported. Needs the Kilo RPC scaffolding (U-E0-02) Later PR
Scout Experimental, default off Not ported U-E11-05
Rules for tools v2 does not have yet (memory, board, notebook, semantic search, suggest) Present Each tool unit adds its rules Tool units

User Impact

  • Shift+Tab cycles Code, Ask, Debug, Orchestrator, Plan. The prompt shows "Code".
  • Ask answers without changing files. Code asks before shell commands outside the allowlist.
  • A global "*": "allow" in config does not make Ask or Plan writable.

The UI is the same as in #14999; its screenshots apply.

Evidence

Automated (temporary XDG directories, Bun 1.4.0 locally):

Command Result
bun typecheck in packages/kilo-plugin, packages/kilo-cli, packages/core pass
bun typecheck in packages/server 1 error in packages/ai/src/protocols/shared.ts (zstdCompressSync), the same without this change. Local only: this worktree is nested in a checkout whose node_modules/@types/node is 22.13.9
bun test in packages/kilo-plugin 9 pass (8 agent tests moved from core, plus the list test)
The ceiling test without KiloAgentPlugin.Ceiling, and with the prefix check of #14999 both fail (deny expected, allow received)
bun test in packages/kilo-cli 5 pass, including the new host test: real server with the host overrides, global * allow plus a Plan rule; Ask and Plan stay read-only, Plan keeps cargo search, Orchestrator has no shell, the probe agent is gone
The host test without the supervisor line, and with the ceiling registered without phase both fail
Core agent, plan, config agent and command subagent suites 62 pass
Core plugin/supervisor.test.ts 7 pass
Core plugin/supervisor-reload.test.ts 2 pass, 6 fail; the same 6 fail on the base code locally
Server fetch.test.ts (upstream version), 3 runs 12 pass each
Server vcs.test.ts (its SdkPlugins fake ignores the phase) 6 pass, 1 skip
bun test progress.test.ts (script/upstream) 12 pass
bun run lint 0 errors, no warnings in changed files
bun run check lint pass; typecheck fails locally only on the zstdCompressSync error above (@opencode/plugin-figma)
bun script/check-shared-patches.ts, bun script/check-opencode-annotations.ts ok
bun script/upstream/placement.ts --imports ok, 8 distinct core-internal modules
bun script/upstream/progress.ts then --check up to date

TUI self-test (vscode-self-test recipe, bun dev --standalone through the host, new profile, kilo/kilo-auto/free, test repo with math.ts):

Scenario Result
Home screen prompt label pass: Code · Auto Free Kilo Gateway
Shift+Tab five times pass: Ask, Debug, Orchestrator, Plan, Code
/agents dialog pass: code, ask, debug, orchestrator, plan. No build, no probe
Ask: "Change VERSION in math.ts to "2.0.0". Edit the file now" pass: refused, math.ts unchanged
Code: run node -e "console.log(41+1)" pass: "Permission required", rejected
Code: run ls pass: ran without a prompt
Switch Ask to Code (session database) pass: one switch reminder with the writable capability line
Global config {"permission": {"*": "allow"}}: Code runs node -e pass: ran without a prompt, so the global rule is active
Same config: Ask lists its tools pass: glob, grep, question, read, shell, skill, webfetch, websearch. No edit, write or subagent
Same config: Ask is asked to edit math.ts or run sed -i pass: refused, math.ts unchanged
CLI log errors none

No test was skipped or deleted.

Placement

Change Rung Why not lower Proof
Kilo agent set, shell defaults, guards, switch reminder 1 n/a packages/kilo-plugin/src/agent/index.ts (ctx.agent.transform, ctx.event, ctx.session.synthetic), kilo_port(unattributed:agent:b6727a425792) and 6 more
Agent ceiling after config 1 n/a same file, KiloAgentPlugin.Ceiling
Registration of both plugins, Global for plugins 2 n/a KiloPlugins and KiloPostPlugins in packages/kilo-plugin/src/index.ts, SdkPlugins.register in packages/kilo-cli/src/host.ts, kilo_port(agent:2e5632e7bfc6)
Registration phase in SdkPlugins 3 The store had no phase, and no hook, editor, service node or boot option runs a plugin after the internal post plugins packages/core/src/plugin/sdk.ts, 6 lines, shared-patches.json
Post plugins after internal.post 3 The supervisor builds the boot order itself and put every embedder plugin in the pre phase packages/core/src/plugin/supervisor.ts, 1 line, shared-patches.json
  • Shared files touched: packages/core/src/plugin/sdk.ts (rung 3), packages/core/src/plugin/supervisor.ts (rung 3). Every marked line is kilocode_change(agent) seam and carries no Kilo value. internal.ts and fetch.test.ts have no diff to the pin.
  • Shared-patch baseline: before 15 files, 45 marked lines, 18 unmarked lines, 0 deleted files (14 seam, 1 patch). After 17 files, 52 marked lines, 18 unmarked lines, 0 deleted files (16 seam, 1 patch).
  • Core-internal imports in packages/kilo-plugin/src/agent/index.ts (no public surface has them; feat(core): add Kilo agents #14999 imported the same modules by relative path): @opencode/core/permission (Permission.evaluate for the reminder capability line), @opencode/core/util/wildcard (Wildcard.match in the ceiling), @opencode/core/shell and @opencode/core/tool-output (the output directories that read-only agents may read). Ratchet 4 to 8. Public imports: @opencode/plugin, @opencode/schema, @opencode/util.
  • Mirrored files: none.

Progress map:

  • agent: 0/15 (0%) before, 6/13 (46.2%) after, 2 dropped. unattributed:agent: 0/34 before, 21/23 (91.3%) after, 11 dropped. Total: 12/9854 (0.1%) before, 39/9841 (0.4%) after, 13 dropped.
  • Landed by rung: 8 plugin, 0 host, 0 seam, 0 patch.
  • kilo_port (8): agent:2e5632e7bfc6 (the KiloPlugins entry); unattributed:agent: b6727a425792 (agent map), 161afe543464 and 655072363498 (default shell rules), 6f9571fe6129 and a91ca8efa1b6 (Code is the default), 55cce67688d4 and 80e846e9fd1c (hidden build copy).
  • native (14 patch cells): rebuild on config change (8 cells, v2 reloads the plugin generation on config.updated); global config and reference directories (2, v2 Code, Debug and General start with * allow); system agent hardening (4, v2 runs title, summary and compaction without tool execution).
  • dropped (13 cells), each with its row of the differences table: Scout (3), the deprecated badge (1), suggest rules (2), runtime flags for Scout and board (2), the mixed per-agent hardening hunk (Explore, Plan edit guard, metadata lifting, Scout references), agent generation prompt and its telemetry (3, v2 has no agent create generation), scout.txt.
  • ported by disposition (feature mismatch, files in kilo-plugin count as feature plugin): kilocode/agent/index.ts and the tests agent-permission-overrides, agent-skill-permissions, ask-agent-permissions. agent-global-config-dirs test: native.
  • Left open: builder.ts, POST /kilocode/agent/remove and agent-remove.test.ts (agent builder and remove, U-E2-12 later PR on U-E0-02); options.ts and agent-options-strip.test.ts (the v1 config migration moves agent options into request.body, so displayName and source from v1 markdown agents reach the provider); agent-routing.test.ts (markdown and config routing precedence, U-E1-07, not verified on v2); the typed displayName and source fields and agent-config-metadata.test.ts (organization modes in the config box need them).

Embedder plugins registered with phase post run after the internal post
plugins, so they see the result of config. Without a phase, all() returns
what it returned before.
Move KiloAgentPlugin out of core into kilo-plugin. The host registers the
agent set before the config plugins and the agent ceiling in the post
phase. The ceiling now keeps rules that later post plugins append to every
agent. internal.ts and fetch.test.ts are upstream again.
kilo_port proofs accept unattributed:<area> as the feature. Add the agent
dispositions and regenerate the map.
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

📈 v2 migration progress: 0.1% → 0.4% (+27 done, -13 total, +13 dropped; 39/9841 cells)

Placement: 7 new marked lines in shared files (7 seam), 8 new kilo_port annotations, 4 new core-internal imports (@opencode/core/permission, @opencode/core/shell, @opencode/core/tool-output, @opencode/core/util/wildcard).

Ratchets: 8 core-internal imports (base 4); shared patches by rung 16 seam, 1 patch (base 14 seam, 1 patch).

Feature Before After Change
agent 0/15 6/13 +1 module done, -1 module total; +1 patch done, -1 patch total; +4 tests done; +2 dropped
unattributed:agent 0/34 21/23 +21 patches done, -11 patches total; +11 dropped
25 cells closed
  • module:packages/opencode/src/kilocode/agent/index.ts
  • module:packages/opencode/test/kilocode/agent-global-config-dirs.test.ts
  • module:packages/opencode/test/kilocode/agent-permission-overrides.test.ts
  • module:packages/opencode/test/kilocode/agent-skill-permissions.test.ts
  • module:packages/opencode/test/kilocode/ask-agent-permissions.test.ts
  • patch:agent:2e5632e7bfc6
  • patch:unattributed:agent:0a0c97da2c48
  • patch:unattributed:agent:161afe543464
  • patch:unattributed:agent:19ff1297ae1a
  • patch:unattributed:agent:1c5cb886bb38
  • patch:unattributed:agent:21c84cad48b3
  • patch:unattributed:agent:407e5d080313
  • patch:unattributed:agent:55cce67688d4
  • patch:unattributed:agent:655072363498
  • patch:unattributed:agent:6f9571fe6129
  • patch:unattributed:agent:6fd86cbf07a5
  • patch:unattributed:agent:80e846e9fd1c
  • patch:unattributed:agent:8558c7e71c33
  • patch:unattributed:agent:860878fa7bab
  • patch:unattributed:agent:8a47a5bd2127
  • patch:unattributed:agent:a46eaa33223b
  • patch:unattributed:agent:a91ca8efa1b6
  • patch:unattributed:agent:b6727a425792
  • patch:unattributed:agent:e4427a3d9c64
  • patch:unattributed:agent:fbbd4a8ba315
13 cells dropped
  • module:packages/opencode/src/kilocode/agent/scout.txt
  • patch:agent:063e034b577a
  • patch:unattributed:agent:09375914c157
  • patch:unattributed:agent:0faa6c731275
  • patch:unattributed:agent:1b8fe669272e
  • patch:unattributed:agent:2e2369fd59e1
  • patch:unattributed:agent:461dc96586d3
  • patch:unattributed:agent:51a770bdc581
  • patch:unattributed:agent:6cdbea643f7d
  • patch:unattributed:agent:7c1daa44f22c
  • patch:unattributed:agent:8c603298aa6d
  • patch:unattributed:agent:92890c7740e7
  • patch:unattributed:agent:d88711e4e0f0

v2 migration progress map at this commit

Full map · how cells close

@github-actions github-actions Bot added the area:cli CLI, TUI and core engine label Oct 19, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of ba889a8..aa8f456. The range contains only regenerated migration-tracking history artifacts. Commit aa8f456 regenerates the chart on the merged first-parent history, so the 2026-10-19 point now reflects the base progress.json restored by the merge of origin/v2 (12/9854) while now remains 39/9841; history() in script/upstream/progress.ts:674 intentionally skips commits equal to the current output. No hand edits to shared upstream files, and no code changes in this range.

Files Reviewed (2 files)
  • migration-tracking/progress/README.md
  • migration-tracking/progress/history.svg
Previous Review Summaries (2 snapshots, latest commit ba889a8)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit ba889a8)

Status: No Issues Found | Recommendation: Merge

Incremental review of 52a7d0c..ba889a8. The only changes are regenerated migration-tracking progress artifacts; the counts match the PR body (agent 6/13 at 46.2%, unattributed:agent 21/23 at 91.3%, 13 dropped, totals 9841) and the summary, feature table, and dropped list in README.md, progress.json, dispositions.json and the SVGs agree with each other. No hand edits to shared upstream files in this range.

Files Reviewed (5 files)
  • migration-tracking/progress/README.md
  • migration-tracking/progress/dispositions.json
  • migration-tracking/progress/history.svg
  • migration-tracking/progress/progress.json
  • migration-tracking/progress/progress.svg

Previous review (commit 52a7d0c)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (24 files)
  • .kilo/skills/v2-migration/SKILL.md
  • bun.lock
  • migration-tracking/progress/README.md
  • migration-tracking/progress/badge.svg
  • migration-tracking/progress/dispositions.json
  • migration-tracking/progress/history.svg
  • migration-tracking/progress/progress.json
  • migration-tracking/progress/progress.svg
  • packages/core/src/plugin/sdk.ts
  • packages/core/src/plugin/supervisor.ts
  • packages/kilo-cli/src/host.ts
  • packages/kilo-cli/test/host.test.ts
  • packages/kilo-plugin/package.json
  • packages/kilo-plugin/src/agent/agent-switch.txt
  • packages/kilo-plugin/src/agent/ask.txt
  • packages/kilo-plugin/src/agent/debug.txt
  • packages/kilo-plugin/src/agent/index.ts
  • packages/kilo-plugin/src/agent/orchestrator.txt
  • packages/kilo-plugin/src/index.ts
  • packages/kilo-plugin/test/agent.test.ts
  • packages/kilo-plugin/test/index.test.ts
  • script/upstream/progress.test.ts
  • script/upstream/progress.ts
  • script/upstream/shared-patches.json

Reviewed by deepseek-v4.1-flash-1017 · Input: 36.9K · Output: 3.9K · Cached: 246.9K

Review guidance: REVIEW.md from base branch v2

The typed displayName and source fields are still needed by organization
modes, so their patch cells and the metadata test stay open. Only the
deprecated badge is dropped.
The progress history follows the first parent. With v2 as the first parent,
the branch has the same first-parent history as the PR merge commit, so the
generated map does not depend on the branch commit order.
@marius-kilocode
marius-kilocode merged commit 48335f4 into v2 Oct 19, 2026
11 of 12 checks passed
@marius-kilocode
marius-kilocode deleted the agents-plugin branch October 19, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI, TUI and core engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants