Skip to content
subcloakdocs

AI Activity

Connect your AI tools

Connect Claude Code, Cursor, Codex and Gemini CLI to Cloak Watch with hooks, the local gateway or telemetry, see the exact settings change first, and undo it.

The Connections tab in AI Activity lists each AI tool on your Mac and how Watch can see it: through its hooks, through Watch’s local gateway, through telemetry, or on the network. You turn each one on per tool. Watch always shows the exact change to the tool’s settings file before it writes anything, and can undo it.

  1. One row per tool
  2. Each way Watch can see it
  3. Set up or undo
  4. What Watch can't see for this tool
The Connections tab: a table of Claude Code, Cursor, Codex, Gemini CLI, Claude, GitHub Copilot and a node script, with Hooks, Gateway, Telemetry, Network and Can stop columns, and Claude Code selected with its hooks, gateway, telemetry and network each described, Undo buttons, and What Watch can't see
Column Values
Tool Claude Code, Cursor, Codex and Gemini CLI, with their versions; Claude (the desktop app), ChatGPT and GitHub Copilot when installed; other apps the network extension saw talking to AI providers
Hooks, Gateway, Telemetry, Network On, Off, Check (needs attention) or — (not available for this tool)
Can stop Yes when a connected way can stop things, Not set up, or No

Select a tool to see, for each way: whether it’s connected, what it adds, what it can stop, and Set Up… or Undo…. What Watch can’t see lists that tool’s blind spots, such as requests Claude Code sends straight to Anthropic even with the gateway on.

Tool Hooks Gateway Telemetry Network
Claude Code Yes Yes Yes Yes
Cursor Yes — — Yes
Codex Yes Yes Yes Yes
Gemini CLI Yes Not yet Not yet Yes
Claude, ChatGPT, GitHub Copilot, other apps — — — Yes
  1. Open AI Activity › Connections and select the tool.

  2. Click Set Up… next to Hooks, Gateway or Telemetry. (With nothing connected yet, the Activity tab’s Connect Claude Code… button sets up Claude Code’s hooks.)

  3. Read the sheet. At the top, Watch says what it will keep: Watch keeps what Claude Code sends and receives (prompts, model requests, tool input and output, for 7 days, secrets masked). Turn off Keep prompts and content to keep only tool names, timings and hosts. Below that, the sheet lists what changes in plain sentences, What you’ll be asked by the tool afterwards, any warnings, and the file with a diff of exactly the lines Watch adds and removes. Nothing is written until you click Apply.

    The Turn on hooks for Claude Code sheet: Adds Watch's local hook for 9 events, What you'll be asked about trusting folders, and a diff of ~/.claude/settings.json adding an http hook to 127.0.0.1:47318
  4. Click Apply. Watch keeps a copy of the old file next to it, named <file>.cloak-watch-backup, then writes exactly what the diff showed. If the file changed after the preview, Watch shows a new preview instead: The settings file changed after the preview. Review the new preview before applying.

Watch refuses to edit a settings file that isn’t valid JSON.

All three ways go in ~/.claude/settings.json (or settings.json in $CLAUDE_CONFIG_DIR).

Hooks adds one http hook for each of UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, SessionEnd, ConfigChange and InstructionsLoaded, pointing at http://127.0.0.1:47318/cloak-watch/hooks/claude-code with a 5-second timeout and a private X-Cloak-Watch-Token header (masked in the diff). No command runs, and Claude Code carries on if Watch is closed. Guard rules you set to fail closed add hooks with onFailure: "block".

What you’ll be asked: Claude Code runs hooks in a folder only after you’ve trusted that folder once; folders you already trust work at once.

Gateway sets env.ANTHROPIC_BASE_URL to http://127.0.0.1:47319/claude-code. Requests still go to where they went before, after Watch checks them (see the local gateway). If you use an HTTPS proxy, Watch also adds 127.0.0.1 and localhost to NO_PROXY. Watch refuses when Claude Code uses Amazon Bedrock, Google Vertex or Microsoft Foundry (CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, CLAUDE_CODE_USE_FOUNDRY). It works with API keys, gateway tokens and claude.ai logins.

