kimi-plugin-cc 2.5.8 → 2.6.2

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 (66) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +19 -0
  4. package/README.md +29 -13
  5. package/agents/kimi-swarm-write.md +6 -4
  6. package/agents/kimi-swarm.md +5 -4
  7. package/commands/swarm.md +5 -3
  8. package/dist/cli-client.js +224 -31
  9. package/dist/commands/recover-swarm.js +4 -0
  10. package/dist/commands/setup.js +5 -1
  11. package/dist/commands/swarm.js +131 -43
  12. package/dist/hooks/approval-hook.js +3 -0
  13. package/dist/hooks/approval-policy.js +34 -12
  14. package/dist/hooks/config-safety.js +5 -4
  15. package/dist/kimi-engine.js +5 -3
  16. package/dist/kimi-timeouts.js +4 -4
  17. package/dist/mcp/operations.js +1 -1
  18. package/dist/process-tree.js +150 -43
  19. package/dist/swarm-activation.js +14 -9
  20. package/dist/swarm-policy.js +72 -0
  21. package/dist/swarm-recovery.js +41 -10
  22. package/dist/swarm-tool-policy.js +146 -0
  23. package/dist/version.js +1 -1
  24. package/docs/migration.md +13 -5
  25. package/docs/registry-releases.md +6 -0
  26. package/docs/safety.md +41 -16
  27. package/docs/swarm-recovery.md +4 -2
  28. package/docs/upstream-2.6.0-certification.md +13 -0
  29. package/docs/upstream-2.6.2-certification.md +132 -0
  30. package/package.json +3 -2
  31. package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
  32. package/plugins/kimi-codex/dist/cli-client.js +224 -31
  33. package/plugins/kimi-codex/dist/commands/recover-swarm.js +4 -0
  34. package/plugins/kimi-codex/dist/commands/setup.js +5 -1
  35. package/plugins/kimi-codex/dist/commands/swarm.js +131 -43
  36. package/plugins/kimi-codex/dist/hooks/approval-hook.js +3 -0
  37. package/plugins/kimi-codex/dist/hooks/approval-policy.js +34 -12
  38. package/plugins/kimi-codex/dist/hooks/config-safety.js +5 -4
  39. package/plugins/kimi-codex/dist/kimi-engine.js +5 -3
  40. package/plugins/kimi-codex/dist/kimi-timeouts.js +4 -4
  41. package/plugins/kimi-codex/dist/mcp/operations.js +1 -1
  42. package/plugins/kimi-codex/dist/process-tree.js +150 -43
  43. package/plugins/kimi-codex/dist/swarm-activation.js +14 -9
  44. package/plugins/kimi-codex/dist/swarm-policy.js +72 -0
  45. package/plugins/kimi-codex/dist/swarm-recovery.js +41 -10
  46. package/plugins/kimi-codex/dist/swarm-tool-policy.js +146 -0
  47. package/plugins/kimi-codex/dist/version.js +1 -1
  48. package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +2 -0
  49. package/plugins/kimi-codex/skills/kimi-swarm-write/SKILL.md +2 -0
  50. package/plugins/kimi-dsh/dist/cli-client.js +224 -31
  51. package/plugins/kimi-dsh/dist/commands/recover-swarm.js +4 -0
  52. package/plugins/kimi-dsh/dist/commands/setup.js +5 -1
  53. package/plugins/kimi-dsh/dist/commands/swarm.js +131 -43
  54. package/plugins/kimi-dsh/dist/hooks/approval-hook.js +3 -0
  55. package/plugins/kimi-dsh/dist/hooks/approval-policy.js +34 -12
  56. package/plugins/kimi-dsh/dist/hooks/config-safety.js +5 -4
  57. package/plugins/kimi-dsh/dist/kimi-engine.js +5 -3
  58. package/plugins/kimi-dsh/dist/kimi-timeouts.js +4 -4
  59. package/plugins/kimi-dsh/dist/mcp/operations.js +1 -1
  60. package/plugins/kimi-dsh/dist/process-tree.js +150 -43
  61. package/plugins/kimi-dsh/dist/swarm-activation.js +14 -9
  62. package/plugins/kimi-dsh/dist/swarm-policy.js +72 -0
  63. package/plugins/kimi-dsh/dist/swarm-recovery.js +41 -10
  64. package/plugins/kimi-dsh/dist/swarm-tool-policy.js +146 -0
  65. package/plugins/kimi-dsh/dist/version.js +1 -1
  66. package/plugins/kimi-dsh/package.json +1 -1
