feat(memory): graph memory schema, core types, and CRUD operations (#1224)#1245
Merged
feat(memory): graph memory schema, core types, and CRUD operations (#1224)#1245
Conversation
…1224) Phase 1 of graph memory epic (#1222): SQLite schema, Rust types, CRUD store, config section, feature flag. Migration 021 adds graph_entities, graph_edges, graph_communities, graph_metadata tables and messages.graph_processed column. Tables are always created (not feature-gated) to avoid migration ordering issues. GraphStore provides 18 methods: entity/edge/community CRUD, BFS traversal with cycle-safe iterative algorithm, metadata persistence. BFS uses recursive CTE for neighbor discovery with HashSet visited guard to prevent infinite loops on cyclic graphs. GraphConfig added to [memory.graph] TOML section with 10 tuning knobs (enabled, extract_model, max_hops, recall_limit, etc.). Feature flag graph-memory wired in root, zeph-core, and zeph-memory Cargo.toml files, included in the full feature set.
Add docs/src/concepts/graph-memory.md covering data model, BFS traversal, configuration, and implementation phases. Update memory concept page with graph memory section, configuration reference with [memory.graph] section, feature flags page, SUMMARY.md, root README, and zeph-memory README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of graph memory epic (#1222): SQLite schema, Rust types, CRUD store, config section, feature flag.
graph_entities,graph_edges,graph_communities,graph_metadatatables +messages.graph_processedcolumnGraphStorewith 18 CRUD methods: entity/edge/community upsert, BFS traversal (cycle-safe iterative), metadata persistenceEntityTypeenum (8 variants),Entity,Edge,Community,GraphFacttypesGraphConfigadded to[memory.graph]TOML section with 10 tuning knobsgraph-memoryfeature flag in root, zeph-core, zeph-memory (included infull)Closes #1224
Test plan
GraphStore::upsert_entityhandles insert and update (UNIQUE constraint)GraphStore::insert_edgecreates edges with correct FKsGraphStore::invalidate_edgesets expired_at and valid_toGraphStore::bfswith max_hops=0 returns only start entityGraphStore::bfswith max_hops=2 traverses chain correctlyGraphStore::bfshandles diamond topology without duplicatesGraphStore::bfshandles cyclic graph without infinite loopGraphStore::bfsskips invalidated edgesGraphStore::edges_betweenchecks both (A->B) and (B->A)community_for_entityuses json_each() SQL (no full table scan)find_entities_fuzzyescapes LIKE metacharactersGraphConfigdeserializes from TOML with defaultsEntityType::from_strhandles all variants + rejects unknowncargo clippy --workspace --features full -- -D warningspassescargo nextest run --workspace --features full --lib --binspasses