Skip to content

Investigation-gate hook

Coined here

A Claude Code PreToolUse hook that blocks any tool call referencing a symbol the agent has not yet read into context — forcing the agent to investigate before it acts.

The investigation-gate hook is Code Majesty’s name for a PreToolUse hook that intercepts any Edit, Write, or Bash call referring to a type, method, or file the agent has not yet opened with the Read tool. The hook returns a block result with a remediation prompt: read the symbol first, then retry the call. This is how the 12-layer system enforces “no edit without context.”

Placeholder body. Replace with the full glossary entry per playbook §9. Include a JSON snippet of the hook config and a worked example of the block-and-remediate cycle.

When to use

  • Any project where agent confabulation about non-existent or stale APIs causes more wasted cycles than human supervision can catch.
  • Codebases with a high churn rate where what the agent learned an hour ago may already be wrong.

Distinguish from

A generic permission hook (which gates by tool name or path glob). The investigation gate gates by semantic dependency — what symbols the planned action references, not what tool is being called.

Related terms