> ## Documentation Index
> Fetch the complete documentation index at: https://ccsafetynet.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Install CC Safety Net for Your AI Coding Agent

> Install CC Safety Net across Claude Code, Codex, Gemini CLI, Copilot CLI, Kimi Code, OpenCode, and Pi. Step-by-step setup; requires Node.js 18 or higher.

CC Safety Net installs as a plugin or hook directly inside your AI coding agent — no separate process or daemon required, and there is no global `npm i -g cc-safety-net` step. It runs on **Windows, macOS, and Linux**, detecting the host OS for correct path handling and command resolution (for example, case-insensitive paths on Windows, and `cmd.exe`/PowerShell resolution via `COMSPEC`/`PATHEXT`). **Node.js 18 or higher** must be available on your system before you begin (this is why examples use `npx`/`bunx` for CLI subcommands). Choose your agent below to see the exact steps.

<Tabs>
  <Tab title="Claude Code" id="claude-code">
    Run these three commands inside Claude Code to install from the plugin marketplace:

    ```bash theme={"dark"}
    /plugin marketplace add kenryu42/cc-marketplace
    /plugin install safety-net@cc-marketplace
    /reload-plugins
    ```

    **Enable auto-updates**

    To keep CC Safety Net up to date automatically, run `/plugin`, navigate to **Marketplaces**, select **cc-marketplace**, and enable **auto-update**.
  </Tab>

  <Tab title="OpenCode" id="opencode">
    Install CC Safety Net with OpenCode's native plugin command:

    ```bash theme={"dark"}
    opencode plugin -g cc-safety-net
    ```

    <Note>
      OpenCode can sometimes keep using a stale cached plugin version. To force OpenCode to reinstall `cc-safety-net`, remove its cached package and reinstall:

      ```bash theme={"dark"}
      rm -rf ~/.cache/opencode/packages/cc-safety-net@latest
      opencode plugin -g -f cc-safety-net@latest
      ```

      If you prefer pinning a specific version:

      ```bash theme={"dark"}
      rm -rf ~/.cache/opencode/packages/cc-safety-net@latest
      opencode plugin -g -f cc-safety-net@<version>
      ```

      Restart OpenCode after updating so the plugin is loaded from the refreshed cache.
    </Note>
  </Tab>

  <Tab title="Kimi Code" id="kimi-code">
    Install CC Safety Net into your Kimi Code config:

    ```bash theme={"dark"}
    npx -y cc-safety-net hook install --kimi-code
    ```

    This writes a `[[hooks]]` block to `~/.kimi-code/config.toml` (or `$KIMI_CODE_HOME/config.toml`) that runs `npx -y cc-safety-net hook --kimi-code` on each `PreToolUse` `Bash` call. The command is idempotent, so running it again is safe. To remove it later, run `npx -y cc-safety-net hook uninstall --kimi-code`.

    Optionally install the `/cc-safety-net` skill so you can author rules interactively inside Kimi Code:

    ```bash theme={"dark"}
    npx skill add kenryu42/cc-safety-net
    ```
  </Tab>

  <Tab title="Pi" id="pi">
    Install CC Safety Net with Pi's package installer:

    ```bash theme={"dark"}
    pi install npm:cc-safety-net
    ```

    Pi loads CC Safety Net as an in-process extension (declared via the `pi.extensions` field in the package), not as a subprocess hook. The extension intercepts the `bash` tool and custom `Shell` tools (for example pi-grok-cli), resolving each call's working directory, and it also registers a `/cc-safety-net` builtin command for managing rulebooks. See [Integration Architecture](/docs/guides/integration-architecture) for details.
  </Tab>

  <Tab title="Gemini CLI" id="gemini-cli">
    Install the Gemini Safety Net extension with a single command, run from outside an interactive Gemini session:

    ```bash theme={"dark"}
    gemini extensions install https://github.com/kenryu42/gemini-safety-net
    ```

    Restart Gemini CLI (or start a new session) after installing so the extension and its hook are loaded.
  </Tab>

  <Tab title="Copilot CLI" id="copilot-cli">
    Run the following inside GitHub Copilot CLI:

    ```bash theme={"dark"}
    /plugin install kenryu42/copilot-safety-net
    ```

    <Note>
      Restart Copilot CLI after installing the plugin for it to take effect.
    </Note>

    Hook support in Copilot CLI is version-gated. Inline hook definitions in Copilot config files require Copilot CLI **1.0.8** or later, and user hook files under `~/.copilot/hooks` require **0.0.422** or later. The `copilot-safety-net` plugin handles this for you; if you configure hooks manually and hit issues, run `npx cc-safety-net doctor` — it reports the detected Copilot version and which hook sources are supported.
  </Tab>

  <Tab title="Codex" id="codex">
    Codex requires a few extra steps to enable plugin hook support before installing.

    **Step 1 — Enable plugin hooks**

    Add the following to `~/.codex/config.toml`:

    ```toml theme={"dark"}
    [features]
    plugin_hooks = true
    ```

    **Step 2 — Add the marketplace**

    ```bash theme={"dark"}
    codex plugin marketplace add kenryu42/cc-marketplace
    ```

    **Step 3 — Install the plugin via the TUI**

    Start Codex, then run `/plugins` in the TUI. Use the arrow keys to select **\[cc-marketplace]** and press **Enter** to install.

    **Step 4 — Trust the hook**

    Run `/hooks` in the TUI, select the **safety-net PreToolUse hook**, and press `t` to trust it.
  </Tab>
</Tabs>

## Verify Your Installation

After installing, run the doctor command to confirm CC Safety Net is wired up correctly and blocking commands as expected:

```bash theme={"dark"}
npx cc-safety-net doctor
# or with bun
bunx cc-safety-net doctor
```

`doctor` runs a full health check across every supported agent — hook integration, a self-test that confirms blocking works, custom-rule validation, active mode flags, recent activity, system versions, and an update check. See the [doctor command reference](/docs/reference/cli-commands#doctor) for what each check does and the flags available.

If any check fails, the output includes a description of the problem and suggested remediation steps.
