Skip to content

Hooks

Instar installs behavioral hooks that fire automatically through Claude Code’s hook system. These are structural guardrails — not suggestions.

Claude Code supports two hook types:

  • PreToolUse (blocking) — Runs before a tool executes. Can block the action.
  • PreToolUse (advisory) — Runs before a tool executes. Provides guidance but doesn’t block.
  • SessionStart — Runs when a new session starts or context is compacted.
HookTypeWhat it does
Dangerous command guardPreToolUse (blocking)Blocks destructive operations: rm -rf, force push, database drops
External operation gatePreToolUse (blocking)LLM-supervised safety for external service calls via MCP tools
Grounding before messagingPreToolUse (advisory)Forces identity re-read before external communication
Deferral detectorPreToolUse (advisory)Catches the agent deferring work it could do itself
External communication guardPreToolUse (advisory)Identity grounding before posting to external platforms
Post-action reflectionPreToolUse (advisory)Nudges learning capture after commits, deploys, and significant actions
Session startSessionStartInjects identity, topic context, capabilities, and pending serendipity findings at session start
Compaction recoverySessionStart (compact)Restores identity, conversation context, and serendipity finding count when context compresses

Hooks are registered in .claude/settings.json and scripts live in .instar/hooks/. They’re installed automatically during setup.

When a blocking hook rejects an action, Claude Code receives a “blocked” response and must find an alternative approach. The agent sees the reason for the block.

Advisory hooks inject information into the agent’s context before a tool executes. The agent sees the advisory and should incorporate it, but the tool isn’t blocked.

All hook scripts are in your project directory and fully editable. You can:

  • Modify existing hooks to change behavior
  • Add new hooks for your specific needs
  • Disable hooks by removing them from .claude/settings.json