Borrowing it
Nothing to install: this file belongs to statecrafting/spec-spine. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/statecrafting/spec-spine/main/.claude/settings.jsongit clone --depth 1 https://github.com/statecrafting/spec-spineWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/hooks/statecrafting/spec-spine/pre-tool-use)<a href="https://agentmods.dev/hooks/statecrafting/spec-spine/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/statecrafting/spec-spine/pre-tool-use/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/hooks/statecrafting/spec-spine/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/statecrafting/spec-spine/pre-tool-use.svg" alt="Reviewed on agentmods" width="80" height="20"></a>Grade A, and why
PreToolUse scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 13 lines — stays where its author put it; the contents beside it link to each section on GitHub.
{
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "command -v jq >/dev/null 2>&1 || { echo '[hook] jq missing, push gate and PR gate skipped'; exit 0; }\npayload=$(cat)\ncmd=$(printf '%s' \"$payload\" | jq -r '.tool_input.command // empty' 2>/dev/null)\nhookcwd=$(printf '%s' \"$payload\" | jq -r '.cwd // empty' 2>/dev/null)\n# The repo the command acts on, NOT the session's project: a multi-repo session\n# pushes and opens PRs in whichever tree the command names. Honour an explicit\n# `cd <dir>` prefix, else the hook's own cwd, then ask git for the toplevel.\ntarget=$(printf '%s' \"$cmd\" | sed -n 's/^[[:space:]]*cd[[:space:]]\\{1,\\}\\([^&;|]*\\).*/\\1/p' | head -1 | sed 's/[[:space:]]*$//')\ntarget=$(printf '%s' \"$target\" | sed \"s|^~|$HOME|\")\n[ -n \"$target\" ] || target=\"$hookcwd\"\n[ -n \"$target\" ] || target=.\nroot=$(git -C \"$target\" rev-parse --show-toplevel 2>/dev/null) || root=\"$target\"\n\n# Spec 093 3.1: the protected branch is RESOLVED for the repository the command\n# acts on, never assumed to be `main`. Highest wins: $SPEC_SPINE_DEFAULT_BRANCH,\n# then the remote's own HEAD (a clone sets it, so most adopters need no\n# configuration at all), then `main` as a compatibility floor. Each step falls\n# back rather than refusing, and step 3 always answers, so the gate reaches a\n# verdict for every repository. Resolution asks git and never the spec-spine\n# binary: the push half of this hook runs on git alone, which is why it still\n# protects a repository where the binary is absent or /setup has not been run.\ndefault_branch() {\n if [ -n \"${SPEC_SPINE_DEFAULT_BRANCH:-}\" ]; then echo \"${SPEC_SPINE_DEFAULT_BRANCH}\"; return 0; fi\n h=$(git -C \"$1\" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null) && [ -n \"$h\" ] && { echo \"${h#origin/}\"; return 0; }\n echo main\n}\n\n# Anchored on the command that actually invokes the push verb (spec 093\n# 3.1). The oWhat else settings.json configures
This page is one entry in a file that holds 5. Installing the file brings all of them; each is measured and scanned on its own page.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago Changed dcadba63091b
- 1mo ago Changed 8cbd50cc99e8
- 1mo ago Changed c971e7feb4eb
- 1mo ago Changed 6ce2ed3d98c4
- 1mo ago Changed cfb697278a19
- 2mo ago First seen · 13 lines scan A 38cbac04a703
PreToolUse is a hook published in the GitHub repository statecrafting/spec-spine (11 stars, last pushed 8d ago), licensed Apache-2.0. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.
PreToolUse compared with hooks from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| PreToolUsestatecrafting/spec-spine | Hook | 11 | 8d ago | Apache-2.0 | A | — | Claude Code |
| PostToolUsesupabase/supabase | Hook | 115k | yesterday | Apache-2.0 | A | — | Claude Code |
| SessionStartsupabase/supabase | Hook | 115k | yesterday | Apache-2.0 | A | — | Claude Code |
| SessionStartgoogle-gemini/gemini-cli | Hook | 109k | yesterday | Apache-2.0 | A | — | Claude Code |
| PreToolUseapache/superset | Hook | 75k | yesterday | Apache-2.0 | A | — | Claude Code |
| PreToolUseanthropics/claude-cookbooks | Hook | 54k | 2d ago | MIT | A | — | Claude Code |
| PostToolUseanthropics/claude-plugins-official | Hook | 46k | yesterday | Apache-2.0 | A | — | Claude Code |