⚡ Activation

💭 in your head · nothing to type

Picture the routine you repeat after every agent response — or before every task you hand it.

Don't picture this as a "manual step." Picture a clock's escapement: the anchor clicks — and the gear advances exactly one tooth, no more, no less. The click happens on its own — nobody pulled a lever. Run it in your head: what in your workflow still needs that manual click?

Which trigger would you automate first?

👁 Reflection

💭 in your head · nothing to type

If you do something after every agent action — that's a Hook.

Don't think of this as a "script." Picture a domino chain. You push the first tile — and the whole row falls by itself, one after another, without you touching a single piece. An event in Claude Code is the first tile; the Hook is everything that follows.

Notice in your head: how many "tiles" in your workflow still need you to push them one by one?

💡 Concept

Events for Hooks

Event When it fires
PreToolUse Before the agent uses a tool
PostToolUse After the agent uses a tool (after every call)
Notification When the agent wants to get your attention
Stop When the agent finishes its response (end of turn)
SessionEnd When the session ends

None of these events happens by the clock. The scheduled pipeline from module 06 is started by the OS scheduler, not a hook. But hooks do fire in the claude -p run from your run.sh. A Stop hook can, for example, notify you that the morning digest is ready.

Hook config

In .claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write",
        "hooks": [
          {
            "type": "command",
            "command": "echo \"File written: $(date)\" >> ~/claude-log.txt"
          }
        ]
      }
    ]
  }
}

The >> redirect is required here: without it, echo writes not to the log but to standard output, which Claude Code itself parses.

Practical examples