Version: v1.2.3 | Status: Active | Last Updated: March 2026
Module: codomyrmex.graph_rag
Last Updated: 2026-01-29
Knowledge graph integration with RAG for structured knowledge retrieval and reasoning
graph_rag/
βββ __init__.py # Module exports
βββ README.md # Documentation
βββ AGENTS.md # Agent guidelines
βββ SPEC.md # This file
βββ PAI.md # Personal AI context
βββ core.py # Core implementation
- Python 3.10+
- Parent module:
codomyrmex
from codomyrmex.graph_rag import (
KnowledgeGraph, # Core knowledge graph with entities and relationships
GraphRAGPipeline, # End-to-end RAG pipeline with graph context
Entity, EntityType,
Relationship, RelationType,
GraphContext,
)Environment variables:
CODOMYRMEX_*: Configuration options
- In-memory graph:
KnowledgeGraphstores entities and relationships in-memory dicts; suitable for session-scoped knowledge, not persistent storage. - Pipeline pattern:
GraphRAGPipelinewraps graph construction + retrieval into a single callable, keeping consumer code simple.
- Graph is not persisted across sessions (in-memory only); use
agentic_memoryfor durable storage. - No graph database backend β does not support very large-scale graphs (>100K nodes).
# Run tests for this module
pytest tests/graph_rag/- Graph database backend integration (Neo4j, NetworkX) to lift the current 100K-node ceiling on in-memory graphs.
- Persistent graph storage across sessions: serialize the knowledge graph to disk and reload incrementally rather than rebuilding from source on every session start.
- Multi-hop reasoning chains: expose a query interface that traces paths of configurable depth through the graph and returns confidence-weighted inference chains.