Skip to content

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

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.

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