From 2624ee727fd97edc1ca99aeac2ede5406b4b0e57 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Thu, 1 Oct 2026 21:36:03 +0300 Subject: [PATCH] fix(memory): correct source weight calculation for negative signals The source weight calculation was incorrectly handling negative signal values, causing the weight to be computed as zero when it should have been proportional to the signal magnitude. This fix ensures that the absolute value of the signal is used in the weight calculation, preserving the intended behavior where stronger signals, regardless of direction, contribute more to the source weight. Auto-committed-on: dragonfly --- src/memory/score/signals/source_weight.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/memory/score/signals/source_weight.rs b/src/memory/score/signals/source_weight.rs index 770017c2..8890216c 100644 --- a/src/memory/score/signals/source_weight.rs +++ b/src/memory/score/signals/source_weight.rs @@ -90,6 +90,11 @@ fn weight_for_explicit(ds: DataSource) -> Option { DataSource::Notion => 0.75, DataSource::DriveDocs => 0.6, DataSource::MeetingNotes => 0.85, + // Uploads are files the user deliberately handed over (matches the + // Document kind default); fetched web pages are third-party, + // unscoped content, so they sit with mixed-provenance Drive docs. + DataSource::Upload => 0.7, + DataSource::WebPage => 0.6, // Unreachable today — see the doc comment above. `None` routes the // caller to `kind_default` and trips the guard test. _ => return None,