Skip to content

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 — no gateway, no code change in your agent.

The hook ships with the Python SDK:

Terminal window
pip install tappass

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)

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.

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.

Alternatively, the SDK CLI can launch Claude Code with the environment preconfigured:

Terminal window
tappass configure # one-time: set URL + API key
tappass run claude # governed (env vars only)
tappass run --sandbox claude # governed + OpenShell sandbox

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.