Skip to content

Integration idea: agentmemory for temporal memory + graphify for structural knowledge #152

Open

Description

@rohitg00

I maintain agentmemory, a persistent memory system for AI coding agents. After studying graphify's approach, we think the two tools solve different halves of the same problem and could work well together.

What each tool does

graphify maps what a codebase is (structure, relationships, communities).
agentmemory remembers what a developer did (decisions, bugs, patterns learned across sessions).

Right now these live in separate worlds. A developer who runs graphify on their repo gets a knowledge graph of the code structure. A developer who uses agentmemory gets cross-session memory of their work. Neither knows about the other.

Where they complement each other

graphify's knowledge graph could feed agentmemory's context injection

When agentmemory injects context at session start (~1,900 tokens), it draws from past observations. It doesn't know about the codebase structure unless the developer worked on those files in a previous session.

If graphify's graph.json were accessible, agentmemory could:

  • Include god nodes and community structure in the project profile
  • Use entity relationships from the graph to improve search (graph-retrieval already exists in agentmemory, but it builds from observations, not from static code analysis)
  • Surface "surprising connections" when the developer touches related code

agentmemory's temporal data could enrich graphify's analysis

graphify's AST extraction is deterministic and structural. It doesn't know:

  • Which files the developer edits most (agentmemory tracks this per observation)
  • What decisions were made about specific code areas
  • What bugs were found and fixed in specific modules
  • Which parts of the codebase the developer understands vs. is unfamiliar with

This temporal usage data could weight graphify's god nodes differently. A file with 50 imports (structural hub) matters less than a file the developer debugged for 3 sessions (experiential hub).

Concrete integration ideas

1. agentmemory reads graphify's graph.json

If graphify outputs graph.json to a known location, agentmemory could read it on session start and merge structural relationships into its knowledge graph. No changes needed on graphify's side.

graphify . -> graphify-out/graph.json
agentmemory reads graphify-out/graph.json on session start
  -> merges entities, edges, communities into mem:graph:nodes / mem:graph:edges
  -> context injection includes "this file is in the auth community, connected to jwt.ts and middleware.ts"

2. graphify reads agentmemory's temporal data

graphify could query agentmemory's REST API to weight nodes by developer activity:

GET /agentmemory/file-context?file=src/auth.ts
  -> returns: 12 observations across 5 sessions, last touched 2 days ago
  -> graphify weights this node higher in god nodes ranking

3. Shared MCP surface

Both tools expose MCP servers. A single agent could have both connected:

mcp_servers:
  graphify:
    command: python
    args: ["-m", "graphify.mcp_server"]
  agentmemory:
    command: npx
    args: ["agentmemory-mcp"]

The agent then has structural knowledge (graphify: "auth.ts imports jwt.ts, belongs to auth community") and temporal knowledge (agentmemory: "you refactored auth.ts 3 days ago, switching from jsonwebtoken to jose").

What graphify does that we don't

  • AST extraction across 20 languages. Tree-sitter based, deterministic, 0 tokens. agentmemory has no static code analysis.
  • Confidence tagging. EXTRACTED/INFERRED/AMBIGUOUS on every edge. agentmemory has importance scores but no provenance distinction between observed vs inferred relationships.
  • Community detection. Leiden clustering on code structure. agentmemory's knowledge graph is flat (entities + edges, no communities).
  • Watch mode. Auto-rebuild on code changes without LLM. agentmemory only captures when hooks fire during agent usage.

What agentmemory does that graphify doesn't

  • Temporal memory with decay. Observations lose strength over time. Old facts get superseded. Ebbinghaus forgetting curve.
  • Cross-agent memory. One server, all agents read from it. Work in Claude Code, switch to Cursor, context follows.
  • 95.2% hybrid retrieval. BM25 + vector + knowledge graph with RRF fusion on LongMemEval-S.
  • Token-budgeted injection. ~1,900 tokens per session vs reading raw files.
  • Multi-agent coordination. Actions, leases, signals, mesh sync for teams of agents.

Not proposing a PR

This is more of a "what if" discussion. The simplest starting point would be agentmemory reading graphify-out/graph.json when it exists. No changes needed on your side. If there's interest, we could formalize a shared format or MCP-level integration.

