RaiCentral

Docs / Integrations

Coding-tool hooks

Check tool, MCP and shell actions from Cursor and Gemini CLI hook points.

Hooks are early. Local hooks can be changed by anyone with access to the machine, and a connected integration does not mean complete coverage. Confirm that a denied action is really blocked in the client version you use.

ClientEnforcedObserved only
CursorMCP calls, shell commandsPrompt, model output
Gemini CLIToolsPrompt, model request and response
Claude CodeDo not rely on it yet (see below)—

Set up

  1. Register the tools and MCP servers the coding agent uses, and declare them on its agent version.
  2. Create a runtime identity and credential.
  3. Open the identity in the console and generate the client setup, or call POST /v1/runtime-identities/{id}/client-integrations/{client}/setup with cursor or gemini_cli.
  4. Install the bridge from the repository (uv sync provides rai-hook) and place the wrapper where the generated command points.
  5. Set RAI_BASE_URL and RAI_AGENT_KEY, merge the generated configuration, and run Test Connection.
Cursor, enforcement hooks (trimmed)
{
  "version": 1,
  "hooks": {
    "beforeMCPExecution": [
      { "command": ".cursor/hooks/rai-hook cursor beforeMCPExecution", "timeout": 10, "failClosed": true }
    ],
    "beforeShellExecution": [
      { "command": ".cursor/hooks/rai-hook cursor beforeShellExecution", "timeout": 10, "failClosed": true }
    ]
  }
}
Gemini CLI, enforcement hook (trimmed)
{
  "hooks": {
    "BeforeTool": [
      {
        "matcher": "*",
        "hooks": [
          {
            "name": "rai-runtime-enforcement",
            "type": "command",
            "command": "$GEMINI_PROJECT_DIR/.gemini/hooks/rai-hook gemini BeforeTool",
            "timeout": 10000
          }
        ]
      }
    ]
  }
}

Enforcement hooks deny when the bridge cannot reach RaiCentral or the key is missing. Observation hooks never block. Set RAI_HOOK_DEBUG=1 to log mapping and decisions to standard error.

Claude Code

The configuration and deny response that the current build produces do not match Claude Code's documented hooks format, so a denied tool call may still run. Support will be documented here once the adapter is updated and verified.