Add calibrate agent, link-set command, and dominating-set query stage
calibrate.agent: Haiku-based agent that reads a node and all its neighbors, then assigns appropriate link strengths relative to each other. Designed for high-volume runs across the whole graph. graph link-set: Set strength of an existing link (0.0-1.0). dominating-set query stage: Greedy 3-covering dominating set — finds the minimum set of nodes such that every node in the input is within 1 hop of at least 3 selected nodes. Use with calibrate agent to ensure every link gets assessed from multiple perspectives. Usage: poc-memory query "content ~ 'bcachefs' | dominating-set"
This commit is contained in:
parent
7fc1270d6f
commit
19e181665d
5 changed files with 166 additions and 1 deletions
|
|
@ -178,6 +178,35 @@ pub fn cmd_link_add(source: &str, target: &str, reason: &[String]) -> Result<(),
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn cmd_link_set(source: &str, target: &str, strength: f32) -> Result<(), String> {
|
||||
super::check_dry_run();
|
||||
let mut store = store::Store::load()?;
|
||||
let source = store.resolve_key(source)?;
|
||||
let target = store.resolve_key(target)?;
|
||||
let strength = strength.clamp(0.01, 1.0);
|
||||
|
||||
let mut found = false;
|
||||
for rel in &mut store.relations {
|
||||
if rel.deleted { continue; }
|
||||
if (rel.source_key == source && rel.target_key == target)
|
||||
|| (rel.source_key == target && rel.target_key == source)
|
||||
{
|
||||
let old = rel.strength;
|
||||
rel.strength = strength;
|
||||
println!("Set: {} ↔ {} strength {:.2} → {:.2}", source, target, old, strength);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
return Err(format!("No link found between {} and {}", source, target));
|
||||
}
|
||||
|
||||
store.save()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn cmd_link_impact(source: &str, target: &str) -> Result<(), String> {
|
||||
let store = store::Store::load()?;
|
||||
let source = store.resolve_key(source)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue