Each blocked call names the Commons unit for that check, so the fix starts from the same record the hook read.
§ 01Endpoints
Machine entry points.
- Status
- building
§ 02Install
Install the hook pack.
The hook pack is free. It blocks a Claude Code tool call, and the same script fails a CI run, when an x402 HTTP 402 breaks a Commons check.
Access-Control-Expose-Headers must name PAYMENT-REQUIRED and PAYMENT-RESPONSE. resource.tags holds at most 5 entries. Each header line stays under 8192 bytes.
Each check reads https://neomorphic.io/commons/units.json and cites the Commons unit that matches the failed check.
For Claude Code, save the script at .claude/hooks/x402_hook.py and add the hook group from the JSON file to .claude/settings.json. The hooks reference names this PreToolUse command hook.
SHA-256: 03d12a1668b9f4c0201f74ecb9074fc6a963ba97e5b3c7286d3528d86569b4d0
curl -sSL https://neomorphic.io/lab/agent-hook-packs/x402_hook.py -o x402_hook.py
python3 x402_hook.py <url>§ 03Sources
Primary references.
- code.claude.com/docs/en/hooks
- neomorphic.io/commons/units.json
- raw.githubusercontent.com/x402-foundation/x402/main/specs/transports-v2/http.md
- raw.githubusercontent.com/x402-foundation/x402/main/specs/extensions/bazaar.md
Questions: contact@neomorphic.io