Skip to content

ai-memory: back the demo with real Context Graph packages - #110

Open
antejavor wants to merge 1 commit into
mainfrom
ai-memory-context-graph-alignment
Open

ai-memory: back the demo with real Context Graph packages#110
antejavor wants to merge 1 commit into
mainfrom
ai-memory-context-graph-alignment

Conversation

@antejavor

Copy link
Copy Markdown

Summary

code-examples/ai-memory.md/.sh/.ps1 illustrated Memgraph's semantic/episodic/procedural memory pitch with a hand-rolled Client/Preference/Interaction/Workflow/Step schema and the generic mcp-memgraph server — no connection to how Memgraph's own Context Graph project actually implements durable AI memory.

This rewires the demo to write and recall all three memory types through the real packages a live coding-assistant plugin uses:

  • sessions-graph — semantic memory (Memory nodes)
  • actions-graph — episodic memory (Session/Action nodes, FOLLOWED_BY sequencing)
  • skills-graph — procedural memory (Skill nodes, USED_SKILL)

These three share a (:User)/(:Session) node as join key, so the demo's "interconnected recall" payoff is now a genuine one-shot Cypher traversal through that shared graph, not three lookups glued together in script. The "Wire It Into a Real Harness" section now points at the actual agent-context-graph plugin bootstrap flow (whose Memgraph defaults already match this demo's container) instead of a generic MCP config snippet.

This trades the previous "no Python" positioning for Python 3.10-3.13 (to pip install the three packages into a throwaway venv) — a deliberate scope call to make the example true to the real product, discussed and confirmed before implementation.

  • New ai-memory.py holds the seed/recall logic.
  • ai-memory.sh/.ps1 now provision that venv alongside the same single Memgraph container (no more separate mcp-memgraph/mgconsole containers — schema-info/ontology inspection reuses the mgconsole already bundled in memgraph-mage).
  • ai-memory.md rewritten to match.

Test plan

  • Ran ./ai-memory.sh end-to-end against a live Docker Memgraph container: network/container up, venv created, sessions-graph/actions-graph/skills-graph installed from PyPI, seed + all four recall queries (semantic/episodic/procedural/interconnected) produced correct output, SHOW SCHEMA INFO succeeded, wrap-up message printed.
  • Ran ./ai-memory.sh clean: container, network, and venv removed.
  • Ran the PowerShell counterpart under a real pwsh 7.4.6 binary (not just syntax-parsed): full run flow reproduced identical output, clean flow removed everything.
  • [System.Management.Automation.Language.Parser]::ParseFile confirms ai-memory.ps1 has no syntax errors.
  • Found and fixed a real ordering bug during testing: sessions-graph's save_memory(session_id=...) provenance write races actions-graph's create_session unique constraint on Session if session creation doesn't happen first — ai-memory.py now creates sessions before anything else references them.

ai-memory.md/.sh/.ps1 previously hand-rolled a generic
Client/Preference/Interaction/Workflow/Step schema against the generic
mcp-memgraph server -- illustrating the semantic/episodic/procedural
memory story with no connection to how Memgraph's own Context Graph
project (github.com/memgraph/ai-toolkit/tree/main/context-graph)
actually implements it.

Rewire the demo to write and recall all three memory types through the
real packages a live coding-assistant plugin uses:
  - sessions-graph : semantic memory  (Memory nodes)
  - actions-graph  : episodic memory  (Session/Action nodes, FOLLOWED_BY)
  - skills-graph   : procedural memory (Skill nodes, USED_SKILL)

The three share a (:User)/(:Session) node as join key, so the payoff
"interconnected recall" is a genuine one-shot Cypher traversal through
that shared graph, not three lookups glued together. The "Wire It Into
a Real Harness" section now points at the actual agent-context-graph
plugin bootstrap flow instead of a generic MCP config snippet.

Drops the "no Python" positioning (now needs Python 3.10-3.13 to pip
install the three packages) in exchange for the example being true to
what the real product does. New ai-memory.py holds the seed+recall
logic; .sh/.ps1 now provision a venv alongside the Memgraph container.
Verified end-to-end on both scripts (bash and real pwsh) against a
live container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant