diff --git a/src/agent/runner.rs b/src/agent/runner.rs index a93fa98..122dcb6 100644 --- a/src/agent/runner.rs +++ b/src/agent/runner.rs @@ -17,7 +17,6 @@ use anyhow::Result; use tiktoken_rs::CoreBPE; use std::io::Write; -use std::process::{Command, Stdio}; use crate::agent::api::ApiClient; use crate::agent::journal; @@ -129,8 +128,9 @@ impl Agent { agent } - /// Run poc-hook for a given event, returning any output to inject. - fn run_hook(&self, event: &str, prompt: &str) -> Option { + /// Run memory search for a given event, returning any output to inject. + /// Direct library call — no subprocess needed since everything is one crate. + fn run_hook(&self, event: &str, _prompt: &str) -> Option { let transcript_path = self.conversation_log.as_ref() .map(|l| l.path().to_string_lossy().to_string()) .unwrap_or_default(); @@ -139,23 +139,9 @@ impl Agent { "hook_event_name": event, "session_id": self.session_id, "transcript_path": transcript_path, - "prompt": prompt, }); - let mut child = Command::new("poc-hook") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::null()) - .spawn() - .ok()?; - - if let Some(ref mut stdin) = child.stdin { - let _ = stdin.write_all(hook_input.to_string().as_bytes()); - } - drop(child.stdin.take()); - - let output = child.wait_with_output().ok()?; - let text = String::from_utf8_lossy(&output.stdout).to_string(); + let text = crate::memory_search::run_hook(&hook_input.to_string()); if text.trim().is_empty() { None } else {