kimi-plugin-cc 2.5.7 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +8 -8
  5. package/agents/kimi-swarm-write.md +3 -3
  6. package/agents/kimi-swarm.md +3 -3
  7. package/commands/swarm.md +2 -2
  8. package/dist/cli-client.js +3 -3
  9. package/dist/commands/recover-swarm.js +2 -1
  10. package/dist/commands/setup.js +7 -7
  11. package/dist/commands/swarm.js +40 -35
  12. package/dist/hooks/config-safety.js +5 -3
  13. package/dist/kimi-engine.js +45 -12
  14. package/dist/mcp/operations.js +1 -1
  15. package/dist/stream-json.js +2 -2
  16. package/dist/swarm-activation.js +73 -32
  17. package/dist/version.js +1 -1
  18. package/docs/migration.md +2 -2
  19. package/docs/registry-releases.md +2 -0
  20. package/docs/safety.md +12 -9
  21. package/docs/swarm-recovery.md +3 -1
  22. package/docs/upstream-2.5.3-certification.md +2 -0
  23. package/docs/upstream-2.6.0-certification.md +52 -0
  24. package/package.json +2 -1
  25. package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
  26. package/plugins/kimi-codex/dist/cli-client.js +3 -3
  27. package/plugins/kimi-codex/dist/commands/recover-swarm.js +2 -1
  28. package/plugins/kimi-codex/dist/commands/setup.js +7 -7
  29. package/plugins/kimi-codex/dist/commands/swarm.js +40 -35
  30. package/plugins/kimi-codex/dist/hooks/config-safety.js +5 -3
  31. package/plugins/kimi-codex/dist/kimi-engine.js +45 -12
  32. package/plugins/kimi-codex/dist/mcp/operations.js +1 -1
  33. package/plugins/kimi-codex/dist/stream-json.js +2 -2
  34. package/plugins/kimi-codex/dist/swarm-activation.js +73 -32
  35. package/plugins/kimi-codex/dist/version.js +1 -1
  36. package/plugins/kimi-dsh/dist/cli-client.js +3 -3
  37. package/plugins/kimi-dsh/dist/commands/recover-swarm.js +2 -1
  38. package/plugins/kimi-dsh/dist/commands/setup.js +7 -7
  39. package/plugins/kimi-dsh/dist/commands/swarm.js +40 -35
  40. package/plugins/kimi-dsh/dist/hooks/config-safety.js +5 -3
  41. package/plugins/kimi-dsh/dist/kimi-engine.js +45 -12
  42. package/plugins/kimi-dsh/dist/mcp/operations.js +1 -1
  43. package/plugins/kimi-dsh/dist/stream-json.js +2 -2
  44. package/plugins/kimi-dsh/dist/swarm-activation.js +73 -32
  45. package/plugins/kimi-dsh/dist/version.js +1 -1
  46. package/plugins/kimi-dsh/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Kimi for Claude Code: code questions, reviews, fixes, parallel tasks, and MCP tasks through the local Kimi Code CLI.",
8
- "version": "2.5.7"
8
+ "version": "2.5.8"
9
9
  },
