post-graph-rag
An open-source Graph RAG library that runs entirely on PostgreSQL, using bi-temporal supersession to close contradicted facts and controlled predicate vocabularies to make graph edges queryable.
At a Glance
Fully open-source under Apache 2.0. Free to use, modify, and distribute.
Engagement
Available On
Alternatives
Listed Sep 2026
About post-graph-rag
post-graph-rag is an open-source Python library developed by Chandan Rajah that brings Graph RAG (Retrieval-Augmented Generation) natively to PostgreSQL, using pgvector for HNSW similarity search and a property graph stored as two tables. It is available on PyPI under the Apache 2.0 license and installable with a single pip install post-graph-rag command.
What It Is
post-graph-rag extracts entities and relations from documents using an LLM, stores them as a property graph alongside pgvector embeddings, and answers questions by fusing vector similarity, graph traversal, and full-text search. Its defining architectural bet is that no separate vector store or graph engine is needed — PostgreSQL handles all three, giving a single consistency model, one backup, and transactions that span the knowledge graph and application tables simultaneously. The underlying graph storage layer, post-graph, is also available as a standalone library.
The Two Core Problems It Solves
Most Graph RAG systems treat extracted relations as timeless assertions. When one document says two people are allies and a later document says they became rivals, both edges land in the graph as co-equal current facts. post-graph-rag addresses two structural gaps that recur across existing systems:
- Supersession from document order: A later assertion closes an earlier one rather than coexisting with it. The project page reports that indexing the d'Artagnan trilogy in publication order closed 13 relationships that later books contradicted — resolved from document order alone, with no dates extracted from the prose. This is described as a capability no comparable system (GraphRAG, LightRAG, Graphiti) currently offers.
- Controlled predicate vocabularies: Free-text LLM-extracted edge labels are unqueryable. The project page reports that an unconstrained extraction run produced 395 distinct predicates across 705 relations, with 74% used exactly once. A configured vocabulary reduced this to 44 distinct predicates with 94% adherence, enabling
WHERE relation_type = 'worked_with'queries to return meaningful results.
Architecture and Retrieval Design
The retrieval pipeline fuses three channels using Reciprocal Rank Fusion (RRF):
- Entity vector search followed by configurable multi-hop graph traversal (default 2 hops, configurable per query)
- Relation embedding search — relations carry their own embeddings so they can be found by similarity rather than only by traversal
- Lexical/BM25 search over relations
Community summarisation follows Microsoft GraphRAG's pattern: the entity graph is clustered using Leiden (with deterministic label-propagation fallback), each cluster is summarised by an LLM, and each report is stored as a vertex with its own embedding. This enables corpus-level "what are the main themes?" queries via vector similarity rather than enumeration.
Temporal grounding is carried through to the synthesis prompt — each relation's validity period is rendered inline — which the project page identifies as the single largest performance lever, reporting a +38.4 point improvement on temporal-reasoning questions in an ablation study.
Benchmark Results
The project page reports benchmark results against Zep's published Graphiti numbers on the full 500-question LongMemEval set. According to the project's own evaluation, post-graph-rag with gemini-3.6-flash scored 94.0% overall against Zep/Graphiti's 71.2% with gpt-4o, with the widest margins on temporal-reasoning (96.2% vs 62.4%) and multi-session (90.2% vs 57.9%). The project page notes qualifications: different judge panels, different model generations, and one excluded question. On the ECT-QA earnings-call benchmark, the project reports 0.807 Correct under element-wise scoring against published figures of 0.599 for TG-RAG, 0.405 for GraphRAG, and 0.406 for LightRAG.
Setup Path
The dependency list is minimal: PostgreSQL with the pgvector extension, any OpenAI-compatible endpoint (including local ones), and the Python package. The library supports multi-tenant realms with optional schema-per-tenant isolation, configurable chunking, gleaning passes for improved recall, and seven runnable example scripts covering quickstart, supersession, bi-temporal audit, multi-tenant spaces, incremental indexing, community exploration, and retrieval modes.
Update: Version 1.10.0 and Recent Activity
The GitHub repository was last pushed on 2026-09-10. Version 1.10.0 added exploration support through three engine calls: a hierarchical topic tree via recursive supergraph clustering (community_levels), opt-in retrieval telemetry for coverage tracking (least_explored_communities, dark_entities), and a changes_since delta API using database-clock watermarks for exactly-once polling. Version 1.8.0 fixed a document key bug where using only source collapsed entire corpora onto one key. Version 1.13.0 added per-document stats and graph views. The architecture paper is available at arXiv:2608.24921, with a revision covering LongMemEval and ECT-QA evaluations described as in preparation.
Community Discussions
Be the first to start a conversation about post-graph-rag
Share your experience with post-graph-rag, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully open-source under Apache 2.0. Free to use, modify, and distribute.
- Full Graph RAG pipeline on PostgreSQL
- Bi-temporal supersession
- Controlled predicate vocabularies
- Multi-hop graph traversal
- Community summarisation
Capabilities
Key Features
- Bi-temporal supersession: later documents close earlier contradicted facts
- Controlled predicate vocabularies for queryable graph edges
- Runs entirely on PostgreSQL with pgvector — no separate graph engine or vector store
- Three-channel retrieval fused by RRF: entity vector search, relation embedding search, lexical BM25
- Configurable multi-hop graph traversal (default 2 hops, per-query override)
- Community summarisation via Leiden clustering with per-community LLM reports
- Entity resolution by canonical name and alias merging across documents
- Gleaning passes for improved relation recall on dense text
- Multi-tenant realms with optional schema-per-tenant isolation
- Validity intervals and as-of temporal filtering
- Exploration support: topic tree, coverage telemetry, change delta polling
- Append-only audit tables and trigger-based shadow logging
- Negated relation handling (stored with negated flag, not as inverted predicate)
- Relation provenance tracking with distinct-contributor weight
- Seven runnable example scripts
- Full evaluation harness included in repository
