Skip to content

feat(memory): graph memory schema, core types, and CRUD operations (#1224)#1245

Merged
bug-ops merged 2 commits intomainfrom
graph-memory-schema
Mar 5, 2026
Merged

feat(memory): graph memory schema, core types, and CRUD operations (#1224)#1245
bug-ops merged 2 commits intomainfrom
graph-memory-schema

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 5, 2026

Summary

Phase 1 of graph memory epic (#1222): SQLite schema, Rust types, CRUD store, config section, feature flag.

  • Migration 021: graph_entities, graph_edges, graph_communities, graph_metadata tables + messages.graph_processed column
  • GraphStore with 18 CRUD methods: entity/edge/community upsert, BFS traversal (cycle-safe iterative), metadata persistence
  • EntityType enum (8 variants), Entity, Edge, Community, GraphFact types
  • GraphConfig added to [memory.graph] TOML section with 10 tuning knobs
  • graph-memory feature flag in root, zeph-core, zeph-memory (included in full)

Closes #1224

Test plan

  • Migration 021 applies on existing and new databases
  • GraphStore::upsert_entity handles insert and update (UNIQUE constraint)
  • GraphStore::insert_edge creates edges with correct FKs
  • GraphStore::invalidate_edge sets expired_at and valid_to
  • GraphStore::bfs with max_hops=0 returns only start entity
  • GraphStore::bfs with max_hops=2 traverses chain correctly
  • GraphStore::bfs handles diamond topology without duplicates
  • GraphStore::bfs handles cyclic graph without infinite loop
  • GraphStore::bfs skips invalidated edges
  • GraphStore::edges_between checks both (A->B) and (B->A)
  • community_for_entity uses json_each() SQL (no full table scan)
  • find_entities_fuzzy escapes LIKE metacharacters
  • GraphConfig deserializes from TOML with defaults
  • EntityType::from_str handles all variants + rejects unknown
  • Config snapshot test updated
  • 31 new graph tests, 4041 total (up from 3782)
  • cargo clippy --workspace --features full -- -D warnings passes
  • cargo nextest run --workspace --features full --lib --bins passes

…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.
@bug-ops bug-ops added enhancement New feature or request memory zeph-memory crate (SQLite) graph-memory Knowledge graph memory feature labels Mar 5, 2026
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate dependencies Dependency updates size/XL Extra large PR (500+ lines) labels Mar 5, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 5, 2026 19:46
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.
@bug-ops bug-ops merged commit 0c73e95 into main Mar 5, 2026
28 checks passed
@bug-ops bug-ops deleted the graph-memory-schema branch March 5, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request graph-memory Knowledge graph memory feature memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(memory): graph memory schema, core types, and CRUD operations

1 participant