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:
ProofOfConcept 2026-03-17 01:39:41 -04:00
parent 7fc1270d6f
commit 19e181665d
5 changed files with 166 additions and 1 deletions

View file

@ -64,6 +64,7 @@ pub enum Stage {
Select(Vec<String>),
Count,
Connectivity,
DominatingSet,
}
#[derive(Debug, Clone)]
@ -90,6 +91,7 @@ peg::parser! {
/ "select" _ f:field_list() { Stage::Select(f) }
/ "count" { Stage::Count }
/ "connectivity" { Stage::Connectivity }
/ "dominating-set" { Stage::DominatingSet }
rule asc_desc() -> bool
= "asc" { true }
@ -425,6 +427,15 @@ fn execute_parsed(
}
Stage::Connectivity => {} // handled in output
Stage::Select(_) | Stage::Count => {} // handled in output
Stage::DominatingSet => {
let mut items: Vec<(String, f64)> = results.iter()
.map(|r| (r.key.clone(), graph.degree(&r.key) as f64))
.collect();
let xform = super::engine::Transform::DominatingSet;
items = super::engine::run_transform(&xform, items, store, &graph);
let keep: std::collections::HashSet<String> = items.into_iter().map(|(k, _)| k).collect();
results.retain(|r| keep.contains(&r.key));
}
}
}