Hooks - Allow beforeSubmitPrompt hook to inject additional context

Describe the request

Problem
The sessionStart hook can inject additional_context into a conversation, but it fires before the user types their first message. The beforeSubmitPrompt hook fires after the user submits their message (so we can read it), but it cannot inject context—only block submission.

This creates a gap: there’s no way to inject context based on the content of the user’s first message.

Use Case
We run a multi-persona AI team where different agents have different memory/context. When a user addresses “Adam” vs “John”, we want to inject that persona’s specific memory context. Currently, we must either:
Inject a default persona’s context at sessionStart (wrong if user addresses someone else)

Have agents manually load their own context on first action (works, but adds latency and requires agent discipline)

Request
Add additional_context to the beforeSubmitPrompt output schema, allowing hooks to inject context based on the prompt content before it reaches the model.

Operating System (if it applies)

MacOS

1 Like

Very keen on this for a ton of reminder injection use cases. This is very useful in opencode