זיכרון מתמיד של Discourse AI

אני מעריך את הפיתוח ב-Discourse AI שהיה מצוין. התכונות מתבגרות במהירות, והכיוון נראה מבטיח מאוד.

שאלה אחת: האם יש כרגע דרך, או תוכניות כלשהן במפת הדרכים, שה-AI ישמור היסטוריה בין צ’אטים? כרגע כל שיחה מתחילה מחדש, ואני תוהה אם זיכרון מתמשך או המשכיות בין סשנים נשקלים.

אם זה עדיין לא במפת הדרכים, אשמח להעלות זאת כבקשת תכונה. האפשרות שה-AI יזכור אינטראקציות קודמות תהפוך דיונים לטבעיים יותר ותרחיב משמעותית את מקרי השימוש.

2 לייקים

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

אני באמת חושב על חווית ההמשכיות של המשתמש הקצה, RAG אני מחשיב כנהדר עבור מנהלים לספק מידע עבור פרסונה. עם ChatGPT/Gemini/אחרים, הבוט נושא פרופיל קטן קדימה - טון, עומק, מטרות מתמשכות - כך שאינך צריך להסביר מחדש כל פעם. זו החוויה שתהיה נהדרת ב-Discourse AI: העוזר זוכר כמה דברים עמידים על כל משתמש ומשתמש בהם כאשר רלוונטי, כך שיחות ממשיכות מהיכן שהופסקו.

אין לי הבנה אם היסטוריית שיחות RAG של משתמש קצה אפשרית בכל דרך.

הערך הוא שכל “זה מכיר אותי” אמין ללא הנחיה מתמדת משפר מאוד את החוויה עבור מקרי שימוש שבהם אותם סוגי שיחות נגישים מחדש על ידי משתמשים.

עם זאת, אני לא חושב שכל זה הוא משימה פשוטה. אני לא יכול להגיד מספיק כמה טוב כל זה פותח כבר.

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 לייקים