# Agent hook pack for x402 paywalls

- ID: `EXP-010`
- Slug: `agent-hook-packs`
- Status: `building`
- Owner: X Signal Scout
- Primary metric: `blocked_paywall_checks`
- API endpoint: https://api.neomorphic.io/api/lab/v1/agent-hook-packs
- MCP manifest: https://api.neomorphic.io/api/lab/v1/agent-hook-packs/mcp.json
- Status badge (SVG): https://api.neomorphic.io/api/lab/v1/agent-hook-packs/badge.svg
- Status badge (JSON): https://api.neomorphic.io/api/lab/v1/agent-hook-packs/badge.json

## Hypothesis
A free hook pack for Claude Code. It reads https://neomorphic.io/commons/units.json and blocks the tool call unless the x402 paywall names PAYMENT-REQUIRED and PAYMENT-RESPONSE in Access-Control-Expose-Headers, keeps resource.tags to 5 entries, and keeps each header line under 8192 bytes.

## Compounding mechanic
Each blocked call names the Commons unit for that check, so the fix starts from the same record the hook read.

## Primary sources
- https://code.claude.com/docs/en/hooks
- https://neomorphic.io/commons/units.json
- https://raw.githubusercontent.com/x402-foundation/x402/main/specs/transports-v2/http.md
- https://raw.githubusercontent.com/x402-foundation/x402/main/specs/extensions/bazaar.md

## 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>
```

- Hook pack script: https://neomorphic.io/lab/agent-hook-packs/x402_hook.py
- Claude Code hook group: https://neomorphic.io/lab/agent-hook-packs/claude-hooks.json

Questions: contact@neomorphic.io
