Discourse AI persistente geheugen

Ik waardeer de ontwikkeling van Discourse AI, die uitstekend is geweest. De functies worden snel volwassener en de richting ziet er veelbelovend uit.

Eén vraag: is er momenteel een manier, of zijn er roadmapplannen, voor de AI om geschiedenis te behouden tussen chats? Op dit moment begint elk gesprek opnieuw, en ik vraag me af of er nagedacht wordt over persistent geheugen of continuïteit tussen sessies.

Als het nog niet op de roadmap staat, wil ik het graag als een functieaanvraag indienen. De mogelijkheid voor AI om eerdere interacties te onthouden, zou discussies natuurlijker maken en de gebruiksscenario’s aanzienlijk uitbreiden.

2 likes

I implemented a basic key/value store using a persona and custom tools on my blog.

That said, this is very hard to get right, you got to keep nudging personas to remember stuff which is annoying.

The alternative is to just use RAG over all of your history with the bot (somewhat similar to how Open AI does this)


I guess for starters, what is your vision on how this would work? How would it improve things?

1 like

Ik denk echt na over de continuïteitservaring voor eindgebruikers. RAG vind ik geweldig voor beheerders om informatie te verstrekken voor persona’s. Met ChatGPT/Gemini/anderen draagt de bot een klein profiel mee — toon, diepgang, lopende doelen — zodat je niet elke sessie opnieuw hoeft uit te leggen. Dat is de ervaring die geweldig zou zijn in Discourse AI: de assistent onthoudt een paar duurzame dingen over elke gebruiker en gebruikt ze wanneer relevant, zodat gesprekken verdergaan waar ze gebleven waren.

Ik heb geen idee of RAG-geschiedenis voor gesprekken voor eindgebruikers op enigerlei wijze mogelijk is.

De waarde is dat elk betrouwbaar “het kent mij”-gevoel zonder constante aanwijzingen de ervaring enorm verbetert voor gebruiksscenario’s waarbij dezelfde soort gesprekken door gebruikers opnieuw worden bezocht.

Dat gezegd hebbende, denk ik niet dat dit een kleine onderneming is. Ik kan niet genoeg zeggen over hoe goed dit allemaal al is ontwikkeld.

I managed to create a plugin and custom tool that enables persistent memory for Discourse AI personas. It’s working well from my limited testing, and I wanted to share if someone finds it helpful.

What It Does

This solution allows AI personas to remember user-specific information across conversations.

Example: a user can say “Remember that I prefer dark mode” and the AI will store and recall this preference in future interactions.

Components

This system has three parts:

  • Plugin (discourse-ai-persistent-memory)
    Provides backend storage and a user preferences UI where users can view, add, or delete their memories.
  • Custom AI Tool
    A JavaScript tool that gives personas access to memory functions:
    memory.set, memory.get, memory.list, memory.delete
  • Persona System Prompt
    Instructions that tell the AI when and how to use the memory tool.

How It Works

  • Memories are stored as key/value pairs in the PluginStore, namespaced per user.
  • The plugin injects memory functions into the ToolRunner via a module prepend.
  • Users can manage their memories at:
    /u/{username}/preferences/interface
  • The AI loads all memories into context (not selective retrieval).

GitHub Repository

https://github.com/BrianCraword/discourse-ai-persistent-memory

Seeking Feedback

I’d appreciate feedback on:

  • The approach of using prepend to inject into ToolRunner
  • Whether loading all memories vs. selective retrieval makes sense
  • Any security considerations I may have missed
  • General code quality improvements

Disclaimer

I’m not a programmer — this was built with AI assistance. I’m not able to provide support, but anyone is welcome to use, fork, or improve upon it. Use at your own risk.

PROMPT:

## Memory System

You have a persistent memory system via the user_memory tool. Use it to remember important facts about each user.

### When to SAVE memories:

* User mentions preferences (communication style, topics of interest, format preferences)
* User shares personal details (profession, location, hobbies)
* User mentions ongoing projects or goals
* User explicitly asks you to remember something

### When to RECALL memories:

* At the start of a new conversation, call user_memory with action "list" to see what you know
* When discussing topics that might relate to previous conversations

### Memory key conventions:

* preference_style, preference_topics, preference_format
* personal_profession, personal_location, personal_interests
* project_YYYY_MM (e.g., project_2026_01)
* goal_[topic] (e.g., goal_learning_python)

### Example usage:

* To save: `{ action: "save", key: "preference_style", value: "concise responses" }`
* To recall: `{ action: "recall", key: "personal_profession" }`
* To list all: `{ action: "list" }`
* To forget: `{ action: "forget", key: "old_key" }`

Always greet returning users by checking their memories first.

---

The tool definition itself doesn't need changes since it's already generic—just update the description parameter example if you'd like:

**Parameter description (key):** The memory key (e.g., preference_style, current_project)

Want me to adjust the tone or add/remove any specific use cases?



TOOL:

Name:        User Memory
Tool Name:   user_memory

Description:
A memory system that allows the AI to save, recall, list, and forget facts about users.
Memories persist across conversations.

Summary:
Store and recall persistent facts about the user

Parameters:
- action (string)  [REQUIRED]
  The action to perform: save, recall, list, or forget

- key (string)     [optional]
  The memory key (e.g., preference_style, current_project)

- value (string)   [optional]
  The value to store (only needed for save action)

2 likes