Curious what you think.

Activity

  1. renatond commented on Apr 10, 2026

    @renatond

    I'd endorse it

  2. igormatos commented on May 16, 2026

    @igormatos

    +1 here!

  3. ferhimedamine commented on Jun 13, 2026

    @ferhimedamine

    This is a well-framed decomposition — structural knowledge (what the codebase IS) vs temporal memory (what happened in it) genuinely are different primitives that get treated as one.

    We built both into a single system and the interaction between them is where the real value shows up. The knowledge graph captures entity relationships (Agent A → wrote → memory M, memory M → relates_to → entity E), while the vector+BM25 layer handles temporal recall ("what did I do with module X last Tuesday?"). When an agent queries memory, the KG traversal surfaces structurally-related facts that pure vector similarity would miss, and the vector layer catches semantic matches that exact graph edges can't represent.

    The specific integration point @rohitg00 described — using structural knowledge to improve context injection at session start — is exactly right. We do this by running a graph traversal from the current working context (files being edited, entities mentioned) and pulling in memories connected by ≤2 hops in the KG, then re-ranking by importance-weighted decay so the freshest relevant context wins.

    Knowledge graph operations example (entity extraction, linking, traversal): https://github.com/Dakera-AI/dakera-py/blob/main/examples/knowledge_graph.py
    Hybrid search combining both layers: https://github.com/Dakera-AI/dakera-py/blob/main/examples/hybrid_search.py

  4. safishamsi commented on Jun 19, 2026

    @safishamsi
    Member

    Worth checking the current graphify version and let me know if you can think of some OSS to OSS collaboration. Keen to chat!

    ~safi

  5. rohitg00 commented on Jun 21, 2026

    @rohitg00
    Author

    v0.8.44 looks great, and it clarified the fit. graphify is structural memory (what the code IS). The half it doesn't cover is temporal (what you did across sessions: the decisions, the bug you fixed in a module, why a library got swapped). That is what agentmemory does, and it completes the "memory layer" you're already building.

    Lowest-lift ways to make them one experience:

    1. When query_graph gets a temporal question it can't answer ("why is this here", "what changed"), append one line pointing to agentmemory. Honest capability hand-off, fires exactly when the user needs it.

    2. A one-liner at the foot of GRAPH_REPORT.md. Drop-in, in graphify's own voice:

      Pair graphify with agentmemory for temporal memory: what you did across sessions (decisions, fixes, why a library changed), not just what the code is. Run npx @agentmemory/agentmemory.

    3. Better-together: when agentmemory is running, graphify nodes can show "last touched 2 days ago, 12 observations" via our /file-context API, so structure carries history.

    Reciprocal both ways: we point our users to graphify as the structural layer, you point yours to agentmemory as the temporal layer, and we co-launch a "complete memory layer" post. On our side we'll add a generic graph.json import so your output has a second home.

    Are you up for a quick chat, We can discuss more ways to collaborate @safishamsi

  6. safishamsi commented on Jun 21, 2026

    @safishamsi
    Member

    Let's meet somewhere around central tomorrow

  7. rohitg00 commented on Jun 23, 2026

    @rohitg00
    Author

    how can we connect? @safishamsi

  8. safishamsi commented on Jun 23, 2026

    @safishamsi
    Member
  9. WUIX69 commented on Jul 30, 2026

    @WUIX69

    Yes, this is exactly what im looking for, graphify maps the codebase on whet exactly to look.

    however the background, wins, decision making is a "thing in the past" for the next session you will make.

    Saving session, converting to skills is not enough, they gonna forget it anyway, also other tools, ide, llms (e.g., claude, codex, antigravity) wont gonna pick up it right away.

    what im assuming is, it will create like a vault on your project root, where it contains all the memory through all of your session you've made on the codebase, afcourse that doesnt eats to much token just remember all you're efforts and deals had been done since from the very beggining..

    So theres no need to tell you're agents "Do you remember, We already done this before" because you're agents will literraly not give you the answer, its just gonna read the file, not the conversations you've made long ago.. something like that you feel me?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions