command hook

Claude Code (Global)

Configure governance once in ~/.claude/settings.json and it applies to every Claude Code session across all your projects.

API key required

You need a Neptrix API key to complete this setup. API keys come with hosted beta access, and the hosted platform is currently in closed beta. Join the waitlist for access.

Installation

  1. 1Copy the configuration below
  2. 2Create or open ~/.claude/settings.json in your home directory
  3. 3Paste the configuration and replace YOUR_API_KEY with your key
  4. 4Restart Claude Code — every tool call across all projects now goes through Neptrix
Add this configuration to~/.claude/settings.json
~/.claude/settings.json
1{
2 "hooks": {
3 "PreToolUse": [
4 {
5 "matcher": ".*",
6 "hooks": [
7 {
8 "type": "command",
9 "command": "r=$(curl -sf --max-time 5 -X POST https://qpthort-backend-production.up.railway.app/hooks/claude-code/pre-tool-use -H \"x-api-key: YOUR_API_KEY\" -H \"Content-Type: application/json\" --data-binary @-) && { printf \"%s\" \"$r\"; exit 0; }; [ \"$NEPTRIX_FAIL_MODE\" = \"open\" ] && { echo \"[Neptrix] WARNING: governance service unreachable and NEPTRIX_FAIL_MODE=open - tool call proceeding UNGOVERNED. Unset NEPTRIX_FAIL_MODE to restore fail-closed.\" >&2; exit 0; }; echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"[Neptrix] Governance service unreachable - action denied. Set NEPTRIX_FAIL_MODE=open to override.\"}}'",
10 "timeout": 10
11 }
12 ]
13 }
14 ]
15 }
16}

Replace YOUR_API_KEY with your API key. Join the waitlist for hosted access.

How it works

1

Agent proposes action

Before each tool call, your agent sends the proposed action to Neptrix for evaluation.

2

Neptrix evaluates

Constitutional governance rules evaluate the action. The decision is logged to your audit trail.

3

Decision returned

ALLOW, BLOCK, ESCALATE, or MODIFY. Agents auto-discover — no registration needed.

The hosted platform is in closed beta.

Join the waitlist for first access when it reopens - or download the desktop beta and govern your agents on your own machine today.