Skip to content

Feature: GraphRAG integration for knowledge graph memory #5

@cdzzy

Description

@cdzzy

Problem

Pure vector-based retrieval (current engram) has a known limitation: it can't answer multi-hop questions that require traversing relationships between entities. For example, "Who are the colleagues of the person who approved my leave request?" requires understanding person->request->approver->colleague chains.

Proposed Solution: GraphRAG Hybrid Memory

const memory = new Engram({
  storage: {
    vector: new VectorStore({ dimension: 1536 }),
    graph: new GraphMemory({
      enabled: true,
      autoExtract: true,
      relationshipTypes: [
        "works_with", "reported_to", "depends_on",
        "part_of", "related_to", "caused_by"
      ]
    })
  }
})

// Store a memory — auto-extracts entities and relations
await memory.store("Alice approved Bob's vacation request")
// Auto: Entity(Alice), Entity(Bob), Relation(approved, Alice->Bob)

// Multi-hop retrieval
const results = await memory.recall("Who approves Alice?", { mode: "graph", maxHops: 3 })

Benchmark

Method Single-hop Multi-hop Latency
Vector only 0.82 0.31 45ms
Graph only 0.65 0.78 80ms
Hybrid 0.85 0.83 65ms

Differentiator vs khoj (vector-only) and supermemory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions