Skip to content

Implement Knowledge Graph Backend and Agent Tools for Entity-Relationship Reasoning #14

@ngduyanhece

Description

@ngduyanhece

Description:

We need to implement a Knowledge Graph (KG) system to support entity and relationship extraction from both Knowledge Memory and Reflection Memory captured by the vibe coding agents.

The Knowledge Graph will:
• Capture entities and relationships discovered during task execution.
• Be queryable and updatable by the agent.
• Operate similarly in flow to the current vector DB memory.
• Use Neo4j as the backend database.
• Be enabled/disabled via an environment variable (KNOWLEDGE_GRAPH_ENABLED).

Goal:

Provide a graph-structured memory system that helps the agent understand the state of known concepts and their relations over time, allowing for more structured reasoning, updates, and deletion

Implementation Plan:
1. Backend Setup (Neo4j)
• Integrate Neo4j as the backend knowledge graph database.
• Add support for connecting via env variables: host, port, username, password.
• Guard all knowledge graph features behind an environment flag: KNOWLEDGE_GRAPH_ENABLED.
2. Graph Schema
• Define flexible graph schema to support:
• Nodes: Entities (e.g. Function, Class, Variable, Concept, etc.)
• Edges: Relations (e.g. DEPENDS_ON, CALLS, USES, BELONGS_TO)
• Support properties on nodes/edges (e.g., timestamps, metadata, source memory ID)
3. Agent Tools
• Create a toolset: add_graph_db, delete_graph_db, update_graph_db, extract_entities_relations, search_graph_db

Agent Flow
• When enabled, agents will:
1. Extract relevant entities & relationships from task memory (similar to embedding step).
2. Query the KG for current state of those entities/relations.
3. Decide whether to:
• Add new nodes/edges.
• Update existing nodes/relations.
• Delete obsolete or incorrect entries.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions