hookify

hookify is a command for Claude Code from kumaran-is/claude-code-onboarding. It costs 34 tokens per session (814 once invoked), scanned A, original, MIT.

A command that creates Hookify rules to warn about or block unwanted actions. Rules can match commands, edited files, prompts, or other tool calls using text patterns and conditions.

In plain words
What is it for?
Use it to create rules such as warning about debug logging, blocking risky commands, requiring a checklist, or checking specific file types and content.
Why use it?
It lets you turn a repeated project mistake or safety requirement into an automatic check.

Command for Claude Code

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/kumaran-is/claude-code-onboarding/hookify
Clone the repo
git clone --depth 1 https://github.com/kumaran-is/claude-code-onboarding

Made for: Claude Code.

Wrote 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.

agentmods badge for hookify

README.md
[![agentmods](https://agentmods.dev/badge/commands/kumaran-is/claude-code-onboarding/hookify.svg)](https://agentmods.dev/commands/kumaran-is/claude-code-onboarding/hookify)
Your own site
<a href="https://agentmods.dev/commands/kumaran-is/claude-code-onboarding/hookify"><img src="https://agentmods.dev/badge/commands/kumaran-is/claude-code-onboarding/hookify.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 814 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.00034 $0.00814
Opus 5 $0.00017 $0.00407
Sonnet 5 $0.00007 $0.00163
Haiku 4.5 $0.00003 $0.00081

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

Security

Grade A, and why

hookify 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 today.

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.

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.

.claude/commands/hookify.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hookify — Create Rule

Create a .claude/hookify.*.local.md rule file to prevent an unwanted behavior. Rules are active immediately — no restart needed.

Rule File Format

---
name: warn-console-log        # kebab-case, start with verb: warn/block/require
enabled: true
event: file                   # bash | file | stop | prompt | all
pattern: console\.log\(       # Python regex matched against relevant field
action: warn                  # warn (show message) | block (deny the tool call)
---

Message shown to Claude when rule triggers. Use markdown.

Fields for event:

  • bash → matches the command field of Bash tool calls
  • file → matches new_text/file_path of Edit/Write/MultiEdit calls
  • stop → fires when Claude tries to stop; block to enforce checklist
  • prompt → fires on user_prompt before Claude reads it
  • all → fires on every tool call

Advanced: multiple conditions (all must match)

conditions:
  - field: file_path
    operator: regex_match
    pattern: \.ts$
  - field: new_text
    operator: contains
    pattern: console.log

Operators: regex_match contains equals not_contains starts_with ends_with

Step 1 — Identify the Behavior

If $ARGUMENTS is provided: use that description as the behavior to prevent.

If $ARGUMENTS is empty: scan recent conversation for:

  • Explicit corrections ("don't do X", "stop doing Y", "I didn't ask for that")
  • Repeated patterns the user had to revert
  • Frustrated reactions

List up to 4 candidate behaviors.

Step 2 — Ask User to Confirm

Use AskUserQuestion:

  • Q1: "Which behavior(s) should become a rule?" (multiSelect: true, list each candidate)
  • Q2: For each selected — "Should this block the operation or just warn?"
    • Option A: warn — show message but allow it to proceed
    • Option B: block — deny the tool call entirely

Step 3 — Infer Pattern

For each confirmed behavior:

  1. Determine event (bash, file, stop, prompt)
  2. Write a Python regex pattern for the relevant field
  3. Test pattern mentally: does it match the bad case? Does it avoid false positives?

Read the full file on GitHub · 96 lines

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. today First seen · 96 lines · 0 tokens per session scan A f676feef5f40

Subscribe to this mod's changes

hookify is a command published in the GitHub repository kumaran-is/claude-code-onboarding (35 stars, last pushed 2mo ago), licensed MIT. It adds 34 tokens to every session and 814 once invoked, about $0.0002 per session on Opus 5. 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-03.