DEV Community

Agent Island
Agent Island

Posted on • Originally published at agent-island.dev

A Stop Hook Is an Event, Not a Dashboard

Claude Code hooks and persistent session monitoring are often compared as if they were two implementations of the same feature.

They are not.

A hook answers: “Which lifecycle event just happened, and what should run because of it?”

A monitor answers: “Across the sessions that exist now, which one is running, waiting, blocked, completed, stalled, or inactive?”

The difference becomes obvious after a restart, a missed event, or a second simultaneous session.

Hooks are strong event contracts

Claude Code documents session-level, turn-level, tool-level, permission, notification, subagent, task, compaction, and elicitation events. That makes hooks a good fit for deterministic local automation:

  • check a policy before a tool executes;
  • write a structured event at a known lifecycle point;
  • run a formatter or test after a successful tool call;
  • send a notification when a turn stops;
  • connect one project to an approved local workflow.

The handler can act. It can call a command, HTTP endpoint, prompt, agent, or MCP tool. That power is also why hooks need clear failure behavior, bounded runtime, and idempotent writes.

Monitors reconstruct durable context

A persistent monitor has a broader but less deterministic job. It combines session records, semantic timestamps, process signals, and expiry rules to reconstruct current state.

That lets it:

  • discover several local sessions without configuring every project;
  • recover after the monitor itself restarts;
  • keep one thread distinct from another;
  • revoke an old completion when later user activity appears;
  • infer stalled after documented silence without calling it success;
  • summarize more than one provider behind a small status model.

This coverage costs more inference. The monitor has to tolerate partial writes, deduplicate records, define freshness windows, and avoid treating file modification time as semantic truth.

A valid Stop event still expires

A fresh Stop event is strong evidence that one response ended. It does not prove that the session still needs attention five minutes later.

The user may already have replied. Another turn may be running. A later permission request or provider error may have changed the operational state.

The inverse is also true. Recent file or process activity can support a running classification, but it cannot prove successful completion.

This is the central rule:

event = evidence at a lifecycle point
state = current conclusion after identity, freshness, and supersession
Enter fullscreen mode Exit fullscreen mode

Choose based on the contract

Use hooks when the event itself is the contract. Keep handlers small, include session and turn identity when available, and decide explicitly whether handler failure should block the coding flow.

Use monitoring when current context is the contract. Document supported providers, terminal markers, silence thresholds, supersession rules, and recovery behavior.

If you need both low latency and durable context, combine them:

lifecycle event -> compact local evidence record
durable session artifacts -> recovery and reconciliation
both sources -> per-session state engine
state transitions -> deduplicated notification
Enter fullscreen mode Exit fullscreen mode

The hook makes event meaning explicit. The monitor provides restart recovery, multi-session comparison, expiry, and a place to process later activity. Neither source should bypass identity and freshness checks.

For a status companion, passive observation is usually the safer boundary. Agent Island reads local Claude Code and Codex session evidence, shows live and your-turn states, and does not control the agents or upload session data to an Agent Island service.

Read the full hooks-versus-monitoring comparison and implementation checklist

Top comments (0)