Skip to content
Development
Hook

Hooks

What metraton-gaia runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

Install
$ npx -y skills add metraton/gaia --agent claude-code

Ships with metraton-gaia. Installing the plugin gets these hooks.

What fires, and when

PreToolUse

  • Runs pre_tool_use.py.

PostToolUse

  • Runs post_tool_use.py.

SubagentStop

  • Runs subagent_stop.py.

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • Runs session_start.py.

SessionEnd

  • Runs session_end_hook.py.

PreCompact

  • Runs pre_compact.py.

PostCompact

  • Runs post_compact.py.

Stop

  • Runs stop_hook.py.

TaskCompleted

  • Runs task_completed.py.

SubagentStart

  • Runs subagent_start.py.

UserPromptSubmit

Fires before Claude sees each prompt you send. A plugin can use it to inject context, so the same instruction reaches the model every turn instead of only at session start.

  • Runs user_prompt_submit.py.

ElicitationResult

  • Runs elicitation_result.py.
Read hooks/hooks.json

Where it lives

Showing the source of 6 of 12 scripts. Every one is linked above.

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

Ships withmetraton-gaia

Generative AI Architecture

Get the whole plugin, auto-invoked