Skip to main content
Glama

kilo_implement

Delegate a concrete code implementation task to Kilo and get a task_id immediately, so you stay the architect while Kilo edits files and runs commands.

Instructions

Delegate a concrete code IMPLEMENTATION task to Kilo (the executor) while you stay the architect/orchestrator/reviewer.

⚠️ SIDE EFFECTS: Kilo runs non-interactively and AUTO-APPROVES its actions — it will create/edit/delete files and run commands in working_directory without asking. Only delegate work you have specified precisely, in a version-controlled directory, and review the diff afterwards.

NON-BLOCKING BY DEFAULT: this tool starts the task and returns IMMEDIATELY with a task_id — it does NOT wait for Kilo to finish, so the calling conversation is never blocked on a long-running delegation. Use:

  • kilo_task_progress — live plan/todo list, recent commentary, cost so far.

  • kilo_task_status — quick OS-level heuristic (any kilo run process).

  • kilo_task_result — the final report, once it is done.

  • kilo_task_cancel — stop it if it is going wrong. Pass background=false only for short tasks where you deliberately want to block and get the full report back in this same call.

How to use it well:

  1. (Optional) kilo_rag_search to locate the relevant files.

  2. Write a precise spec in task_instructions or pass an existing Markdown file via brief_file (when both are given, task_instructions is appended under ## Additional instructions without modifying brief_file on disk); pass the key files as focus_files; add execution_hints, skills_to_load, and optionally log_dir (to also save <task_id>.log in the project; relative brief_file/log_dir paths resolve against the original working_directory even with isolation='worktree'). When the task instructions enumerate items (a numbered or bulleted list of deliverables), Kilo is instructed to include one line per item ("done" or "not done: why") in the Final Report, in the same order. Initial context size (prompt + focus_files) is checked by preflight: warns above max_context_tokens_warn (default 40,000) and refuses above max_context_tokens_refuse (default 120,000; 0 disables) to avoid connection resets.

  3. Pick a valid model (see kilo_list_models) and agent.

  4. Scale how closely you watch it to the task's complexity/risk: a small, well-scoped change needs only a final kilo_task_result check; a large, multi-file, or high-risk delegation deserves periodic kilo_task_progress polling so you can catch it drifting off-spec early.

  5. Act as reviewer: check Exit Code and review the Final Report and changed files; inspect the resulting changes.

STEERING & RESUMING: if a run (background or foreground) drifts off-spec, don't just restart from scratch — read its session_id (in the result / progress report), optionally kilo_task_cancel the current run, then call kilo_implement again with continue_session_id set to that id and corrective task_instructions. Kilo resumes the SAME session with full memory of what it already built, rather than starting blind. If a run died mid-way (network error, cancel, crash, or failed_with_uncommitted_work), pass resume_task_id set to the previous task id: kilo_implement reuses its worktree and branch (refusing if the worktree is gone or another run is active on it), reuses its Kilo session when known (else starts a fresh session), prepends a generated preamble with git status --short, git diff --stat, commits since base, and resume instructions to the original spec stored in the task record (with optional task_instructions appended as corrections), and links resumed_from: <old id> on the new task record. If a task is still actively running on that session or worktree, kilo_implement refuses to spawn a second process — wait for it to complete with kilo_task_wait or stop it with kilo_task_cancel before continuing. When continuing or resuming in an isolated worktree, pass refresh_base='merge' or refresh_base='rebase' to update the worktree from the current tip of its base branch before resuming; when conflicts occur, refresh_base_on_conflict='abort' (default) aborts and returns the conflicting files, while refresh_base_on_conflict='resolve' (with refresh_base='merge' only; rebase + resolve is refused) leaves the conflicted merge in place and instructs Kilo in the prompt to resolve the conflicts preserving both sides' intent, run the tests, and complete the merge commit before continuing.

Parallelism & Batch Queues: emitting several kilo_implement calls in one turn runs them concurrently (independent Kilo subprocesses). For large batches, pass queue='<name>' (with background=true) and optional queue_concurrency=<int> to enqueue runs in FIFO order instead of spawning all at once. A detached queue runner (python server.py --queue-runner) starts queued tasks while slots are free under both the queue's cap and the global max_concurrent_runs cap (config [kilo].max_concurrent_runs / env KILO_MCP_MAX_CONCURRENT_RUNS, default 3), so the queue keeps draining even after the calling session and MCP server process exit.

⚠️ NO ISOLATION, NO LOCKING BY DEFAULT: Kilo runs directly in working_directory with nothing preventing a concurrent writer — another kilo_implement call, or your own git commands — from racing it in the same tree (uncommitted changes lost, branches reset out from under a run, whichever writer runs last silently wins). Pass isolation='worktree' to auto-create a dedicated git worktree + branch for this run (equivalent to calling kilo_create_worktree yourself first) — use it for anything beyond a single trivial edit, and always when dispatching parallel tasks against the same repo. If you don't isolate, the response is prefixed with a collision warning whenever another task is already running against the exact same working_directory — treat that warning as a stop sign, not a formality.

When to skip a worktree: a worktree adds nothing for a brand new repository or a directory nobody else writes to; it is still recommended whenever another writer (a session, the user, another task) may touch the same tree.

⚠️ PROTECTED CONFIG FILES: Kilo always asks for approval before editing the project-root AGENTS.md, kilo.json(c), opencode.json(c), or anything under .kilo/ or .kilocode/ (except .kilo/plans/), whatever the permissions say. A non-interactive run auto-rejects that ask and ENDS, with no Final Report and no commit. The delegated prompt therefore tells Kilo to write the intended content to <path>.proposed instead; apply it yourself. Don't ask Kilo to edit those files directly.

⚠️ EXTERNAL PATHS: Unattended runs cannot read outside the working directory unless the Kilo config allows external_directory; do real-world checks on such paths on the orchestrator side.

Handling of *.proposed files is controlled by proposed_files:

  • proposed_files='untracked' (default): Kilo is instructed to leave *.proposed files uncommitted (never git add them, committing everything else). After the run, kilo-mcp lists any *.proposed files present in the working tree in the result ("Proposed files to apply: …"). If one got committed anyway, the result says so explicitly.

  • proposed_files='commit': Kilo is allowed to commit *.proposed files alongside other changes as before.

Returns a text report (trimmed by default: status, exit code, session_id, worktree/branch when present, parsed Final Report, and log file path; pass include_trace=true for the full run trace).

When to delegate

Kilo runs at no cost to this operator; the only cost is your own (Claude) tokens. DELEGATE to Kilo when doing the task yourself would need a large agentic loop that is specifiable up front — multi-file changes, bulk/mechanical generation (e.g. tests for every endpoint), wide refactors, anything where the resent context of an inline loop would dwarf a written spec. ALSO PREFER DELEGATING when Kilo has a skill or agent matching the task's domain (check kilo_list_skills / kilo_list_agents; pass them via skills_to_load / agent): domain-specific skills and agents encode proven procedures and pitfalls, making Kilo's output better than an unguided inline attempt regardless of size. DO IT YOURSELF when the task is small (one or a few files, short edits), needs tight back-and-forth reasoning that can't be pinned down in a spec, or when writing the spec plus reviewing Kilo's output would cost more tokens than just doing it inline. Either way, always review the returned report.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "kilo_implement"
  }
}

