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

# Long-Term Memory

> The agent remembers who you are and how your infrastructure works — durable facts persist across sessions as plain local files you control.

## Commands at a glance

| Command                 | What it does                               |
| ----------------------- | ------------------------------------------ |
| `/memory`               | List everything the agent remembers        |
| `/memory show <name>`   | Print one memory in full                   |
| `/memory forget <name>` | Delete one memory                          |
| `/memory path`          | Print the folder where memories are stored |

***

## What the agent remembers

OpenSRE keeps durable knowledge across sessions so you never repeat yourself:

* **Who you are** — your name, role, and how you like to work
* **Your infrastructure** — cluster names, naming conventions, known-flaky services
* **Your preferences** — report formats, notification choices, defaults
* **Investigation learnings** — root causes and lessons worth keeping

The memory index is shown to the agent at the start of every conversation, so
facts saved last week ground answers today.

## Saving memories

Just tell the agent — no special syntax needed:

```
remember that our prod cluster is eks-prod-eu-1
```

```
my name is Vaibhav, I'm on the platform team
```

The agent saves durable facts with its memory tools and updates existing
entries instead of duplicating them. At the end of each session, a background
pass also scans the conversation for durable facts you shared but didn't
explicitly ask to save — so knowledge doesn't get lost. On shell exit that
pass finishes before the process ends.

## Viewing and deleting memories

```
/memory
```

```
  Long-term memory

   name                      type            description                          updated
   ─────────────────────────────────────────────────────────────────────────────────────────
   prod-cluster-conventions  infrastructure  Prod EKS clusters: eks-prod-<region>  2026-07-09
   user-profile              user            Vaibhav, platform team                2026-07-09
```

Delete one with `/memory forget prod-cluster-conventions`, or ask the agent:
"forget what you know about the prod cluster".

## Where memories live

Memories are plain markdown files under `~/.opensre/memory/` — one file per
memory plus a generated `MEMORY.md` index. They are stored **locally and
unencrypted**. The agent includes the memory index, and sometimes recalled
entries, in prompts sent to your configured LLM provider so it can use those
facts in future answers. You can open, edit, or delete the files directly at
any time; the index rebuilds on the next write.

## Turning memory off

| Environment variable                    | Effect                                                        |
| --------------------------------------- | ------------------------------------------------------------- |
| `OPENSRE_MEMORY_DISABLED=1`             | Disable long-term memory entirely                             |
| `OPENSRE_MEMORY_AUTOEXTRACT_DISABLED=1` | Keep memory, but skip the session-end extraction              |
| `OPENSRE_MEMORY_GATEWAY_ENABLED=1`      | Opt in on Slack/Telegram gateway (off by default — see below) |

The session-end extraction makes one lightweight LLM call per session and
saves at most five memories. On shell exit that pass runs to completion after
resources are released so durable facts are not dropped. Never share secrets
or credentials expecting them to be remembered — the memory ingestion path
blocks obvious tokens, passwords, private keys, and credential-shaped values,
and redacts matching spans before the extraction LLM call.

## Gateway (Slack / Telegram)

Memory is a **host-global** local folder. On a shared gateway host it is **off
by default** so one allowlisted user's facts cannot appear in another user's
prompts or channel replies. Single-operator gateway deployments can opt in with
`OPENSRE_MEMORY_GATEWAY_ENABLED=1`.
