session.system()
Preview the Session's base instruction snapshot and current dynamic system context
Example
const system = await session.system();What It Returns
It returns a structured system preview:
{
session_id: string;
session: {
agent_id: string;
session_id: string;
project_root: string;
created_at: string;
timezone: string;
};
blocks: Array<{
source: "core" | "instruction" | "power" | "session";
name: string;
content: string;
}>;
}The blocks can include:
- the
instruction/agentblock, combining the Agentname,id, and caller-provided staticinstruction - Downcity Agent core guidance, including default reply style, task boundaries, and document delivery rules
- registered and enabled power system text
- stable session context, including
session_id,project_root, creation time, and timezone - dynamic system context generated by the Composer for this call; the default Composer includes the latest summary when a checkpoint exists
The returned blocks follow the same system assembly order as model requests: the base instruction snapshot first, then the current Composer's context_system_blocks. Base blocks are fixed in Session memory on first assembly; later Agent instruction or power registry changes do not automatically rewrite them. Dynamic context is reassembled each time, so summary updates require no base instruction refresh. New Sessions generate base blocks from the current configuration.
To explicitly adopt the Agent's current configuration in an existing local Session, call session.syncshot().
The session creation time and timezone are the reference time context for the conversation. Dynamic values such as current time should be placed in the user message, not in instruction.
Block Order
The default Composer builds base system blocks in this order:
instruction/agent: combines the SDK-injected Agentnameandidwith the host-provided role, business rules, and response preferences.power(after_instruction): Power blocks positioned immediately after Agent instructions, such as Agent Profile.core: default Downcity Agent reply style, task boundaries, and document delivery rules.power: Power system blocks without a specified position, followed bybefore_sessionblocks such as User Profile.session: stable context for the current session.
The current context_system_blocks follow the base snapshot. The default summary is a <session-context-summary> block; no summary is added when no checkpoint exists. snapshot() and syncshot() do not freeze these dynamic blocks into the base snapshot.
core remains a separate block after Agent instructions and any after_instruction blocks. The session block describes the session itself and does not repeat the Agent identity.
Default Reply Style
The core guides the Agent to speak naturally, using everyday words and complete, short sentences. Everyday questions should get one or two sentences when enough, leading with the answer and skipping filler, repetition, and unnecessary headings. The Agent can go deeper when the user asks or the task needs it. Short replies do not reduce the research, execution, or verification needed for the work.
These defaults are shared across Session types. Task deliverables, Agent personality, and user preferences also shape the response. After updating the SDK and reloading the runtime code, new Sessions use the updated rules; existing Sessions need an explicit session.syncshot() to rebuild their system.
Example Preview Without a Summary
{
"session_id": "design-review",
"session": {
"agent_id": "reviewer",
"session_id": "design-review",
"project_root": "/path/to/project",
"created_at": "2026-05-19T14:16:25.048Z",
"timezone": "Asia/Shanghai"
},
"blocks": [
{
"source": "instruction",
"name": "agent",
"content": "# Agent Identity\n\nYou are \"Code Reviewer\" (agent id: reviewer).\n\nYou are the Downcity project assistant."
},
{
"source": "core",
"name": "default",
"content": "# Session Behavior\n\nYou are a Downcity Agent working in the user's existing environment. Follow the project's structure and conventions.\n\nSpeak naturally, like a thoughtful friend who knows the subject. ..."
},
{
"source": "power",
"name": "task",
"content": "# Task Power\n\nYou can use the `task` power to manage task definitions, execution, scheduling, and status control..."
},
{
"source": "session",
"name": "context",
"content": "Current session context:\nThis session is \"design-review\".\nThe current project root is \"/path/to/project\".\nThis session was created at 2026-05-19T14:16:25.048Z, with Asia/Shanghai as its reference timezone.\nThis creation time is a stable reference for the session and does not represent the current time for every run.\nIf the user message provides a newer current time, a relative time, or other dynamic context, prioritize the dynamic information from the user message."
}
]
}What It Does Not Do
session.system() does not write system prompts into canonical Message history.
Use system() to inspect the system context that accompanies model history; use snapshot() to persist base instructions.