PreToolUse hook output on EnterPlanMode deprioritized by plan mode system prompt

Resolved 💬 3 comments Opened Mar 30, 2026 by jpicklyk Closed May 3, 2026

Description

When a PreToolUse hook is registered on EnterPlanMode and injects a <system-reminder> with prerequisite instructions (e.g., "run this skill/step before planning begins"), the hook output is consistently ignored by the model because it competes with plan mode's own detailed system prompt that arrives in the same turn.

Reproduction

  1. Register a PreToolUse hook on EnterPlanMode that injects a <system-reminder> with a prerequisite step (e.g., "invoke skill X before planning")
  2. Enter plan mode via EnterPlanMode
  3. Observe that the model skips the hook-injected prerequisite and immediately follows plan mode's Phase 1–5 workflow

Root Cause

Both the hook output and the plan mode system prompt arrive in the same model turn. The plan mode prompt is long, highly structured (numbered phases, detailed sub-steps), and presents itself as the authoritative workflow. The hook's <system-reminder> is a short paragraph that the model treats as secondary context rather than a prerequisite.

Expected Behavior

PreToolUse hook output on EnterPlanMode should be surfaced before the plan mode system prompt in the model's context, so the model processes the hook as a prerequisite step that runs before the plan mode phases begin. This preserves the hook's intent as a gate/precondition rather than optional side-context.

Suggested Fix

Order the messages so that hook-injected content for EnterPlanMode appears before (or is clearly framed as preceding) the tool's own system prompt. This could be:

  • Message ordering: Emit the hook's <system-reminder> as a separate preceding message rather than inline with the tool result
  • Plan mode prompt update: Add explicit language to the plan mode instructions like "First, process any PreToolUse hook instructions before proceeding with the phases below"
  • Framing: Wrap hook output in a higher-priority tag or prefix (e.g., <prerequisite> instead of <system-reminder>)

Impact

This affects any plugin or workflow that uses PreToolUse hooks on EnterPlanMode to inject prerequisite steps. The hook fires correctly, but its output has no practical effect because the model deprioritizes it against the plan mode instructions.

Environment

  • Claude Code version: latest (March 2026)
  • Platform: Windows 11
  • Model: Claude Opus 4.6

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