Skip to main content
Run npx -y cc-safety-net@latest install --kimi-code and choose one of two methods. The installer can write a global hook to ~/.kimi-code/config.toml, or you can install a native Kimi Code plugin from inside Kimi Code. Both run the same check on every tool call, and npx cc-safety-net doctor confirms either one is active. Kimi Code hooks fail open with either method.

Install CC Safety Net in Kimi Code

In a terminal, install --kimi-code and the interactive installer ask whether to install the global hook now or print the native plugin steps. Choosing the plugin writes nothing. Outside a terminal, for example in CI, the flag installs the global hook without asking.
1

Run the installer

In a terminal, choose the global hook in the prompt.
2

Confirm the hook is active

To write rules from inside Kimi Code, add the rule authoring skill.

What the Kimi Code global hook install changes

The installer writes a [[hooks]] block to ~/.kimi-code/config.toml, or to $KIMI_CODE_HOME/config.toml when KIMI_CODE_HOME is set. The block runs npx -y cc-safety-net hook --kimi-code on each PreToolUse call.

What the Kimi Code hook checks

The global hook and the plugin run the same check on every tool call. They analyze Bash calls as shell commands and inspect the inputs of other tools for protected paths.

What happens when the Kimi Code check fails

Kimi Code hooks fail open. With either method, a hook process that cannot start, crashes, or times out lets the tool call proceed. Kimi Code also ignores every hook in config.toml when one hooks entry is invalid. See Invalid hooks entries in Kimi Code.

Kimi Code coverage limits

In kimi web and ACP sessions, Kimi Code sends the server’s launch directory as the payload cwd, not the session’s own directory. So CC Safety Net checks every Bash call in those sessions against the directory the server was launched from:
  • CC Safety Net resolves relative paths, and the rules about paths outside the working directory, against the wrong directory. That can block a safe command or allow one the rules would block.
  • The hook denies a cwd argument that names the session directory when that directory is outside the server’s launch directory.
Terminal kimi sessions are unaffected. Only Kimi Code can close this gap, by sending the session directory.

Move from the global hook to the native plugin

Install the plugin and confirm it is active first, then remove the global hook:
A short overlap where both run only repeats the denial message. A gap with neither active leaves you unprotected.

Update CC Safety Net in Kimi Code

update refreshes the global hook but never the native plugin. For the plugin, it prints:

Uninstall CC Safety Net from Kimi Code

Uninstall removes only the global hook. It does not touch the native plugin.

Troubleshoot Kimi Code

Invalid hooks entries in Kimi Code

Kimi Code ignores every hook in config.toml when one hooks entry breaks its schema. So doctor checks every [[hooks]] entry, not only the CC Safety Net one, and prints this error for each bad entry:
<n> counts entries from 1. <problem> is one of these:

Kimi Code plugin is installed but not enabled

doctor reads the plugin record from installed.json under plugins in the Kimi home, $KIMI_CODE_HOME or ~/.kimi-code. A record that is not enabled prints:
Run /plugins enable cc-safety-net in Kimi Code. When doctor cannot read that file, it prints Cannot read <path>, so doctor cannot tell whether the Kimi Code plugin is installed and exits 1.
Last modified on October 22, 2026