@@ -0,0 +1,146 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { constants } from "node:fs";
3
+ import { link, lstat, mkdir, open, realpath, unlink } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { RuntimeError } from "./errors.js";
6
+ const POLICY_CONTENT = `${JSON.stringify({ disabledTools: ["TaskStop"] })}\n`;
7
+ const POLICY_MAX_BYTES = 4096;
8
+ const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,255}$/;
9
+ /**
10
+ * Called only for our fresh, stopped, journal-proven session before its first
11
+ * print turn. TaskStop is already denied by the managed hook; disabling it in
12
+ * native policy also makes Bash's allowBackground false for every child,
13
+ * including its automatic foreground-timeout detachment path.
14
+ */
15
+ export async function installBoundedSwarmToolPolicy(kimiHome, identity, signal) {
16
+ const directories = [];
17
+ let candidatePath;
18
+ let candidateIdentity;
19
+ try {
20
+ checkSignal(signal);
21
+ if (!SAFE_ID.test(identity.sessionId) || !SAFE_ID.test(identity.workspaceId)) {
22
+ throw policyFailure("invalid-session-identity");
23
+ }
24
+ const canonicalHome = await realpath(kimiHome);
25
+ let current = canonicalHome;
26
+ for (const segment of [undefined, "sessions", identity.workspaceId, identity.sessionId]) {
27
+ if (segment !== undefined)
28
+ current = path.join(current, segment);
29
+ directories.push(await directoryIdentity(current));
30
+ checkSignal(signal);
31
+ }
32
+ const policyDir = path.join(current, "tool-policy");
33
+ await assertDirectoriesUnchanged(directories);
34
+ await mkdir(policyDir, { mode: 0o700 }).catch((error) => {
35
+ if (error.code !== "EEXIST")
36
+ throw error;
37
+ });
38
+ directories.push(await directoryIdentity(policyDir));
39
+ const statePath = path.join(policyDir, "state.json");
40
+ // No merge or replacement: this is a fresh-session construction, not an
41
+ // operator-policy editor. link() below closes this absence-check race.
42
+ const existing = await lstat(statePath).catch((error) => {
43
+ if (error.code === "ENOENT")
44
+ return undefined;
45
+ throw error;
46
+ });
47
+ if (existing !== undefined)
48
+ throw policyFailure("policy-already-exists");
49
+ checkSignal(signal);
50
+ await assertDirectoriesUnchanged(directories);
51
+ candidatePath = path.join(policyDir, `.state.${process.pid}.${randomUUID()}.tmp`);
52
+ const candidate = await open(candidatePath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
53
+ try {
54
+ const stats = await candidate.stat({ bigint: true });
55
+ candidateIdentity = { dev: stats.dev, ino: stats.ino };
56
+ if (!stats.isFile())
57
+ throw policyFailure("candidate-not-regular");
58
+ if (process.platform !== "win32")
59
+ await candidate.chmod(0o600);
60
+ await candidate.writeFile(POLICY_CONTENT, "utf8");
61
+ await candidate.sync();
62
+ }
63
+ finally {
64
+ await candidate.close();
65
+ }
66
+ checkSignal(signal);
67
+ await assertDirectoriesUnchanged(directories);
68
+ // A hard link publishes the complete synced inode atomically and refuses
69
+ // an existing destination, unlike rename(), which could replace policy.
70
+ await link(candidatePath, statePath);
71
+ await verifyPublishedPolicy(statePath, candidateIdentity);
72
+ await assertDirectoriesUnchanged(directories);
73
+ checkSignal(signal);
74
+ }
75
+ catch (error) {
76
+ if (signal?.aborted)
77
+ throw policyFailure("cancelled", true);
78
+ if (error instanceof RuntimeError)
79
+ throw error;
80
+ throw policyFailure("policy-installation-failed");
81
+ }
82
+ finally {
83
+ // Never unlink a replacement or follow a replaced ancestor while cleaning
84
+ // up our private candidate. An uncertain path remains as failure evidence.
85
+ if (candidatePath !== undefined && candidateIdentity !== undefined) {
86
+ try {
87
+ await assertDirectoriesUnchanged(directories);
88
+ const stats = await lstat(candidatePath, { bigint: true });
89
+ if (stats.isFile() && sameIdentity(stats, candidateIdentity))
90
+ await unlink(candidatePath);
91
+ }
92
+ catch { /* Preserve uncertain paths. */ }
93
+ }
94
+ }
95
+ }
96
+ async function directoryIdentity(directory) {
97
+ const stats = await lstat(directory, { bigint: true });
98
+ if (!stats.isDirectory() || stats.isSymbolicLink() || await realpath(directory) !== directory) {
99
+ throw policyFailure("unsafe-session-directory");
100
+ }
101
+ return { path: directory, dev: stats.dev, ino: stats.ino };
102
+ }
103
+ async function assertDirectoriesUnchanged(directories) {
104
+ for (const directory of directories) {
105
+ const current = await directoryIdentity(directory.path);
106
+ if (!sameIdentity(current, directory))
107
+ throw policyFailure("session-directory-changed");
108
+ }
109
+ }
110
+ async function verifyPublishedPolicy(statePath, expected) {
111
+ const file = await open(statePath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
112
+ try {
113
+ const before = await file.stat({ bigint: true });
114
+ if (!before.isFile() || before.size > BigInt(POLICY_MAX_BYTES) || !sameIdentity(before, expected)) {
115
+ throw policyFailure("published-policy-invalid");
116
+ }
117
+ const bytes = Buffer.alloc(Number(before.size));
118
+ let offset = 0;
119
+ while (offset < bytes.length) {
120
+ const { bytesRead } = await file.read(bytes, offset, bytes.length - offset, offset);
121
+ if (bytesRead === 0)
122
+ break;
123
+ offset += bytesRead;
124
+ }
125
+ const after = await file.stat({ bigint: true });
126
+ const named = await lstat(statePath, { bigint: true });
127
+ if (offset !== bytes.length || bytes.toString("utf8") !== POLICY_CONTENT ||
128
+ before.size !== after.size || !sameIdentity(after, expected) ||
129
+ !named.isFile() || !sameIdentity(named, expected)) {
130
+ throw policyFailure("published-policy-changed");
131
+ }
132
+ }
133
+ finally {
134
+ await file.close();
135
+ }
136
+ }
137
+ function sameIdentity(a, b) {
138
+ return a.dev === b.dev && a.ino === b.ino;
139
+ }
140
+ function checkSignal(signal) {
141
+ if (signal?.aborted)
142
+ throw policyFailure("cancelled", true);
143
+ }
144
+ function policyFailure(reason, cancelled = false) {
145
+ return new RuntimeError("SWARM_ACTIVATION_FAILED", "The fresh swarm session could not install its native tool restriction; refusing the model turn.", "swarm-activation.tool-policy", { details: { reason, ...(cancelled ? { cancelled: true } : {}) } });
146
+ }
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@
4
4
  // and AGENTS.md on every release. A future improvement would read this from
5
5
  // package.json at build time, but that adds a build-step dependency we
6
6
  // don't want yet.
7
- export const KIMI_PLUGIN_CC_VERSION = "2.5.8";
7
+ export const KIMI_PLUGIN_CC_VERSION = "2.6.2";
package/docs/migration.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Compatibility and upgrades
2
2
 
3
- The runtime certifies exact CLI releases per operation. Exact 2.6.0 is certified for review, challenge, ask, rescue, review gate and pursue only; both swarm modes refuse before model spawn. Full eight-operation certification ends at 2.5.3, with the inherited rate-limit limitation disclosed, and earlier exact rows remain unchanged. `NATIVE_V2_CERTIFIED_VERSIONS` remains the all-operation export, so automatic full-swarm pin selection does not move to 2.6.0; `NATIVE_V2_ANY_OPERATION_VERSIONS` is the separate scoped union used by setup and engine selection. Choose 2.6.0 explicitly for non-swarm use. Later patches and minor releases, including 2.6.1, are not accepted automatically. The npm distribution adds an installation channel; it does not change this compatibility table.
3
+ The runtime certifies exact CLI releases per operation. Plugin 2.6.2 adds bounded swarm on exact stock CLI 2.6.2; see the [certification receipt](upstream-2.6.2-certification.md) for validation status. Exact 2.6.0 remains non-swarm-only. Older full-operation rows through 2.5.3 keep their inherited recovery limitation. `NATIVE_V2_CERTIFIED_VERSIONS` is the all-operation export, and `NATIVE_V2_ANY_OPERATION_VERSIONS` is the scoped union. Other versions, including 2.6.1 and 2.6.3, are not accepted automatically. The npm channel does not change the compatibility matrix.
4
4
 
5
5
  Plugin 2.5.1 also adds DeepSeek Harness as a third host with all seven operations and a DSH-specific bundle, data root, and managed hook id. Existing Claude Code and Codex certification, job stores, and host-scoped hooks are unchanged; no migration is required for those hosts. New DSH installations follow the [README DSH section](../README.md#install-in-deepseek-harness), including `/kimi-setup` on that host.
6
6
 
@@ -12,13 +12,21 @@ Use the [README installation and update steps](../README.md) for Claude Code or
12
12
 
13
13
  Plugin versions advance independently using ordinary SemVer and may deliberately align with a certified CLI release. Nearby version numbers do not imply compatibility or operation scope; the exact per-operation matrix is authoritative. Published versions and tags are never reused. Every upstream patch requires its own certification. The native-v2 no-plan profile, plugin/marketplace IDs and existing job store are preserved.
14
14
 
15
- ## CLI 2.3.2, 2.3.3, 2.4.0, 2.4.1 and 2.5.0/2.5.1/2.5.2/2.5.3 swarm activation
15
+ ## Plugin 2.6.2 swarm behavior on exact CLI 2.6.2
16
16
 
17
- Upstream 2.3.2 removes model self-activation of `AgentSwarm` in fresh print sessions. On exact 2.3.2, 2.3.3, 2.4.0, 2.4.1 and 2.5.0/2.5.1/2.5.2/2.5.3, swarm commands and MCP calls use the same `runSwarm` lifecycle:
17
+ Concurrency 1 uses one direct worker without native swarm activation or delegation. The default for write mode remains 1; its edits still produce an unapplied patch from a temporary worktree. Read mode defaults to 4 and uses guarded waves. At concurrency 2 or more, new and resumed entries share the wave limit; a model must divide larger tasks into successive waves. Fresh-only waves require at least two entries, so group odd target counts into disjoint entries or resume an own-session child for remaining work. `--cap` remains an advisory lifetime-total count.
18
18
 
19
- 1. A short-lived `web --no-open --host 127.0.0.1 --port 0 --log-level error` process uses authenticated loopback routes to verify the exact v2 server, choose the explicit or configured default model, create a session, bind the model and auto permission, enable and verify `swarm_mode`, and shut down. On exact 2.5.0/2.5.1/2.5.2/2.5.3, creation explicitly selects the local environment and an authenticated `/environment` read proves its cwd before profile mutation; state verification uses protocol-v2 WebSocket main-agent frames because `/status` was removed. The child environment sets `KIMI_CODE_SESSION_IDLE_RECLAIM_MS=0` to disable ambient idle-session reclamation.
19
+ The plugin overrides native swarm-child timeout, so a stuck child holds its wave until completion or finite whole-job stop. It disables native Bash backgrounding in owned parallel sessions and denies explicit background Bash. Both normal exit and cancellation settle verified owned processes before artifacts or patches are captured. Concurrency counts Kimi child-agent turns, not subprocesses started by allowed repository tests; individual Bash timeout does not prove those descendants stop between waves. No user timeout configuration change or patched CLI installation is needed. Older exact CLI versions keep their prior behavior. Update the active host plugin and run its setup/check so its canonical hook contains the new policy; re-pinning an older runtime does not add that policy.
20
+
21
+ Parallel Bash commands use the native 60-second default foreground timeout, with a 300-second maximum, and are killed on expiry. Use concurrency 1 for longer tests: automatic timeout-to-background remains available there, root-agent turns stay sequential, and result capture still waits for whole-job settlement. The parallel session's native TaskStop policy remains after deactivation; external interactive resume is outside the managed-job guarantee.
22
+
23
+ ## Native parallel swarm activation
24
+
25
+ Upstream 2.3.2 removes model self-activation of `AgentSwarm` in fresh print sessions. On exact 2.3.2, 2.3.3, 2.4.0, 2.4.1 and 2.5.0/2.5.1/2.5.2/2.5.3, plus the exact-2.6.2 parallel path, swarm commands and MCP calls use the same `runSwarm` lifecycle. The 2.6.2 single-worker path skips it:
26
+
27
+ 1. A short-lived `web --no-open --host 127.0.0.1 --port 0 --log-level error` process uses authenticated loopback routes to verify the exact v2 server, choose the explicit or configured default model, create a session, bind the model and auto permission, enable and verify `swarm_mode`, and shut down. On exact 2.5.0/2.5.1/2.5.2/2.5.3, creation explicitly selects the local environment and an authenticated `/environment` read proves its cwd before profile mutation; state verification uses protocol-v2 WebSocket main-agent frames because `/status` was removed. Exact 2.6.2 uses authenticated direct-subscription state proof and verifies the same local binding. The child environment sets `KIMI_CODE_SESSION_IDLE_RECLAIM_MS=0` to disable ambient idle-session reclamation.
20
28
  2. One ordinary `kimi -p -r` prompt runner resumes that session. Its recorded session-id source is `preactivated`, and the returned print session must match it.
21
- 3. A second short-lived web lifecycle rechecks the local binding on 2.5.0/2.5.1/2.5.2/2.5.3, disables swarm mode, verifies the version-appropriate state proof and the `swarm_mode.exit` journal record, and shuts down.
29
+ 3. A second short-lived web lifecycle rechecks the local binding on 2.5.0/2.5.1/2.5.2/2.5.3/2.6.2, disables swarm mode, verifies the version-appropriate state proof and the `swarm_mode.exit` journal record, and shuts down.
22
30
 
23
31
  Activation is inside the job's finite budget. Graceful process close has a bounded 15-second allowance. `runSwarm` solely owns deactivation: normal cleanup uses the remaining budget, while failure recovery has a separate two-second cancellation-aware bound and is never retried. Print/session failures stay primary. The ready token stays in memory and out of logs, and success cannot complete if cleanup fails. Post-mutation identity or process/group uncertainty preserves diagnostics and, for write-swarm, the recovery worktree. Process groups are rechecked after teardown; unknown survivors are unverified and unproven groups are not signalled. Older certified versions still launch swarm directly with `kimi -p`. This narrow lifecycle is not a full RPC transport or a model-driven activation workaround; the managed hook and workspace boundaries still govern every tool call.
24
32
 
@@ -8,6 +8,12 @@ no separate CLI.
8
8
 
9
9
  ## Publishing status
10
10
 
11
+ Plugin **2.6.2** certifies unmodified exact Kimi Code **2.6.2** for all eight operations. Parallel swarm uses bounded waves and a native timeout override; concurrency one uses a direct worker. Final runtime commit `b69a416d8588ed12239148ccc9f120e3dbfe0dcb` passed 1,767 repository tests with 23,008 assertions, 30 live production tests with 386 assertions, all 23 stock-runtime swarm controls, and 130 Linux controls with kernel threads visible. The 340-file package, all three compiled distributions, DSH host installation and isolated consumer security passed. Independent Codex and Fable reviews closed all findings. The first CI run exposed a Linux identity mismatch; its correction passed CI, and the final runtime also handles unrelated nonsignalable ancestry and reports uncertain cancellation cleanup. See the [certification record](./upstream-2.6.2-certification.md) for boundaries and evidence. Final release CI, tagging and npm publication are pending; publication receipts will be recorded after those actions complete. Publication does not update installed hosts or operator pins.
12
+
13
+ Plugin **2.5.9** certifies exact Kimi Code **2.6.2** for review, challenge, ask, rescue, review_gate and pursue only; both swarm modes refuse before model spawn, and exact 2.6.1 and 2.6.3 are excluded. The release-commit production matrix passed 23 tests with 171 assertions in 225.87 seconds, the definitive full gate passed 1,503 tests with 20,086 assertions in 433.07 seconds, and package validation passed 334 files with isolated consumer security. Codex and Claude both returned NO FINDINGS / APPROVE. `NATIVE_V2_CERTIFIED_VERSIONS` remains the all-operation export through 2.5.3, so automatic full-swarm pins do not silently select either narrowed 2.6.x release. [Release v2.5.9](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.9) is anchored at `6f9eaa6e145d62e7f35e5ff38d317bd7e3a673c5`. [Final CI](https://github.com/linxule/kimi-plugin-cc/actions/runs/43585425445) and [OIDC publication](https://github.com/linxule/kimi-plugin-cc/actions/runs/43585933931) passed. The 334-file registry tarball has SHA-1 `2158551b73d3408af14e2061c29e40dc60622947` and SHA-256 `d5c43b95c708468393f357c353c180488ae83edb56cae93e840d08ee2b3dc520`, matches the validated workflow artifact byte-for-byte, and carries signed SLSA provenance (log index `3876002731`) and publish attestation (log index `3876057720`). A fresh registry npm installation has zero production advisories and no invalid or missing signatures; setup/check passes with the explicit non-swarm warning, and the installed runtime enforces the scoped refusals. The Discover timestamp records npm publication at `2026-11-14T10:43:34.167Z`. Publication does not update installed hosts or operator pins.
14
+
15
+ Plugin **2.5.8** certifies exact Kimi Code **2.6.0** for review, challenge, ask, rescue, review_gate and pursue only; both swarm modes refuse before model spawn, and exact 2.6.1 is excluded. The narrowed production matrix passed 23 tests with 170 assertions, the definitive full gate passed 1,472 tests with 19,530 assertions in 402.26 seconds, and package validation passed 333 files with isolated consumer security. Codex and Claude both approved with no blocker or major findings. `NATIVE_V2_CERTIFIED_VERSIONS` remains the all-operation export through 2.5.3, so automatic full-swarm pins do not silently select non-swarm-only 2.6.0. [Release v2.5.8](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.8) is anchored at `887958d7de39cf388ebc3faaffd31cabe76c5a99`. [Release-commit CI](https://github.com/linxule/kimi-plugin-cc/actions/runs/43452771909) and [OIDC publication](https://github.com/linxule/kimi-plugin-cc/actions/runs/43453807099) passed. The 333-file registry tarball has SHA-1 `65145489591e6873556f85a06506d0d276880441` and SHA-256 `6fc5f44aacafa92671f5aea8e2343e6323116f81d4456dee47181481050af5f4`, matches the validated workflow artifact byte-for-byte, and carries signed SLSA provenance (log index `3857088726`) and publish attestation (log index `3857133123`). A fresh registry npm installation has zero production advisories and no invalid or missing signatures; setup/check passes with the explicit non-swarm warning, and the installed runtime enforces the scoped refusals. The Discover timestamp records npm publication at `2026-11-13T15:41:45.145Z`. Publication does not update installed hosts or operator pins.
16
+
11
17
  Plugin **2.5.7** certifies exact Kimi Code **2.5.3** for all eight operations, alongside 2.5.0, 2.5.1 and 2.5.2; see the [2.5.3 certification record](./upstream-2.5.3-certification.md). Candidate and production matrices each passed 24 tests with 201 assertions and no skips. The corrected-tree full check passed 1,437 tests with 18,980 assertions in 396.30 seconds, package validation passed 332 files across all three distributions, and isolated consumer security passed. Codex returned APPROVE with no findings; Claude returned READY-TO-TAG with no blocker or major findings, and its two chronology corrections are included. Publication does not update installed hosts or operator pins. [Release v2.5.7](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.7) is anchored at `b203b6fd0db865935bf47241ee4ea8cf3931b9a5`. [Release-commit CI](https://github.com/linxule/kimi-plugin-cc/actions/runs/43045729840) and [OIDC publication](https://github.com/linxule/kimi-plugin-cc/actions/runs/43046887763) passed. The 332-file registry tarball has SHA-1 `adfee8da730dc14349d26125bc5add44fe204aa5`, matches the validated workflow artifact byte-for-byte, and carries signed provenance (sigstore log index `3812668747`). A fresh registry npm installation has zero production advisories; isolated Claude Code, Codex, and DSH setup/checks and unsupported-version refusal pass, and all compiled runtime mirrors match the release tag. The Discover timestamp records npm publication at `2026-11-11T15:25:33.059Z`.
12
18
 
13
19
  Plugin **2.5.6** certifies exact Kimi Code **2.5.2** for all eight operations, alongside 2.5.0 and 2.5.1; see the [2.5.2 certification record](./upstream-2.5.2-certification.md). Candidate and production matrices each passed 24 tests with 167 assertions and no skips. The full check passed 1,429 tests with 18,662 assertions, package validation passed 331 files across all three distributions, and isolated consumer security passed. Publication does not update installed hosts or operator pins. [Release v2.5.6](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.6) is anchored at `a9585a1cd4177b17e422b63305d390aa1f1b9c81`. [Release-commit CI](https://github.com/linxule/kimi-plugin-cc/actions/runs/42376507143) and [OIDC publication](https://github.com/linxule/kimi-plugin-cc/actions/runs/42381804227) passed; the first three publication attempts failed with `TLOG_CREATE_ENTRY_ERROR` during a Sigstore Rekor database upgrade and published nothing, and attempt 4 succeeded unchanged. The 331-file registry tarball has SHA-1 `32c712a00186c1b0a334bf39d03cc397a2012b05`, matches the validated workflow artifact byte-for-byte, and carries provenance (sigstore log index `3739983164`). A fresh registry npm installation has zero production advisories and all compiled runtime mirrors match. The Discover timestamp records npm publication at `2026-11-07T14:56:36.462Z`.
package/docs/safety.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This guide describes the current checkout runtime. Read-only tasks deny file writes and shell commands. Rescue and pursue can edit your workspace. Write-swarm returns a patch from a temporary Git worktree.
4
4
 
5
- Native agent-core-v2 is certified at exact CLI versions `0.42.0`, `0.43.0`, `0.43.1`, `2.0.0`, `2.0.1`, `2.0.2`, `2.1.0`, `2.1.1`, `2.2.0`, `2.3.0`, `2.3.1`, `2.3.2`, `2.3.3`, `2.4.0`, `2.4.1`, `2.5.0`, `2.5.1`, `2.5.2`, and `2.5.3`, with plan mode disabled. Exact 2.6.0 has a narrowed certification for review, challenge, ask, rescue, review gate and pursue only; both swarm modes refuse before model spawn because upstream rate-limit recovery can exceed the configured concurrency limit. The [runtime certification table](../runtime/kimi-engine.ts) controls routing and operation scope. The hook is not an operating-system sandbox.
5
+ Native agent-core-v2 uses the no-plan construction on exact reviewed versions. The [runtime certification table](../runtime/kimi-engine.ts) controls routing and operation scope. Exact 2.6.0 remains limited to review, challenge, ask, rescue, review gate and pursue. Plugin 2.6.2 adds the bounded swarm construction described below for exact stock CLI 2.6.2; its [certification receipt](upstream-2.6.2-certification.md) records validation status. Older full-operation rows through 2.5.3 retain their known rate-limit-recovery limitation. The hook is not an operating-system sandbox.
6
6
 
7
7
  ## Why the safety story is hook-based
8
8
 
@@ -148,8 +148,8 @@ Write boundaries are identical to the companion commands: rescue and pursue edit
148
148
  | `ask` | `Read`, `Grep`, `Glob`, `ReadMediaFile`, `TaskList`, `TaskOutput` | everything else, including `Bash`, `Write`, `Edit` |
149
149
  | `review`, `challenge`, `review_gate` | same as `ask` | same as `ask` |
150
150
  | `rescue` | governed by [`evaluateRescueHookRequest`](../runtime/rescue-approval.ts) against the plugin-owned `KIMI_PLUGIN_CC_WORKSPACE_ROOT` — workspace-bound shell allowlist, symlink-aware path containment, mutating-flag detection on `git`/`find`/`sed`, etc. | missing-root writes and every shell command, file edit, or write that the allowlist rejects |
151
- | `swarm` | same read-only set as `ask`, plus exact `AgentSwarm` | everything else, including singular `Agent`, shell, and writes |
152
- | `swarm-write` | read-only set + `AgentSwarm`; `Write`/`Edit`/`Bash` only through the rescue evaluator against the trusted ephemeral-worktree root | singular `Agent`, missing-root writes, and everything the rescue evaluator rejects |
151
+ | `swarm` | same read-only set as `ask`; exact `AgentSwarm` subject to the version-specific wave guard | everything else, including singular `Agent`, shell, and writes |
152
+ | `swarm-write` | read-only set + admitted `AgentSwarm` on parallel paths; `Write`/`Edit`/`Bash` only through the rescue evaluator against the trusted ephemeral-worktree root | singular `Agent`, missing-root writes, and everything the rescue evaluator rejects |
153
153
  | unknown label | `Read`, `Grep`, `Glob`, `ReadMediaFile`, `TaskList`, `TaskOutput` | everything else (conservative-deny for stale/misconfigured callers) |
154
154
 
155
155
  `EnterPlanMode` and `ExitPlanMode` are explicitly denied before any per-label write evaluator for every managed label. Denied tool calls exit the hook with code 2 and write a reason to stderr. kimi-code surfaces the reason to the model, which can adapt and try a different approach (e.g., use `Read` instead of `Bash cat`).
@@ -226,24 +226,47 @@ For interrupted runs, see [durable recovery and its explicit limits](swarm-recov
226
226
 
227
227
  Upstream 2.3.2 removes model self-activation of `AgentSwarm` in fresh print sessions. A rejected call can therefore coexist with zero child journals and a successful exit; a tool-call record, aggregate denial, or coordinator-produced patch does not prove fan-out. The plugin does not use prompt workarounds or replace its print transport with general RPC.
228
228
 
229
- For versions requiring activation (currently exact 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2 and 2.5.3), both slash-command and MCP swarm operations use the same `runSwarm` implementation and one ordinary `kimi -p -r` prompt runner per job, bracketed by short-lived host-managed web lifecycles:
229
+ For parallel paths requiring activation (exact 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2, 2.5.3 and 2.6.2), both slash-command and MCP swarm operations use the same `runSwarm` implementation and one ordinary `kimi -p -r` prompt runner per job, bracketed by short-lived host-managed web lifecycles:
230
230
 
231
- 1. The exact planned CLI starts `web --no-open --host 127.0.0.1 --port 0 --log-level error`. The child environment sets `KIMI_CODE_SESSION_IDLE_RECLAIM_MS=0`, so ambient idle-session reclamation cannot disrupt the plugin-owned lifecycle. The plugin accepts only the expected loopback ready URL, uses a supplied token for authenticated REST requests, and keeps that token in memory, never writing it to logs. `/api/v1/meta` must confirm backend v2, the exact planned version, and no dangerous authentication bypass. The plugin uses the explicit model or environment-model alias, otherwise reading the default alias from `/api/v1/config`; creates a session in the job cwd; on exact 2.5.0/2.5.1/2.5.2/2.5.3 explicitly binds `environment_id:"local"` and the job cwd, then verifies that binding through authenticated `/environment` before either profile mutation; binds the selected model with `permission_mode:auto` and `swarm_mode:true`; verifies those settings and `plan_mode:false` through `/status` on earlier versions or protocol-v2 authenticated WebSocket main-agent state on 2.5.0/2.5.1/2.5.2/2.5.3, closing that channel before validating the latest frame; verifies clean shutdown; and requires the main journal's manual `swarm_mode.enter` record.
231
+ 1. The exact planned CLI starts `web --no-open --host 127.0.0.1 --port 0 --log-level error`. The child environment sets `KIMI_CODE_SESSION_IDLE_RECLAIM_MS=0`, so ambient idle-session reclamation cannot disrupt the plugin-owned lifecycle. The plugin accepts only the expected loopback ready URL, uses a supplied token for authenticated REST requests, and keeps that token in memory, never writing it to logs. `/api/v1/meta` must confirm backend v2, the exact planned version, and no dangerous authentication bypass. The plugin uses the explicit model or environment-model alias, otherwise reading the default alias from `/api/v1/config`; creates a session in the job cwd; on exact 2.5.0/2.5.1/2.5.2/2.5.3 explicitly binds `environment_id:"local"` and the job cwd, then verifies that binding through authenticated `/environment` before either profile mutation; binds the selected model with `permission_mode:auto` and `swarm_mode:true`; verifies those settings and `plan_mode:false` through `/status` on earlier versions or protocol-v2 authenticated WebSocket main-agent state on 2.5.0/2.5.1/2.5.2/2.5.3, closing that channel before validating the latest frame; verifies clean shutdown; and requires the main journal's manual `swarm_mode.enter` record. Exact 2.6.2 instead uses authenticated direct-subscription state proof with exact request/session identity and the same local environment checks.
232
232
  2. The ordinary stream-json print runner resumes that session with `kimi -p -r`. The job records `kimi_session_id_source:"preactivated"`, and the session returned by print must exactly match the preactivated id. Every coordinator and child tool call remains governed by the same managed PreToolUse hook and operation allowlist.
233
- 3. After the print run, a second web lifecycle rechecks the local binding on 2.5.0/2.5.1/2.5.2/2.5.3, sets `swarm_mode:false`, verifies the version-appropriate state proof, shuts down cleanly, and requires `swarm_mode.exit` in the main journal. Activation consumes part of the same finite job budget rather than extending it. `runSwarm` solely owns session deactivation: normal cleanup uses the remaining budget, while failure recovery has a separate two-second cancellation-aware bound and is never retried. Print/session failures stay primary, with exit codes and cleanup diagnostics preserved. Cancellation aborts the owned lifecycle and never starts a fresh cleanup server. Every post-mutation failure retains the session identity; process/group uncertainty is marked without inventing an ID; process groups are rechecked after teardown, unknown survivors are unverified, unproven groups are never signalled, and a same-PID/start-token process that changes PGID remains active but is not a validated signal target. Root loss requires a previously observed matching identity; first-missing roots and actual probe errors/timeouts remain unverified. Reparenting and PGID moves preserve the current verified child identity for revalidation rather than treating it as exited. Unverified cleanup prevents success and preserves raw output, structured diagnostics, and the write worktree for recovery.
233
+ 3. After the print run, a second web lifecycle rechecks the local binding on 2.5.0/2.5.1/2.5.2/2.5.3/2.6.2, sets `swarm_mode:false`, verifies the version-appropriate state proof, shuts down cleanly, and requires `swarm_mode.exit` in the main journal. Activation consumes part of the same finite job budget rather than extending it. `runSwarm` solely owns session deactivation: normal cleanup uses the remaining budget, while failure recovery has a separate two-second cancellation-aware bound and is never retried. Print/session failures stay primary, with exit codes and cleanup diagnostics preserved. Cancellation aborts the owned lifecycle and never starts a fresh cleanup server. Every post-mutation failure retains the session identity; process/group uncertainty is marked without inventing an ID; process groups are rechecked after teardown, unknown survivors are unverified, unproven groups are never signalled, and a same-PID/start-token process that changes PGID remains active but is not a validated signal target. Root loss requires a previously observed matching identity; first-missing roots and actual probe errors/timeouts remain unverified. Reparenting and PGID moves preserve the current verified child identity for revalidation rather than treating it as exited. Unverified cleanup prevents success and preserves raw output, structured diagnostics, and the write worktree for recovery.
234
234
 
235
235
  Older certified versions keep the direct `kimi -p` path. The web processes are narrow, planned lifecycle helpers, not a second model runner and not a general RPC transport.
236
236
 
237
+ ## Bounded swarm on exact CLI 2.6.2
238
+
239
+ `--max-concurrency` defaults to 4 for read-only work and 1 for write work. On exact native-v2 2.6.2, the runtime chooses one of two paths:
240
+
241
+ - **Two or more:** the canonical hook admits only waves whose fresh items plus resumed entries fit the requested concurrency. Forks, malformed requests and fresh singleton waves are denied. Group odd numbers of targets into at least two disjoint entries per fresh wave, or resume an existing child for the remaining work. The hard bound covers simultaneous Kimi child-agent turns, excluding their coordinator. Fresh children cannot activate another swarm; resumes stay within the new job's own session.
242
+ - **One:** a single worker runs directly in fresh print, without activating native swarm or launching children. Both delegation tools are denied. It keeps the same read-only restrictions or confined worktree writes and patch output.
243
+
244
+ The plugin forces `KIMI_CODE_SWARM_TIMEOUT_MS=2147483647` on bounded spawns, overriding saved or ambient short child timeouts. This value exceeds the plugin's maximum 24-hour job budget. A short native swarm-child timeout is unsafe here: it can return a wave result before a retry stops. A slow or stuck child therefore holds its wave until it completes or the finite whole-job budget or explicit cancellation stops the run. Environment value `0` is ignored upstream and is not used as a timeout override.
245
+
246
+ For the parallel path, the plugin disables `TaskStop` in its fresh owned native session after the activation web process has shut down and before print starts. The managed hook already denies that tool; disabling it in native policy also removes the complete `TaskList`/`TaskOutput`/`TaskStop` set that stock 2.6.2 requires for Bash backgrounding. This closes both explicit backgrounding and automatic detachment after a foreground timeout, whose completion could otherwise wake a finished child. The hook separately denies explicit `Bash.run_in_background:true` on both bounded paths. The escape monitor receives the same trusted wave policy as the hook; a native mode-off rejection on the direct-worker path can still be a harmless mismatch diagnostic, not proof of execution.
247
+
248
+ With parallel backgrounding disabled, native Bash uses a 60-second default foreground timeout and a 300-second maximum; commands that exceed their timeout are killed rather than detached. Use `--max-concurrency 1` for longer tests. That direct-worker path still permits native automatic timeout-to-background behavior, although explicit background requests are denied. Its root-agent turns remain sequential, and whole-job settlement still gates the result; the limit of one is an agent-turn bound, not a promise of one OS process.
249
+
250
+ The native `TaskStop` policy remains in the plugin-owned session after deactivation. The plugin does not restore it or claim the same bounded behavior if a user later resumes that historical session interactively outside the managed job.
251
+
252
+ Normal print exit and terminal cancellation both wait for identity-verified owned-process settlement before artifacts or write patches are captured. A native timeout on an individual Bash call does not prove arbitrary command descendants have stopped before the next wave. An allowed repository test can itself start many OS subprocesses; the concurrency limit counts Kimi child-agent turns, not those processes. The whole-job settlement barrier stops verified owned tails and refuses success when quiescence cannot be established.
253
+
254
+ Process-tree settlement applies on POSIX; Windows retains direct-child-only cleanup. Job-end cleanup also stops observed, identity-verified build/test daemon descendants, so services started by the job are not preserved. Process sampling retains the trusted-repository boundary and does not provide universal OS daemon containment.
255
+
256
+ `--cap` stays a soft lifetime-total hint, separate from concurrency. Sequential waves can process more targets than the concurrency limit. The finite budget bounds duration, not dollars or total tokens. This construction does not change the existing trust boundary for test runners or other allowed commands that execute repository code.
257
+
258
+ The construction is exact-version-specific. Older certified versions retain normal-launch limits and the inherited recovery overrun; exact 2.6.0 remains non-swarm-only. The upstream 2.6.2 binary is unmodified. Validation state and evidence are recorded in the [2.6.2 certification record](upstream-2.6.2-certification.md).
259
+
237
260
  ## Read-only swarm (`/kimi:swarm`)
238
261
 
239
262
  `/kimi:swarm` (v1.2) fans a **read-only** review out across subagents using kimi-code's `AgentSwarm` tool (kimi-code 0.12.0+). The coordinator launches one subagent per target (file/module/question); each inspects the workspace with read tools and reports findings, which the coordinator consolidates into one markdown report. It opens **zero new write surface**.
240
263
 
241
- - **The hook label is `swarm`, and it allows the read-only tool set PLUS `AgentSwarm`.** The coordinator must be allowed to call `AgentSwarm` (else the swarm never launches), but no write/edit/shell tool is allowed. The exact allowed tool name is `AgentSwarm` (verified at 0.42.0 against `packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts`: `'AgentSwarm'`, strict schema). The singular `Agent` tool is deliberately *not* allowed — swarm is the fan-out surface, not arbitrary delegation.
242
- - **Every subagent inherits the `swarm` label and fires the same hook.** On native v2 (0.42.0) `AgentSwarm` children run in-process in a child DI scope with their OWN eager external-hooks service, so every child tool call passes the same before-execute channel and the same managed hook — there is no sub-vs-main branch and no deny-all shortcut on the swarm route. So a subagent's `Write`/`Edit`/`Bash` is denied exactly like a single-turn review's. The swarm listener in that channel is non-terminal and nothing auto-approves `AgentSwarm` ahead of the hook. (Legacy-v1 ≤ 0.41 reached the same result by placing the hook policy at index 0 of every agent's permission stack.) **Required for final certification evidence** (`tests/runtime/real-binary-smoke.test.ts`, run via `bun run smoke:real`): distinct child journals must exist, and each assigned Write/Edit `path` must be correlated through its `toolCallId` with the managed denial in that exact tool result; unrelated denials and coordinator-only reports are insufficient. On 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2 and 2.5.3, targeted controls also prove that direct OFF produces no children while the preactivated ON path produces the real child journals and denials.
264
+ - **The hook label is `swarm`, and it allows the read-only tool set PLUS `AgentSwarm`.** On parallel paths the coordinator may call an admitted `AgentSwarm`, but no write/edit/shell tool is allowed; the exact-2.6.2 direct-worker path denies delegation too. The exact allowed tool name is `AgentSwarm` (verified at 0.42.0 against `packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts`: `'AgentSwarm'`, strict schema). The singular `Agent` tool is deliberately *not* allowed — swarm is the fan-out surface, not arbitrary delegation.
265
+ - **Every subagent inherits the `swarm` label and fires the same hook.** On native v2 (0.42.0) `AgentSwarm` children run in-process in a child DI scope with their OWN eager external-hooks service, so every child tool call passes the same before-execute channel and the same managed hook — there is no sub-vs-main branch and no deny-all shortcut on the swarm route. So a subagent's `Write`/`Edit`/`Bash` is denied exactly like a single-turn review's. The swarm listener in that channel is non-terminal and nothing auto-approves `AgentSwarm` ahead of the hook. (Legacy-v1 ≤ 0.41 reached the same result by placing the hook policy at index 0 of every agent's permission stack.) **Required for parallel-path certification evidence** (`tests/runtime/real-binary-smoke.test.ts`, run via `bun run smoke:real`): distinct child journals must exist, and each assigned Write/Edit `path` must be correlated through its `toolCallId` with the managed denial in that exact tool result; unrelated denials and coordinator-only reports are insufficient. On 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2 and 2.5.3, targeted controls also prove that direct OFF produces no children while the preactivated ON path produces the real child journals and denials.
243
266
  - **The managed hook is the read-only boundary; no `explore`-profile second layer is assumed.** Production deliberately omits `subagent_type` for read-only swarm rather than selecting kimi-code's `explore` profile. Every coordinator and subagent tool call is enforced by the same managed hook.
244
267
  - **Swarm refuses without the hook, like every model-spawning command.** A swarm makes the reason especially acute: it asks for up to `--cap` subagents, but this total-count hint is advisory, so a missing hook would remove enforcement from all of them at once. `KIMI_PLUGIN_CC_SKIP_HOOK_CHECK=1` remains an explicit tests/diagnostics escape hatch, not a recovery path.
245
- - **The only new risk is COST, and the plugin bounds it.** Read-only swarm writes nothing, so the new risk is runaway cost from N parallel model runs (and possible nested `AgentSwarm`). `/kimi:swarm` enforces a **mandatory finite wall-clock ceiling** via its AbortController (`--budget`, default 30m); the SIGTERM→SIGKILL descendant-reaping cancellation reaps the whole subagent process tree. Two **distinct** subagent bounds: `--cap N` is a *soft* prompt-injected hint on TOTAL subagent count (the hook is stateless and cannot enforce a count, so the model may exceed it), and `--max-concurrency N` caps normal launches of kimi-code's `SubagentBatch` — exported as `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` (PR #888) on **kimi-code 0.18.0+** (older binaries ignore the unknown env var, so on < 0.18 only the soft hint applies). It **defaults to 4** when the user passes none (`resolveSwarmMaxConcurrency` in swarm.ts), so every swarm run — agent-dispatched or human-typed — carries a normal-launch peak-parallelism ceiling on 0.18.0+; pass an explicit value to widen or throttle. **Never merge them into one flag:** concurrency ≠ total count — the normal-launch cap of N still permits more than N subagents over the life of the run, and rate-limit recovery can also exceed its at-once peak as detailed below. The `--budget` bounds elapsed time, not a dollar amount or total token count; `--max-concurrency` bounds *peak* parallelism (the spike in simultaneous model spend), and `--cap` is only an advisory total-count nudge. Folding both onto one flag would create the "cap-as-total-count illusion" — a user reading `--cap N` would expect a total bound but receive only a peak-parallelism one. **Known upstream limitation:** normal launches enforce the configured maximum, but deterministic controls against exact 2.6.0 show rate-limit recovery exceeding it (cap 1 reaching two active attempts; cap 4 reaching five). Source inspection shows the same inherited defect in 2.5.3. Until a released upstream fix is certified, `--max-concurrency` is a requested peak with normal-launch enforcement, not an unconditional hard ceiling. This limitation is disclosed for existing rows rather than silently rewriting their certification history; 2.6.0 remains uncertified for either swarm operation, and its narrowed non-swarm certification does not waive the limitation.
246
- - **A model-invocable `kimi-swarm` agent (v1.3) wraps this command.** The `/kimi:swarm` slash command is human-only (`disable-model-invocation: true`, the blanket convention for *all* commands), but the `kimi-swarm` subagent lets the main thread *dispatch* a read-only fan-out on its own judgement — the same human-command + model-invocable-agent split that `kimi-review`/`kimi-challenge`/`kimi-ask`/`kimi-rescue` already use. Swarm is a safe candidate for an agent precisely because it is **read-only (zero write surface)**: the only thing auto-dispatch adds is COST exposure, already bounded by the finite `--budget` and the normal-launch `--max-concurrency` that the runtime defaults to 4 for every swarm run (with the recovery qualification above) — so an auto-dispatched fan-out is bounded by construction, not by ignorable agent prose (the agent additionally restricts backgrounding to explicit user requests). `/kimi:pursue` ALSO gains a model-invocable agent (`kimi-pursue`, v1.3 — see the Autonomous goal mode section above): it is write-capable, but auto-dispatch widens no write surface (the rescue workspace allowlist + the managed PreToolUse hook gate every tool call on every continuation turn, and it cannot mutate git state) and removes no bound (the mandatory `--budget` ceiling holds), so its agent path is exactly as confined as its command path. Because it is the plugin's highest-autonomy surface, its agent description demands an explicit hands-off-autonomy request and steers single bounded tasks to `kimi-rescue`.
268
+ - **Concurrency and total count are separate.** Every swarm has a finite `--budget` (default 30m). Exact 2.6.2 follows the bounded-wave/direct-worker construction above; `--max-concurrency` defaults to 4 for read-only work. Older certified binaries use `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` for normal launches on 0.18.0+ and can exceed it during rate-limit recovery. `--cap` is only a soft lifetime-total hint: a stateless per-wave guard does not make it a total-count limit. A time budget is not a dollar or token cap. Keep all three controls distinct.
269
+ - **A model-invocable `kimi-swarm` agent (v1.3) wraps this command.** The `/kimi:swarm` slash command is human-only (`disable-model-invocation: true`, the blanket convention for *all* commands), but the `kimi-swarm` subagent lets the main thread *dispatch* a read-only fan-out on its own judgement — the same human-command + model-invocable-agent split that `kimi-review`/`kimi-challenge`/`kimi-ask`/`kimi-rescue` already use. Swarm is a safe candidate for an agent precisely because it is **read-only (zero write surface)**: the only thing auto-dispatch adds is COST exposure, already bounded by the finite `--budget` and the version-specific `--max-concurrency` bound that defaults to 4 for read-only work — so an auto-dispatched fan-out is bounded by construction, not by ignorable agent prose (the agent additionally restricts backgrounding to explicit user requests). `/kimi:pursue` ALSO gains a model-invocable agent (`kimi-pursue`, v1.3 — see the Autonomous goal mode section above): it is write-capable, but auto-dispatch widens no write surface (the rescue workspace allowlist + the managed PreToolUse hook gate every tool call on every continuation turn, and it cannot mutate git state) and removes no bound (the mandatory `--budget` ceiling holds), so its agent path is exactly as confined as its command path. Because it is the plugin's highest-autonomy surface, its agent description demands an explicit hands-off-autonomy request and steers single bounded tasks to `kimi-rescue`.
247
270
 
248
271
  ## Write-capable swarm (`/kimi:swarm --write`)
249
272
 
@@ -254,8 +277,9 @@ Older certified versions keep the direct `kimi -p` path. The web processes are n
254
277
  - **`coder` subagents really can write, and the hook is the sole boundary.** Verified at kimi-code 0.42.0: swarm subagents get their own eager external-hooks service under the standard before-execute channel — there is no deny-all path on the swarm route (the `btw` side-question path is separate). Write-swarm's `coder` subagents DO have edit tools, and the managed PreToolUse hook is the **only** write boundary — which is why the trusted-root confinement above is load-bearing and gated tightly.
255
278
  - **The plugin never touches git; the main thread owns the merge.** Subagents cannot run git (allowlist denies mutation). The plugin captures the change set with `git add -N` (intent-to-add, so new files appear in the diff WITHOUT writing loose objects into the shared object DB) + `git diff --binary` (untruncated, applyable), writes it to a `swarm-write-<jobId>.patch` artifact, and prints the path. It does **not** `git apply`, commit, or move any ref — the user/main thread reviews the patch and applies it (`git apply <path>`). The worktree shares the main repo's object DB and refs, but no ref/HEAD is ever moved, so the user's repository state is untouched.
256
279
  - **The patch is captured on every terminal path, before cleanup.** Success, cancel, budget-expiry, and failure all capture the (possibly partial) patch BEFORE `git worktree remove --force` discards the tree, so a cancelled run never silently loses the work the subagents already did. If capture itself fails, the job fails instead of completing and the worktree is retained with its path in the error details for recovery. That guarantee covers the plugin's own terminal paths, including `companion.sh cancel`. It does **not** cover a harness interrupt: Esc/TaskStop delivers SIGTERM then SIGKILL after ~1.35s (measured, process-group-wide), which is shorter than the 1500ms child escalation plus quiescence plus patch capture — so a hard interrupt can kill the companion mid-teardown and lose the patch. `companion.sh cancel` signals from a separate process not racing that deadline and is the work-preserving stop. Abandoned worktrees are retained, never age-deleted. Use the preview/apply recovery procedure in [swarm-recovery.md](swarm-recovery.md); uncertain ownership refuses automatic cleanup.
257
- - **Gated tightly.** Requires kimi-code **≥ 0.18.0** (below it `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` is ignored, so a write fan-out would have no normal-launch peak bound); because that support cannot be confirmed without a version probe, the write-mode version gate **fails closed** on an unconfirmable `kimi --version` probe (the shared execution-plan gate also refuses unverified or uncertified binaries for read-only swarm; older certified legacy versions may lack normal-launch concurrency support). The rate-limit recovery qualification above applies to every supported version reviewed here. Also requires a git repo with a **committed HEAD**, and the PreToolUse hook (**refuses** without it, like read swarm). Bases the worktree on HEAD, so a **loud warning** fires when the working tree is dirty (uncommitted work is not visible to the swarm). Default `--max-concurrency` is **1** for normal-launch serialization since disjoint-target partitioning is prompt-only and unenforceable by the stateless hook; the rate-limit recovery qualification above applies; the coordinator prompt also forbids git mutation and nested `AgentSwarm`.
258
- - **Required for final certification evidence.** `tests/runtime/real-binary-smoke.test.ts` runs the real `runSwarm --write` and requires the POSITIVE end-to-end: distinct child journals contain their assigned edits with `Write`/`Replaced` results on the same `toolCallId`, those child-authored changes land in the worktree and captured patch, the user's real tree is byte-identical + git-clean, and the worktree is cleaned up. A patch without per-call child provenance is not accepted as fan-out evidence. The NEGATIVE lane correlates each absolute out-of-root `path` and `toolCallId` with its managed denial. It is the check that catches `tool_input` field-name drift — `Write`/`Edit` carry `path`, not `file_path`, and reading the wrong key denies every real write silently.
280
+ - **Gated tightly.** Requires an exact certified CLI (write mode additionally requires at least 0.18.0), a Git repository with committed HEAD, and a verified managed hook. A dirty-tree warning explains that the worktree starts from HEAD and does not contain uncommitted edits. Default concurrency 1 uses a direct worker on exact 2.6.2; larger values use bounded waves. Older certified versions retain normal-launch serialization with the disclosed recovery limitation. Disjoint targets remain prompt guidance, and Git mutation stays denied.
281
+ - **Required for final certification evidence on parallel paths.** `tests/runtime/real-binary-smoke.test.ts` runs the real `runSwarm --write` and requires the POSITIVE end-to-end: distinct child journals contain their assigned edits with `Write`/`Replaced` results on the same `toolCallId`, those child-authored changes land in the worktree and captured patch, the user's real tree is byte-identical + git-clean, and the worktree is cleaned up. A patch without per-call child provenance is not accepted as fan-out evidence. The NEGATIVE lane correlates each absolute out-of-root `path` and `toolCallId` with its managed denial. It is the check that catches `tool_input` field-name drift — `Write`/`Edit` carry `path`, not `file_path`, and reading the wrong key denies every real write silently.
282
+ - **The single-worker path needs separate evidence.** At concurrency 1 on exact 2.6.2, require fresh print with no web activation or child journals, managed delegation denials, a confined main-agent write captured in the patch, unchanged user tree, and cancellation/budget settlement. Coordinator-only patches are valid for this explicit path, never substitutes for parallel child evidence.
259
283
  - **Model-invocable agent (v1.5), patch-only by construction.** Following the field-proof above, `--write` now has a `kimi-swarm-write` subagent so the main thread can dispatch a write fan-out on its own judgement — the same human-command + model-invocable-agent split the rest of the suite uses. Auto-dispatch is a safe extension here because it widens **no** write surface and retains the documented bounds: the agent path runs the identical `runSwarm --write` code, so edits still land only in the throwaway worktree, the managed hook still gates every `coder` subagent, the patch is still handed back for the user to apply (**the plugin never applies or commits**), and `--budget` + default `--max-concurrency` 1 + the hook requirement still apply, with the rate-limit-recovery qualification above. In fact write-swarm is a *less* dangerous agent than the `kimi-pursue` agent already shipped: pursue writes directly into the workspace, whereas write-swarm's output is a patch the human reviews before anything reaches a real tree. Because it is still a write surface, the agent description demands BOTH signals — many disjoint write targets AND explicit fan-out intent — and steers single edits to `kimi-rescue`, read-only fan-outs to `kimi-swarm`, and autonomous loops to `kimi-pursue`. Default `--max-concurrency` stays **1**; raising it (concurrent writers) remains a deliberate, human-or-explicitly-requested choice.
260
284
 
261
285
  ## MCP transport and long-running jobs
@@ -298,7 +322,7 @@ worktree. A directory the operator trusted interactively in the Kimi TUI still
298
322
  has that property; that persisted-trust route is a documented residual, not
299
323
  something the plugin can close.
300
324
 
301
- Plugin-managed execution must remain local. Unused remote declarations can remain in operator config, but a configured remote default refuses before spawn. Disabling workspace trust through `[workspace] require_trust = false` also refuses, because it would enable project MCP outside the managed hook. Launcher environment selectors are reserved. Fresh exact 2.5.0/2.5.1/2.5.2/2.5.3/2.6.0 print selects `--environment local`; resume instead inspects persisted metadata and every agent journal and refuses nonlocal or wrong-root records against the expected execution root (the isolated worktree for swarm-write); older sessions without environment records do not fail this check merely for lacking them.
325
+ Plugin-managed execution must remain local. Unused remote declarations can remain in operator config, but a configured remote default refuses before spawn. Disabling workspace trust through `[workspace] require_trust = false` also refuses, because it would enable project MCP outside the managed hook. Launcher environment selectors are reserved. Fresh exact 2.5.0/2.5.1/2.5.2/2.5.3/2.6.0/2.6.2 print selects `--environment local`; resume instead inspects persisted metadata and every agent journal and refuses nonlocal or wrong-root records against the expected execution root (the isolated worktree for swarm-write); older sessions without environment records do not fail this check merely for lacking them.
302
326
 
303
327
  ## Running a newer Kimi than the plugin certifies
304
328
 
@@ -320,9 +344,10 @@ Both binaries share `~/.kimi-code` (login, config, hook), so nothing else
320
344
  changes. The full-operation certified maximum can be read from the installed
321
345
  plugin (`NATIVE_V2_CERTIFIED_VERSIONS` in `dist/kimi-engine.js`), which lets an
322
346
  upgrade script bump the full-swarm pin automatically after each full-operation
323
- certification. That export deliberately excludes narrowed releases such as
324
- 2.6.0; `NATIVE_V2_ANY_OPERATION_VERSIONS` is the separate scoped union, so an
325
- automatic full-swarm pin does not silently become a non-swarm-only pin.
347
+ certification. That export excludes narrowed releases such as 2.6.0 and includes exact 2.6.2
348
+ under its certified bounded-swarm construction. `NATIVE_V2_ANY_OPERATION_VERSIONS`
349
+ is the separate scoped union, so an automatic full-swarm pin does not silently
350
+ become a non-swarm-only pin.
326
351
 
327
352
  ## The setup probe
328
353
 
@@ -2,7 +2,9 @@
2
2
 
3
3
  Normal stop: use `scripts/companion.sh cancel` for a shell-owned run, or the MCP job cancel tool for an MCP-owned run. A hard kill cannot execute cleanup. Cancellation still starts no fresh cleanup server.
4
4
 
5
- For exact CLI 2.3.2, 2.3.3, 2.4.0, 2.4.1 and 2.5.0/2.5.1/2.5.2/2.5.3 swarm runs created by this runtime, status includes a durable `swarm_recovery` record. It contains the resolved home/workspace, companion identity, launch intent, verified process identities and session identity. It never contains the web authentication token, credentials, prompt or config contents. Session identity is committed before the request enabling swarm mode.
5
+ For exact CLI 2.3.2, 2.3.3, 2.4.0, 2.4.1 and 2.5.0/2.5.1/2.5.2/2.5.3 swarm runs, plus exact-2.6.2 parallel runs, status includes a durable `swarm_recovery` record. It contains the resolved home/workspace, companion identity, launch intent, verified process identities and session identity. It never contains web authentication tokens, credentials, prompts or config contents. Session identity is committed before enabling swarm mode. The exact-2.6.2 concurrency-1 path starts a direct worker without a mutable swarm session, so it does not create an activation-recovery record; normal cancellation and patch capture still apply.
6
+
7
+ Exact-2.6.2 parallel sessions retain their native `TaskStop`-disabled policy after normal deactivation or recovery. Recovery does not remove it. The bounded construction covers the managed job; resuming that historical session interactively through another client is outside its certification.
6
8
 
7
9
  The exact 2.6.0 swarm integration is candidate-only: the narrowed 2.6.0 non-swarm certification excludes both swarm operations and does not certify this recovery path. Recovery canonicalizes `record.cwd` only for session deactivation through symlinked execution parents. Ownership, workspace, and patch checks continue to use the original recorded alias.
8
10
 
@@ -19,7 +21,7 @@ Preview does not signal processes, modify sessions, or capture patches. Apply:
19
21
 
20
22
  1. Requires the original companion to be gone and acquires an identity-checked recovery claim. A second recovery cannot race the first; a dead recovery owner can be reclaimed by compare-and-swap.
21
23
  2. Revalidates recorded processes and groups. It stops only verified individual identities, never a guessed PID or unproven group. An unknown surviving group member, changed group, incomplete probe or unrecorded launch refuses recovery.
22
- 3. If session cleanup is pending, requires the selected exact certified CLI and valid managed hook. It starts one bounded authenticated web lifecycle, disables the recorded session's swarm mode, verifies the version-appropriate state proof and exit journal, then verifies process quiescence. On 2.5.0/2.5.1/2.5.2/2.5.3 this includes the local environment binding and protocol-v2 WebSocket main-agent state rather than `/status`. It does not resume a prompt, generate model output, install hooks or retry failed cleanup automatically. New recovery web launches are themselves journaled. Deactivation uses the realpath of `record.cwd`; the original recorded alias remains the ownership, workspace, and patch-check boundary.
24
+ 3. If session cleanup is pending, requires the selected exact certified CLI and valid managed hook. It starts one bounded authenticated web lifecycle, disables the recorded session's swarm mode, verifies the version-appropriate state proof and exit journal, then verifies process quiescence. On 2.5.0/2.5.1/2.5.2/2.5.3 this includes the local environment binding and protocol-v2 WebSocket main-agent state rather than `/status`. On exact 2.6.2 parallel sessions it uses authenticated direct-subscription state proof and the same local binding checks. It does not resume a prompt, generate model output, install hooks or retry failed cleanup automatically. New recovery web launches are themselves journaled. Deactivation uses the realpath of `record.cwd`; the original recorded alias remains the ownership, workspace, and patch-check boundary.
23
25
  4. Captures a binary patch from a retained write worktree. It does not apply the patch or delete the tree. The result names both paths for inspection.
24
26
 
25
27
  The recovery attempt has a 30-second cancellation signal, with bounded identity probes and normal teardown. Interrupting recovery retains its journal. An already-recovered record is an idempotent no-op. Failed/cancelled/completed job outcomes are immutable; a previously running abandoned job becomes failed, never completed. Recovery status is separate from task success.
@@ -50,3 +50,16 @@ Upstream `AgentRunBatch` can exceed `maxConcurrency` during rate-limit recovery:
50
50
  - Final package validation (`non-swarm-release-final-package.log`): **333 files**, all three compiled distributions, isolated setup/check/version refusal, patched DSH host/profile with seven providers/tools and Web boot, terminal exit 0. `non-swarm-release-final-consumer.log` passed isolated npm consumer security with exit 0.
51
51
  - Codex's final review returned **APPROVE with no blocker or major findings**, after verifying persisted-plan refusals, candidate selection, 2.6.1 refusal and intersection-based full-swarm pins staying at 2.5.3. Its publication-metadata note is handled by recording the actual DSH publication timestamp at publication, as in the preceding release.
52
52
  - Claude's final review returned **APPROVE — no blockers, no majors**. Its remaining schema-scope contradiction, environment/plan lists, translated remedy text and new-swarm-certification wording were corrected, and the schema comment's compiled mirrors were regenerated. Initial findings also drove the candidate fix, complete staged snapshot, export compatibility split, evidence corrections and Git-admin assertion. Subsequent CI/publication receipts are recorded below before completion. Publication does not update installed hosts or operator CLI pins.
53
+
54
+ ## Publication receipt
55
+
56
+ Release commit `887958d7de39cf388ebc3faaffd31cabe76c5a99` passed [release-commit CI run 43452771909](https://github.com/linxule/kimi-plugin-cc/actions/runs/43452771909), including both the full check/package pipeline and Windows spawn controls. The immutable [v2.5.8 tag and GitHub release](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.8) are live. [Release-event publication run 43453807099](https://github.com/linxule/kimi-plugin-cc/actions/runs/43453807099) passed build and OIDC publish.
57
+
58
+ npm published `kimi-plugin-cc@2.5.8` at **2026-11-13T15:41:45.145Z**. The registry tarball contains 333 files and is byte-identical to the validated CI artifact:
59
+
60
+ - SHA-1: `65145489591e6873556f85a06506d0d276880441`
61
+ - SHA-256: `6fc5f44aacafa92671f5aea8e2343e6323116f81d4456dee47181481050af5f4`
62
+ - Signed SLSA provenance: sigstore log index `3857088726`
63
+ - Publish attestation: sigstore log index `3857133123`
64
+
65
+ A fresh registry installation has zero production advisories and no invalid or missing signatures. Isolated setup and `setup --check` pass with the explicit non-swarm warning; the installed runtime preserves the full-swarm pin list and enforces all six non-swarm admissions and both swarm refusals. The new certification record is present in the package. The DSH discovery timestamp is updated to the npm publication time. No installed host or operator CLI pin was changed.