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
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.