Persistent long-term memory via self-hosted Dakera — following Engram PR pattern #38249
ferhimedamine
started this conversation in
Suggestion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Overview
This proposes adding persistent long-term memory to Dify via Dakera — a self-hosted, decay-weighted vector memory server. The implementation follows the pattern established by the Engram draft PR (weaviate integration) and is fully opt-in behind environment variables.
The problem
Dify's
TokenBufferMemory(api/core/memory/token_buffer_memory.py) is session-scoped and stored in the Dify database — it does not survive beyond a conversation window. Users building production AI applications need memory that:Proposed implementation
Following the Engram PR pattern exactly — new files, no breaking changes, fully opt-in:
New files:
Modified files:
api/core/app/apps/chat/app_runner.py— inject recalled memories beforeorganize_prompt_messages()api/configs/feature/__init__.py— add PydanticFielddeclarations for new env varsEnvironment variables (all off by default):
Core class:
Signal handler:
Differentiation vs Weaviate Engram approach
Next step
Happy to submit a PR implementing the above once maintainers confirm this direction is welcome. The implementation is complete on our side — we are waiting for guidance on the preferred integration pattern before opening a formal PR.
All reactions