agents: log raw LLM output to files, not graph nodes

Raw agent responses were being stored as nodes in the graph
(_consolidate-*, _knowledge-*), creating thousands of nodes per day
that polluted search results and bloated the store. Now logged to
~/.claude/memory/llm-logs/<agent>/<timestamp>.txt instead.

Node creation should only happen through explicit agent actions
(WRITE_NODE, REFINE) or direct poc-memory write tool calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-16 18:44:48 -04:00
parent f0df489465
commit c7509a0c2d

View file

@ -674,13 +674,13 @@ pub fn run_one_agent(
let output_kb = output.len() / 1024;
log(&format!("response {}KB", output_kb));
// Store raw output for audit trail — key includes a content slug
// Log raw output to file, not the graph
let ts = store::compact_timestamp();
let slug = make_report_slug(&output);
let report_key = format!("_{}-{}-{}{}", llm_tag, agent_name, ts,
if slug.is_empty() { String::new() } else { format!("-{}", slug) });
let provenance = agent_provenance(agent_name);
store.upsert_provenance(&report_key, &output, &provenance).ok();
let log_dir = store::memory_dir().join("llm-logs").join(agent_name);
fs::create_dir_all(&log_dir).ok();
let log_path = log_dir.join(format!("{}.txt", ts));
fs::write(&log_path, &output).ok();
log(&format!("logged to {}", log_path.display()));
let actions = parse_all_actions(&output);
let no_ops = count_no_ops(&output);