Skip to content

feat(memory): extend SYNAPSE to five-signal retrieval + async consolidation daemon#4392

Merged
bug-ops merged 6 commits into
mainfrom
synapse-five-signal-retrieval
May 18, 2026
Merged

feat(memory): extend SYNAPSE to five-signal retrieval + async consolidation daemon#4392
bug-ops merged 6 commits into
mainfrom
synapse-five-signal-retrieval

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 18, 2026

Summary

Extends SYNAPSE recall in zeph-memory from two signals (recency + semantic relevance) to five by adding access frequency, causal distance, and novelty. Adds an optional async consolidation daemon via zeph-scheduler that promotes high-utility episodic facts to Qdrant.

Research basis: MemTier (arXiv:2605.03675) — +33pp on LongMemEval-S; 14pp tool-execution success degradation over 72h windows with flat retrieval.

Changes

New module: crates/zeph-memory/src/five_signal/ (7 submodules)

  • weightsFiveSignalWeights, normalization at startup, is_baseline() short-circuit
  • access_frequencyfact_access_log SQLite tracking, per-turn GROUP BY aggregation, session-scoped
  • causal_distance — BFS on MAGMA causal edges, bounded by causal_bfs_max_depth, per-turn cache
  • noveltyexp(-λ × days_since_agent_init), zero I/O
  • scoring — five-signal weighted sum, is_baseline() fast path
  • consolidation — async daemon: promotion/demotion loop (Qdrant wiring deferred, stub present)
  • metrics — Prometheus counters: five_signal_recall_total, consolidation_*_total

Config: [memory.five_signal] + [memory.five_signal.consolidation_daemon] in zeph-config. All new weights default to 0.0 — backward compatible. Config migration step 48 added.

Migration 090: fact_access_log table, messages.memory_tier, messages.qdrant_promoted columns.

Integration: SemanticMemory::recall_merge_and_rank — five-signal scoring runs after existing temporal decay + MMR pipeline, fully gated by enabled flag.

Deferred (tracked separately)

  • Qdrant promotion/demotion wiring in consolidation daemon (struct present, None wired)
  • Scheduler registration of consolidation daemon (TaskKind::Custom variant not yet added to zeph-scheduler)
  • --init wizard update for new config section

Test plan

  • cargo nextest run -p zeph-memory --lib — 21 five-signal tests pass
  • cargo nextest run --workspace --lib --bins — 9906 tests pass, zero regressions
  • cargo clippy --workspace -- -D warnings — clean
  • cargo +nightly fmt --check — clean
  • Backward compat: w_frequency=w_causal=w_novelty=0.0 produces ranking identical to two-signal baseline (covered by scoring::zero_new_weights_equals_two_signal_baseline)
  • Weight normalization WARN when config doesn't sum to 1.0 (covered by weights::unnormalized_weights_emit_warn)
  • Causal BFS bounded by depth limit (covered by causal_distance::distance_to_score_beyond_max_depth_clamped_to_min)

Closes #4374
Closes #3703

@bug-ops bug-ops added enhancement New feature or request memory zeph-memory crate (SQLite) P3 Research — medium-high complexity labels May 18, 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 May 18, 2026
@bug-ops bug-ops force-pushed the synapse-five-signal-retrieval branch from 12b1124 to c144808 Compare May 18, 2026 17:30
@bug-ops bug-ops enabled auto-merge (squash) May 18, 2026 17:30
@bug-ops bug-ops force-pushed the synapse-five-signal-retrieval branch from c144808 to 8c1bf85 Compare May 18, 2026 17:30
@github-actions github-actions Bot removed the core zeph-core crate label May 18, 2026
bug-ops added 6 commits May 18, 2026 19:55
- Bump workspace version 0.21.1 → 0.21.2
- Consolidate duplicate CHANGELOG.md section headers in [0.21.2]
- Update splash snapshot for new version string
- Update test badge count (9824)
- Update specs to reflect changes since v0.21.1
…dation daemon

Extends SYNAPSE recall in zeph-memory from two signals (recency + semantic
relevance) to five by adding access frequency, causal distance, and novelty.
Adds an optional async consolidation daemon via zeph-scheduler that promotes
high-utility episodic facts to Qdrant and deprioritizes cold ones.

New signals (all off by default — w_frequency=w_causal=w_novelty=0.0):
- access_frequency: log(1+count) normalized, tracked in fact_access_log SQLite
  table; session-scoped via per-process UUID
- causal_distance: BFS on MAGMA causal edges from current goal entity, bounded
  by causal_bfs_max_depth (default 10), cached per turn
- novelty: exp(-λ × days_since_agent_init), pure arithmetic, zero I/O

Weight normalization to 1.0 happens once at startup with WARN if config values
diverge. The is_baseline() short-circuit preserves zero overhead for the
two-signal default. Feature-gated consolidation daemon registered via
zeph-scheduler under the `scheduler` feature.

Migration 090 adds: fact_access_log table, messages.memory_tier,
messages.qdrant_promoted columns.

Research basis: MemTier (arXiv:2605.03675) — +33pp on LongMemEval-S;
14pp tool-execution degradation over 72h with flat retrieval.

Closes #4374
Closes #3703
- Rename migration 090 → 091 to avoid conflict with 090_implicit_conflict_candidates
  added in #4386 (TrajectoryRiskAccumulator)
- Rename ConsolidationDaemonConfig (five-signal) → FiveSignalConsolidationConfig
  to avoid collision with existing spec 004-17 ConsolidationDaemonConfig
- Keep shadow_memory field added by #4386 alongside five_signal in MemoryConfig
@bug-ops bug-ops force-pushed the synapse-five-signal-retrieval branch from 65cfd24 to af4a2e1 Compare May 18, 2026 17:55
@bug-ops bug-ops merged commit de422ad into main May 18, 2026
32 checks passed
@bug-ops bug-ops deleted the synapse-five-signal-retrieval branch May 18, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request memory zeph-memory crate (SQLite) P3 Research — medium-high complexity rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant