agents: surface search hit counts to guide keep/demote decisions

Nodes actively found by search now show "Search hits: N ← actively
found by search, prefer to keep" in both the node section (seen by
extractor, linker, etc.) and rename candidate listings.

Extractor and rename prompts updated to respect this signal — merge
into high-hit nodes rather than demoting them, skip renaming nodes
that are working well in search.
This commit is contained in:
ProofOfConcept 2026-03-11 00:18:58 -04:00
parent 7a3ce4f17d
commit de204e3075
3 changed files with 16 additions and 0 deletions

View file

@ -114,6 +114,11 @@ pub fn format_nodes_section(store: &Store, items: &[ReplayItem], graph: &Graph)
}
out.push('\n');
let hits = crate::counters::search_hit_count(&item.key);
if hits > 0 {
out.push_str(&format!("Search hits: {} ← actively found by search, prefer to keep\n", hits));
}
// Content (truncated for large nodes)
let content = &node.content;
if content.len() > 1500 {
@ -306,6 +311,11 @@ pub fn format_rename_candidates(store: &Store, count: usize) -> (Vec<String>, St
};
out.push_str(&format!("Created: {}\n", created));
let hits = hit_map.get(key).copied().unwrap_or(0);
if hits > 0 {
out.push_str(&format!("Search hits: {} ← actively found by search, prefer to keep current name\n", hits));
}
let content = &node.content;
if content.len() > 800 {
let truncated = crate::util::truncate(content, 800, "\n[...]");