# How the Conversation list demo works

This demo shows conversation history: a returning visitor picks up where they left off. Watch the strip above the help center and the "Your conversations" card on the left. Both light on the element's `mindset:conversation` event, when your conversation is saved after its first answer and when you reopen an earlier one from Conversations at the top of the chat.

Orbit is a made-up home goods store, and this is its help center. Support is where people come back: the refund they asked about on Tuesday, the delivery they chased last week. The agent sits wide on the right, and its Conversations button lists every earlier conversation you have had with it, newest first. Pick one and you are back in it, with its whole history.

## One attribute

The chat is Mindset's own `<mindset-agent>` element. The page creates it, calls `configure({ getSession, pageTools, situationalAwareness })`, and then adds the `conversation-list` attribute. That is the whole feature on the page's side. It is a presence attribute, so any value turns it on, and adding it after `configure()` only redraws the element: the conversation carries on. In your own markup you can write `<mindset-agent agent="orbit" conversation-list>`, or pass `conversationList: true` to `configure()`.

## Whose list it is

The list shows what the session can reach: this visitor's own conversations, with this one agent. The docs site's server creates that session. It gives each demo visitor a random id in a signed cookie that lasts 180 days, and uses that id as the Mindset end user. So the list is yours alone, and it is still there when you come back next month. On your first visit it is empty. A conversation joins it once its first reply is complete, because that is when the conversation is written.

## What the page sees

The page never reads the list. It listens for the element's `mindset:conversation` event, which bubbles out of the element with the conversation id and nothing else. The **Your conversations** card stays unlit until that event arrives. It lights once when this conversation is saved, and again when you reopen an earlier one, which the event marks with `replacedBecause: "switched"`. A real product stores that id against the user, so their next visit can resume the conversation they chose.

## The agent

`orbit` is a Mindset agent defined by five prompt fields, a model and two functions. `orbit-order-status` and `orbit-refund-status` hold three sample orders and one refund as literal data, so they reach nothing outside and every answer comes from them. The page gives the agent one page tool, `show_order`, which brings the order it is talking about into view on the left; it checks its argument first, because a model chose it. With every turn the page sends situational awareness: your orders, the order in view and whether the list is on. The agent knows it cannot read other conversations from inside this one, and says so rather than pretending to remember.

## Under the hood

The strip below the page shows each tool call as it happens: the two functions and the page tool, with their arguments and results.

## Build the same thing

- [The mindset-agent element](https://docs4.mindset.ai/docs/sdk/the-mindset-agent-element) covers `conversation-list` and the `mindset:conversation` event.
- [Create a session for your users](https://docs4.mindset.ai/docs/sdk/create-a-session-for-your-users) covers the identity the list is scoped to.
- [Events reference](https://docs4.mindset.ai/docs/sdk/events-reference) lists `conversation_id` and the rest.
- [Build a function](https://docs4.mindset.ai/docs/ams/build-a-function) covers functions like `orbit-order-status`.
