Claude Code vs OpenClaw hooks: events and CLI compared

16 lifecycle moments · event names from both official hook references · updated 2026-08-24

Claude Code and OpenClaw both let you run your own code at lifecycle moments, but the two hook models are shaped by different architectures. Claude Code hooks live inside a single agent session: thirty-one PascalCase events cover the loop from SessionStart through PreToolUse, PostToolUse and Stop to SessionEnd, with a matcher field narrowing when each fires. OpenClaw hooks live in a long-running gateway that serves chat channels: sixteen colon-namespaced keys (command:new, message:received, gateway:startup) group into five families, and subscribing to a bare family name catches everything in it. The table pairs the moments that correspond; the fourth column is our note on how exact each pairing is.

Lifecycle momentClaude CodeOpenClawHow close is the match
A new conversation or session is createdSessionStartcommand:newClaude Code fires SessionStart for startup, resume, clear, compact, and fork (matcher-selectable). OpenClaw's event is tied to the /new command itself.
A session is resetSessionStartcommand:resetClaude Code treats clear as one more way a session starts; OpenClaw emits a dedicated command:reset.
Before context compactionPreCompactsession:compact:beforeNear-identical concept; Claude Code's matcher distinguishes manual from auto.
After compaction completesPostCompactsession:compact:afterBoth fire after the summary replaces history.
Work is stoppedStopcommand:stopDifferent meanings: Claude Code's Stop fires whenever Claude finishes responding; OpenClaw's fires when the /stop command is issued.
A scheduled or idle resetSessionStartsession:auto-resetOpenClaw's daily/idle reset is its own event; in Claude Code a resumed or restarted session comes back through SessionStart.
Session properties changeConfigChangesession:patchLoose equivalence: ConfigChange watches configuration files, session:patch fires on session property modification.
Inbound user inputUserPromptSubmitmessage:receivedClaude Code hooks the prompt before processing; OpenClaw hooks the inbound channel message, including transcription and preprocessing stages after it.
Audio input transcribed-message:transcribedNo Claude Code equivalent - transcription is an OpenClaw gateway concern.
Media/link preprocessing done-message:preprocessedFires whether preprocessing ran or was skipped.
Outbound message / displayMessageDisplaymessage:sentMessageDisplay is display-only while text streams; message:sent reports the send attempt with context.success.
Workspace context injectionInstructionsLoadedagent:bootstrapClaude Code fires per loaded CLAUDE.md or rules file; OpenClaw fires once before bootstrap files are injected.
Process startup / shutdownSessionEndgateway:startupClosest pairing across different architectures: Claude Code sessions end (SessionEnd); OpenClaw's long-running gateway starts, stops (gateway:shutdown) and restarts (gateway:pre-restart).
Subscribe to a whole family-commandOpenClaw accepts bare family names (command, session, agent, gateway, message) as catch-alls; Claude Code hooks subscribe per event, with matchers narrowing within an event.
List configured hooks/hooksopenclaw hooks listClaude Code's /hooks is an in-session command; OpenClaw manages hooks from the shell.
Inspect / toggle a hook-openclaw hooks info <hook-name>OpenClaw adds info, check, enable and disable subcommands; in Claude Code, hooks live in settings files and /hooks is the in-session view.

The structural difference is where filtering happens. Claude Code has many events and a matcher within each: PreToolUse alone can be narrowed by tool name, SessionStart by how the session began, StopFailure by error type. OpenClaw has fewer, more specific keys and no matcher; its docs instead warn that subscribing to an unlisted name leaves a hook silently dead, and openclaw hooks info flags such typos. Tool-call interception is the biggest one-sided gap: Claude Code's PreToolUse, PermissionRequest, PostToolUse and PostToolUseFailure have no OpenClaw counterpart, because OpenClaw hooks watch commands and messages rather than an agentic tool loop.

Management is the mirror image. OpenClaw ships a full shell CLI - openclaw hooks list, info, check, enable, disable - with an eligibility system that verifies binaries, environment variables and config before a hook can run. Claude Code keeps configuration in settings files, surfaces the current state through the in-session /hooks command, and decides at fire time via matchers. Full event tables with per-event notes are on the two reference pages below.

Full references: Claude Code (142) · OpenClaw (99) · all comparisons