Currently, dify's memory mechanism is limited to the current session, right? If you refresh the chat conversation window again, a new conversation will be created and the memory will be lost, right?Does DIY have a memory that includes all conversations? #15059

Closed
opened 2026-02-21 19:20:00 -05:00 by yindo · 2 comments
Owner

Originally created by @orcharddd2024 on GitHub (Jul 2, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

Image

On the basis of the agent chat mode, secondary development has been carried out, and now short-term and long-term memory mechanisms have been added. Currently, dify's memory mechanism is limited to the current session, right? If you refresh the chat conversation window again, a new conversation will be created and the memory will be lost, right?

Image

Image

The source code in the agent chat mode is shown in the figure. If only conversion_id exists, assign a value to the memory variable. Otherwise, set it to None; I noticed that when I refresh the chat window, a new data entry will be added to the conversations table

Image

The messages table also stores the content of each conversation, meaning that multiple sets of conversations may occur in the same conversation. Each set of conversations will be stored in the Meissages table, but the memory mechanism used by dify in agent chat mode is within one conversation. When there is a new conversation, previous messages will not be counted in this memory;
Let me call this short-term memory for now. The current demand is to set up long-term memory. Does this DIY have it? Do you need to do secondary development yourself?

Originally created by @orcharddd2024 on GitHub (Jul 2, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Provide a description of requested docs changes ![Image](https://github.com/user-attachments/assets/6e63eb24-3d49-4c31-b50b-7ed32399a737) On the basis of the agent chat mode, secondary development has been carried out, and now short-term and long-term memory mechanisms have been added. Currently, dify's memory mechanism is limited to the current session, right? If you refresh the chat conversation window again, a new conversation will be created and the memory will be lost, right? ![Image](https://github.com/user-attachments/assets/32fdeb63-7cce-4df7-b131-0345da421e97) ![Image](https://github.com/user-attachments/assets/7f13b8d4-8354-40ef-85ae-b6e0bf1a6b73) The source code in the agent chat mode is shown in the figure. If only conversion_id exists, assign a value to the memory variable. Otherwise, set it to None; I noticed that when I refresh the chat window, a new data entry will be added to the conversations table ![Image](https://github.com/user-attachments/assets/a90b9ccf-f9e9-4d56-8178-565cc95745b5) The messages table also stores the content of each conversation, meaning that multiple sets of conversations may occur in the same conversation. Each set of conversations will be stored in the Meissages table, but the memory mechanism used by dify in agent chat mode is within one conversation. When there is a new conversation, previous messages will not be counted in this memory; Let me call this short-term memory for now. The current demand is to set up long-term memory. Does this DIY have it? Do you need to do secondary development yourself?
yindo added the 🙋‍♂️ question label 2026-02-21 19:20:00 -05:00
yindo closed this issue 2026-02-21 19:20:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 2, 2025):

You're correct—Dify's memory mechanism is session-based, meaning memory is scoped to a single conversation (identified by conversation_id). When you refresh the chat window, a new conversation is created and previous memory is not carried over. There is no built-in support for long-term memory that spans multiple conversations or aggregates memory across all sessions. Implementing long-term memory would require secondary development, such as querying across conversations or designing a custom mechanism to store and retrieve information from previous sessions. You can see this in the way memory is fetched and tied to a specific conversation in the code (source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 2, 2025): <!-- Answer --> You're correct—Dify's memory mechanism is session-based, meaning memory is scoped to a single conversation (identified by conversation_id). When you refresh the chat window, a new conversation is created and previous memory is not carried over. There is no built-in support for long-term memory that spans multiple conversations or aggregates memory across all sessions. Implementing long-term memory would require secondary development, such as querying across conversations or designing a custom mechanism to store and retrieve information from previous sessions. You can see this in the way memory is fetched and tied to a specific conversation in the code ([source](https://github.com/langgenius/dify/pull/20843)). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/21809)
Author
Owner

@orcharddd2024 commented on GitHub (Jul 2, 2025):

You're correct—Dify's memory mechanism is session-based, meaning memory is scoped to a single conversation (identified by conversation_id). When you refresh the chat window, a new conversation is created and previous memory is not carried over. There is no built-in support for long-term memory that spans multiple conversations or aggregates memory across all sessions. Implementing long-term memory would require secondary development, such as querying across conversations or designing a custom mechanism to store and retrieve information from previous sessions. You can see this in the way memory is fetched and tied to a specific conversation in the code (source).

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

OK 3Q

@orcharddd2024 commented on GitHub (Jul 2, 2025): > You're correct—Dify's memory mechanism is session-based, meaning memory is scoped to a single conversation (identified by conversation_id). When you refresh the chat window, a new conversation is created and previous memory is not carried over. There is no built-in support for long-term memory that spans multiple conversations or aggregates memory across all sessions. Implementing long-term memory would require secondary development, such as querying across conversations or designing a custom mechanism to store and retrieve information from previous sessions. You can see this in the way memory is fetched and tied to a specific conversation in the code ([source](https://github.com/langgenius/dify/pull/20843)). > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/518e0800-8f40-4caa-a748-b1d34055a08b?feedback_type=other)  [![Join Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/21809) OK 3Q
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15059