conversations placeholder: show graph neighborhood to extractor

When building the {{conversations}} placeholder for the observation
agent, search for existing nodes relevant to each conversation
fragment and include them in the prompt. Uses seed matching + one-hop
graph expansion to find the neighborhood, so the extractor sees what
the graph already knows about these topics.

This helps prevent duplicate extractions, but the deeper bug is that
select_conversation_fragments doesn't track which conversations have
already been processed — that's next.
This commit is contained in:
ProofOfConcept 2026-03-12 17:55:47 -04:00 committed by Kent Overstreet
parent 10499a98ea
commit b3cf934c18
2 changed files with 60 additions and 1 deletions

View file

@ -163,7 +163,17 @@ fn resolve(
"conversations" => {
let fragments = super::knowledge::select_conversation_fragments(count);
let text = fragments.iter()
.map(|(id, text)| format!("### Session {}\n\n{}", id, text))
.map(|(id, text)| {
let existing = super::knowledge::find_existing_observations(store, text, 10);
let mut section = format!("### Session {}\n\n{}", id, text);
if !existing.is_empty() {
section.push_str("\n\n#### Already extracted from this or similar conversations\n\n");
for (key, preview) in &existing {
section.push_str(&format!("- **`{}`**: {}\n", key, preview));
}
}
section
})
.collect::<Vec<_>>()
.join("\n\n---\n\n");
Some(Resolved { text, keys: vec![] })