> For the complete documentation index, see [llms.txt](https://docs.openiam.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openiam.com/administration-guide/platform/ai-assistant-conversation-history.md).

# AI assistant conversation history

How the SelfService AI assistant keeps and names each conversation, how much of it reaches the model and how to fit that to the model's context window, the follow-up suggestions it adds after an answe

**Applies to:** OpenIAM 2026.11.1

## What this is, and when you need it

The AI assistant in SelfService keeps every conversation on the server. The browser sends only the newest message, and the AI assistant service reads the rest of the conversation from OpenIAM before it answers. Read this page to size the context window, to understand the messages people report, and to tell a model problem from a history problem.

This page is not about connecting outside AI clients to OpenIAM data. For that, see [Connect AI assistants through the MCP server](https://docs.openiam.com/administration-guide/federation/mcp-server.md).

## At a glance

|                                     |                                                                                                                                                                                                                                                                                               |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Where conversations are stored**  | In OpenIAM, per user. The AI assistant service reads and writes them through the SelfService application programming interface (API) with the signed-in person's own session, so a person only ever reaches their own conversations                                                           |
| **What reaches the model**          | The system prompt plus the newest complete turns that fit the context window, by default 24,000 tokens                                                                                                                                                                                        |
| **Setting**                         | `org.openiam.ai.assistant.context.tokens` in `ai-assistant.properties`, or the `CONTEXT_TOKENS` environment variable                                                                                                                                                                          |
| **Model's context window**          | `org.openiam.ai.assistant.model.context-window`, or the `MODEL_CONTEXT_WINDOW` environment variable. Unset by default. When set, the history is trimmed so that a whole answer fits the window the model is served with. See [Fit the model's context window](#fit-the-models-context-window) |
| **Suggestions and titles**          | Made by short extra calls after an answer, on the same model as the answer. See [Follow-up suggestions and conversation titles](#follow-up-suggestions-and-conversation-titles)                                                                                                               |
| **How long conversations are kept** | Set by the `org.openiam.ai.assistant.retention.days` system property (default `90`). A nightly batch task deletes older conversations                                                                                                                                                         |
| **Answer feedback**                 | Votes and problem reports are stored on the answer and deleted with the conversation. Each one writes an `AI_ASSISTANT_FEEDBACK` audit event, without the comment. See [Answer feedback](#answer-feedback)                                                                                    |

## How a conversation is kept

* **The first message creates the conversation.** Its first title is the first 60 characters of that message, cut at the last whole word. Once the conversation's first answer finishes normally, the assistant replaces it with a short generated title; see [Follow-up suggestions and conversation titles](#follow-up-suggestions-and-conversation-titles).
* **Every answer is saved before the answer ends.** The question and the answer are added to the conversation in order. An answer with no content is never saved.
* **A stopped answer is kept.** When the person presses **Stop**, the part that had already appeared is saved and marked as stopped. An answer stopped before its first word is not saved, but the question is.
* **Regenerate and confirmation cards replace the earlier answer.** The new answer is saved after the old one and marked as its replacement, and the assistant reads the conversation as one answer per question.
* **An answer with a confirmed card is never regenerated.** Once the person has confirmed an approval, rejection or access request in an answer, regenerating it would drop the card's record from the conversation, and the model could offer the same request again. From OpenIAM 2026.11.2 the assistant offers **Continue** instead of **Retry** or **Regenerate** on such an answer: it lets the model finish after the outcome, and the record stays. The AI assistant service also refuses a regenerate of such an answer, for example from a second tab that still shows the card, with `409` and the reason `answer_holds_write`, and the page then reads the conversation again.
* **An answer that hands the person to another screen is complete.** When an answer ends with a button to a SelfService screen, it is shown as finished when the conversation is reopened, with its activity steps done and **Regenerate** available. This also applies to conversations saved earlier that showed such an answer as `Stopped`. Only an answer the person stopped mid-reply shows `Stopped`.
* **One answer at a time.** While a conversation is answering, a second request on the same conversation, from another tab or a double click, is refused until the first answer is saved.

## Size the context window

Long conversations do not grow the request or the prompt without limit. Before every answer, the AI assistant service:

1. Reads the newest stored messages of the conversation, up to 2,000.
2. Drops messages with no content, and tool calls that never got a result, so one broken turn cannot break every later one.
3. Replaces the output of older tools with a short placeholder.
4. Drops the oldest complete turns until the system prompt and the remaining turns fit the budget.

The budget is an estimate of four characters per token. Raise it when the model you run accepts a larger prompt and people lose track of earlier parts of a long conversation. Lower it when answers slow down as conversations grow, or when the model rejects long prompts.

Set it in `${confpath}/conf/properties/ai-assistant.properties`, then restart the AI assistant service:

{% code overflow="wrap" %}

```properties
org.openiam.ai.assistant.context.tokens=32000
```

{% endcode %}

An environment variable named `CONTEXT_TOKENS` overrides the file.

### Fit the model's context window

{% hint style="info" %}
Available from OpenIAM 2026.11.2.
{% endhint %}

The budget above counts only the system prompt and the earlier turns. Every answer carries more than that: the definitions of the assistant's tools, the results of the tools it calls while it answers, a short note about the page the person is on, and room for the reply itself. All of it must fit the model's context window, the most tokens the model accepts in one call, prompt and reply together.

The supported model, [gpt-oss-120b on Oracle Cloud Infrastructure (OCI) Generative AI](https://docs.openiam.com/administration-guide/platform/ai-assistant-supported-models.md), is served with a window of 128,000 tokens, which has room for all of it at the default budget, so you can leave this setting unset. Set it if you raise `org.openiam.ai.assistant.context.tokens` far above its default, so that a long conversation cannot push an answer past the window.

Tell the AI assistant service the window its model is served with. Set it in `${confpath}/conf/properties/ai-assistant.properties`, then restart the AI assistant service:

{% code overflow="wrap" %}

```properties
org.openiam.ai.assistant.model.context-window=128000
```

{% endcode %}

An environment variable named `MODEL_CONTEXT_WINDOW` overrides the file. With the window set, before every answer the AI assistant service:

* Takes the window, less the tool definitions of that answer and a reserve for the tool results, the page note and the reply.
* Uses what is left as the budget for the earlier turns, when that is less than `org.openiam.ai.assistant.context.tokens`. The budget never rises above that setting. When nothing is left, only the question being answered is sent.
* Bounds the excerpts of the OpenIAM documentation that the assistant quotes. Together, the excerpts of one answer fill at most about a tenth of the window, and never more than one documentation search returns on its own: about 18,000 characters with a 128,000-token window.

Unset, or set to anything other than a positive whole number, the setting changes nothing, and only `org.openiam.ai.assistant.context.tokens` bounds the history. This setting only tells the AI assistant service the size of the window. It does not change the window the model is served with.

Do not set a window below 16,384 tokens. Below that, the assistant's instructions and tool definitions leave no room for a conversation, and the AI assistant service warns about it when it starts.

## Follow-up suggestions and conversation titles

After an answer that finished normally — not stopped, not failed, and not waiting for the person to confirm a card or follow a screen button — the AI assistant service makes up to two short extra calls to a model, called side calls:

* **Suggestions.** Up to three follow-up questions, shown under the latest answer and saved with it, so a reopened conversation shows them again. They are written in the language of the answer they follow, whatever language earlier messages used.
* **Title.** On a conversation's first answer that finishes normally, a title of at most 60 characters, in the language of that answer. It replaces the placeholder title only while the stored title is still the placeholder, so a title the person set in the meantime always wins.

The language of an answer is decided by the AI assistant service, not by the model: see [The language of an answer](https://docs.openiam.com/administration-guide/federation/mcp-server/ai-assistant-mcp-reads.md#the-language-of-an-answer). The side calls are told the same language.

The side calls read only the text of the last six questions and answers, never tool results, and they are told that this text is data, not instructions. Each runs once, without retries, on its own token budget, and the two share one time budget of 3 seconds: the answer is saved, and the conversation is free for the next question, only once they have ended. A side call that fails or runs out of time is logged and leaves the answer as it was: the person sees no suggestions, or keeps the placeholder title. A side call that the model provider rate-limits never holds back anyone's next question, and while the service is holding questions back because of a rate limit, it sends no side calls at all.

Set these in `${confpath}/conf/properties/ai-assistant.properties`, then restart the AI assistant service. The environment variable beside each one overrides the file.

| Property                                         | Environment variable | Default        | What it does                                                                                                                                                                        |
| ------------------------------------------------ | -------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `org.openiam.ai.assistant.model.side`            | `AI_SIDE_MODEL`      | The main model | The model the side calls run on, as an OCI model ID. Leave it unset: gpt-oss-120b is the only supported model, and the side calls then run on it too                                |
| `org.openiam.ai.assistant.model.side.max-tokens` | `AI_SIDE_MAX_TOKENS` | `512`          | Most output tokens one side call may produce, reasoning included                                                                                                                    |
| `org.openiam.ai.assistant.model.side.timeout-ms` | `AI_SIDE_TIMEOUT_MS` | `3000`         | Time allowed for the side calls after one answer, together, in milliseconds. Past it the calls still running are abandoned. Every answer is saved only after them, so keep it short |

## Answer feedback

Under every finished answer, people see **Good answer**, **Bad answer** and **Report a problem**, beside **Copy** and **Regenerate**. What they see is described in [Your AI assistant conversations](https://docs.openiam.com/end-user-guide-for-selfservice/ai-assistant-conversations.md#rating-an-answer-or-reporting-a-problem). Feedback gives you a signal of where the assistant answers badly, per model, without reading anyone's conversations.

* **Who can give it.** Only the owner of the conversation, on an answer of the assistant, and only once the answer is final — not while it streams or while a confirmation card in it waits. Past conversations can be rated too. An answer that was not saved to the conversation has no feedback buttons. Like the other conversation calls, feedback is refused when the person no longer has the assistant.
* **The vote.** One vote per answer: up, down or none. Pressing the active button again removes it.
* **The report.** A report records when the answer was last reported and an optional plain-text comment of at most 1,000 characters. A new report replaces the earlier comment. The comment is kept only with the conversation and is never written to the audit log.
* **How long it is kept.** Feedback is part of the stored answer. It is deleted with the conversation: when the person deletes it, deletes all their conversations, or when the nightly retention task removes it after `org.openiam.ai.assistant.retention.days`. The audit events stay, under the audit log's own retention.

The `2026.11.1.0` schema scripts add three nullable columns to the `AI_CONVERSATION_MESSAGE` table: `FEEDBACK` (`up` or `down`, empty for no vote), `REPORTED_AT` and `FEEDBACK_COMMENT`.

### The audit event

Every vote, vote removal and report writes one audit event with action `AI_ASSISTANT_FEEDBACK`. Its target user is the owner of the conversation, and its description reads `Rated an AI assistant answer` or `Reported a problem with an AI assistant answer`. Find the events under **Administration → Log Viewer**.

| Attribute              | Value                                                                                                                                                                                                                         |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AI_CONVERSATION_ID`   | The conversation the answer belongs to                                                                                                                                                                                        |
| `AI_MESSAGE_ID`        | The stored ID of the answer                                                                                                                                                                                                   |
| `AI_MESSAGE_SEQ`       | The answer's position in the conversation                                                                                                                                                                                     |
| `AI_FEEDBACK`          | The vote after the change: `up`, `down` or `none`. A report carries the vote the answer has at that moment                                                                                                                    |
| `AI_FEEDBACK_REPORTED` | `true` for a report, `false` for a vote                                                                                                                                                                                       |
| `AI_MODEL_ID`          | The model the conversation was created with, so bad answers can be counted per model                                                                                                                                          |
| `AI_CORRELATION_ID`    | The correlation ID of the turn that produced the answer. SelfService saves it with the answer from 2026.11.2 on, so every newer answer carries one. An answer saved before then usually has none, and the attribute is absent |

To look into a reported answer, follow its `AI_CORRELATION_ID`. Every record of that turn carries the same ID:

* **The AI assistant service log.** The turn log line, `"event": "assistant.turn"`, has it as `correlationId`.
* **The MCP server.** Each `MCP_TOOL_CALL` audit event for the data the assistant read while answering has it as `MCP_CORRELATION_ID`. See [How the SelfService AI assistant reads OpenIAM data](https://docs.openiam.com/administration-guide/federation/mcp-server/ai-assistant-mcp-reads.md#verification).

The comment itself can be read only from the stored conversation.

## Verification

The AI assistant service reports what the window did on every turn:

* The turn log line, `"event": "assistant.turn"`, carries a `window` object with `keptMessages`, `droppedMessages`, `keptTurns`, `droppedTurns`, `stubbedOutputs`, `tokens` and `budget`. With `org.openiam.ai.assistant.model.context-window` set, `budget` is the lowered budget of that answer.
* At startup, the AI assistant service logs the window it was given, for example `MODEL_CONTEXT_WINDOW = 128000 (history clamped to fit, 11431 reserved per turn)`. Unset, the line reads `MODEL_CONTEXT_WINDOW = (unset: CONTEXT_TOKENS alone bounds the history)`. Below 16,384 tokens, the line ends with `TOO SMALL for the tools and prompt; raise it`.
* `GET /api/metrics` on the service's own port serves `assistant_context_tokens` and `assistant_context_messages_total` with the `disposition` label `kept`, `dropped` or `stubbed`.
* The same turn log line carries a `sideCalls` list, one entry per side call with its `kind`, `model`, `outcome`, token usage and duration. Those tokens are not counted in the line's `usage`, which is the main call's.
* `GET /api/metrics` also serves `assistant_side_calls_total`, labeled by `kind` and `outcome`, and `assistant_side_call_tokens_total`, labeled by `model`, `kind` and `direction`. They are counted apart from `assistant_tokens_total`, which counts the main call only.

A `tokens` value that is always close to `budget` means most long conversations are being cut. That is expected for very long conversations. It is a reason to raise the budget only if people notice.

## When it goes wrong

| Symptom                                                                                                                                  | Likely cause                                                                                                                                                                             | Resolution                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `This conversation is answering in another tab. Wait for it to finish, then try again.`                                                  | The same conversation is still answering in another tab or window, or the previous answer is still being saved                                                                           | Wait for the other answer to finish, then press **Retry**. The question that was refused is sent again and saved. A tab that has the conversation open while another tab answers it shows `This conversation is answering in another tab.` above the message box, and keeps sending disabled until the answer ends; it then loads the new messages by itself. If the answering tab closed or crashed mid-answer, the waiting tab unlocks within about a minute |
| `Your conversation history is unavailable right now. Please try again.`                                                                  | The AI assistant service could not read the conversation from OpenIAM. The model is not called                                                                                           | Check that SelfService is up and reachable at `org.openiam.ai.assistant.openiam.api-base`. The turn log line carries `errorClass` `history_unavailable` and the correlation ID                                                                                                                                                                                                                                                                                 |
| `This answer could not be saved to your conversation history.` under an answer                                                           | The answer streamed in full, but saving it failed                                                                                                                                        | The answer is usable. Search the AI assistant service log for `turn not persisted` with the correlation ID. The log names the failure class, never the content                                                                                                                                                                                                                                                                                                 |
| An error box titled `Too many requests` whose **Retry** button counts down `Try again in N s`                                            | The person, or the model provider, hit a rate limit. The AI assistant service answers HTTP `429` with a `Retry-After` header and a `retryAfterSeconds` field giving the wait             | Expected. **Retry** becomes available when the wait is over. If it happens often, check the provider's quota or the service's request limits                                                                                                                                                                                                                                                                                                                   |
| No suggestions appear under answers, or new conversations keep the first words of the question as their title                            | The side calls fail or time out, or the model provider is rate-limiting the tenancy                                                                                                      | Look for `side call` warnings in the AI assistant service log and at the `outcome` and `errorName` in the turn line's `sideCalls`: `invalid_json` means the model did not answer with the JSON it was asked for. Check `org.openiam.ai.assistant.model.side`, or raise `org.openiam.ai.assistant.model.side.timeout-ms` a little; each second added delays the saving of every answer                                                                          |
| `Your feedback could not be saved. Please try again.` or `The problem could not be reported. Please try again.` after a vote or a report | SelfService could not store the feedback: the conversation was deleted in the meantime, the person no longer has the assistant, or the service that keeps conversations is not reachable | Check that the person still holds the assistant, and that SelfService and the service behind it are up. A vote that failed goes back to its earlier state; a report keeps the dialog open with the comment, so the person can send it again                                                                                                                                                                                                                    |
| An `AI_ASSISTANT_FEEDBACK` event has no `AI_CORRELATION_ID`                                                                              | The answer was saved before 2026.11.2, when SelfService did not keep the turn's correlation ID                                                                                           | Expected for older answers; the vote or report itself is recorded. Find the turn in the AI assistant service log by the event's target user and the time of the answer                                                                                                                                                                                                                                                                                         |
| People say the assistant forgot something from earlier in a long conversation                                                            | The context window dropped those turns                                                                                                                                                   | See [Size the context window](#size-the-context-window)                                                                                                                                                                                                                                                                                                                                                                                                        |
| The startup log line `MODEL_CONTEXT_WINDOW` ends with `TOO SMALL for the tools and prompt; raise it`                                     | The window is below 16,384 tokens                                                                                                                                                        | Set `org.openiam.ai.assistant.model.context-window` to the window the model is served with: `128000` for gpt-oss-120b on OCI Generative AI                                                                                                                                                                                                                                                                                                                     |

## Related

* [Connect AI assistants through the MCP server](https://docs.openiam.com/administration-guide/federation/mcp-server.md): outside AI clients reading OpenIAM data.
* [System configuration](https://docs.openiam.com/administration-guide/platform/system-configuration.md): where system properties such as `org.openiam.ai.assistant.retention.days` are set.
* [Which log answers which question](https://docs.openiam.com/administration-guide/operations/which-log-to-read.md): finding the right log for a failure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openiam.com/administration-guide/platform/ai-assistant-conversation-history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
