Skip to content

feat(memory): hybrid SYNAPSE seed selection and A-MEM link weight evolution (#2167, #2163)#2182

Merged
bug-ops merged 2 commits intomainfrom
feat/issue-2167/synapse-hybrid-seed-selection
Mar 26, 2026
Merged

feat(memory): hybrid SYNAPSE seed selection and A-MEM link weight evolution (#2167, #2163)#2182
bug-ops merged 2 commits intomainfrom
feat/issue-2167/synapse-hybrid-seed-selection

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

Changes

  • migrations/043_graph_edge_retrieval.sql — additive schema: retrieval_count, last_retrieved_at on graph_edges
  • graph/types.rsevolved_weight(), ScoredEntity, retrieval_count in Edge/GraphFact
  • graph/store/mod.rsfind_entities_ranked(), entity_structural_scores(), entity_community_ids(), record_edge_retrieval(), decay_edge_retrieval_counts(); chunking at 163/490 for SQLite bind limit
  • graph/retrieval.rs — hybrid seed selection pipeline with SA-INV-10 guard, embedding fallback
  • graph/activation.rs — spread uses evolved_weight() instead of raw confidence
  • semantic/graph.rs — time-based decay block in community task via graph_metadata timestamp
  • zeph-config/src/memory.rs — new fields: seed_structural_weight, seed_community_cap, link_weight_decay_lambda (with serde validation), link_weight_decay_interval_secs

Test Plan

  • 16 new unit tests covering: hybrid score math, community cap guard, embedding fallback on error, evolved_weight identity/growth, retrieval tracking, decay, BFS weight factor
  • All 6525 tests pass (cargo nextest run --workspace --features full --lib --bins)
  • cargo +nightly fmt --check clean
  • 0 new clippy errors in modified files

Closes #2167
Closes #2163

bug-ops added 2 commits March 27, 2026 00:24
…lution (#2167, #2163)

Hybrid seed selection (#2167):
- Replace flat FTS5 match with hybrid score: fts * 0.6 + structural * 0.4
- Structural score combines normalized entity degree and edge-type diversity
- Embedding fallback when FTS5 returns 0 results (WAL cross-session gap fix)
- Community-aware seed capping with SA-INV-10 zero-out guard
- New config: memory.synapse.seed_structural_weight, seed_community_cap

A-MEM evolving link weights (#2163):
- Migration 043: add retrieval_count, last_retrieved_at to graph_edges
- evolved_weight() = confidence * (1 + 0.2 * ln(1 + count)) capped at 1.0
- Fire-and-forget retrieval tracking after SYNAPSE spread and BFS recall
- Time-based multiplicative decay independent of graph eviction cycle
- New config: memory.graph.link_weight_decay_lambda, link_weight_decay_interval_secs
- Serde validation for link_weight_decay_lambda (must be in (0.0, 1.0])
- SQLite bind-limit chunking in entity_structural_scores and entity_community_ids

Adds 16 unit tests; all 6525 tests pass.
@github-actions github-actions bot added enhancement New feature or request documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate size/XL Extra large PR (500+ lines) and removed enhancement New feature or request labels Mar 26, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 26, 2026 23:25
@bug-ops bug-ops merged commit 667b5c0 into main Mar 26, 2026
25 checks passed
@bug-ops bug-ops deleted the feat/issue-2167/synapse-hybrid-seed-selection branch March 26, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant