Repository navigation
GML 2193 Add short-term and long-term agent memory in the KB graph (replace last-4 SQLite history) - #71
Open
prinskumar-tigergraph wants to merge 1 commit into
Open
GML 2193 Add short-term and long-term agent memory in the KB graph (replace last-4 SQLite history)#71prinskumar-tigergraph wants to merge 1 commit into
prinskumar-tigergraph wants to merge 1 commit into
Conversation
Collaborator
|
@prinskumar-tigergraph — GraphRAG 2.0.4 is released, and 2.1.0 work now collects on Please change this PR's base branch from Thanks! |
Replace chat-history with mem0-backed short-term context and user/graph-scoped long-term facts so the agent can recall conversation state and standing preferences across chats.
prinskumar-tigergraph
force-pushed
the
feat/agent-memory
branch
from
October 23, 2026 13:41
f73dd0d to
18719d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds short-term and long-term agent memory so GraphRAG can remember the current conversation and durable user preferences across chats. This replaces the
chat-historyservice for conversation storage.STM is per conversation: recent exact turns plus a rolling summary, capped by
stm_context_tokens. When the budget is exceeded, older turns are folded into the summary; rows are not deleted.LTM is per
username+graphname: mem0 extracts durable user facts (preferences, decisions, goals) after each reply. Fact text lives in Postgres; only the vector is written to TigerGraphMemoryEmbedding.conversation_idis provenance, not a recall filter, so a preference planted in chat A is available in chat B for the same user and graph.Identity:
username+graphname+conversation_idusername+graphnameuser_id=graphname + "\0" + usernameHow a turn works
MemoryEmbedding, then join hits back tomemory_facts(ltm_top_k,ltm_score_threshold). Empty scopes skip mem0/TigerGraph startup.fact_extract_async). Secrets matching_SECRET_PATTERNare dropped before extract. mem0infer=Truemay ADD/UPDATE/DELETE facts; TigerGraph upserts go throughmemory_outbox.MemoryEmbeddingandMemory_*queries are hidden from agent-visible schema and MCP tools so the agent cannot treat the memory index as graph evidence.Storage and deploy
MemoryEmbeddingscope_hash(username, graphname)Compose and k8s replace
chat-historywith Postgres. Enable viamemory_configinserver_config.json, orGRAPHRAG_MEMORY_ENABLED/GRAPHRAG_MEMORY_DATABASE_URL.UI history/feedback routes are now graph-scoped (
/ui/{graphname}/user,/conversation,/feedback) and read/write throughMemoryServiceinstead of the chat-history HTTP API.Test plan
memory_config, start postgres, keepchat-historystopped; rebuild the graphrag imagememory_factsfor that user+graphMemoryEmbedding/Memory_*do not appear in agent-visible schema or installed-query lists