Capture effective main-call context and answer tool-free side questions.
Register after middleware that modifies the model, prompt, or settings,
including extensions. ConfigurableModelMiddleware resolves the model
early, before memory, skills, and local context enrich the prompt. Those
downstream request overrides are not returned to it with the response.
Resume and cost hooks inspect state and responses rather than the complete
model request, so neither supplies this capture point.
This separate hook snapshots the resolved request before calling the model,
allowing /btw to use it while the main response is still streaming. Main
calls also save effective instructions to the sessions database and
checkpoint generation settings on success for use after restart or
eviction. Instructions stay out of checkpoints because each checkpoint row
repeats every state value. answer invokes the model without
running the agent or writing conversation state; when saved instructions are absent,
it reuses the main agent's memory and skill loaders on a local state copy.