Skip to content
Last updated

In-Session Memory

WebDesktopMobile

Long analysis sessions stay productive because Studio manages context automatically. When the context window fills up, auto-compaction summarizes older exchanges so the AI keeps working without losing critical decisions, query results, or segment logic.

Note

Auto-compaction runs in the background when the context window approaches its limit. The AI selects what to preserve (schema definitions, query results, decisions) and what to summarize. You can also trigger compaction manually for finer control over what stays in active memory.

Objective

Keep long-running sessions productive by understanding context capacity, recognizing when compaction occurs, and using manual commands to optimize the AI's working memory before pivoting to a new analysis phase.

Prerequisites


How Context Works

Every message you send and every response the AI generates adds to the context window. This includes:

  • Your messages and the AI's replies
  • Tool call inputs and outputs (query results, file contents, API responses)
  • System messages and status updates

The AI can only reference content within the current context window. As the context fills up, Studio uses auto-compaction to summarize older content and free space for new exchanges.

Context Indicator

Studio displays a context usage indicator that shows how much of the available context window is in use.

Web & Desktop

The context usage percentage appears in the chat interface. As you chat, the percentage grows.

Mobile (iOS)

The context indicator appears in the same location, showing the current usage percentage.

Auto-Compaction

When the context window approaches its limit, Studio automatically compacts older messages to free space. This happens seamlessly — your conversation continues without interruption.

What You See

When auto-compaction occurs, two system messages appear in the chat:

  1. Context compacted — A notification pill showing the token count that was compacted:

    "Context compacted (X tokens)"

    This appears as a small pill with an amber dot, centered in the chat.

  2. Context summary — A collapsible summary of the compacted conversation:

    • Click the summary to expand and read the full text
    • The summary captures key decisions, results, and context from the compacted portion
    • Displayed with a blue dot indicator

What Happens Behind the Scenes

Technical Note

Auto-compaction summarizes earlier messages into a condensed representation that preserves key context (decisions made, query results, segment definitions) while reducing token usage. The AI references this summary when generating future responses. The original messages remain visible in the chat history but are no longer part of the active context window.

Manual Context Commands

You can manage context proactively using commands in the chat input:

CommandWhat It Does
/contextShows a detailed breakdown of current context usage — how many tokens are used, what is consuming space, and how much room remains
/compactManually triggers compaction, summarizing the conversation so far to free up context space. Useful before starting a new phase of work in the same chat
/clearClears the context entirely and starts fresh within the same chat session. Message history is preserved but the AI no longer references it

When to Use Manual Commands

Use /compact when:

  • You are about to shift focus within the same chat (e.g., finished querying data, now building a segment for a campaign activation)
  • The context indicator is approaching the limit and you want to compact on your terms rather than wait for auto-compaction
  • You want a clean summary checkpoint before a complex multi-step task

Use /clear when:

  • You want to start a completely new topic in the same chat without any prior context influencing the AI's responses
  • The AI is referencing outdated information from earlier in the conversation that is no longer relevant

Use /context when:

  • You want to understand what is consuming context space (large query results, file contents, etc.)
  • You are diagnosing why the AI seems to have "forgotten" something from earlier in the conversation — it may have been compacted

Best Practices for Long Sessions

For Data Analysts

  1. Use projects to carry context across chats. Rather than extending a single conversation indefinitely, create a project and start new chats within it. The project's instructions persist across sessions.

  2. Compact before pivoting. If you finish a query exploration phase and want to start building segments or setting up activations, run /compact first. This creates a clean summary checkpoint and maximizes available context for the next phase.

  3. Watch for large tool outputs. Query results, file contents, and API responses consume significant context. If a query returns a large result set, the AI may summarize it rather than keeping the full output in context.

  4. Review context summaries. When auto-compaction occurs, expand the context summary to verify that key information (table schemas, column definitions, segment logic) was preserved. If something important was lost, you can re-query or re-state it.

For Marketers

  1. Start a new chat for each distinct task. Audience building, journey creation, and activation setup are best handled in separate conversations where the full context window is available for the task at hand.

  2. Auto-compaction handles the rest. For most campaign and activation workflows, you will not need to use manual context commands. Studio manages the context window automatically.

Differences from Treasure Studio Labs

FeatureTreasure Studio LabsTreasure AI Studio
Context managementLocal context window, manual commands onlyServer-side context with auto-compaction
Auto-compactAvailableAvailable, with visual notifications (compact boundary + summary)
Manual commands/context, /compact, /clearSame commands, same behavior
Cross-session memoryProject instructions persisted locallyProject instructions and memory files persisted server-side. The AI can read and write memory files that carry context across conversations within the same project

Verification

  • Run /context and see a breakdown of token usage
  • Run /compact and see a "Context compacted" notification followed by a collapsible "Context summary"
  • Continue the conversation normally after compaction, with the AI referencing key prior decisions

Troubleshooting

IssueSolution
AI "forgot" something from earlierRun /context to check if compaction occurred. If it did, expand the context summary to see what was preserved. Re-state any critical information the AI needs to reference
/compact does not free much spaceCompaction summarizes prior turns but cannot reduce tool output already in context. Start a new chat if the session is heavily loaded
Context indicator not visibleThe context indicator appears only when usage exceeds 50%. Continue working — it will surface as context fills

Next Steps