Skip to content

Plugin SessionStart hooks execute but additionalContext stdout is silently discarded #45438

Closed

Description

@ssilvius

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)

Activity

  1. github-actions commented on Apr 8, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. Plugin SessionStart hooks don't surface hookSpecificOutput.additionalContext to Claude #16538
    2. [BUG] Plugin hook output not captured or passed to agent (UserPromptSubmit, SessionStart) #12151
    3. [BUG] SessionStart hook with 'compact' matcher: executes successfully but additionalContext not injected #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

  2. ssilvius commented on Apr 8, 2026

    @ssilvius
    Author

    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.

  3. ssilvius commented on Apr 8, 2026

    @ssilvius
    Author

    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.

  4. ssilvius commented on Apr 8, 2026

    @ssilvius
    Author

    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.

  5. ssilvius commented on Apr 8, 2026

    @ssilvius
    Author

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

  6. github-actions commented on Apr 16, 2026

    @github-actions

    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.

  7. locked as resolved and limited conversation to collaborators on Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions