training: per-node scoring with graph weight updates

Memory scoring now uses the graph as source of truth:
- last_scored timestamp on each node (new capnp field @22)
- Nodes scored when older than scoring_interval_secs (default 1hr)
- Oldest-scored-first ordering
- Window: scoring_response_window assistant responses (default 100)
- First-quarter memories scored even without full window
- Per-response normalization (raw divergence / response count)
- Asymmetric weight update: alpha=0.5 up, alpha=0.1 down
  (responds fast to importance, decays slowly — memories stay
  surfaced even if only useful 1/4 of the time)

Graph writes disabled pending normalization calibration.

Also: configurable scoring_interval_secs and scoring_response_window.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 05:01:49 -04:00 committed by Kent Overstreet
parent b0603fd1ef
commit fcd77fb79e
8 changed files with 109 additions and 64 deletions

View file

@ -662,13 +662,19 @@ impl Agent {
_ => unreachable!(),
};
let text = entry.message().content_text();
let score = memory_scores
// Show node weight from graph (updated by incremental scorer)
let graph_weight = crate::hippocampus::store::Store::load().ok()
.and_then(|s| s.nodes.get(key).map(|n| n.weight));
// Show full matrix score if available
let matrix_score = memory_scores
.and_then(|s| s.memory_weights.iter()
.find(|(k, _)| k == key)
.map(|(_, v)| *v));
let label = match score {
Some(v) => format!("{} (importance: {:.1})", key, v),
None => key.to_string(),
let label = match (graph_weight, matrix_score) {
(Some(w), Some(s)) => format!("{} (w:{:.2} score:{:.1})", key, w, s),
(Some(w), None) => format!("{} (w:{:.2})", key, w),
(None, Some(s)) => format!("{} (score:{:.1})", key, s),
(None, None) => key.to_string(),
};
ContextSection {
name: label,