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:
parent
c0e6d5cfb3
commit
966219720a
2 changed files with 10 additions and 2 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue