session.snapshot()

Explicitly persist a local Session's base system snapshot

A local Session freezes base system blocks in memory on first assembly. Later Agent instruction or power registry changes do not automatically rewrite that base snapshot; the Composer still regenerates dynamic system context each step.

Call snapshot() to explicitly persist the Session's base system:

await session.snapshot();

The default store merges base blocks into text in their original order and writes it to session_state.system_snapshot in session.db. Later calls replace that value.

The base snapshot includes Agent identity, custom instruction, SDK core, Power system, and stable Session context. snapshot() excludes the Composer's context_system_blocks, so checkpoint summaries are never frozen into it. It does not save message history, model, or environment variables.

Recovery reads the persisted base snapshot first. If none exists, the SDK regenerates base instructions from the Agent's current instruction and powers. Dynamic summaries come from the Composer's current checkpoint. Model requests and session.system() previews both assemble the base snapshot followed by the latest dynamic context.

To adopt the Agent's current configuration before persisting, call await session.syncshot() followed by await session.snapshot(). If a persisted snapshot already exists, syncshot() also replaces it directly.

This method is available only on local AgentSession instances. A remote Session's instruction persistence policy belongs to its server host.