Feature request: PostThinking hook event for reasoning content inspection

Resolved 💬 3 comments Opened Mar 30, 2026 by MasculineMallard Closed Mar 31, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Claude Code's hook system exposes Stop, PreToolUse, PostToolUse, and PreCompact events, but provides no hook point for inspecting the agent's extended thinking / reasoning content before or after it surfaces in tool calls or output.

This matters because behavioral guardrails (e.g., rules that enforce "read the full file before editing" or "review every checklist item individually") are most often violated in the agent's reasoning, not in its visible output. The agent decides internally to shortcut ("I have enough from the first 100 lines"), then produces a clean-looking response that hides the violation.

In Cursor, an afterAgentThought hook scans thinking blocks for violation patterns and catches these before they become actions. In Claude Code, the same guardrail system can only scan the final response via the Stop hook, which misses violations that never leak into output text.

Proposed Solution

Add a PostThinking (or AfterThinking) hook event that fires after the model produces an extended thinking block, with the thinking content available in the hook input payload:

{
  "session_id": "...",
  "hook_event_type": "PostThinking",
  "thinking_content": "I'll just read the first 50 lines to get the gist...",
  "message_id": "..."
}

The hook would support the same response contract as other hooks:

  • {} to allow (no action)
  • {"decision": "block", "reason": "..."} to block the response and force self-correction
  • {"additionalContext": "..."} to inject guidance before the agent acts on its reasoning

Use Cases

  1. Behavioral guardrails: Scan reasoning for shortcut patterns (partial reads, spot-checking, scope reduction) and block before they become actions. This is the primary detector layer in Cursor-based guardrail systems and the single largest enforcement gap when porting to Claude Code.
  1. Compliance auditing: Log reasoning patterns for post-hoc analysis without blocking. Useful for teams that want to understand why agents make certain decisions.
  1. Safety monitoring: Detect reasoning that precedes risky actions (e.g., the agent reasoning about deleting files or force-pushing) and inject additional caution before the action happens.
  1. Self-correction detection: Distinguish between an agent that has a bad impulse and acts on it vs. one that catches itself ("actually, the rule says I should read the full file"). This enables near-miss tracking rather than treating every thinking-level pattern as a violation.

Alternative Solutions

  • Stop hook scanning: Currently the only option. Only catches violations that leak into response text, which is a subset of actual violations. The agent's polished output often hides internal shortcuts.
  • PreToolUse heuristics: Can infer some violations (e.g., a Read call with a small limit parameter), but this is indirect and misses the reasoning behind the action.
  • Prompt-only enforcement: Relying on system prompt instructions alone. Works sometimes, but without a feedback loop, the agent has no mechanism to catch and correct its own violations.

Priority

Nice to have - Not blocking but would improve my workflow significantly

Feature Category

Hooks and automation

Additional Context

This is the single largest enforcement gap between Cursor and Claude Code hook systems. The Cursor afterAgentThought hook is documented as the "PRIMARY detector" in guardrail systems because most behavioral violations originate in reasoning, not output. The response-level scanner (which Claude Code does support via Stop) is explicitly labeled the "BACKUP detector" in those systems.

Related but distinct from #14859 (AssistantOutput hook), which captures intermediate output text between tool calls. This request is specifically about thinking/reasoning content, which is architecturally different from output text.

View original on GitHub ↗

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