kimi-code-agent

kimi-code

developmentClaude Codeby Ragnar Rova

Summary

Run Kimi Code CLI as a Claude Code plugin subagent through the official Kimi CLI.

Install to Claude Code

/plugin install kimi-code-agent@kimi-code

Run in Claude Code. Add the marketplace first with /plugin marketplace add rrva/claude-code-kimi-agent if you haven't already.

README.md

<p align="center"> <img src="assets/banner.svg" alt="Kimi Code Agent for Claude Code" width="820"> </p>

Kimi Code Agent for Claude Code

Delegate coding tasks from Claude Code to the Kimi Code CLI — run Kimi as a plugin subagent. Ask Claude to spawn a Kimi agent to implement, review, explore, or debug, and Kimi's result (plus a resume command) comes back into your session.

Built on:

  • Claude Code plugins, skills, and subagents
  • Kimi Code CLI non-interactive prompt mode: kimi -p "<task>" --output-format stream-json
  • Kimi resume flags: --continue, --session
  • An optional --verify loop so Kimi iterates to a passing check on its own

Requirements

  • Kimi Code CLI on PATH, authenticated:
  kimi --version
  kimi login
  • Claude Code with plugin support
  • Node.js ≥ 18 (the helper is a small, dependency-free Node script)

Install

This repository is a single-plugin Claude Code marketplace. Add it straight from GitHub and install the plugin — no clone needed:

claude plugin marketplace add rrva/claude-code-kimi-agent
claude plugin install kimi-code-agent@kimi-code

Develop locally

Clone it and load it for a single session without installing:

git clone https://github.com/rrva/claude-code-kimi-agent
claude --plugin-dir ./claude-code-kimi-agent

Usage

Once installed, ask Claude in natural language:

Spawn a kimi agent to review the current diff.
Use the kimi skill to implement the smallest safe fix for this failing test.

Or invoke the subagent explicitly:

Spawn the kimi-code-agent:kimi-code subagent to explore this repo and summarize its architecture.

The helper prints a session id and a resume command after each run, so you can continue where Kimi left off:

Continue the previous kimi session and add tests for the change.

How it works

Claude Code
  └─ skill: kimi   ── or ──   subagent: kimi-code-agent:kimi-code
       └─ Bash → bin/kimi-agent-run
            └─ kimi -p "<task>" --output-format stream-json
                 └─ parsed → Kimi's response + session id + resume command

The bundled bin/kimi-agent-run helper spawns Kimi in headless prompt mode, parses its streaming stream-json output, and returns a concise summary. Claude never drives Kimi interactively — it delegates a task and gets a result back.

Watch a run live

kimi -p is non-interactive, so by default you only see the final summary. Use --tee <path> to mirror Kimi's live stream-json to a file as it runs, then tail -f that file in another terminal to watch tool calls and output in real time. The summary returned to Claude Code is unchanged — the tee is a side channel for you.

# terminal A — run it (or let Claude run it)
bin/kimi-agent-run --tee /tmp/kimi.jsonl <<'KIMI_TASK'
Explore this repository and summarize its architecture.
KIMI_TASK
# terminal B — watch
tail -f /tmp/kimi.jsonl

--live is a shorthand that tees to a temp file and prints the tail -f command.

Verify and inspect runs

kimi -p is one non-interactive pass, so a task that needs iteration normally takes several nudges. Pass --verify with your project's check command and --max-iters to make Kimi loop to green on its own:

bin/kimi-agent-run --verify 'npm run typecheck && npm test' --max-iters 4 <<'KIMI_TASK'
Implement <the change>. Only commit if the verify command passes; never commit red.
KIMI_TASK

After Kimi finishes, the helper runs --verify in the working directory. If it fails and attempts remain, Kimi is re-invoked with --continue (the failing output fed back in), up to --max-iters total attempts. The helper prints PASS/FAIL and exits non-zero (2) when the check is still failing — so Claude knows the work isn't done. Use the exact command your CI runs. (--verify and --worktree are mutually exclusive: one checks the working tree, the other isolates changes in a separate worktree.)

Every run also ends with a repository state block — git status --porcelain, git diff --stat HEAD, and the latest commits (or git worktree list for a --worktree run) — so you can see what Kimi actually changed and whether it committed, instead of trusting the prose summary.

Helper reference

bin/kimi-agent-run runs Kimi's official non-interactive prompt mode. The prompt comes from stdin or --prompt.

| Option | Description | | --- | --- | | --prompt <text> | Prompt text. If omitted, stdin is used. | | --continue | Continue the most recent Kimi session for the cwd. | | --session <id> | Resume a specific Kimi session id. | | --model <model> | Kimi model alias for this invocation. | | --worktree[=<name>] | Ask Kimi to create a git worktree for a new session. | | --cwd <path> | Working directory for the Kimi process. | | --tee <path> | Mirror live stream-json to <path> (watch with tail -f). | | --live | Like --tee but to a temp file; prints the tail command. | | --verify <cmd> | Shell check run after Kimi (in --cwd). On failure, Kimi re-runs with --continue to fix it, up to --max-iters times; exit 2 if still failing. Not combinable with --worktree. | | --max-iters <n> | Max Kimi attempts when --verify is set. Default: 1 (run once, no fix loop). | | --timeout-seconds <n> | Timeout before terminating Kimi (per sub-process). Default: 1800. | | --kimi-bin <path> | Kimi executable. Default: kimi. | | --dry-run | Print the resolved Kimi command without running it. |

Smoke test (no Kimi call):

bin/kimi-agent-run --dry-run <<'KIMI_TASK'
Summarize this repository.
KIMI_TASK

Notes & limitations

  • Permissions: Kimi prompt mode runs with auto permission — every file, shell, and network action is auto-approved with no prompt. There is no higher "yolo" level in prompt mode, and this holds regardless of the parent Claude Code session's permission mode.
  • --worktree requires a Kimi CLI version that supports -w/--worktree in prompt mode.
  • The helper depends only on Node's standard library — nothing to npm install.

License

MIT

Related plugins

Browse all →