Input Schema

NameRequiredDescriptionDefault
agentNoKilo agent to use. `code` for implementation (default). Use kilo_list_agents to see custom agents. Note: subagents such as `explore` cannot be used as primary agents for implementation.code
modelNoModel id in `provider/model` form. MUST be a real id from kilo_list_models; an unknown id makes the run fail. Allowed models by policy: google/gemini-3.8-flash (routine tasks) and google/gemini-4-argon (complex/high-risk tasks). This environment has two configured tiers — pick by task risk, don't just reuse whatever model you (the connected assistant) happen to be: simple/routine tasks (mechanical edits, low risk) -> google/gemini-3.8-flash; complex/high-risk tasks (subtle bugs, read-modify-write races, security-sensitive edits, multi-step reasoning) -> google/gemini-4-argon. Defaults to the workspace's configured Kilo model when there is one, or google/gemini-3.8-flash. Run `kilo-mcp --configure-models` to change these tiers, or kilo_list_models for the full catalog.
queueNoQueue name to enqueue this background run into instead of spawning immediately (e.g. 'audit-batch'; pass 'default' for the default queue). Requires `background=true`. A detached queue-runner process (`python server.py --queue-runner`) starts queued tasks in FIFO order respecting both the per-queue concurrency cap (`queue_concurrency`) and the global `max_concurrent_runs` cap (default 3). Because the queue state and runner live on disk/OS outside the calling session and MCP server process, the queue keeps draining even after both exit.
log_dirNoDirectory (absolute, or relative to `working_directory`; created if missing) where the run log is ALSO written as `<task_id>.log` (tee: the canonical log under the kilo-mcp data dir stays where it is, so kilo_task_result/progress/wait keep working unchanged). With `isolation='worktree'`, relative paths resolve against the original `working_directory` (the main checkout), not the new worktree, so the log lands in the requester's tree.
env_varsNoExtra environment variables for the Kilo subprocess (e.g. {'DEBUG': '1'}). Powerful and rarely needed; can override Kilo's runtime config. Leave empty unless debugging.
isolationNoSet to 'worktree' to isolate this run: auto-creates a new git worktree + branch under working_directory (equivalent to calling kilo_create_worktree yourself first, then passing its path as working_directory — but one step, harder to forget) and runs Kilo there instead of directly in working_directory. kilo_implement has NO isolation and NO locking by default: nothing stops a second concurrent call (or your own git commands) from racing this one in the same directory. Use isolation='worktree' for anything beyond a single trivial edit, and always when dispatching multiple kilo_implement calls in parallel against the same repo. Leave unset to run directly in working_directory (you'll get a warning if another task is already running there — see the tool description). The worktree (and later the session, once known) are also registered in .kilo/agent-manager.json best-effort, so they can show up in the Kilo Agent Manager UI — but there is no live sync with a running VS Code extension window: if it's open on this repo, its own next save can silently overwrite this registration with its own in-memory state. Reliable when the extension isn't running against this repo, or visible after its next reload otherwise.
backgroundNoDefault true: start the task and return IMMEDIATELY with a task_id instead of blocking the conversation until Kilo finishes. Monitor with kilo_task_progress (live plan/commentary) or kilo_task_status (quick heuristic); fetch the outcome with kilo_task_result; stop it with kilo_task_cancel. Set to false only for short tasks where blocking for the full report in this same call is actually preferable.
brief_fileNoPath (absolute, or relative to `working_directory`) of a Markdown file used as the task specification. When given, its content is the spec (if `task_instructions` is also non-empty, it is appended after the file content under a `## Additional instructions` heading). Contract sections (executor contract, Final Report requirements, proposed-files rules) are added to the prompt at run time as usual; the brief file itself is never modified. With `isolation='worktree'`, relative paths resolve against the original `working_directory` (the main checkout), not the new worktree, so the brief lives in the requester's tree.
focus_filesNoPaths (absolute, or relative to working_directory) that Kilo must read before making changes. Populate this with the files you identified via kilo_rag_search to keep Kilo focused. Preflight checks initial context size (prompt + focus_files) against configurable warn/refuse thresholds to avoid connection resets.
refresh_baseNoWhen continuing a session or resuming a task in a worktree (via continue_session_id or resume_task_id), optionally update the worktree from the current tip of the base branch before resuming: 'no' (default, leave worktree as is), 'merge' (git merge <base_branch>), or 'rebase' (git rebase <base_branch>). Conflict behavior is controlled by `refresh_base_on_conflict`.no
include_traceNoIf True, includes the full execution trace in the result. Defaults to False (returns status, exit code, session_id, worktree/branch when present, Final Report, and log path).
proposed_filesNoHow to handle `*.proposed` files written when Kilo needs to modify protected config files (AGENTS.md, kilo.json(c), etc.): 'untracked' (default, tells Kilo to leave them uncommitted and lists any in the working tree after the run for the orchestrator to apply) or 'commit' (allow Kilo to commit `*.proposed` files alongside other changes as before).untracked
resume_task_idNoTask id of a previous interrupted, failed, or cancelled run to resume in the same worktree and branch. Reuses its worktree and branch (refuses with a clear error if the worktree is gone or another run is active on it), reuses its Kilo session when known (else starts a fresh session), and prepends a generated preamble (current `git status --short`, `git diff --stat`, commits since base, and fixed resume instructions) to the original spec stored in the task record. Optional `task_instructions` are appended as corrections. The new task record links `resumed_from: <old id>`.
skills_to_loadNoNames of Kilo skills (from kilo_list_skills) that Kilo should apply to this task. Only listed names have any effect.
execution_hintsNoStrategic guidance on HOW to execute: ordering, constraints, patterns to follow, things to avoid, how to verify.
worktree_branchNoBranch name for the new worktree when isolation='worktree'. Defaults to 'kilo/<task_id>' if omitted. Ignored unless isolation is set.
queue_concurrencyNoConcurrency cap for `queue` (stored in `<data_dir>/queues/<name>.json`; last value given wins). A queue's runs count against both `queue_concurrency` and the global `max_concurrent_runs` cap.
task_instructionsNoDetailed, self-contained Markdown specification of the work to perform. Required unless `brief_file` is provided; when both `brief_file` and `task_instructions` are non-empty, `task_instructions` is appended after the brief file's content under a `## Additional instructions` heading. YOU are the architect: state goals, constraints, acceptance criteria and edge cases explicitly — Kilo executes what is written and does not share your conversation context. Long specs are fine; they are passed via a temp-file bridge, not the shell.
working_directoryNoAbsolute path to the repository/workspace Kilo should run in and modify. Defaults to the server's current working directory. Ensure it is under version control before delegating. Unattended runs cannot read outside the working directory unless the Kilo config allows `external_directory`; do real-world checks on such paths on the orchestrator side.
continue_session_idNoKilo session id to resume instead of starting fresh (see the session_id surfaced by kilo_task_progress / a prior kilo_implement result). Use this to STEER a delegation: after reviewing or cancelling a run that went off track, send corrective task_instructions into the SAME session so Kilo keeps the context of what it already built. Leave empty for a fresh session.
worktree_base_branchNoBase branch/commit for the new worktree when isolation='worktree'. Defaults to the current branch (git worktree add's own default). Ignored unless isolation is set.
refresh_base_on_conflictNoHow to handle conflicts when `refresh_base` ('merge' or 'rebase') encounters conflicts: 'abort' (default, aborts the merge/rebase leaving the worktree untouched and returns an error listing conflicting files) or 'resolve' (supported with refresh_base='merge' only; leaves the conflicted merge in place and adds the conflicting file list and instructions to the prompt so Kilo resolves them preserving both sides' intent, runs tests, and completes the merge commit before continuing; rebase + resolve is refused).abort

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full burden and does so: it discloses auto-approval of file create/edit/delete and command execution, non-blocking-by-default semantics with task_id return, absence of isolation/locking with a collision warning, the protected-config auto-reject-and-end failure mode, external_directory read restrictions, and worktree registration caveats. These are non-obvious failure modes an agent could not infer from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the side-effect warning and non-blocking default, and uses headings plus a numbered workflow, which helps. But it is very long and repeats schema content (queue, isolation, log_dir, resume semantics appear in both the prose and the parameter descriptions), so significant text does not earn its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 22-parameter, high-risk delegation tool with no annotations, the description covers when to call it, what it will do destructively, how to monitor, how to steer/resume, parallelism and queuing, and conflict handling. An output schema exists, so return-value detail is rightly left to it, with only the trimmed-vs-include_trace distinction noted.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so baseline is 3; the description earns above that by explaining cross-parameter interaction — task_instructions appended under '## Additional instructions' without modifying brief_file, relative brief_file/log_dir resolving against the original working_directory under isolation, continue_session_id vs resume_task_id as distinct resume paths, and refresh_base='rebase' being refused with refresh_base_on_conflict='resolve'. It does restate a fair amount of per-parameter text that already exists in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a precise verb+resource framing: delegate a concrete code IMPLEMENTATION task to Kilo while the caller stays architect/reviewer. It explicitly positions itself against the monitoring siblings (kilo_task_progress, kilo_task_status, kilo_task_result, kilo_task_cancel), so an agent knows this is the launcher, not the poller.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Contains an explicit 'When to delegate' section with decision criteria (multi-file, bulk/mechanical, wide refactors, or when a matching skill/agent exists) versus when to do it inline (small, tight back-and-forth, spec+review costs more than doing it). Also names the preferred prerequisites (kilo_rag_search, kilo_list_models, kilo_list_skills/kilo_list_agents) and the review-afterwards step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.