new-hook

A guided generator for Claude Code hooks. Hooks are scripts that run when Claude Code reaches events such as using a tool or starting a session.

In plain words
What is it for?
Use it to create hooks that block Bash commands, block writes to files, block MCP tools, add context, load rules, or advise on session recovery.
Why use it?
It reduces the manual work of creating hook files, test inputs, a test runner, and the settings entry that enables the hook.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ackeskin/contexture/new-hook
Clone the repo
git clone --depth 1 https://github.com/AcKeskin/contexture
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 316 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00028 $0.00316
Opus 5 $0.00014 $0.00158
Sonnet 5 $0.00006 $0.00063
Haiku 4.5 $0.00003 $0.00032

Measured yesterday against content hash f50fb4a5f07b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

new-hook scanned grade B with 1 finding 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 yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

The skill picks a recipe (one of `bash-command-blocker`, `file-write-blocker`, `mcp-tool-blocker`, `context-injector`, `rule-prime`, `session-recovery-advisory`), prompts for a hook name, asks one question per recipe pla
commands/new-hook.md · 18 lines

What it actually says

Run the new-hook skill for the current context.

Any text after /new-hook is treated as a hint that biases recipe selection but never enough to skip the interview. Examples:

  • /new-hook — full interview from the recipe-selection step.
  • /new-hook block writes to secrets/ — hint suggests file-write-blocker; skill still confirms.
  • /new-hook PreToolUse on Bash — hint suggests bash-command-blocker; skill still confirms.

The skill picks a recipe (one of bash-command-blocker, file-write-blocker, mcp-tool-blocker, context-injector, rule-prime, session-recovery-advisory), prompts for a hook name, asks one question per recipe placeholder, detects whether to write into contexture/hooks/ or ~/.claude/hooks/ based on bootstrap state, shows a settings.json diff for confirmation, and only after y writes the four artefacts (hook + block fixture + allow fixture + Node-based runner) and merges the registration into ~/.claude/settings.json.

After writing, the skill spawns the runner and reports PASS/FAIL for both fixtures. Fail-noisy: artefacts stay on disk; the skill does not auto-revert.

See ~/.claude/skills/new-hook/SKILL.md for the full procedure.

Changes

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.

  1. yesterday First seen · 18 lines · 28 tokens per session scan B f50fb4a5f07b

Subscribe to this mod's changes

new-hook is a command published in the GitHub repository AcKeskin/contexture (2 stars, last pushed 1mo ago), licensed MIT. It adds 28 tokens to every session and 316 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.