Leveraging Hooks

Skills and slash commands are powerful, but they’re deliberate — you have to remember to run them. Hooks are the passive layer: they fire automatically when Claude does something, with no manual trigger needed.

How Hooks Work

Claude Code supports PostToolUse hooks in .claude/settings.json. These fire after specific tool calls — typically Write or Edit. The hook runs a shell command and passes context about what just happened.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write",
        "hooks": [
          { "command": "python3 .scripts/enforce-blog-index.py" }
        ]
      }
    ]
  }
}

The hook can inspect what file was written and decide whether to do anything. This is where the interesting automation lives — hooks can be smart enough to act only when relevant.

Blog Index Enforcement

The most useful hook in the vault: enforce-blog-index.py fires after every file write.

It checks if the written file is inside 00 Blogs/. If it is:

  1. Creates a stub _index.md if the folder is missing one
  2. Adds the new file to its folder’s ## Table of Contents if it’s not already listed
  3. Updates the parent folder’s TOC when new subfolders appear

Why this matters for sessions: without this hook, every Claude session would need to re-scan the entire 00 Blogs/ structure to understand what exists. The hook keeps every _index.md current passively — so when Claude reads the blog indexes at session start, it gets an accurate map without re-exploring.

It’s also idempotent — running it multiple times on the same directory produces the same result. So the /organize-blogs skill also calls it explicitly at the end as a safety net.

Inbox Threshold Alert

The second hook watches 04 Inbox/. When the inbox hits 5+ unprocessed notes, it surfaces a reminder:

⚠️ Inbox has 7 notes. Consider running /organize-inbox.

This one is about preventing silent accumulation. The inbox is a capture point — notes land there from everywhere (phone, Telegram, quick desktop captures). Without a signal, it’s easy to let it fill up over weeks until it becomes a backlog that feels overwhelming to process.

5 notes is a low enough bar that the reminder fires regularly, keeping the inbox as a short-term holding area rather than a long-term storage system.

What Hooks Can’t Do

Hooks fire in response to Claude’s tool calls, not on a schedule. You can’t set a hook to run at 9am every day (that’s a cron job) or to watch for external file changes.

For scheduled automation, Claude Code has a separate scheduling system — /schedule can set up recurring remote agents. But for anything that should happen as a consequence of Claude doing something, hooks are the right tool.

The goal is a vault that maintains itself between deliberate work sessions. Hooks are what make that passive — they run quietly in the background and only speak up when something needs attention.


Related: Overview of Claude Structure — where hooks fit in the broader setup.