10
10
  "plugins": [
11
11
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kimi",
3
3
  "description": "Kimi for Claude Code: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP tasks through the local Kimi Code CLI, with PreToolUse safety hooks.",
4
- "version": "2.5.7",
4
+ "version": "2.5.8",
5
5
  "homepage": "https://github.com/linxule/kimi-plugin-cc",
6
6
  "repository": "https://github.com/linxule/kimi-plugin-cc",
7
7
  "license": "Apache-2.0",
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  > **Post-1.0 release history (v1.0.1 -> present) lives in [ROADMAP-TO-GA.md § Post-GA audit log](./ROADMAP-TO-GA.md#post-ga-audit-log)** and the "Version" / "Upstream compat" lines of [AGENTS.md](./AGENTS.md). Docs-only kimi-code compat checkups that don't bump the plugin version (e.g. the 0.14.2 / 0.14.3 patches) are recorded there, not here. Notable releases are summarized below; the GA entry and full pre-GA detail follow.
4
4
 
5
+ ## 2.5.8 — 2026-11-13
6
+
7
+ - Certify exact kimi-code 2.6.0 for review, challenge, ask, rescue, review_gate and pursue only. Both swarm operations refuse before model spawn with `v2-swarm-not-certified`, including at the persisted-plan boundary; neither falls back to legacy-v1. Setup reports the narrowed scope. Exact 2.6.1 and full swarm certification remain uncertified. See the [2.6.0 non-swarm evidence](docs/upstream-2.6.0-certification.md).
8
+ - Preserve `NATIVE_V2_CERTIFIED_VERSIONS` as the all-operation export for automatic full-swarm pins, and add `NATIVE_V2_ANY_OPERATION_VERSIONS` for the scoped union. Existing full-swarm pin selection therefore does not move silently to non-swarm-only 2.6.0; choose that CLI explicitly for non-swarm use.
9
+ - Integrate the reviewed 2.6.0 executor, direct-subscription, local-environment, goal-journal and canonical execution-root changes. Preserve the no-plan construction and recovery safeguards. Candidate swarm activation and recovery remain outside production scope on 2.6.0.
10
+ - Pass the exact 2.6.0 source scan (19 tests / 225 assertions), 2.5.3 regression (153 assertions), full-scope candidate matrix (24 tests / 201 assertions / no skips), and narrowed production matrix (**23 tests / 170 assertions in 241.67 seconds**). The only three production skips are explicitly excluded swarm execution lanes; both real swarm command paths prove pre-spawn refusal with no model session, retained worktree, or user-tree change.
11
+ - Pass the definitive isolated full repository gate with **1,472 tests, 36 expected skips and 19,530 assertions in 402.26 seconds**, including generated-surface and drift checks with frozen dependencies. A five-second setup fixture timeout was raised to 30 seconds after its unchanged behavior passed in isolation; every assertion was preserved. Validate 333 package files across all three distributions, patched DSH host/profile with seven providers/tools and Web boot, and isolated npm consumer security. Independent reviews and publication receipts are recorded in the certification record.
12
+ - Preserve the upstream follow-up for the rate-limit recovery cap defect rather than waiving it. Full swarm certification still ends at 2.5.3 with its inherited limitation disclosed; restoration requires an exact upstream release containing the scheduler correction and fresh full-scope evidence. Publication does not update installed hosts or operator pins.
13
+
5
14
  ## 2.5.7 — 2026-11-11
6
15
 
7
16
  - Certify exact kimi-code 2.5.3 for all eight native-v2 operations, alongside 2.5.0, 2.5.1 and 2.5.2. All 40 load-bearing source files are unchanged from 2.5.2; steering/transcript, agent-loop, MCP startup and Windows spawn changes preserve the single before-execute gate and no-plan construction. See the [2.5.3 evidence](docs/upstream-2.5.3-certification.md).
package/README.md CHANGED
@@ -40,7 +40,7 @@ You need:
40
40
  - macOS or Linux
41
41
  - Claude Code, Codex, or DSH with plugin support
42
42
  - Node.js 22.5 or newer (24.9 or newer for DSH)
43
- - Kimi Code CLI 2.4.1 (certified; 2.4.0, 2.3.3, 2.3.2, 2.3.1 and 2.3.0 are also certified)
43
+ - Kimi Code CLI 2.6.0 for review, challenge, ask, rescue, review gate, or pursue. Both swarm modes refuse on 2.6.0; full eight-operation certification ends at 2.5.3, with the [documented rate-limit limitation](./docs/safety.md). Other exact certified versions remain supported per the [runtime matrix](./docs/native-v2-certification-provenance.md).
44
44
 
45
45
  Windows is not currently supported. Contributors can help with the [no-model Windows diagnostics checks](./docs/windows-validation.md). Check your versions in a terminal:
46
46
 
@@ -238,7 +238,7 @@ Remove the app's hook before removing its plugin. In Claude Code, run `/kimi:set
238
238
 
239
239
  If a hook check fails, follow its diagnosis. Run setup for the affected app when instructed. Do not bypass the check.
240
240
 
241
- If you see `KIMI_CAPABILITY_NOT_CERTIFIED`, update the plugin or use a certified CLI version. Running setup again does not certify a new CLI.
241
+ If you see `KIMI_CAPABILITY_NOT_CERTIFIED`, update the plugin or select a CLI certified for the requested operation. On 2.6.0, use the six non-swarm operations; swarm requires a CLI version certified for that operation, not merely a release listed for another operation. Running setup again does not certify a new CLI or expand its operation scope.
242
242
 
243
243
  If you see `CLI_V2_PLAN_MODE_CONFIGURED`, set `default_plan_mode` to `false` or remove it from your Kimi `config.toml` file. Sessions run by this plugin cannot use plan mode.
244
244
 
@@ -284,7 +284,7 @@ Contributors need Bun to run `bun run check`. The detailed engineering documents
284
284
  - macOS 或 Linux
285
285
  - 支持插件的 Claude Code、Codex 或 DSH
286
286
  - Node.js 22.5 或更高版本(DSH 需要 24.9 或更高版本)
287
- - Kimi Code CLI 2.4.1(已认证;2.4.0、2.3.3、2.3.2、2.3.1 和 2.3.0 也已认证)
287
+ - Kimi Code CLI 2.6.0(仅限 review、challenge、ask、rescue、review gate 和 pursue;两种 swarm 模式均会拒绝运行。完整八项操作认证止于 2.5.3,并有已披露的速率限制恢复缺陷。其他精确认证版本见[运行时矩阵](./docs/native-v2-certification-provenance.md))
288
288
 
289
289
  目前不支持 Windows。在终端检查版本:
290
290
 
@@ -455,7 +455,7 @@ codex plugin add kimi@kimi-marketplace
455
455
 
456
456
  如果钩子检查失败,请按诊断信息处理。提示需要重新配置时,在对应应用中运行 setup。不要绕过检查。
457
457
 
458
- 如果出现 `KIMI_CAPABILITY_NOT_CERTIFIED`,请更新插件,或改用已验证兼容的 CLI 版本。再次运行 setup 不能让新的 CLI 版本自动通过兼容性验证。
458
+ 如果出现 `KIMI_CAPABILITY_NOT_CERTIFIED`,请更新插件,或改用针对所需操作已认证的 CLI 版本。2.6.0 仅支持六项非 swarm 操作;swarm 需要选择针对该操作认证的版本,而不是仅凭其他操作已认证的版本。再次运行 setup 不能认证新的 CLI,也不能扩大其操作范围。
459
459
 
460
460
  如果出现 `CLI_V2_PLAN_MODE_CONFIGURED`,请将 Kimi 的 `config.toml` 文件中的 `default_plan_mode` 设为 `false`,或删除该项。本插件运行的会话不能使用计划模式。
461
461
 
@@ -503,7 +503,7 @@ Il vous faut :
503
503
  - macOS ou Linux
504
504
  - une version de Claude Code, Codex ou DSH prenant en charge les plugins
505
505
  - Node.js 22.5 ou une version ultérieure (24.9 ou ultérieure pour DSH)
506
- - Kimi Code CLI 2.4.1 (certifiée ; les versions 2.4.0, 2.3.3, 2.3.2, 2.3.1 et 2.3.0 sont également certifiées)
506
+ - Kimi Code CLI 2.6.0 (uniquement pour review, challenge, ask, rescue, review gate et pursue ; les deux modes swarm sont refusés. La certification complète des huit opérations s'arrête à 2.5.3, avec la limite connue de récupération après limitation de débit. Les autres versions exactes certifiées figurent dans la [matrice runtime](./docs/native-v2-certification-provenance.md))
507
507
 
508
508
  Windows n'est pas pris en charge actuellement. Vérifiez les versions dans un terminal :
509
509
 
@@ -672,7 +672,7 @@ Supprimez le hook de l'application avant d'en retirer le plugin. Dans Claude Cod
672
672
 
673
673
  Si la vérification du hook échoue, suivez le diagnostic. Relancez setup dans l'application concernée lorsque les instructions le demandent. Ne contournez pas la vérification.
674
674
 
675
- Si vous voyez `KIMI_CAPABILITY_NOT_CERTIFIED`, mettez à jour le plugin ou utilisez une version du CLI dont la compatibilité a été vérifiée. Relancer setup ne valide pas la compatibilité d'une nouvelle version du CLI.
675
+ Si vous voyez `KIMI_CAPABILITY_NOT_CERTIFIED`, mettez à jour le plugin ou utilisez une version du CLI certifiée pour l'opération demandée. La version 2.6.0 est limitée aux six opérations non swarm ; swarm exige une version certifiée pour cette opération, pas seulement pour une autre. Relancer setup ne valide pas une nouvelle version du CLI et n'élargit pas son champ d'opérations.
676
676
 
677
677
  Si vous voyez `CLI_V2_PLAN_MODE_CONFIGURED`, réglez `default_plan_mode` sur `false` ou supprimez cette option du fichier `config.toml` de Kimi. Les sessions lancées par ce plugin ne peuvent pas utiliser le mode plan.
678
678
 
@@ -718,7 +718,7 @@ Les contributeurs ont besoin de Bun pour exécuter `bun run check`. La documenta
718
718
  - macOS または Linux
719
719
  - プラグインに対応した Claude Code、Codex、または DSH
720
720
  - Node.js 22.5 以降(DSH では 24.9 以降)
721
- - Kimi Code CLI 2.4.1(認証済み。2.4.0、2.3.3、2.3.2、2.3.1 と 2.3.0 も認証済み)
721
+ - Kimi Code CLI 2.6.0(対象は review、challenge、ask、rescue、review gate、pursue のみ。両 swarm モードは拒否されます。8 操作すべての認証は 2.5.3 までで、継承されたレート制限復帰時の問題も開示しています。その他の正確な認証バージョンは[ランタイムマトリックス](./docs/native-v2-certification-provenance.md)を参照)
722
722
 
723
723
  現在、Windows には対応していません。ターミナルでバージョンを確認します。
724
724
 
@@ -889,7 +889,7 @@ codex plugin add kimi@kimi-marketplace
889
889
 
890
890
  フックの確認に失敗した場合は、診断結果に従って対処してください。Setup の実行を指示された場合は、該当するアプリで実行します。確認を回避しないでください。
891
891
 
892
- `KIMI_CAPABILITY_NOT_CERTIFIED` が表示されたら、プラグインを更新するか、互換性を検証済みの CLI バージョンを使ってください。Setup を再実行しても、新しい CLI の互換性が検証済みになるわけではありません。
892
+ `KIMI_CAPABILITY_NOT_CERTIFIED` が表示されたら、プラグインを更新するか、実行したい操作が認証された CLI バージョンを選んでください。2.6.0 では 6 つの非 swarm 操作のみ利用できます。swarm には、ほかの操作ではなく、その操作が認証されたバージョンが必要です。Setup を再実行しても、新しい CLI の互換性が検証済みになったり、対応操作が広がったりすることはありません。
893
893
 
894
894
  `CLI_V2_PLAN_MODE_CONFIGURED` が表示されたら、Kimi の `config.toml` で `default_plan_mode` を `false` にするか、その項目を削除してください。このプラグインが実行するセッションではプランモードを使えません。
895
895
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kimi-swarm-write
3
- description: Use this agent ONLY when the user has explicitly asked Kimi to make EDITS across MANY disjoint targets IN PARALLEL (a write fan-out) — e.g. "apply this same change to every handler, in parallel" or "fan out these independent edits across these N files." Requires BOTH signals: many independent WRITE targets AND explicit fan-out intent. WRITE-CAPABLE but PATCH-ONLY: edits happen in an ephemeral throwaway git worktree off HEAD and come back as a reviewable .patch — the plugin NEVER applies or commits, the user owns the merge, and the real working tree is never touched. Bounded by a MANDATORY hard --budget and a hard --max-concurrency. Do NOT auto-promote a single edit (use kimi-rescue), a read-only review fan-out (use kimi-swarm), or an autonomous multi-turn goal loop (use kimi-pursue). Requires kimi-code >= 0.18.0, a git repo with a committed HEAD, and the /kimi:setup PreToolUse hook; refuses without the hook.
3
+ description: Use this agent ONLY when the user has explicitly asked Kimi to make EDITS across MANY disjoint targets IN PARALLEL (a write fan-out) — e.g. "apply this same change to every handler, in parallel" or "fan out these independent edits across these N files." Requires BOTH signals: many independent WRITE targets AND explicit fan-out intent. WRITE-CAPABLE but PATCH-ONLY: edits happen in an ephemeral throwaway git worktree off HEAD and come back as a reviewable .patch — the plugin NEVER applies or commits, the user owns the merge, and the real working tree is never touched. Bounded by a MANDATORY hard --budget and a normal-launch --max-concurrency; reviewed 2.5.3/2.6.0 sources can exceed the requested cap during rate-limit recovery. Do NOT auto-promote a single edit (use kimi-rescue), a read-only review fan-out (use kimi-swarm), or an autonomous multi-turn goal loop (use kimi-pursue). Requires kimi-code >= 0.18.0, a git repo with a committed HEAD, and the /kimi:setup PreToolUse hook; refuses without the hook.
4
4
  model: sonnet
5
5
  tools: Bash
6
6
  color: red
@@ -47,7 +47,7 @@ When invoked:
47
47
  - confirm BOTH signals are present before dispatching: (1) MANY disjoint WRITE targets and (2) an explicit request to fan the edits out in parallel. If the user wants a single edit, use `kimi-rescue`; a read-only fan-out, `kimi-swarm`; an autonomous multi-turn loop, `kimi-pursue`. When in doubt, prefer `kimi-rescue` — do not shard one task into a swarm
48
48
  - preserve the user's objective and the disjoint target list with minimal reframing; partition into NON-overlapping targets (the subagents edit in one shared worktree, so overlapping targets can clobber each other)
49
49
  - call the shared companion runtime with one Bash invocation after any model-discovery step: `${CLAUDE_PLUGIN_ROOT}/scripts/companion.sh task swarm --write <args>` (the `--write` flag is REQUIRED — this agent is the write path)
50
- - the companion accepts a **strict allowlist** of flags: `--thinking <off|low|medium|high>` (requested per run), `--budget <duration>` (HARD wall-clock ceiling; e.g. `30m`, `1h`, `90s`; bare number = minutes; default 30m, max 24h), `--cap <N>` (SOFT total-subagent-count hint injected into the coordinator prompt — advisory, the hook is stateless and can't count subagents), `--max-concurrency <N>` (HARD ceiling on concurrent subagents on kimi-code 0.18.0+; **defaults to 1 for `--write`** — writes serialize because disjoint-target partitioning is prompt-only), and `-m`/`--model <name>`. Everything else is trailing objective text. Reasoning behavior follows the selected model and Kimi configuration unless `--thinking <effort>` requests one for this run (honoured by Kimi's own providers on models that can turn thinking off; other providers ignore it silently; the plugin cannot verify it). `--no-thinking` is rejected; use `--thinking off`
50
+ - the companion accepts a **strict allowlist** of flags: `--thinking <off|low|medium|high>` (requested per run), `--budget <duration>` (HARD wall-clock ceiling; e.g. `30m`, `1h`, `90s`; bare number = minutes; default 30m, max 24h), `--cap <N>` (SOFT total-subagent-count hint injected into the coordinator prompt — advisory, the hook is stateless and can't count subagents), `--max-concurrency <N>` (caps normal launches on kimi-code 0.18.0+; **defaults to 1 for `--write`** — normal-launch writes serialize because disjoint-target partitioning is prompt-only; reviewed 2.5.3/2.6.0 sources can exceed the requested cap during rate-limit recovery), and `-m`/`--model <name>`. Everything else is trailing objective text. Reasoning behavior follows the selected model and Kimi configuration unless `--thinking <effort>` requests one for this run (honoured by Kimi's own providers on models that can turn thinking off; other providers ignore it silently; the plugin cannot verify it). `--no-thinking` is rejected; use `--thinking off`
51
51
  - do not invent flags. The runtime hard-fails with `INVALID_ARGS` on unknown flag-shaped tokens — pass `--` before flag-shaped objective text to forward it as objective text rather than a flag
52
52
  - **this is write-capable, but the blast radius is bounded by construction — and PATCH-ONLY is the load-bearing safety property.** Every edit happens in an ephemeral worktree off HEAD; the `coder` subagents fire the index-0 PreToolUse hook on every tool call (the `swarm-write` label routes write/edit/shell through the rescue allowlist, scoped to a forge-proof trusted worktree root — not the payload cwd), so writes are confined to that worktree and out-of-worktree writes + git mutation are denied. The result is a `.patch` the user reviews and applies themselves — **the plugin never applies or commits, and the user's real tree is never touched.** Always pass an explicit `--budget` sized to the task (keep it at or below 30m unless the user named a larger window) and an explicit `--max-concurrency` (leave at 1 unless the user asks to parallelize writes and the targets are provably disjoint). Never try to remove these bounds
53
53
  - swarm-write **bases the worktree on HEAD: uncommitted changes are NOT included.** If the user has a dirty tree the runtime warns; surface that and suggest committing or stashing first if the swarm needs those changes
@@ -55,7 +55,7 @@ When invoked:
55
55
  - **the user should never have to type a job id** (it is a raw UUID), and you will not have one either — a detached run prints nothing at launch; the job id only reaches you with the final report. So cancel by omitting it: `${CLAUDE_PLUGIN_ROOT}/scripts/companion.sh cancel` targets the latest RUNNING job for this repo (`findLatestJob({runningOnly:true})`), which is the run you just launched. Pass an explicit id only if you already have one from a completed report. Note the ambiguity: with two runs in flight, the no-id form takes the most recent — if the user has more than one going, confirm which they mean before cancelling
56
56
  - **prefer `companion.sh cancel` over an Esc/interrupt, and say so if the user asks how to stop it.** A harness interrupt gives the companion only ~1.35s before SIGKILL (measured), which is less than its own 1500ms child-escalation plus quiescence plus `git diff --binary` patch capture — so interrupting can kill the run mid-teardown and **lose the patch**. The cancel command signals the job from a separate process that is not racing that deadline, so teardown completes and the partial patch survives
57
57
  - swarm-write **REFUSES without the `/kimi:setup` PreToolUse hook** (a write fan-out with no per-subagent enforcement is an N-fold blast radius). If the companion refuses, surface that and tell the user to run `/kimi:setup`; do not reach for `KIMI_PLUGIN_CC_SKIP_HOOK_CHECK`
58
- - requires kimi-code **>= 0.18.0** (the hard concurrency cap) and a git repo with a **committed HEAD** — surface `WRITE_SWARM_NOT_A_REPO` / `WRITE_SWARM_NO_HEAD` plainly if the runtime reports them
58
+ - requires kimi-code **>= 0.18.0** (normal-launch concurrency support; reviewed 2.5.3/2.6.0 sources have a rate-limit-recovery overrun) and a git repo with a **committed HEAD** — surface `WRITE_SWARM_NOT_A_REPO` / `WRITE_SWARM_NO_HEAD` plainly if the runtime reports them
59
59
  - `/kimi:result <jobId> --json` returns a structured envelope with metadata plus the artifact body.
60
60
 
61
61
  When swarm-write completes:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kimi-swarm
3
- description: Use this agent ONLY when the user has explicitly asked for a READ-ONLY review fanned out in PARALLEL across many independent targets (files, modules, or questions) at once — a user-scoped whole-directory or repo-wide audit where one subagent per target is the point. Requires BOTH signals: many independent targets AND an explicit request for parallel fan-out. Do NOT auto-promote a single, unscoped, or diff-shaped review into a per-file swarm — use kimi-review for a single working-tree/branch diff or any review the user did not scope as a fan-out. Read-only (every subagent is hook-denied writes — zero write surface), bounded by a hard wall-clock --budget and a concurrency ceiling; requires the /kimi:setup PreToolUse hook and refuses without it. Not for writes (see kimi-rescue) or free-form Q&A (see kimi-ask).
3
+ description: Use this agent ONLY when the user has explicitly asked for a READ-ONLY review fanned out in PARALLEL across many independent targets (files, modules, or questions) at once — a user-scoped whole-directory or repo-wide audit where one subagent per target is the point. Requires BOTH signals: many independent targets AND an explicit request for parallel fan-out. Do NOT auto-promote a single, unscoped, or diff-shaped review into a per-file swarm — use kimi-review for a single working-tree/branch diff or any review the user did not scope as a fan-out. Read-only (every subagent is hook-denied writes — zero write surface), bounded by a hard wall-clock --budget and a normal-launch concurrency setting; requires the /kimi:setup PreToolUse hook and refuses without it. Not for writes (see kimi-rescue) or free-form Q&A (see kimi-ask).
4
4
  model: sonnet
5
5
  tools: Bash
6
6
  color: green
@@ -42,9 +42,9 @@ When invoked:
42
42
  - decide whether the task is a BROAD read-only fan-out rather than a single-diff review (kimi-review), free-form ask (kimi-ask), or implementation (kimi-rescue); for one working-tree or branch diff, use kimi-review instead
43
43
  - preserve the user's review scope as the trailing focus text — what to review across the workspace — with minimal reframing
44
44
  - call the shared companion runtime with one Bash invocation after any model-discovery step: `${CLAUDE_PLUGIN_ROOT}/scripts/companion.sh task swarm <args>`
45
- - the companion accepts a **strict allowlist** of flags: `--thinking <off|low|medium|high>` (requested per run), `--budget <duration>` (HARD wall-clock ceiling; e.g. `30m`, `1h`, `90s`; bare number = minutes; default 30m), `--cap <N>` (SOFT total-subagent-count hint injected into the coordinator prompt — advisory, the hook is stateless and can't count subagents), `--max-concurrency <N>` (HARD ceiling on how many subagents run AT ONCE, on kimi-code 0.18.0+; **defaults to 4** when omitted, older binaries ignore it), and `-m`/`--model <name>`. Everything else is trailing focus text. Reasoning behavior follows the selected model and Kimi configuration unless `--thinking <effort>` requests one for this run (honoured by Kimi's own providers on models that can turn thinking off; other providers ignore it silently; the plugin cannot verify it). `--no-thinking` is rejected; use `--thinking off`
45
+ - the companion accepts a **strict allowlist** of flags: `--thinking <off|low|medium|high>` (requested per run), `--budget <duration>` (HARD wall-clock ceiling; e.g. `30m`, `1h`, `90s`; bare number = minutes; default 30m), `--cap <N>` (SOFT total-subagent-count hint injected into the coordinator prompt — advisory, the hook is stateless and can't count subagents), `--max-concurrency <N>` (caps normal launches on kimi-code 0.18.0+; **defaults to 4** when omitted, older binaries ignore it; reviewed 2.5.3/2.6.0 sources can exceed the requested cap during rate-limit recovery), and `-m`/`--model <name>`. Everything else is trailing focus text. Reasoning behavior follows the selected model and Kimi configuration unless `--thinking <effort>` requests one for this run (honoured by Kimi's own providers on models that can turn thinking off; other providers ignore it silently; the plugin cannot verify it). `--no-thinking` is rejected; use `--thinking off`
46
46
  - do not invent flags. The runtime hard-fails with `INVALID_ARGS` on unknown flag-shaped tokens — pass `--` before flag-shaped objective text to forward it as scope text rather than a flag
47
- - **cost is the only real risk, and it is bounded by construction.** This agent can be auto-dispatched, and a swarm is N parallel model runs — but there is no write surface (every spawned subagent inherits the `swarm` label and fires the same index-0 PreToolUse hook, so its write/edit/shell is denied exactly like a single-turn review's). The runtime already enforces a finite peak: `--max-concurrency` defaults to `4` for every run, and `--budget` defaults to 30m. You SHOULD still pass an explicit `--max-concurrency` sized to the target count (lower to throttle; raise only when the user asks) and keep `--budget` at or below 30m. Never attempt to remove these bounds
47
+ - **cost is the only real risk, and it is bounded by construction.** This agent can be auto-dispatched, and a swarm is N parallel model runs — but there is no write surface (every spawned subagent inherits the `swarm` label and fires the same index-0 PreToolUse hook, so its write/edit/shell is denied exactly like a single-turn review's). The runtime enforces a normal-launch peak: `--max-concurrency` defaults to `4` for every run, and `--budget` defaults to 30m; reviewed 2.5.3/2.6.0 sources can exceed the requested peak during rate-limit recovery. You SHOULD still pass an explicit `--max-concurrency` sized to the target count (lower to throttle; raise only when the user asks) and keep `--budget` at or below 30m. Never attempt to remove these bounds
48
48
  - swarm is **foreground-only** — do not pass `--background`, `--wait`, `--fresh`, or `--resume` (the parser rejects them with `INVALID_ARGS`). Default to foreground so the run stays watchable. Detach the Bash call with `run_in_background: true` ONLY when the user explicitly asks for fire-and-forget, and only with a finite `--max-concurrency` and a reduced `--budget` (a backgrounded fan-out has no human watching it to Ctrl+C); after launching, tell the user to check `/kimi:status` for progress
49
49
  - swarm **REFUSES without the `/kimi:setup` PreToolUse hook**, matching every model-spawning command. If the companion refuses, surface that and tell the user to run `/kimi:setup`; do not reach for `KIMI_PLUGIN_CC_SKIP_HOOK_CHECK`
50
50
  - requires kimi-code **>= 0.12.0** (the `AgentSwarm` tool); `--max-concurrency` only binds on **>= 0.18.0**
package/commands/swarm.md CHANGED
@@ -19,13 +19,13 @@ Supported flags:
19
19
  - `--write` — fan out EDITS (not just review). Requires kimi-code **>= 0.18.0**, a git repo with a committed HEAD, and the PreToolUse hook. Bases the worktree on HEAD: **uncommitted changes are NOT included** (you'll get a warning) — commit or stash first if the swarm needs them. `--write` is also reachable via the model-invocable `kimi-swarm-write` subagent, with strict triggering (many disjoint write targets AND explicit fan-out intent); auto-dispatch widens no write surface and keeps every bound, and the slash command itself stays human-only.
20
20
  - `--budget <duration>` — HARD wall-clock ceiling (e.g. `30m`, `1h`, `90s`; bare number = minutes). Default 30m. The always-on bound on cost/runaway.
21
21
  - `--cap <N>` — SOFT cap on TOTAL subagent count: injected into the prompt as a model instruction. Advisory, not hook-enforced (the hook is stateless and can't count subagents), so the model may exceed it. Bounds lifetime total, not peak parallelism.
22
- - `--max-concurrency <N>` — HARD ceiling on how many subagents run AT ONCE, on kimi-code **0.18.0+** (exported as `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY`; older binaries ignore it). **Defaults to 4 for read, 1 for `--write`** (writes serialize by default since disjoint-target partitioning is prompt-only) — pass a value to widen or throttle. Distinct from `--cap`: concurrency (simultaneous) ≠ total count (lifetime).
22
+ - `--max-concurrency <N>` — caps normal launches of concurrent subagents on kimi-code **0.18.0+** (exported as `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY`; older binaries ignore it). **Defaults to 4 for read, 1 for `--write`** (normal-launch writes serialize by default since disjoint-target partitioning is prompt-only) — pass a value to widen or throttle. On reviewed 2.5.3/2.6.0 sources, rate-limit recovery can exceed this setting; it is not an unconditional hard ceiling. Distinct from `--cap`: concurrency (simultaneous) ≠ total count (lifetime).
23
23
  - `-m`, `--model <name>`
24
24
 
25
25
  Prototype limitations:
26
26
 
27
27
  - **No `--background` flag** — the runtime has no detached-worker mode for swarm. That is separate from how the *caller* runs the shell command: for `--write` (30m default budget vs a 10-minute foreground Bash cap) detaching the call is expected; for a read-only fan-out the default stays foreground and detaching is a per-request choice. `--budget` and `--max-concurrency` stay finite either way, and budget expiry still captures the patch/report. To stop a run, just say so — the stop path is `companion.sh cancel` with no id (it targets the latest running job for this repo). For `--write`, prefer that over Esc: an interrupt can kill the run mid-teardown and lose the captured patch.
28
- - Read-only swarm requires kimi-code **>= 0.12.0** (the `AgentSwarm` tool); `--write` requires **>= 0.18.0** (the hard concurrency cap). Both **refuse** without the `/kimi:setup` PreToolUse hook (a fan-out with no enforcement is an N-fold blast radius).
28
+ - Read-only swarm requires kimi-code **>= 0.12.0** (the `AgentSwarm` tool); `--write` requires **>= 0.18.0** (normal-launch concurrency support; reviewed 2.5.3/2.6.0 sources have a rate-limit-recovery overrun). Both **refuse** without the `/kimi:setup` PreToolUse hook (a fan-out with no enforcement is an N-fold blast radius).
29
29
 
30
30
  Return the companion stdout verbatim.
31
31
 
@@ -115,8 +115,8 @@ export async function runCliPrompt(opts) {
115
115
  const records = [];
116
116
  const malformed = [];
117
117
  // Rolling stderr tail — keep only the trailing STDERR_TAIL_BYTES so a
118
- // long-running kimi process emitting megabytes of stderr (tool.progress,
119
- // thinking deltas) doesn't grow our RSS unboundedly.
118
+ // long-running kimi process emitting megabytes of stderr (tool.updated
119
+ // output/status, thinking deltas) doesn't grow our RSS unboundedly.
120
120
  let stderrTail = "";
121
121
  let announcedSessionId;
122
122
  let announcedGoalSummary;
@@ -786,7 +786,7 @@ function buildArgs(opts) {
786
786
  ? opts.env.KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE
787
787
  : undefined;
788
788
  if (opts.resumeSessionId === undefined &&
789
- ["2.5.0", "2.5.1", "2.5.2", "2.5.3"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
789
+ ["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
790
790
  args.push("--environment", "local");
791
791
  }
792
792
  if (opts.resumeSessionId !== undefined) {
@@ -103,7 +103,8 @@ export async function runRecoverSwarm(argv, context) {
103
103
  if (current.command !== plan.command || current.kimiVersion !== plan.kimiVersion || JSON.stringify(current.prefixArgs) !== JSON.stringify(plan.prefixArgs))
104
104
  throw recoveryError("The exact recorded CLI is not selected. Restore that certified binary before session cleanup.");
105
105
  signal.throwIfAborted();
106
- await deactivateSwarmSession({ cwd: record.cwd, env: context.env, command: current.command,
106
+ const recoveryExecutionCwd = await realpath(record.cwd);
107
+ await deactivateSwarmSession({ cwd: recoveryExecutionCwd, env: context.env, command: current.command,
107
108
  prefixArgs: current.prefixArgs, executionPlan: current, commandLabel: expectedRoot ? "swarm-write" : "swarm",
108
109
  trustedWorkspaceRoot: expectedRoot ?? undefined, ...record.session, signal,
109
110
  onRecoveryEvent: (event) => recordRecoveryEvent(store, record, event) });
@@ -28,7 +28,7 @@ import { normalizeTopLevelInlineHooks, validateKimiHookSetForEnvironment, withKi
28
28
  import { buildHookShellCommand, hostIdFromHookCommand, resolveHookScriptPath, resolveHostId, resolveNodeBinary, } from "../hooks/install-paths.js";
29
29
  import { decodeManagedCommandLine, effectiveHost, evaluateInstalled, findUnmanagedApprovalHookBlocks, markerCommentLines, MARKERS, ORPHAN_MARKER_REMEDY, parseManagedBlock, } from "../hooks/managed-block.js";
30
30
  import { formatVersionOutOfRangeWarning, probeKimiVersion, } from "../kimi-version-probe.js";
31
- import { isNativeV2CertifiedVersion, NATIVE_V2_CERTIFIED_VERSIONS } from "../kimi-engine.js";
31
+ import { isNativeV2CertifiedVersion, NATIVE_V2_ANY_OPERATION_VERSIONS, NATIVE_V2_NON_SWARM_VERSIONS, } from "../kimi-engine.js";
32
32
  import { resolveKimiHome } from "../kimi-home.js";
33
33
  import { ensurePluginPaths, resolvePluginPaths } from "../paths.js";
34
34
  import { KIMI_PLUGIN_CC_VERSION } from "../version.js";
@@ -973,13 +973,13 @@ async function collectKimiVersionWarnings(env, warnings) {
973
973
  // clearer message. Avoid double-noise.
974
974
  return;
975
975
  }
976
- // Certified for EITHER engine is "in range": the legacy tested minors, or an
977
- // exact native-v2 certified version (which is deliberately outside
978
- // KIMI_TESTED_MINORS — that table never gains 0.42). Without this, setup on a
979
- // v2-certified binary would wrongly warn "not certified, commands will refuse".
980
- if (probe.inTestedRange || isNativeV2CertifiedVersion(probe.version))
976
+ if (!probe.inTestedRange && !isNativeV2CertifiedVersion(probe.version)) {
977
+ warnings.push(formatVersionOutOfRangeWarning(probe, KIMI_PLUGIN_CC_VERSION, NATIVE_V2_ANY_OPERATION_VERSIONS));
981
978
  return;
982
- warnings.push(formatVersionOutOfRangeWarning(probe, KIMI_PLUGIN_CC_VERSION, NATIVE_V2_CERTIFIED_VERSIONS));
979
+ }
980
+ if (NATIVE_V2_NON_SWARM_VERSIONS.includes(probe.version)) {
981
+ warnings.push(`NOTE: kimi-code ${probe.version} is certified for review, challenge, ask, rescue, review gate, and pursue only. Read-only swarm and write swarm refuse before model spawn because upstream rate-limit recovery can exceed maxConcurrency.`);
982
+ }
983
983
  }
984
984
  /**
985
985
  * Non-blocking notice for kimi-code's own enabled plugins from
@@ -2,7 +2,7 @@ import { resolveKimiHome } from "../kimi-home.js";
2
2
  import { probeProcessIdentity } from "../process-tree.js";
3
3
  import { recordRecoveryEvent, finishRecoveryRecord } from "../swarm-recovery.js";
4
4
  import { allocateJobId } from "../job-id.js";
5
- import { mkdir, writeFile } from "node:fs/promises";
5
+ import { mkdir, realpath, writeFile } from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  import { createCliCancellationHandlers } from "../cli-cancellation.js";
8
8
  import { ResponseTimeoutError, runCliPromptWithBudget } from "../cli-client.js";
@@ -23,46 +23,47 @@ import { assertCliResultSuccess, reassembleProseFromRecords, warnIfSessionIdMiss
23
23
  import { buildKimiSessionTitle, syncKimiSessionTitle } from "../session-title.js";
24
24
  // /kimi:swarm — parallel fan-out, read-only by default and runtime-foreground-only.
25
25
  // A finite wall-clock budget bounds the whole run. --cap is a SOFT total-count
26
- // prompt hint; --max-concurrency is a HARD peak ceiling enforced on kimi-code
27
- // 0.18.0+. The plugin always exports that setting; older read-only swarms retain
28
- // only the wall-clock hard bound. Read/write modes reuse review/rescue lineage,
29
- // and the mandatory PreToolUse hook enforces read-only policy or trusted-worktree
30
- // write confinement on the coordinator and every subagent. Write mode requires
31
- // kimi-code 0.18.0+. Exact 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2
32
- // and 2.5.3 additionally activate a same-job session through a bounded loopback
33
- // web lifecycle, then resume it through the normal print path. The production
34
- // certification table controls whether each exact version is reachable.
26
+ // prompt hint; --max-concurrency caps normal launches on kimi-code 0.18.0+.
27
+ // Reviewed 2.5.3/2.6.0 schedulers can exceed that cap during rate-limit recovery.
28
+ // The plugin always exports the setting; older read-only swarms retain only the
29
+ // wall-clock hard bound. Read/write modes reuse review/rescue lineage, and the
30
+ // mandatory PreToolUse hook enforces read-only policy or trusted-worktree write
31
+ // confinement on the coordinator and every subagent. Write mode requires
32
+ // kimi-code 0.18.0+. Exact 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2,
33
+ // and certified 2.5.3 activate a same-job session through a bounded loopback
34
+ // web lifecycle, then resume it through the normal print path. Candidate-only
35
+ // 2.6.0 activation uses that lifecycle too; production 2.6.0 is non-swarm
36
+ // certified and refuses both modes before model spawn. The certification table
37
+ // controls whether each exact version is reachable.
35
38
  const SWARM_SUMMARY_MAX = 120;
36
39
  const SWARM_AGENT_PROFILE = "<swarm>";
37
40
  const SWARM_WRITE_AGENT_PROFILE = "<swarm-write>";
38
41
  /**
39
- * Default concurrency setting when the user passes no `--max-concurrency`.
40
- * The plugin always exports KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY; kimi-code
41
- * 0.18.0+ enforces it as a hard peak ceiling, while older read-only swarms
42
- * ignore it and retain only the wall-clock hard bound. Conservative by design;
43
- * override with an explicit `--max-concurrency N`.
42
+ * Default normal-launch concurrency setting when the user passes no
43
+ * `--max-concurrency`. The plugin always exports
44
+ * KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY; older read-only swarms ignore it and
45
+ * retain only the wall-clock hard bound. Rate-limit recovery can exceed it on
46
+ * reviewed 2.5.3/2.6.0 sources; this is not an unconditional peak guarantee.
44
47
  */
45
48
  export const SWARM_DEFAULT_MAX_CONCURRENCY = 4;
46
49
  /**
47
- * Resolve the effective hard concurrency ceiling: an explicit `--max-concurrency`
48
- * wins; otherwise fall back to SWARM_DEFAULT_MAX_CONCURRENCY so the ceiling is
49
- * never unset. Pure + exported for unit testing (the parser leaves the value
50
- * undefined; swarm.ts owns the default, mirroring `budgetMs`).
50
+ * Resolve the requested normal-launch concurrency: an explicit
51
+ * `--max-concurrency` wins; otherwise use SWARM_DEFAULT_MAX_CONCURRENCY so the
52
+ * setting is never unset. Pure + exported for unit testing (the parser leaves
53
+ * the value undefined; swarm.ts owns the default, mirroring `budgetMs`).
51
54
  */
52
55
  export function resolveSwarmMaxConcurrency(requested) {
53
56
  return requested ?? SWARM_DEFAULT_MAX_CONCURRENCY;
54
57
  }
55
58
  /**
56
- * Default HARD concurrency ceiling for WRITE mode — 1 (serialized) vs read's 4.
57
- * Writes are riskier than reads: disjoint-target partitioning is prompt-only and
58
- * unenforceable (the hook is stateless), so two concurrent `coder` subagents
59
- * racing the same file in the shared worktree would corrupt the patch. Serialize
60
- * by default until a real-binary smoke proves clean concurrent disjoint writes;
61
- * override with an explicit `--max-concurrency N`. Effective only on kimi-code
62
- * 0.18.0+ (the write-mode version gate), so the ceiling is always enforced.
59
+ * Default normal-launch concurrency for WRITE mode — 1 (serialized) vs read's 4.
60
+ * Disjoint-target partitioning is prompt-only, so normal writes serialize by
61
+ * default. Rate-limit recovery can still exceed the requested cap on reviewed
62
+ * 2.5.3/2.6.0 sources; this is not an unconditional serialization guarantee.
63
+ * Override with an explicit `--max-concurrency N`.
63
64
  */
64
65
  export const SWARM_WRITE_DEFAULT_MAX_CONCURRENCY = 1;
65
- /** Resolve the write-mode concurrency ceiling: explicit wins, else default 1. */
66
+ /** Resolve the write-mode normal-launch concurrency: explicit wins, else default 1. */
66
67
  export function resolveSwarmWriteMaxConcurrency(requested) {
67
68
  return requested ?? SWARM_WRITE_DEFAULT_MAX_CONCURRENCY;
68
69
  }
@@ -76,9 +77,10 @@ export function resolveSwarmWriteMaxConcurrency(requested) {
76
77
  * Read-only is NOT enforced by this prose — the PreToolUse hook (swarm label) at
77
78
  * policy index 0 denies every write/edit/shell for the coordinator AND every
78
79
  * subagent, so slimming this text does not move the safety boundary. The optional
79
- * `cap` is a SOFT subagent-count hint (the hook cannot enforce a count). The HARD
80
- * concurrency ceiling is separate: --max-concurrency →
80
+ * `cap` is a SOFT subagent-count hint (the hook cannot enforce a count). The
81
+ * normal-launch concurrency setting is separate: --max-concurrency →
81
82
  * KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY (see executeSwarmJob / cli-client buildKimiCliEnvironment).
83
+ * Reviewed 2.5.3/2.6.0 sources can exceed it during rate-limit recovery.
82
84
  * The --budget wall-clock ceiling is the always-on hard bound on the whole run.
83
85
  */
84
86
  export function buildSwarmPrompt(objective, cap) {
@@ -211,7 +213,7 @@ async function runReadSwarm(parsed, objective, context) {
211
213
  await markJobFailed(store, paths, job, classified, "Swarm failed.", { phase: "failed" });
212
214
  throw classified;
213
215
  }
214
- const completed = await executeSwarmJob(job.job_id, prompt, objective, job.budget_ms, resolveSwarmMaxConcurrency(parsed.maxConcurrency), context);
216
+ const completed = await executeSwarmJob(job.job_id, prompt, objective, job.budget_ms, resolveSwarmMaxConcurrency(parsed.maxConcurrency), context, undefined, await realpath(context.cwd));
215
217
  if (!completed.final_output_path) {
216
218
  throw new RuntimeError("SWARM_RESULT_MISSING", "Swarm finished without a rendered result.", "swarm.result");
217
219
  }
@@ -321,7 +323,7 @@ async function runWriteSwarm(parsed, objective, context) {
321
323
  onPatchCaptureFailure: () => {
322
324
  preserveWorktree = true;
323
325
  },
324
- });
326
+ }, await realpath(worktreePath));
325
327
  if (preserveWorktree && completed.error) {
326
328
  throw new RuntimeError(completed.error.code, completed.error.message, completed.error.stage, {
327
329
  details: completed.error.details,
@@ -391,8 +393,11 @@ async function executeSwarmJob(jobId, prompt, objective, budgetMs, maxConcurrenc
391
393
  * (`spawnCwd`), the hook label is "swarm-write", and `workspaceRoot` (the same
392
394
  * worktree) is exported as the trusted allowlist root + used to capture the
393
395
  * patch. Undefined ⇒ read-only swarm (label "swarm", spawn cwd = job.cwd).
396
+ * Real command paths supply the canonical execution cwd for activation/resume,
397
+ * trusted-root checks, read-mode preflight, and the print spawn. Virtual test
398
+ * doubles may omit the canonical path and retain their original spawn spelling.
394
399
  */
395
- writeMode) {
400
+ writeMode, executionCwd) {
396
401
  const paths = resolvePluginPaths(context.env);
397
402
  await ensurePluginPaths(paths);
398
403
  const store = new JobStore(paths);
@@ -467,7 +472,7 @@ writeMode) {
467
472
  store.saveSwarmRecovery(job.job_id, recovery);
468
473
  }
469
474
  activationOptions = {
470
- cwd: writeMode?.spawnCwd ?? job.cwd,
475
+ cwd: executionCwd ?? writeMode?.spawnCwd ?? job.cwd,
471
476
  env: context.env,
472
477
  command: executionPlan.command,
473
478
  prefixArgs: executionPlan.prefixArgs,
@@ -476,7 +481,7 @@ writeMode) {
476
481
  model: job.model ?? undefined,
477
482
  thinkingEffort: job.thinking_effort ?? undefined,
478
483
  swarmMaxConcurrency: maxConcurrency,
479
- trustedWorkspaceRoot: writeMode?.workspaceRoot,
484
+ trustedWorkspaceRoot: executionCwd ?? writeMode?.workspaceRoot,
480
485
  expectedVersion: executionPlan.kimiVersion ?? undefined,
481
486
  onRecoveryEvent: recovery ? (event) => recordRecoveryEvent(store, recovery, event) : undefined,
482
487
  };
@@ -556,7 +561,7 @@ writeMode) {
556
561
  prompt,
557
562
  commandLabel,
558
563
  swarmMaxConcurrency: maxConcurrency,
559
- trustedWorkspaceRoot: writeMode?.workspaceRoot,
564
+ trustedWorkspaceRoot: executionCwd ?? writeMode?.workspaceRoot,
560
565
  model: job.model ?? undefined,
561
566
  thinkingEffort: job.thinking_effort ?? undefined,
562
567
  resumeSessionId: preactivated?.sessionId,
@@ -596,8 +596,9 @@ function validateVersionSensitiveEvents(events, version) {
596
596
  // 2.0.2 (9d07f634), 2.1.0 (52437299), 2.1.1 (f67e6398), 2.2.0 (472192c3),
597
597
  // 2.3.0 (b5e28fd6), 2.3.1 (684bae9e), 2.3.2 (b8dd3a13), 2.3.3 (ec495f0c),
598
598
  // 2.4.0 (f26e4d91), 2.4.1 (2c73f3f5), 2.5.0 (41c34143), 2.5.1 (1b02030d),
599
- // 2.5.2 (1c142a00), and 2.5.3 (5af9942e):
600
- // the additive events and HookDefSchema are unchanged.
599
+ // 2.5.2 (1c142a00), 2.5.3 (5af9942e), and 2.6.0 (740d6c0b):
600
+ // the additive events and HookDefSchema are unchanged. Exact 2.6.0 schema acceptance
601
+ // covers the narrowed non-swarm production certification, not swarm operations.
601
602
  // Require the full version string AND matching components; no inferred 2.x compatibility.
602
603
  if (version.major === 2 && ((version.minor === 0 && ((version.version === "2.0.0" && version.patch === 0) ||
603
604
  (version.version === "2.0.1" && version.patch === 1) ||
@@ -614,7 +615,8 @@ function validateVersionSensitiveEvents(events, version) {
614
615
  (version.minor === 5 && ((version.version === "2.5.0" && version.patch === 0) ||
615
616
  (version.version === "2.5.1" && version.patch === 1) ||
616
617
  (version.version === "2.5.2" && version.patch === 2) ||
617
- (version.version === "2.5.3" && version.patch === 3))))) {
618
+ (version.version === "2.5.3" && version.patch === 3))) ||
619
+ (version.minor === 6 && ((version.version === "2.6.0" && version.patch === 0))))) {
618
620
  return { valid: true };
619
621
  }
620
622
  if (version.major !== 0) {
@@ -50,14 +50,29 @@ export const NATIVE_V2_CERTIFIED_VERSIONS = Object.freeze([
50
50
  "2.5.2",
51
51
  "2.5.3",
52
52
  ]);
53
+ /**
54
+ * Exact releases certified only for review, challenge, ask, rescue, review_gate
55
+ * and pursue. Their upstream rate-limit recovery can exceed AgentSwarm's
56
+ * configured maximum, so both swarm operations refuse before model spawn.
57
+ */
58
+ export const NATIVE_V2_NON_SWARM_VERSIONS = Object.freeze(["2.6.0"]);
59
+ /**
60
+ * Any-operation union used by setup and engine selection. The older
61
+ * NATIVE_V2_CERTIFIED_VERSIONS export stays all-operation-only for consumers
62
+ * that choose a full-swarm pin automatically.
63
+ */
64
+ export const NATIVE_V2_ANY_OPERATION_VERSIONS = Object.freeze([
65
+ ...NATIVE_V2_CERTIFIED_VERSIONS,
66
+ ...NATIVE_V2_NON_SWARM_VERSIONS,
67
+ ]);
53
68
  /** Per-operation native-v2 certification. One green operation never certifies another. */
54
69
  export const NATIVE_V2_CERTIFIED = new Map([
55
- ["review", NATIVE_V2_CERTIFIED_VERSIONS],
56
- ["challenge", NATIVE_V2_CERTIFIED_VERSIONS],
57
- ["ask", NATIVE_V2_CERTIFIED_VERSIONS],
58
- ["rescue", NATIVE_V2_CERTIFIED_VERSIONS],
59
- ["review_gate", NATIVE_V2_CERTIFIED_VERSIONS],
60
- ["pursue", NATIVE_V2_CERTIFIED_VERSIONS],
70
+ ["review", NATIVE_V2_ANY_OPERATION_VERSIONS],
71
+ ["challenge", NATIVE_V2_ANY_OPERATION_VERSIONS],
72
+ ["ask", NATIVE_V2_ANY_OPERATION_VERSIONS],
73
+ ["rescue", NATIVE_V2_ANY_OPERATION_VERSIONS],
74
+ ["review_gate", NATIVE_V2_ANY_OPERATION_VERSIONS],
75
+ ["pursue", NATIVE_V2_ANY_OPERATION_VERSIONS],
61
76
  ["swarm", NATIVE_V2_CERTIFIED_VERSIONS],
62
77
  ["swarm-write", NATIVE_V2_CERTIFIED_VERSIONS],
63
78
  ]);
@@ -77,16 +92,17 @@ export function isNativeV2CertifiedVersion(version) {
77
92
  const normalized = parseVersionLine(version)?.raw;
78
93
  if (normalized === undefined)
79
94
  return false;
80
- return NATIVE_V2_CERTIFIED_VERSIONS.includes(normalized);
95
+ return NATIVE_V2_ANY_OPERATION_VERSIONS.includes(normalized);
81
96
  }
82
97
  /**
83
- * Engine selection for a probed binary: native v2 when the exact version is
84
- * certified for this operation, else legacy-v1 (whose own tested-range check
85
- * still applies). kimi-code 0.42.0 removed the v1 engine, so a v1 plan on a
86
- * ≥0.42 binary is refused by the legacy range rather than silently run on v2.
98
+ * Select native v2 for an exactly certified version or a test-only operation
99
+ * admission, then enforce scope in assertCertifiedCapability. A narrowed
100
+ * release must not fall back to legacy-v1 for an excluded operation.
87
101
  */
88
102
  export function selectIntendedEngine(operationKind, probe) {
89
- return isNativeV2Certified(operationKind, probe.version) ? "native-v2" : "legacy-v1";
103
+ return isNativeV2CertifiedVersion(probe.version) || isNativeV2Certified(operationKind, probe.version)
104
+ ? "native-v2"
105
+ : "legacy-v1";
90
106
  }
91
107
  const UNSAFE_EXPERIMENTAL_VALUES = new Set(["1", "true", "yes", "on"]);
92
108
  /**
@@ -547,6 +563,23 @@ function assertExecutionPlanShape(plan) {
547
563
  }
548
564
  function nativeV2NotCertified(operationKind, version) {
549
565
  const certified = NATIVE_V2_CERTIFIED.get(operationKind) ?? [];
566
+ const normalized = version === null ? undefined : parseVersionLine(version)?.raw;
567
+ if (normalized !== undefined &&
568
+ NATIVE_V2_NON_SWARM_VERSIONS.includes(normalized) &&
569
+ (operationKind === "swarm" || operationKind === "swarm-write")) {
570
+ return new RuntimeError("KIMI_CAPABILITY_NOT_CERTIFIED", `Refusing ${operationKind}: kimi-code ${normalized} is certified only for non-swarm operations (review, challenge, ask, rescue, review_gate, pursue). Its upstream rate-limit recovery can exceed AgentSwarm's configured maximum, so this plugin refuses AgentSwarm before model spawn. Use a non-swarm operation on ${normalized}, or select a version explicitly certified for ${operationKind}.`, "kimi-engine.capability", {
571
+ details: {
572
+ refusal_kind: "v2-swarm-not-certified",
573
+ certification_scope: "non-swarm",
574
+ retryable_after_setup: false,
575
+ operation_kind: operationKind,
576
+ intended_engine: "native-v2",
577
+ kimi_version: normalized,
578
+ certified_versions: [...certified],
579
+ certified_operations: ["review", "challenge", "ask", "rescue", "review_gate", "pursue"],
580
+ },
581
+ });
582
+ }
550
583
  const observed = version === null ? "an unprobed version" : `kimi-code ${version}`;
551
584
  return new RuntimeError("KIMI_CAPABILITY_NOT_CERTIFIED", `Refusing ${operationKind} on native v2: ${observed} is not in this operation's exactly certified set [${certified.join(", ")}]. Update kimi-plugin-cc to a release that certifies this kimi-code version, or point KIMI_PLUGIN_CC_KIMI_BIN at a certified binary. KIMI_PLUGIN_CC_SKIP_VERSION_PROBE is a test/smoke seam, not a production repair path.`, "kimi-engine.capability", {
552
585
  details: {
@@ -65,7 +65,7 @@ const CAP_PROPERTY = {
65
65
  const MAX_CONCURRENCY_PROPERTY = {
66
66
  type: "integer",
67
67
  minimum: 1,
68
- description: "Hard peak subagent concurrency on supported Kimi Code versions. Distinct from the soft total cap.",
68
+ description: "Requested normal-launch subagent concurrency on supported Kimi Code versions. Rate-limit recovery can exceed it on reviewed 2.5.3/2.6.0 sources. Distinct from the soft total cap.",
69
69
  };
70
70
  const START_RESULT_GUIDANCE = "Task-capable clients receive an MCP task. Other clients receive a job ID immediately after launch; use kimi_job_status and kimi_job_result until terminal, and kimi_job_cancel to stop. Do not present a launch handle as the finished answer.";
71
71
  function schema(properties, required = []) {
@@ -23,8 +23,8 @@
23
23
  // stream, not on a separate channel.
24
24
  // - thinking.delta events are silently discarded by the CLI's
25
25
  // PromptJsonWriter (`writeThinkingDelta(): void {}`).
26
- // - tool.progress events are written to stderr only, never entering
27
- // stream-json.
26
+ // - tool.updated output/status events are written to stderr only, never
27
+ // entering stream-json.
28
28
  // - assistant messages are only emitted when content OR tool_calls are
29
29
  // non-empty; we still defend against the empty case for resilience.
30
30
  export const MAX_STREAM_JSON_LINE_BYTES = 1_048_576;