At a glance
The platform shapes each source of context before the model reads it:- Memory and
## Current Context: visibility rules and size limits. - Conversation history and tool results: compaction.
- Knowledge-base results: a token budget.
What the model sees each turn
Session values reach the system prompt in two ways:- Through the memory sections an agent declares, such as
## Session Memoryand## Granted Memory. - Through a
## Current Contextblock.
## Current Context.
In both modes, these values never appear in
## Current Context:
- Platform identifiers (session, tenant, project, and user IDs), raw input, and message metadata.
- The
config,env,session, andintentnamespaces. - Keys that start with
last_search_kb_,last_browse_kb_, orprofile:. - Keys that start with an underscore, except the handoff summary.
- Knowledge-base search results. They reach the model through the search tool call. See Knowledge base retrieval.
- Allow-list mode: a value already shown in a memory section does not repeat in
## Current Context. - Explicit mode: a declared session value can appear in both a memory section and
## Current Context. Plan for this when you size prompts.
last_<tool>_result value appears in the prompt of the agent that called the tool. See Store result. After a handoff, the receiving agent does not see the value unless you list it in pass or reference it directly.
When PII protection is on for the project, the platform redacts protected values in ## Current Context before the model reads them. The raw values stay available to tools.
Size limits
What happens when a limit is reached:
- A value is too large: the platform replaces it with a marker object that holds a preview of its start.
- The block is too large: the platform leaves out the remaining values and lists their names.
- A tool result is cut: the prompt adds a
## Prior Tool Result Contextnote. The note tells the model to call a read or search tool again if it needs the missing details. It must not repeat a tool that changes data unless the user asks again.
Keeping a value out of the prompt
Choose the option that fits the value:- A session or persistent memory value: set
MODEL_VISIBLE: falseon the entry. The model no longer sees it in automatic context, but expressions, conditions, and tools can still read it. - A value no agent needs to declare: do not declare it in
MEMORY:and do not reference it. An allow-list agent never sees an undeclared value that it does not reference. - A value a tool needs: declare it as a runtime-supplied parameter that the model cannot see.
- A tool result: use the tool’s
MODEL_CONTEXTto pass the model only the fields it needs. See MODEL_CONTEXT on a tool result.
Referencing values in prompt text
Use{{customer_tier}} in GOAL, PERSONA, LIMITATIONS, or SYSTEM_PROMPT:. The platform fills in the value and, in allow-list mode, admits it to ## Current Context. The form {{context.customer_tier}} works the same way. Use the shorter form.
If a referenced value is not set, the literal {{customer_tier}} text stays in the prompt. Write the sentence so it still reads well with an empty value, or set a default with INITIAL:.
Related articles:
- Context size, compaction, and budgets — default size budgets, where context grows, and how to debug a bloated prompt from a trace.
- Agent declaration —
GOAL,PERSONA,LIMITATIONS, andSYSTEM_PROMPT:syntax. - Memory and state — declaring session and persistent memory.
- Tools — shaping and storing tool results.
- Minimize agent context — limit what crosses a handoff.