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

# hook コマンド

> cc-safety-net hook のリファレンスです。エージェントが呼び出すランタイムフックのエントリーポイント、エージェントごとの連携フラグ、代わりに CC Safety Net をプロセス内に読み込むエージェントを説明します。

`hook` は、エージェントがツールを実行する前に呼び出すコマンドです。エージェントのフック入力を標準入力から JSON として読み取り、呼び出しをブロックする場合はそのエージェントの拒否形式で応答します。設定はエージェントのプラグインや設定ファイルが行うため、通常は手で実行しません。

たとえば `install --cursor` は、次のコマンドを Cursor のフック設定に書き込みます。Cursor はツールを呼び出すたびにこのコマンドを実行します。

```bash theme={"dark"}
npx -y cc-safety-net hook --cursor
```

## hook の連携フラグ

`hook` には、エージェントを示す連携フラグを 1 つだけ指定する必要があります。フラグがない場合や複数ある場合は、`hook requires exactly one integration flag. Try: cc-safety-net hook --kimi-code` とコマンドのヘルプを表示し、`1` で終了します。

| フラグ | エージェント | レガシーフラグ |
| - | - | - |
| `-ac`, `--agy-cli` | [Antigravity CLI](/docs/ja/installation/antigravity-cli.md) | なし |
| `-cc`, `--coding-cli` | [Coding CLI（Claude Code）](/docs/ja/installation/claude-code.md) | `--claude-code`。最上位形式の `cc-safety-net -cc` と `cc-safety-net --claude-code` も使える |
| `-cx`, `--codex` | [Codex](/docs/ja/installation/codex.md) | なし |
| `-cu`, `--cursor` | [Cursor](/docs/ja/installation/cursor.md) | なし |
| `-dv`, `--devin` | [Devin CLI](/docs/ja/installation/devin-cli.md) | なし |
| `-fd`, `--droid` | [Factory Droid](/docs/ja/installation/factory-droid.md) | なし |
| `-gc`, `--gemini-cli` | [Gemini CLI](/docs/ja/installation/gemini-cli.md) | 最上位形式の `cc-safety-net -gc` と `cc-safety-net --gemini-cli` |
| `-cp`, `--copilot-cli` | [GitHub Copilot CLI](/docs/ja/installation/github-copilot-cli.md) | 最上位形式の `cc-safety-net -cp` と `cc-safety-net --copilot-cli` |
| `-gb`, `--grok-build` | [Grok Build](/docs/ja/installation/grok-build.md) | なし |
| `-ha`, `--hermes-agent` | [Hermes Agent](/docs/ja/installation/hermes-agent.md) | なし |
| `-kc`, `--kimi-code` | [Kimi Code](/docs/ja/installation/kimi-code.md) | なし |

フックが何を検査し、検査に失敗したときにどうなるかは、各エージェントのページで説明しています。Claude Code では、フックがブロックする代わりにユーザーに確認を求めることがあります。[Claude Code がブロックせずに確認を求める場合](/docs/ja/installation/claude-code.md#when-claude-code-asks-you-instead-of-blocking)を参照してください。

## hook フラグのないエージェント

Amp Code、DeepSeek Harness、OpenClaw、OpenCode、Pi には `hook` のフラグがありません。これらは、CC Safety Net をプラグインまたは拡張機能として自身のプロセス内に読み込みます。[連携方式](/docs/ja/guides/how-it-works.md#integration-models)を参照してください。

> [!NOTE]
>
> `hook install` や `hook uninstall` というサブコマンドはありません。最上位の [`install`](/docs/ja/reference/cli/install) と [`uninstall`](/docs/ja/reference/cli/uninstall) コマンドを使ってください。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.