feat: support prompt-aware startup context for memory hooks
Open 💬 0 comments Opened May 12, 2026 by dergachoff
Problem
SessionStart is the natural hook for loading memory, but its input is prompt-blind. It has cwd, source, session_id, model, and permission mode, but no user prompt.
UserPromptSubmit does include prompt and can return additionalContext, but it runs on every turn and has no first-turn matcher. Memory plugins that want prompt-specific startup recall must implement their own first-turn state.
Evidence
Current docs/schemas show:
SessionStartsupportsadditionalContext, but has noprompt.UserPromptSubmithaspromptand supportsadditionalContext.
Related but different: #19385 covers PreToolUse.additionalContext; #21696 covers hiding hook context from the TUI.
Expected fix
Add a supported first-prompt memory path. For example:
- include an optional
promptinSessionStartwhen startup is triggered by the first user prompt, or - add
is_first_prompt/turn_index/ first-turn matcher support toUserPromptSubmit.
Goal: memory plugins can inject small prompt-specific startup context once, without broad stale SessionStart recall or recurring every-turn recall.