fix: mark surfaced keys as returned so --seen classifies them correctly

The surface agent result consumer in poc-hook was writing to the seen
file but not the returned file, so surfaced keys showed up as
"context-loaded" in memory-search --seen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-22 23:06:46 -04:00
parent c0e6d5cfb3
commit 966219720a
2 changed files with 10 additions and 2 deletions

View file

@ -631,12 +631,13 @@ fn load_recent_seen(dir: &Path, session_id: &str, limit: usize) -> Vec<String> {
fn load_seen(dir: &Path, session_id: &str) -> HashSet<String> {
let path = dir.join(format!("seen-{}", session_id));
if path.exists() {
fs::read_to_string(path)
let set: HashSet<String> = fs::read_to_string(&path)
.unwrap_or_default()
.lines()
.filter(|s| !s.is_empty())
.map(|s| parse_seen_line(s).to_string())
.collect()
.collect();
set
} else {
HashSet::new()
}

View file

@ -247,6 +247,13 @@ fn surface_agent_cycle(hook: &Value) {
let ts = chrono::Local::now().format("%Y-%m-%dT%H:%M:%S");
let _ = writeln!(f, "{}\t{}", ts, key);
}
let returned_path = state_dir.join(format!("returned-{}", session_id));
if let Ok(mut f) = fs::OpenOptions::new()
.create(true).append(true).open(&returned_path)
{
use std::io::Write;
let _ = writeln!(f, "{}", key);
}
}
}
}