diff --git a/poc-memory/src/neuro/scoring.rs b/poc-memory/src/neuro/scoring.rs index 3a74e74..39d26fd 100644 --- a/poc-memory/src/neuro/scoring.rs +++ b/poc-memory/src/neuro/scoring.rs @@ -181,18 +181,36 @@ impl ConsolidationPlan { if self.run_health { runs.push(("health", 0)); } - for (name, count) in [ - ("replay", self.replay_count), + // Build per-type batch lists, then interleave so different agent + // types alternate rather than running all-replay-then-all-linker. + let types: [(&str, usize); 4] = [ ("linker", self.linker_count), + ("replay", self.replay_count), ("separator", self.separator_count), ("transfer", self.transfer_count), - ] { - let mut remaining = count; + ]; + let mut queues: Vec> = types.iter().map(|(name, count)| { + let mut q = Vec::new(); + let mut remaining = *count; while remaining > 0 { let batch = remaining.min(batch_size); - runs.push((name, batch)); + q.push((*name, batch)); remaining -= batch; } + q + }).collect(); + + // Round-robin interleave + loop { + let mut added = false; + for q in &mut queues { + if let Some(run) = q.first() { + runs.push(*run); + q.remove(0); + added = true; + } + } + if !added { break; } } runs } @@ -239,28 +257,32 @@ fn consolidation_plan_inner(store: &Store, detect_interf: bool) -> Consolidation // Target: α ≥ 2.5 (healthy scale-free) if alpha < 2.0 { - plan.replay_count += 10; - plan.linker_count += 5; + plan.replay_count += 50; + plan.linker_count += 100; plan.rationale.push(format!( - "α={:.2} (target ≥2.5): extreme hub dominance → 10 replay + 5 linker", + "α={:.2} (target ≥2.5): extreme hub dominance → 50 replay + 100 linker", alpha)); } else if alpha < 2.5 { - plan.replay_count += 5; - plan.linker_count += 3; + plan.replay_count += 25; + plan.linker_count += 50; plan.rationale.push(format!( - "α={:.2} (target ≥2.5): moderate hub dominance → 5 replay + 3 linker", + "α={:.2} (target ≥2.5): moderate hub dominance → 25 replay + 50 linker", alpha)); } else { - plan.replay_count += 3; + plan.replay_count += 10; + plan.linker_count += 20; plan.rationale.push(format!( - "α={:.2}: healthy — 3 replay for maintenance", alpha)); + "α={:.2}: healthy — 10 replay + 20 linker for maintenance", alpha)); } // Target: Gini ≤ 0.4 + // High Gini means degree inequality — most nodes under-connected. + // Linker fixes this by adding edges to low-degree nodes. if gini > 0.5 { - plan.replay_count += 3; + plan.replay_count += 10; + plan.linker_count += 50; plan.rationale.push(format!( - "Gini={:.3} (target ≤0.4): high inequality → +3 replay", + "Gini={:.3} (target ≤0.4): high inequality → +10 replay + 50 linker", gini)); }