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

@ -110,6 +110,9 @@ New node keys should be descriptive: `skills#bcachefs-assert-triage`,
nodes. Make existing ones better rather than adding more. nodes. Make existing ones better rather than adding more.
- **DEMOTE aggressively.** If a node's useful content is now captured - **DEMOTE aggressively.** If a node's useful content is now captured
in a better node, demote it. This is how the graph gets cleaner. in a better node, demote it. This is how the graph gets cleaner.
- **Respect search hits.** Nodes marked "actively found by search" are
being retrieved in live queries. Prefer to keep these — merge *into*
them rather than demoting them.
- **Don't force it.** If the neighborhood is already well-organized, - **Don't force it.** If the neighborhood is already well-organized,
say so. "This neighborhood is clean — no changes needed" is a say so. "This neighborhood is clean — no changes needed" is a
valid output. Don't produce filler. valid output. Don't produce filler.

View file

@ -51,5 +51,8 @@ If a node already has a reasonable name, skip it.
- **Don't rename to something longer than the original.** - **Don't rename to something longer than the original.**
- **Preserve the date.** Always keep YYYY-MM-DD. - **Preserve the date.** Always keep YYYY-MM-DD.
- **When in doubt, skip.** A bad rename is worse than an auto-slug. - **When in doubt, skip.** A bad rename is worse than an auto-slug.
- **Respect search hits.** Nodes marked "actively found by search" are
being retrieved by their current name. Skip these unless the rename
clearly preserves searchability.
{{rename}} {{rename}}

View file

@ -114,6 +114,11 @@ pub fn format_nodes_section(store: &Store, items: &[ReplayItem], graph: &Graph)
} }
out.push('\n'); 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) // Content (truncated for large nodes)
let content = &node.content; let content = &node.content;
if content.len() > 1500 { 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)); 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; let content = &node.content;
if content.len() > 800 { if content.len() > 800 {
let truncated = crate::util::truncate(content, 800, "\n[...]"); let truncated = crate::util::truncate(content, 800, "\n[...]");