store: remove dead code and move params to config
Remove: - score_weight() - never called - position field on Node - never read (was for export) - Provenance enum - inline helper for capnp migration - migrate_transcript_progress + CLI command - init_from_markdown, import_file, ingest_units - export command and export_to_markdown - RetrievalEvent, GapRecord types - classify_filename, new_transcript_segment Move spreading activation params to Config: - default_node_weight, edge_decay, max_hops, min_activation - Remove Params struct and StoreView::params() Simplify cmd_init to just seed identity via upsert(). Simplify cmd_import to use parse_units + upsert directly. -576 lines Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
6104c63890
commit
7d49f29fde
10 changed files with 69 additions and 576 deletions
|
|
@ -268,22 +268,6 @@ impl Store {
|
|||
Ok((old, weight))
|
||||
}
|
||||
|
||||
/// Update a node's weight with a new score and record the scoring
|
||||
/// timestamp. Uses asymmetric smoothing: responds quickly to high
|
||||
/// scores (alpha=0.5) but decays slowly on low scores (alpha=0.1).
|
||||
/// This keeps memories surfaced even if they're only useful 1 in 4 times.
|
||||
/// Returns (old_weight, new_weight).
|
||||
pub fn score_weight(&mut self, key: &str, score: f64) -> Result<(f32, f32)> {
|
||||
let node = self.nodes.get_mut(key)
|
||||
.ok_or_else(|| anyhow!("node not found: {}", key))?;
|
||||
let old = node.weight;
|
||||
let alpha = if score > old as f64 { 0.5 } else { 0.1 };
|
||||
let new = (alpha * score + (1.0 - alpha) * old as f64) as f32;
|
||||
node.weight = new.clamp(0.01, 1.0);
|
||||
node.last_scored = chrono::Utc::now().timestamp();
|
||||
Ok((old, node.weight))
|
||||
}
|
||||
|
||||
/// Set the strength of a link between two nodes. Deduplicates if
|
||||
/// multiple links exist. Returns the old strength, or error if no link.
|
||||
pub fn set_link_strength(&mut self, source: &str, target: &str, strength: f32) -> Result<f32> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue