[Bug] SessionStart hook additionalContext not persisting to transcript file
Resolved 💬 7 comments Opened Nov 18, 2025 by KJ7LNW Closed Jan 21, 2026
Bug Description
SessionStart Hook additionalContext Not Persisting to Transcript
Summary
SessionStart hook's hookSpecificOutput.additionalContext reaches the model during session
nitialization but does not persist to the transcript file on disk.
Expected Behavior
According to the Claude Code hooks API documentation (lines 571-583):
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": "My additional context here"
}
}
The additionalContext field should:
- Be added to the model's context at session start
- Persist in the transcript file for the session
- The option should be available so that it can block the model or not: that is, either the model should immediately begin processing and respond in the block case, or in the default case, add to the context as if a user entered text, but do not trigger model execution.
Actual Behavior
The context is:
- ✅ Successfully generated by the hook (verified in logs)
- ✅ Reaches the model (model can see and respond to the content during the session)
- ❌ Does NOT persist to the transcript JSONL file
Reproduction Steps
- Configure SessionStart hook to return additionalContext:
sub process {
my ($self) = @_;
$self->add_context('The purple squirrel danced gracefully under the moonlit willow tree.');
return $self->to_hash();
}
- Start a new Claude Code session (triggers SessionStart hook)
- Hook output (verified in logs):
{
"hookSpecificOutput": {
"additionalContext": "The purple squirrel danced gracefully under the moonlit willow tree.",
"hookEventName": "SessionStart"
}
}
- Query the model about the purple squirrel - model can see it ✅
- Check transcript file - context is missing ❌
Environment
- Claude Code hooks API implementation
- SessionStart hook event
- Hook output structure matches API documentation exactly
Impact
SessionStart context is ephemeral - available only during the initial session but lost if Claude is restarted
Related Documentation
- docs/claude-hook-api.md lines 571-583 (SessionStart Decision Control)
- docs/claude-hook-api.md lines 427-428 (Exit code 0 behavior for SessionStart)
Environment Info
- Platform: linux
- Terminal: vte-based
- Version: 2.0.37
- Feedback ID: ac21ca3a-e938-4c92-93cc-c782158a338d
Errors
[]This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