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:

  • SessionStart supports additionalContext, but has no prompt.
  • UserPromptSubmit has prompt and supports additionalContext.

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 prompt in SessionStart when startup is triggered by the first user prompt, or
  • add is_first_prompt / turn_index / first-turn matcher support to UserPromptSubmit.

Goal: memory plugins can inject small prompt-specific startup context once, without broad stale SessionStart recall or recurring every-turn recall.

View original on GitHub ↗