Back to browse
GitHub Repository

Structural verification for graph databases. 5M vertices. 35 microseconds. Zero ML.

18 starsPython

Sigma Guard – deterministic contradiction checks for graph memory

by invariantjason·May 9, 2026·3 points·0 comments

AI Analysis

●●●BangerBig BrainWizardryNiche Gem

Applies sheaf cohomology to catch graph contradictions that schema validation misses.

Strengths
  • Uses Dirichlet energy to pinpoint exact edges causing structural inconsistencies.
  • Runs locally in milliseconds without requiring GPU, Docker, or external APIs.
  • Solves the specific GraphRAG pain point of storing mutually exclusive facts.
Weaknesses
  • Mathematical complexity of sheaf cohomology may deter average application developers.
  • Niche applicability limited to teams already managing complex graph memory layers.
Category
Target Audience

AI engineers building GraphRAG systems or knowledge graphs

Similar To

Neo4j · ArangoDB · Memgraph

Post Description

I built a small open-source verifier for graph-backed AI memory and GraphRAG-style systems.

The basic problem: graph databases can validate schema, but they usually do not know whether two accepted facts contradict each other. An AI memory layer can store both "Acme prefers annual billing" and "Acme rejected annual billing and requires monthly billing." Both writes may be valid. The contradiction only shows up later when an agent retrieves both and reasons over them.

SIGMA Guard tries to catch that earlier.

It represents claims as a graph with local consistency rules and checks whether the proposed structure can be made globally consistent. The underlying mechanism uses cellular sheaf cohomology. The practical interface is simpler: given claims, a graph, or a proposed write, it returns SAFE or UNSAFE with the contradiction details and a receipt hash.

The repo includes:

verify_claims - check a set of subject/property/value claims check_write - test a proposed graph write before commit verify_graph - verify a full graph MCP server support for Claude Desktop / agent workflows a local demo, no API key required

Install:

pip install sigma-guard[mcp]

Run MCP server:

sigma-guard-mcp

Or run the local demo:

git clone https://github.com/Jasonleonardvolk/sigma-guard cd sigma-guard pip install -e . python examples/verify_llm_output.py

I also ran a scale experiment because the obvious objection is that sheaf-style graph verification will not fit in memory. On a laptop, the current cellular implementation completed a 5M-vertex / 39,999,936-edge streaming run. The key trick was avoiding duplicated restriction matrices: 80M endpoint maps were represented by 1,024 canonical maps in a shared store. The streaming update path averaged 0.119 ms/edit with p99 1.534 ms in that run.

Separate from the streaming benchmark, I also ran a "poisoned edge" demo on the same 5M graph. One local restriction map was replaced with a cyclic permutation. Exact local verification recomputed one affected cell out of 25,473. H0 dropped from 8 to 1, meaning 7 local consistency modes were destroyed. That exact check took 11.5s because it used dense SVD on the affected cell; the point of that demo was localization and exactness, not production latency.

Limitations:

This is not a replacement for a graph database. It does not make LLM output true. The current exact poisoned-edge demo is slower than the streaming update path. Some demos use structured claims rather than arbitrary natural language. The interesting question is whether this belongs as a pre-commit / pre-output verifier for agent memory, not as a standalone database.

Repo:

https://github.com/Jasonleonardvolk/sigma-guard

I would be interested in feedback from people working on graph databases, GraphRAG, or agent memory. Does a deterministic "verify before memory write / before agent output" layer make sense in your stack?

Similar Projects

Developer Tools●●●Banger

FlowScript – Agent memory where contradictions are features

Five queries vector stores can't answer: why(), tensions(), blocked(), whatIf(), alternatives().

Big BrainZero to OneWizardry
phillipclapham
212mo ago
AI/ML●●Solid

Kremis – Deterministic memory graph for AI agents (Rust)

Deterministic graph memory vs. embeddings is clever, but fragmentation of AI memory ecosystems is already painful.

Big BrainWizardry
M2Dr3g0n
103mo ago
AI/ML●●●Banger

Cairn – Event-sourced reasoning graphs for AI memory

Tracks what you decided, not just what you said — propositions with confidence scores and lifecycle status.

Big BrainWizardry
smcady
202mo ago
AI/ML●●●Banger

Director-AI – token-level NLI+RAG

Token-level streaming halt stops hallucinations mid-sentence before user sees them—genuinely novel safety layer.

Big BrainWizardry
anulum
273mo ago