Claude Code
TapPass ships a tappass-claude-code-hook command that plugs into Claude Code’s PreToolUse hook. Every tool call becomes a TOOL_CALL behavior posted to /v1/govern; a block decision refuses the tool.
This is the hooks way to connect, with no gateway and no code change in your agent. It governs tool calls only. For the simplest setup (route the model calls), see the Claude Code page under Connect your harness; this page is the deeper, tool-call governance.
Install
Section titled “Install”The hook ships with the Python SDK:
pip install tappassConfigure
Section titled “Configure”Register the hook in .claude/settings.json:
{ "hooks": { "PreToolUse": [ { "matcher": "*", "hooks": [ { "type": "command", "command": "tappass-claude-code-hook" } ] } ] }}Configure via environment variables (Claude Code hooks inherit the parent env):
| Variable | Purpose |
|---|---|
TAPPASS_URL |
TapPass server URL (default http://localhost:9620) |
TAPPASS_API_KEY |
Bearer key for the server (tp_dev_…) |
TAPPASS_AGENT_ID |
Stable identifier for this agent |
TAPPASS_ORG_ID |
Tenant id (unlocks per-tenant policy cascade) |
TAPPASS_SESSION_ID |
Session id; falls back to Claude Code’s own session_id |
TAPPASS_FAIL_OPEN |
Set to 1 to let tools run when TapPass is unreachable (default is fail-closed) |
What gets blocked
Section titled “What gets blocked”The hook exits 0 to allow the tool and 2 to block it, the block reason is surfaced to the agent on stderr. Policy is evaluated server-side, so updating policy needs no Claude Code restart.
Example policy
Section titled “Example policy”For example, you can block Bash tool calls whose command contains rm -rf. Rules like this are authored in the dashboard, from a template, or in plain English.
Governed launcher
Section titled “Governed launcher”Alternatively, the SDK CLI can launch Claude Code with the environment preconfigured:
tappass configure # one-time: set URL + API keytappass run claude # governed (env vars only)tappass run --sandbox claude # governed + OpenShell sandboxFull session audit (server hooks)
Section titled “Full session audit (server hooks)”The hook above governs tool calls. If you also want prompts, session starts/stops, and post-tool events in the audit trail, the server exposes a native hooks endpoint (POST /api/hooks) that accepts Claude Code’s raw hook payloads across PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, and SessionEnd, the same surface used for Cursor. Ask your platform team to enable it, or see the HTTP API.