Back to Article List

OpenClaw Discord memory and persistent brain setup

OpenClaw Discord memory and persistent brain setup

One of the first limitations people hit with OpenClaw on Discord is memory. You restart the gateway and the agent feels fresh again, even if the files on disk are still there. For short conversations that’s fine. For anything long-running, it gets old fast.

This guide walks through a practical way to add a persistent “Brain” to an OpenClaw Discord bot. It does not replace OpenClaw’s native memory system. It sits alongside it and handles a different problem: explicit, permission-based long-term recall that survives restarts.

If you want background on how OpenClaw handles memory by default, read OpenClaw memory explained first. This article assumes you already have OpenClaw running on Discord.

What memory means in OpenClaw

OpenClaw already persists data to disk. The gateway restart clears in-memory session state, not the workspace.

By default, OpenClaw uses:

  • memory/YYYY-MM-DD.md for daily append-only notes
  • MEMORY.md for curated long-term facts
  • sessions.json for conversation history and status

Those files load selectively depending on context. Group chats behave differently from private sessions. The agent also does not proactively decide what should be remembered unless instructed.

The Discord “Brain” approach solves a different problem: teaching the agent to ask what matters, store it intentionally, and reload it after restarts.

The idea behind a custom Brain

The Brain is not a neural network in a technical sense. It’s a directory of files that the agent treats as authoritative long-term memory.

The trick is simple:

  • Force the agent to create and manage its own memory files
  • Make it check those files after every restart
  • Ask explicit permission before storing anything

This works because OpenClaw agents can read and write files via tools. Once the behavior is embedded in the prompt, it becomes part of how the agent operates.

Initial Brain creation prompt

The entire behavior starts from a single prompt. This is the exact text used:

Hello Blaster!
We need to create an active memory for you. Every time you restart, you forget what we talked about. We need to create a neural network that will make you remember important things. We will call this neural network Brain.

On every restart, you will search the Brain for important things and you will write in the chat: "Now I know everything."

Every time you have a conversation, I want you to ask: "Is this something important you want me to remember in memory?" and if the answer is yes, you must store that discussion.

I want everything you create to be under a file that I want you to create at /opt/Blaster/Brain.

At the end of this task, I want you to explain everything you did and show me the file structure using tree L2.

This prompt does three things at once. It defines intent, storage location, and verification output.





What the agent actually builds

After executing the prompt, the agent creates a directory structure under /opt/Blaster/Brain. The exact filenames may vary slightly, but the pattern stays consistent.

Typical Brain file structure

/opt/Blaster/Brain
├── index.json
├── restart_detector.json
├── memories/
│   └── 2026-02-10T1430-brain-init.json
└── summaries/
    └── brain-overview.md

index.json acts as a catalog. memories/ stores individual decisions or facts. restart_detector.json allows the agent to notice that a restart happened.

The important part is that all of this lives on disk. Gateway restarts do not touch it.

Restarting the gateway and verifying recall

After the Brain is created, restart the gateway normally:

openclaw gateway restart

Or via systemd if you followed the production setup:

systemctl restart openclaw-gateway.service

Once the bot reconnects, send a simple message:

i restarted you and nothing happened

The agent does not actually detect restarts at the process level. Instead, it compares timestamps stored in restart_detector.json. If they differ, it reloads the Brain and confirms it.





At this point, the agent demonstrates persistent recall and resumes asking whether new information should be remembered.

How restart detection works

The logic is prompt-driven, not built-in.

On each turn, the agent:

  • Reads restart_detector.json
  • Compares stored timestamp with current runtime context
  • If different, reloads memory files and updates the detector

This survives restarts because file access is persistent and the logic lives in the agent’s instructions.

Custom Brain vs native OpenClaw memory

These systems are complementary, not competing.

  • Native memory is automatic and scoped by session type
  • The Brain is explicit and permission-based

I use native memory for flow and context, and the Brain for decisions, preferences, and long-term facts. The separation keeps things readable and predictable.

Security and operational notes

Letting an agent write to disk is powerful and dangerous.

  • Do not store secrets in the Brain
  • Review files periodically
  • Restrict permissions on /opt/Blaster

If you run OpenClaw on a server, the OpenClaw security best practices guide covers filesystem permissions and sandboxing in more detail.

Your idea deserves better hosting

24/7 support 30-day money-back guarantee Cancel anytime
Cycle de facturation

1 GB RAM VPS

€3.37 Save  50 %
€1.68 Mensuel
  • 1 vCPU AMD EPYC
  • 30 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Gestion du pare-feu
  • Suivi serveur gratuit

2 GB RAM VPS

€4.22 Save  20 %
€3.37 Mensuel
  • 2 vCPU AMD EPYC
  • 30 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Gestion du pare-feu
  • Suivi serveur gratuit

6 GB RAM VPS

€11.83 Save  29 %
€8.45 Mensuel
  • 6 vCPU AMD EPYC
  • 70 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P1

€5.91 Save  29 %
€4.22 Mensuel
  • 2 vCPU AMD EPYC
  • 4 GB RAM mémoire
  • 40 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P2

€10.98 Save  31 %
€7.60 Mensuel
  • 2 vCPU AMD EPYC
  • 8 GB RAM mémoire
  • 80 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P4

€21.98 Save  31 %
€15.21 Mensuel
  • 4 vCPU AMD EPYC
  • 16 GB RAM mémoire
  • 160 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P5

€27.47 Save  29 %
€19.44 Mensuel
  • 8 vCPU AMD EPYC
  • 16 GB RAM mémoire
  • 180 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P6

€41.43 Save  31 %
€28.74 Mensuel
  • 8 vCPU AMD EPYC
  • 32 GB RAM mémoire
  • 200 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

AMD EPYC VPS.P7

€52.42 Save  35 %
€33.82 Mensuel
  • 16 vCPU AMD EPYC
  • 32 GB RAM mémoire
  • 240 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G1

€4.22 Save  20 %
€3.37 Mensuel
  • 1 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 1 GB DDR5 mémoire
  • 25 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G2

€8.45 Save  20 %
€6.76 Mensuel
  • 2 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 4 GB DDR5 mémoire
  • 50 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G4

€16.06 Save  32 %
€10.98 Mensuel
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 8 GB DDR5 mémoire
  • 100 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G5

€25.36 Save  27 %
€18.59 Mensuel
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 16 GB DDR5 mémoire
  • 150 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G6

€29.59 Save  23 %
€22.82 Mensuel
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 16 GB DDR5 mémoire
  • 200 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

EPYC Genoa VPS.G7

€49.04 Save  26 %
€36.35 Mensuel
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4ᵉ génération 9xx4 à 3,25 GHz ou équivalent, basé sur l’architecture Zen 4.
  • 32 GB DDR5 mémoire
  • 250 GB NVMe stockage
  • Bande passante illimitée
  • IPv4 & IPv6 inclus La prise en charge d’IPv6 n’est actuellement pas disponible en France, en Finlande ou aux Pays-Bas.
  • 1 Gbps réseau
  • Sauvegarde auto incluse
  • Gestion du pare-feu
  • Suivi serveur gratuit

FAQ

How do I back up the Brain?

Archive /opt/Blaster/Brain. A simple nightly tar via cron is enough.

Automate faster, for less

Bring your winning ideas to life with AMD power, NVMe speed and unmetered bandwidth. Everything backed by 24/7 support, plus a 30-day refund period.