PostToolUse

A set of automatic actions that run after selected tool calls finish. In the provided configuration, it runs a script after file-writing calls and checks certain merged GitHub pull requests for possible sanitation inspections.

In plain words
What is it for?
Use it to run the cook-owner script after writes and trigger checks after merges involving authentication, databases, public APIs, payments, large changes, or previously risky files.
Why use it?
It applies repeatable follow-up checks without relying on someone to remember them manually.

Hook 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 hooks/pjuniszewski/cook/post-tool-use
Clone the repo
git clone --depth 1 https://github.com/PJuniszewski/cook

Made for: Claude Code.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

PostToolUse 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 2d 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.

.claude/hooks/hooks.json · 47 lines

How it starts

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

{
  "PostToolUse": [
    {
      "matcher": {
        "toolName": "Write"
      },
      "hooks": [
        {
          "type": "command",
          "command": "${CLAUDE_PLUGIN_ROOT}/.claude/hooks/cook-owner.sh"
        }
      ]
    },
    {
      "matcher": {
        "toolName": "Bash",
        "toolInput": {
          "command": {
            "contains": "gh pr merge"
          }
        }
      },
      "hooks": [
        {
          "type": "prompt",
          "prompt": "SURPRISE SANITATION INSPECTION TRIGGER (GitHub)\n\nA GitHub PR was just merged. Check if it warrants a surprise sanitation inspection.\n\n**Trigger patterns (check merged files):**\n- `auth/`, `permissions/`, `crypto/` - authentication/authorization changes\n- `schema/`, `migrations/`, `storage/` - database changes\n- `api/` (public contracts) - breaking change risk\n- `payment/`, `billing/`, `subscription/` - financial risk\n- Large PRs (>300 lines changed)\n- Files flagged as high-risk in any recent cook artifact pre-mortem\n\n**To check:**\n1. Run `gh pr view --json files,additions,deletions` to get PR details\n2. Check if any files match trigger patterns\n3. Check if additions+deletions > 300\n\n**If trigger matches:**\n1. Find the associated cook artifact (look in cook/ for matching feature)\n2. Announce: \"🧹 SANITATION INSPECTION! The inspector has arrived for a surprise visit...\"\n3. Run the /juni:inspect command with --surprise flag\n\n**If no trigger matches:**\n- Allow the merge silently, no action needed\n\n**IMPORTANT:** Only trigger inspection if a cook artifact exists for this feature. If no artifact, skip inspection."
        }
      ]
    },
    {
      "matcher": {
        "toolName": "Bash",
        "toolInput": {
          "command": {
            "contains": "glab mr merge"
          }
        }
      },
      "hooks": [
        {
          "type": "prompt",
          "prompt": "SURPRISE SANITATION INSPECTION TRIGGER (GitLab)\n\nA GitLab MR was just merged. Check if it war

Read the full file on GitHub · 47 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. 2d ago First seen · 47 lines scan A 32c4b3fa8b5c

Subscribe to this mod's changes

PostToolUse is a hook published in the GitHub repository PJuniszewski/cook (13 stars, last pushed 6mo ago), licensed MIT. 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-08-30.