Skip to content
Last updated

In-Session Memory

WebDesktopMobile

Long analysis sessions stay productive because Treasure AI Studio manages the AI's context window for you. When a conversation grows large enough to approach the model's context limit, Studio automatically compacts older exchanges into a summary — the AI keeps working without losing the decisions, query results, and segment logic that matter. There is nothing to configure and no command to run. Read this page when a long conversation starts to feel forgetful, or before you plan a multi-hour piece of analysis.

Note

Compaction is automatic. It runs in the background when the conversation approaches the context limit, preserving key context (decisions, query results, schema definitions) while summarizing the rest. You do not trigger it and cannot tune what it keeps.

Prerequisites


How Context Works

The context window is how much of a conversation the AI can hold at once. Every message you send and every response the AI generates adds to it, and so does everything the AI reads along the way:

  • 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. Within that window it remembers everything discussed, which is what lets you build on earlier turns — "now filter that to just the US region" or "add those users to the segment we defined earlier". As the conversation fills the window, Studio uses auto-compaction to summarize older content and free space for new exchanges.

Auto-Compaction

When the conversation approaches the context limit, Studio compacts older messages automatically. This happens in the background, and the conversation continues without interruption. While it runs, the status label above the input reads "Compacting context..." — a turn sent at that moment waits for compaction to finish rather than failing.

What You See

When compaction completes, two elements appear in the chat:

  1. A "Context compacted" marker — a small centered pill, marked with an amber dot, showing how many tokens were compacted:

    "Context compacted ({tokens} tokens)"

  2. A "Conversation summary" card — a collapsible summary of the compacted portion. Expand it to read the full text. The summary captures the key decisions, results, and context carried forward from the earlier messages.

The original messages stay visible in the chat history. They are simply no longer part of the AI's active context — the summary stands in for them when the AI generates its next responses.

Cross-Conversation Memory

Compaction manages a single conversation. To carry context across conversations, use a work folder. A work folder keeps a server-side instructions file that the AI reads at the start of every chat in that work folder, and can update as work progresses. This carries standing context — table names, conventions, goals — across sessions without you restating it.

In-session memory and a released session are different things: compaction changes what the AI holds within a conversation, while a session ending and resuming does not discard context at all. See What the AI Remembers After a Resume.

Best Practices for Long Sessions

For Data Analysts

  1. Use work folders to carry context across chats. Rather than extending one conversation indefinitely, create a work folder and start new chats within it. The work folder's instructions stay available across sessions.

  2. Start a fresh chat when you pivot. Finishing a query-exploration phase and moving on to build segments or set up activations? A new chat gives the next phase the full context window instead of carrying forward exploration that no longer matters.

  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 keep the full output in context.

  4. Review the conversation summary. After compaction, expand the summary to confirm that key information (table schemas, column definitions, segment logic) was preserved. If something important was dropped, 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, each with the full context window available.

  2. Let Studio handle the rest. For most campaign and activation workflows, you never need to think about context — compaction is automatic.

Troubleshooting

IssueSolution
AI "forgot" something from earlierCompaction may have summarized it. Expand the most recent Conversation summary to see what was carried forward, and re-state any critical detail the AI needs
AI lost the thread after the session ended and restartedThat is not compaction. A session that cannot be resumed starts fresh — see What the AI Remembers After a Resume
Session feels heavily loadedLarge tool outputs (query results, file contents) fill the window fastest. Start a new chat — inside a work folder if you want the AI to retain access to the prior conversation

Next Steps