Telemetry adds these env keys, so Claude Code reports usage to Watch on this Mac. OTEL_LOG_USER_PROMPTS is only added while Watch keeps content; with metadata only, Claude Code isn’t asked for prompt text.

~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://127.0.0.1:47318/cloak-watch",
"OTEL_EXPORTER_OTLP_HEADERS": "X-Cloak-Watch-Token=…",
"OTEL_LOG_TOOL_DETAILS": "1",
"OTEL_LOG_USER_PROMPTS": "1"
}
}

If Claude Code’s telemetry already goes somewhere else, Watch leaves it alone and says so.

If your organization’s managed settings (/Library/Application Support/ClaudeCode/managed-settings.json) allow only managed hooks, Connections says Your organisation allows only managed hooks and offers no setup for hooks.

The Cursor, Codex and Gemini CLI hooks run a small script Watch writes to ~/Library/Application Support/Cloak Watch/AI/hooks/watch-hook, with its token in a file next to it that only you can read.

The gateway is a small forwarder inside Cloak Watch, listening on 127.0.0.1:47319. A tool that uses it sends its model requests to Watch; Watch checks them against your Guard secrets rule, records them, and forwards them to the real destination.

  • It chains, it doesn’t replace. The upstream is whatever the tool used before. For Claude Code, that’s the previous ANTHROPIC_BASE_URL from its settings or your shell profile (which Watch reads but never edits), or https://api.anthropic.com. For Codex, the previous provider’s base_url, https://api.openai.com/v1, or ChatGPT’s Codex backend when you sign in with ChatGPT. If you already use a company gateway, requests still reach it.
  • Your login passes through untouched. API keys, auth tokens and claude.ai or ChatGPT logins are forwarded as they are and never stored. Watch reads only their shape, to label the login type.
  • Responses are never changed. Streamed replies pass through as they arrive.
  • It speaks Anthropic Messages, OpenAI Chat Completions and OpenAI Responses.
  • Only secrets rules run here. Guard replaces each secret in what you or a tool wrote with [REDACTED: type], or blocks the request. The system prompt, tool definitions and earlier assistant turns are flagged, not changed. Tool rules run in hooks, not here.
  • It only listens on this Mac and refuses requests from web pages.

The Connections inspector shows, for example, Gateway on 127.0.0.1:47319 · 412 requests · adds 0.6 ms.

If Subcloak turns the gateway off from the signed feed because of a problem, it stops and tools that used it go direct; Watch says so in a bar and in Settings › About.

Hooks and telemetry report to a second small server inside Watch, on 127.0.0.1:47318. It accepts only requests that carry Watch’s private token (X-Cloak-Watch-Token) and refuses requests from web pages. It never listens beyond this Mac.

Connection What happens
Claude Code hooks Claude Code can’t reach the hook and carries on (fails open).
Cursor, Codex and Gemini CLI hooks The hook script gives up after 5 seconds and allows the action.
A Guard rule set to fail closed The action is blocked instead.
Gateway The tool can’t reach its model until Watch is running again.
Telemetry The tool’s reports are lost; it keeps working.
  1. Open AI Activity › Connections and select the tool.

  2. Click Undo… next to the connection. The sheet (Turn off …) shows the diff. Watch removes only its own lines.

    The Turn off the Watch gateway for Claude Code sheet: Points Claude Code back at https://llm.example.net, with a diff restoring ANTHROPIC_BASE_URL in ~/.claude/settings.json
  3. Click Remove.

If the file is still exactly as Watch left it, Undo puts back the whole file as it was before Watch changed it. If you’ve changed it since, Undo removes only Watch’s entries, and for the gateway, restores the previous base URL. The .cloak-watch-backup copy stays next to the file. Codex telemetry is the exception: remove its [otel] table by hand.