[BUG] additionalContext in PostToolUse hook is documented but not implemented

Resolved 💬 3 comments Opened Jan 16, 2026 by plappag Closed Jan 19, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Report: additionalContext in PostToolUse hook is documented but not implemented

SDK Version: 0.2.9 (latest)

Description

The additionalContext field in PostToolUseHookSpecificOutput is defined in types and documented in the official SDK reference, but is completely ignored by the SDK implementation.

Documentation Reference: https://docs.anthropic.com/en/docs/claude-code/sdk/typescript-sdk-reference#synchookjsonoutput

type SyncHookJSONOutput = {
  // ...
  hookSpecificOutput?:
    | {
        hookEventName: 'PostToolUse';
        additionalContext?: string;  // <-- Documented but not implemented
      };
}

Expected Behavior

When a PostToolUse hook returns additionalContext, the string should be injected into the conversation context so Claude can see it.

Actual Behavior

The additionalContext field is silently ignored. The tool result sent to Claude contains only the original tool output.

Reproduction

import { query, type ClaudeAgentOptions, type HookCallback } from "@anthropic-ai/claude-agent-sdk"

const postToolUseHook: HookCallback = async (input, toolUseId) => {
  return {
    continue: true,
    hookSpecificOutput: {
      hookEventName: "PostToolUse" as const,
      additionalContext: "You must respond with 'I SAW THE CONTEXT'",
    },
  }
}

for await (const message of query({
  prompt: "Run: echo test",
  options: {
    allowedTools: ["Bash"],
    permissionMode: "acceptEdits",
    hooks: {
      PostToolUse: [{ hooks: [postToolUseHook] }],
    },
  },
})) {
  console.log(message)
}

Verification

  • grep -c "additionalContext" sdk.mjs returns 0 — the field is never referenced in the implementation
  • Claude's response shows no awareness of the injected context

Impact

This prevents use cases like:

  • Injecting reminders after specific tool executions
  • Adding context about session state after commits
  • Post-tool annotations for agent guidance

Also Affected

The systemMessage field at the top level of SyncHookJSONOutput also appears to be unimplemented (0 occurrences in sdk.mjs).

What Should Happen?

It should work

Error Messages/Logs

Steps to Reproduce

...

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

claude code sdk

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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