[FEATURE] Support additionalContext in PreToolUse hooks

Resolved 💬 7 comments Opened Dec 25, 2025 by cool-RR Closed Jan 16, 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

PostToolUse hooks support additionalContext to inject information into Claude's context after a tool runs. However, PostToolUse only fires when a tool completes successfully - it doesn't run when commands fail.

This is problematic for "first-use documentation injection" patterns where you want to show Claude the docs for a CLI tool the first time it's used. If the user runs mytool hello and hello isn't a valid subcommand (exit code 2), the PostToolUse hook never fires and Claude never sees the documentation that would help it understand the correct usage.

Proposed Solution

Add additionalContext support to PreToolUse hooks, matching the PostToolUse behavior:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "additionalContext": "Documentation or context to inject for Claude"
  }
}

This would allow hooks to inject context before the tool runs, ensuring Claude sees the information regardless of whether the command succeeds or fails.

Alternative Solutions

  1. Make PostToolUse fire on failure too - Could add a config option like "runOnFailure": true, but this changes existing behavior
  2. Have CLI tools print docs on error - Requires per-tool changes and clutters stderr
  3. Accept the limitation - But this defeats the purpose of first-use documentation injection

Priority

Medium - Enables important hook use cases

Feature Category

Hooks

Use Case Example

I have a hook that detects first-time use of CLI tools and injects their documentation (via clocki command structure + quick guide). Currently:

# First call - command fails, PostToolUse doesn't run, no docs injected
$ saffi hello
Error: No such command 'hello'.
# Claude doesn't see the saffi documentation

# Second call - command succeeds, but first-use already "spent"
$ saffi --help
# Now PostToolUse fires, but it's not first-use anymore

With PreToolUse additionalContext support:

# First call - PreToolUse injects docs BEFORE command runs
$ saffi hello
# Claude already has saffi docs, can suggest correct usage
Error: No such command 'hello'.

Additional Context

Current PreToolUse output options per documentation:

  • permissionDecision: allow/deny/ask
  • permissionDecisionReason: shown to user only, NOT to Claude
  • updatedInput: modify tool input

The permissionDecisionReason explicitly does NOT get shown to Claude, so there's currently no way to inject context in PreToolUse.

View original on GitHub ↗

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