Skip to main content

Crate mnemo_graph

Crate mnemo_graph 

Source
Expand description

Bitemporal graph layer for Mnemo.

Inspired by Graphiti (repo, paper). The model is the same: every edge carries valid_from / valid_to (when the fact is true in the world) plus recorded_at (when the system saw it), so historical queries can ask “what did we believe at time T?” without losing later corrections.

valid_from              valid_to (None = still true)
    ^                       ^
    |   fact validity       |
    +-----------------------+
    |
    +-- recorded_at (when we wrote the row)

Today this crate ships:

  1. The TemporalEdge type and a GraphStore async trait.
  2. A DuckDB-backed DuckGraphStore that creates graph_nodes and graph_edges tables on first use and supports the round-trip
    • bitemporal as_of walk needed by retrieval.
  3. graph_expand — bounded BFS that respects as_of filtering and a maximum depth.

Edge extraction is out of scope for this crate. It is a bitemporal STORAGE + QUERY layer: callers construct TemporalEdges and this crate stores, closes and walks them. There is deliberately no LLM in it.

An extract() stub used to live here, always returning an empty Vec. That is worse than absent: a caller cannot distinguish “found no relations” from “not implemented”, so wiring it in yields silent no-ops forever. It was removed in favour of saying so (see #156).

Re-exports§

pub use crate::model::TemporalEdge;
pub use crate::store::GraphStore;
pub use crate::store::duckdb::DuckGraphStore;

Modules§

model
store

Functions§

graph_expand
Bounded BFS from seed that respects bitemporal validity at as_of and a max walk depth.