> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory

> Choose what to recall, whose facts to use, and what to forget.

At \$0.00 in Atlaso credit, the AI clean-up of saved messages waits, for Gateway
calls and Plugin messages alike. Saving, recall, Ambient Memory, Ask and own-key
model calls keep working. See [Credits and learning](https://docs.atlaso.ai/account/credits-and-learning.md).

## Modes

| Mode on the API keys page | Value | Behavior |
| - | - | - |
| Use only | `use` | Recall existing facts. Do not learn new ones from calls. |
| Use and learn | `learn` | Recall existing facts, and save the messages a person types in calls, as the Plugin does. See [Learning from calls](#learning-from-calls). |
| Off | `off` | Do not retrieve memory. |

Mode is a key setting, not a documented Chat Completions body parameter.
When recall succeeds but finds nothing relevant, the model can still answer.
If recall fails, the key's **If memory can't be reached** setting controls whether
the call continues without memory or returns `503 memory_unavailable` before
calling the model. Off mode has nothing to require.

## Learning from calls

Learning works only on keys set to **Use and learn** with **Memory for: Me**.
Keys set to **Each user of my app** and browser tokens never learn from calls:
save facts for your app's users with the [Memory API](https://docs.atlaso.ai/gateway/memory-api.md).
New keys whose **Memory for** is **Me** start on **Use and learn**.

The Gateway learns automatically, the way the Atlaso Plugin does. After each
successful call, Atlaso saves the newest user message in the request, whole, as
one memory. Recognised passwords, API keys and tokens are blacked out first.
Other details, such as card or ID numbers, are saved as typed. Atlaso does not
check whether a message is true or reads like a fact: questions and
instructions are saved too. Atlaso's AI then cleans the saved message into a
memory, the same clean-up as for Plugin messages.

It uses the same worth-keeping check as the Plugin, so it does not save:

* a message that is only a short reply, such as "ok", "thanks", "yes" or "go ahead";
* a message of fewer than four words, unless it holds a word such as "always",
  "never", "prefer" or "use";
* a message longer than 4,000 characters, such as a pasted log or document;
* a message that starts with a notice a coding tool adds, such as a task
  notification or a system reminder.

Atlaso cannot tell the words a person typed from text your app adds to that
message. If your app puts a retrieved document, a pasted email or other text
into the user message, that text is saved, cleaned and counted with it. For
such an app, use **Use only**.

A message that closely repeats a memory already saved in the same place saves
nothing new: Atlaso refreshes the existing memory instead. Once an account has
saved 1,000 whole messages from calls in one UTC day, Atlaso saves only asks
such as "remember that" until the next UTC day.

* **What is read:** only the newest user message, and only after the call
  succeeded. Atlaso never reads your system prompt, earlier turns, tool calls or
  results, images, files or the model's reply for learning. A call whose newest
  message is a tool result, or a message that holds only an image or a file,
  saves nothing. A failed, refused or cut-off call learns nothing.
* **Who sees it:** Atlaso's own code decides and saves the message. The
  clean-up then runs on Atlaso's AI provider, Fireworks AI, with zero data
  retention, the same as for Plugin messages. Facts you save can also be sent to
  Fireworks AI for dashboard greetings and other Atlaso AI features, on the same
  terms: see [Privacy](https://docs.atlaso.ai/account/privacy.md).
* **How it is cleaned:** each message is cleaned on its own. It is not merged
  with other memories. The cleaned memory replaces the saved message, and
  forgetting the message also forgets its cleaned memory. As with Plugin
  messages, the clean-up can drop a message it finds to be noise, so some saved
  messages leave no cleaned memory. Until it is cleaned, the message's text also
  waits in Atlaso's processing queue: see
  [Privacy and security](https://docs.atlaso.ai/gateway/privacy-and-security.md).
* **What it costs:** saving is free. The clean-up is paid from Atlaso credit at
  $0.25 per 1,000 messages, counted as on [Credits and learning](https://docs.atlaso.ai/account/credits-and-learning.md), the same as for Plugin
  messages. Every account starts with $25.00 in free credit, once. The Credits
  page shows the clean-up under the key's name. At \$0.00 the clean-up waits,
  while saving and recall keep working. Model calls on your own provider keys
  never use Atlaso credit.
* **Where it is saved:** in the key's project, or in your personal facts for a
  key with no project. Using the Plugin's rules, a message about your own
  preferences, such as "I prefer short answers", is saved to your personal facts.
  An ask such as "remember that" is always saved to the key's project, or to your
  personal facts for a key with no project.
* **How to turn it off:** set the key to **Use only** or **Off**. For one
  call, send `x-atlaso-memory: use` to recall as usual but learn nothing from
  that call, or `x-atlaso-memory: off` to neither recall nor learn.

Saying "forget that" in a chat deletes nothing, and the message can itself be
saved like any other. Delete facts as described in [Forgetting](#forgetting).
After you forget a fact, a message with the same words (ignoring case,
punctuation and spacing) does not save it again: Atlaso keeps a keyed
fingerprint of the forgotten text, never the text. It does not match
paraphrases.

### Asks such as "remember that"

Asks are still recognised, and Atlaso handles them first. When the newest user
message starts with an ask such as "remember that", "remember:", "note that",
"keep in mind that", "for future reference" or "from now on", in any letter
case, optionally after "please", "ok" or "also", and looks like one typed line
of at most 240 characters, Atlaso saves only the rest of the first sentence
after the ask, as typed. That ask is saved as stated and is not cleaned. When
an ask does not fit these rules, for example because another sentence follows,
Atlaso saves the whole message instead, as above.

## One memory for each app user

> [!WARNING]
>
> Owner-scope keys (**Memory for: Me**) use your own memory. Passing a user ID
> alone does not isolate users on an owner-scope key.

Choose **Each user of my app** under **Memory for** on the key. The memory boundary is your
account, the key's project (or, for a key with no project, the key itself), and your
app's stable user ID. Two keys with no project never share users. Keys with the
**same project** share that project's users: any of them reads, adds to and deletes
the same user's memory. Your own personal facts are not a fallback for that scope.

While the key's project (or, for a key with no project, the key itself) has any
app users, Atlaso refuses to change the key's project or its **Memory for** setting
(409 [`key_has_app_users`](https://docs.atlaso.ai/gateway/errors#key_has_app_users)). The users belong to
the project, and other keys may share that project, so deleting them removes them
for every key in it. To use other settings, create a new key instead. A key moved
into a project that already has users reads, adds to and deletes those users'
memory from then on.

A key whose memory is yours (**Me**) never answers for an app user: with its
memory on, a chat, Responses, Messages or Memory API call that sends
`x-atlaso-user` is refused with 403
[`memory_scope_owner`](https://docs.atlaso.ai/gateway/errors#memory_scope_owner) before memory and before
the provider. Use a key set to **Each user of my app** for your app's users.

On chat calls and Memory API calls, a per-user key reads the user ID from **one
source only**: the `x-atlaso-user` header, set by your app's server. Set it on each
call, not on the client:

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(base_url=os.environ["ATLASO_BASE_URL"], api_key=os.environ["ATLASO_KEY"])


def ask(user_id: str, text: str) -> str:
    response = client.chat.completions.create(
        model="openai/gpt-6-sol",
        messages=[{"role": "user", "content": text}],
        extra_headers={"x-atlaso-user": user_id},
    )
    return response.choices[0].message.content


print(ask("demo-user-42", "What is my demo project called?"))
```

Do not put `x-atlaso-user` in `default_headers` on a client your server shares
between users: every call from that client would then use the same user's memory.

The body's `safety_identifier` and `user` fields are never read as the ID for
this key, so a value a client sends there cannot choose whose memory is used.
They still reach the provider as usual. If either names a **different** user than
the header, the call is refused with 400 [`user_id_conflict`](https://docs.atlaso.ai/gateway/errors#user_id_conflict)
naming the field; the same value is fine. Without the header the call has no user
ID, whatever the body says.

**Keep the app key on your server.** It must never reach a browser, mobile app or
other device: anyone holding it can name any user ID. Resolve the ID on your
server from the signed-in user, never from a request field your client controls.
IDs are used exactly as supplied, with no trimming or case folding. Use an opaque
app ID, not a name, email or secret.

The ID must be a printable string, not just spaces, at most 256 characters, and
must not look like a secret. Send it as plain ASCII. The OpenAI SDKs cannot send
other characters in a header intact, and Atlaso rejects a header value that is not
valid UTF-8. For an ID with other characters, send a hash or a percent-encoded
form, and send it the same way every time. `x-atlaso-user` stays at Atlaso and is
never sent to the provider.

### Without a user ID

For a per-user key, a call with no user ID is answered **without memory**.
It never falls back to shared or owner memory. Missing, null and empty IDs count
as absent. The memory header reports `status=skipped` with `reason=no_user_id`.
A rejected ID similarly skips memory with `reason=user_id_rejected`.
Other call checks, such as authentication and provider availability, still apply.
The Memory API itself requires an ID and returns an error when it is missing.

### Keys that require memory

If a per-user key's **If memory can't be reached** setting is **Stop the call**
and its mode is not Off, a call without a usable user ID is refused instead,
before the model is called:

| HTTP | `error.code` | When |
| - | - | - |
| 400 | `user_id_required` | No user ID was sent. |
| 400 | `user_id_not_accepted` | The user ID was rejected. The message says why, never the ID itself. |

Every per-user key, required or not, refuses a call whose `safety_identifier` or
`user` field names a different user than `x-atlaso-user` (400 `user_id_conflict`).

All three carry `x-should-retry: false`: sending the same call again will not help.
Fix the ID and send the call again.

## Shared memory for a project

Shared memory holds facts your server or dashboard writes once for a project.
Every app user of that project can receive those facts beside their own. For
example, you can save support hours or a product policy once. A key must use
**Each user of my app** and have a project. Owner keys and project-less keys
cannot use shared memory. Shared facts never include your personal owner memory.

Use `atlaso.shared` on a server-key client, not on `forUser(id)` or
`for_user(id)`. The [SDK example](https://docs.atlaso.ai/gateway/sdk.md#shared-memory) adds a fact and shows it in a
chat receipt. Delete every shared fact with `shared.deleteAll()` in TypeScript
or `shared.delete_all()` in Python, in the separate warned example. The wire routes are `POST` and `GET
/v1/memory/shared/facts`, `DELETE /v1/memory/shared/facts/{id}`, and
`DELETE /v1/memory/shared`. Do not send `x-atlaso-user` on these routes.
Browser tokens cannot access them. Shared facts are kept until deleted or the
account is erased; revoking a key does not delete them.

A shared fact is `{"id", "object": "memory.shared_fact", "created", "text",
"source"}`; it has no app-user label. The list answer is newest first and
carries `total`, the project's shared fact count, on every page. `POST
/v1/memory/shared/facts` accepts the same optional `Idempotency-Key` header as
`POST /v1/memory/facts`: resending the same text with the same key within 24
hours returns the first fact with `x-atlaso-idempotent-replay: true`, while the
fact still exists. After you delete the fact or all shared facts, a resend with
that key within its 24 hours returns `409 fact_replaced` with `replaced_by` null
and saves nothing. If you pass your own key, make it random: a key derived from
the text makes the stored key a keyed hash of that text.

When a call has a usable user ID and memory is on, Atlaso can add up to three
shared facts within 768 bytes, leaving the rest of the eight-line, 2,048-byte
memory note for that user's facts. The user's own stated fact wins if text is
duplicated. A shared read failure does not stop the model call, including on
a key that requires memory. `x-atlaso-memory: off` turns off both parts for
one call. A call with no user ID gets neither part.

The `x-atlaso-memory` header adds `shared=<ids>` only when shared facts were
put into the prompt. Those IDs are a subset of `ids`. The SDK exposes them as
`receipt.memory.sharedIds` or `receipt.memory.shared_ids`.

## Inspect memory use

Every reply includes the `x-atlaso-memory` header, with six fields and an
optional seventh for shared facts:

```
status=...; ids=...; ms=...; reason=...; added=...; action=...
```

* `status` is `used`, `none`, `off`, `skipped`, or `bypass` for a reply that did
  not go through normal chat recall.
* `ids` is a comma-separated list of memory IDs, not memory text.
* `ms` is the time Atlaso spent on the call before it reached the provider, in
  milliseconds. It is not recall time alone.
* `reason` explains the status, such as `no_match`, `key_mode_off` (the key is
  set to Off), `request_off` (the call sent `x-atlaso-memory: off`), or a recall
  failure.
* `added` counts the facts added to the model request.
* `action` is `added`, `none`, or `off`.
* `shared` is present only when shared facts were added, and lists their IDs.

A key in Off mode does not call recall. Refusals before the key is checked report
what is known: no memory was added, with the refusal reason. Use `x-request-id`
when asking for help.

## Forgetting

Delete owner memories through the dashboard's Memory controls. For app users,
the [Memory API](https://docs.atlaso.ai/gateway/memory-api.md) deletes one fact or a user's memory
within the key's project. A successful delete removes the fact from future recall.
If a delete answers `503 delete_pending`, it has begun and not finished: retry the
same delete. Until it finishes, that user's calls do not recall what is being
deleted, and adds for that user are refused. See
[Delete receipts](https://docs.atlaso.ai/gateway/memory-api.md#delete-receipts).

A model saying “I've forgotten that” is not a deletion receipt. Atlaso deletes
nothing because of what a chat says, and learns from a chat only as described in
[Learning from calls](#learning-from-calls). Also remove forgotten
facts from the chat history you send: deleting stored memory cannot erase text
already in your app's messages or in an earlier response.

## Off means off, delete means deleted

Per-user recall reads the user's current facts on each call. Atlaso does not
cache fact text between calls. Calls begun after a successful delete cannot
recall the deleted fact from Atlaso. A request already sent to a provider cannot
be recalled, and text your app sends again in chat history is outside
stored-memory deletion. While a delete for a user is in progress, that user's
calls may be answered without memory.

Automatic learning cannot restore **the same fact, worded the same way**. Atlaso
compares keyed fingerprints after folding case, whitespace and punctuation;
it does not match paraphrases. Only fingerprints are retained, never the deleted
fact's text. These fingerprints survive deleting the user's store. After a user
delete, only an explicit `POST /v1/memory/facts` can create a new store. Explicit
API adds may restore a deleted fact, but do not remove its learning protection.
Keys for an app's own users do not learn from calls.

### Memory notes stored by OpenAI

On OpenAI models through [`/v1/responses`](https://docs.atlaso.ai/gateway/responses-api), Atlaso adds
the memory note to `input`, and OpenAI receives it like the rest of your input.
When OpenAI stores the response (`store` is on by default at OpenAI) and a later
call continues it with `previous_response_id` or `conversation`, OpenAI's stored
state keeps each earlier call's note. Deleting a fact, or sending
`x-atlaso-memory: off`, does not remove notes OpenAI already stored. To make a
delete take effect on these calls, send `store: false` and the full input on each
call.

## Why did it say that

In **Activity**, open a call's right drawer and read **Memory used**. For a
request with several calls, expand **Memory used** under the individual call.
It shows the facts as stored now, the recorded source tool or app, how they
were captured, and their dates on your local clock. When available, it also
shows the older facts they replaced and facts that replaced them since the call.
Missing provenance is labelled as not recorded.

**Edit** saves a correction linked to the original fact. **Forget this** asks
you to confirm before deleting the fact. A deleted fact reads **Forgotten
since this call**; its text is not recovered from a call log. A replaced fact shows its current replacement, and Edit opens that replacement. A stale edit is rejected; read the history again before saving.

Each new call records a content-free reference to the exact memory store used.
Changing a key's project later cannot redirect its history to another app user.
Older calls without a reliable store reference show **Memory history unavailable**.
Atlaso never stores your prompt or the model's answer in the call record. The
history is a view of current facts and their recorded relationships, not a
snapshot of the original prompt or proof that a fact caused the model's answer.

### Turn memory off for one call

Send `x-atlaso-memory: off` with the request (`client` is the one created
[above](#one-memory-for-each-app-user)):

```python theme={null}
response = client.chat.completions.create(
    model="openai/gpt-6-sol",
    messages=[{"role": "user", "content": "Answer without saved memories."}],
    extra_headers={"x-atlaso-memory": "off"},
)
```

That call makes no recall or memory replay lookup and adds no memory note.
The reply's `x-atlaso-memory` header has `status=off` and `reason=request_off`. The
override applies only to this request, including its routed attempts, and does
not change the key's setting. It also overrides the key's memory-required setting
for this request. Authentication, budgets, and provider-key checks still apply.

To keep recall but skip learning for one call, send `x-atlaso-memory: use`
instead, the same way. The call recalls and adds the memory note as usual, and
nothing from it is learned. This matters only on a key set to **Use and learn**:
other keys do not learn from calls. Neither value can turn memory or learning on
for a key whose setting is lower.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.