# klieo-memory-graph
`KnowledgeGraph` trait surface + `InMemoryGraph` for klieo GraphRAG.
**Status:** stable at 3.x. Trait freeze contract recorded in [ADR-039](../../docs/adr/adr-039-graphrag-1-0-promotion.md).
## Production wiring
This crate is the **trait surface only**. For production deployments
plug a real backend:
- [`klieo-memory-graph-neo4j`](https://crates.io/crates/klieo-memory-graph-neo4j) —
Neo4j-backed `Neo4jKnowledgeGraph` (recommended for multi-process
agent fleets). See that crate's README for the
`MemoryNeo4j → Neo4jKnowledgeGraph` wiring.
`InMemoryGraph` (this crate) is petgraph-backed and intended for unit
tests and the M1 spike only — not for shipping agents.
## Cargo features
| `provenance` | **on** | Surfaces `klieo_provenance::ChainEntry` on `PathHop::chain_entry`. Graph-only consumers can disable via `default-features = false` to drop the audit-chain stack (`ed25519-dalek`, `sha2`, `hex`). |
## Layers
- `klieo-core` (Layer 0) — frozen
- **`klieo-memory-graph`** (Layer 1) — this crate
- `klieo-memory-graph-neo4j` (Layer 2, separate crate) — Neo4j backend
- `klieo-memory-graph-rag` (Layer 2, separate crate) — composer
## What lives here
- `KnowledgeGraph` trait (M1) — retrieval (`neighbors`/`recall_paths`/
`recall_filtered`) plus `subgraph(scope, limit)` for bounded whole-graph
enumeration (backs the ops-viz explorer)
- `GraphView` / `GraphNode` / `GraphEdge` — the browsable subgraph snapshot;
`GraphView::fact_texts` is a sidecar mapping fact ids to their sentence text
- `FilterableLongTermMemory` supertrait of `LongTermMemory` (M1)
- `EntityExtractor` trait (M1)
- `EntityType` / `EntityRef` / `known_epoch()` (M1)
- `InMemoryGraph` — petgraph `StableGraph` impl for tests + spike only (M1)
- `RecallMetrics` — hit@k + projector-lag counters (M1)
## License
MIT.