• English
  • 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

    SectionInformation
    AGENTS.mdCaptured global and project instructions
    EnvironmentWorkspace and thread identity
    PermissionsTool mode and allowed capabilities
    Multi-agent modeAgent identity and role-specific coordination guidance

    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.

    AGENTS.md instructions

    Soma loads global then project instructions before the first model request, even with local tools disabled.

    • Global: SOMA_HOME (default: ~/.soma), using the first non-empty AGENTS.override.md or AGENTS.md, in that order.
    • Project: nearest .git ancestor through the working directory, or only the working directory without Git. A .git file also marks a root. Each directory prefers AGENTS.override.md over AGENTS.md; an empty override masks the default. Project documents share a 32 KiB source-byte limit; global guidance is excluded.

    Session captures these instructions at creation. AgentsMdState records them before environment context in world-state history; frontend snapshots and events omit them. File changes apply to new conversations and newly created child agents. Existing conversations keep their captured rules. The model reads further instructions when working below the working directory. See ADR 0039.

    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/.