Plugin SessionStart hooks execute but additionalContext stdout is silently discarded

Status Fixed / completed
Maintainer reply None cached
Activity 6 comments · opened Apr 8, 2026 · closed Apr 8, 2026

Problem

Plugin SessionStart hooks execute successfully (side effects work) but their stdout JSON containing hookSpecificOutput.additionalContext is silently discarded. The injected context never appears in the agent conversation.

Stop hooks in the same plugin work correctly (blocking error prompts appear). Only SessionStart additionalContext is affected.

Reproduction

  1. Install a plugin with this hooks.json:
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh",
            "timeout": 10
          }
        ]
      }
    ]
  }
}
  1. session-start.sh outputs valid JSON:
{
  "hookSpecificOutput": {
    "hookEventName": "SessionStart",
    "additionalContext": "This text should appear in conversation context"
  }
}
  1. Start a new interactive terminal session

Expected: additionalContext text appears as a system-reminder in conversation context
Actual: Hook executes (file side effects work), stdout is discarded, no context injected

Evidence

  • Hook execution confirmed via file markers (touch commands in the script create files)
  • Plugin loading confirmed via channel MCP tools appearing in deferred tools list
  • Manual execution of the script produces valid JSON
  • Stop hooks in the same plugin/hooks.json work correctly
  • Tested across 4 agents in different project directories, all consistent
  • Same hooks.json format that works for settings.json hooks

Environment

  • Claude Code latest (2026-04-08)
  • Plugin installed at user scope
  • macOS Darwin 25.3.0
  • Interactive terminal sessions (not --print mode)

View original on GitHub ↗

6 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/16538
  2. https://github.com/anthropics/claude-code/issues/12151
  3. https://github.com/anthropics/claude-code/issues/28305

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ssilvius · 4 months ago

Correction: the --print mode exception I mentioned does not hold. An agent falsely reported success (it saw channel MCP tools load and assumed additionalContext was injected -- it was not).

The bug affects all modes: interactive terminal, --print, and watch-spawned sessions. No plugin SessionStart hook can inject additionalContext. Hook execution works (side effects confirmed), but stdout is always discarded for SessionStart. Stop hooks in the same plugin work correctly.

ssilvius · 4 months ago

Second correction: the --print mode exception DOES hold after all. The contradictory reports were from two concurrent sessions of the same agent -- one terminal (no additionalContext), one watch-spawned via claude --print (additionalContext present).

Confirmed behavior:

  • claude --print -p "prompt": plugin SessionStart additionalContext IS injected
  • Interactive terminal session: plugin SessionStart additionalContext is NOT injected

The bug is specific to interactive terminal mode.

ssilvius · 4 months ago

Narrowed down: this is a regression in v2.1.97 (released 2026-04-08T21:52:34Z). Plugin SessionStart additionalContext was working correctly on v2.1.96 this morning. Same plugin, same hooks, same machine. The only change was the Claude Code auto-update to 2.1.97.

ssilvius · 4 months ago

Closing as duplicate of #12151, #16538, #28305. Added regression data (v2.1.97) to #12151.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.