Model context
Core assembles each request from conversation history, role instructions, captured settings, and the tools available to that step.
Capture a stable view
TurnContext identifies the conversation, turn, and workspace. StepContext
adds the model selection, project role, agent guidance, and finalized tool router.
The request and its tool execution share this snapshot; later configuration
changes take effect at a future step.
Describe the world
The first step records these sections in full. Later steps record replacements only when values change. Their comparison baseline and rendered fragments stay with runtime history, so replay retains context across successful and failed requests without repeatedly appending unchanged instructions.
Preserve provenance
History keeps user input, assistant output, tool calls and results, steering, messages, and completion notifications in execution order. Messages and worker reports carry their source identity. They remain data and grant no new user authorization.
Provider-private replay items stay scoped to their originating configuration. Provider switching preserves visible conversation and tool history.
Fork a child
A child can inherit all, some, or none of the parent's turns. The filtered fork keeps user inputs and final assistant replies. Its first step captures fresh identity, permissions, and environment for the child's own conversation.
Implementation: context/world_state/.