From 2f896bca2c12c1ba961b7bc9203a5b8e7a2eba11 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Mon, 9 Mar 2026 17:57:04 -0400 Subject: [PATCH] poc-hook: call memory-search on PostToolUse for chunk drip-feed Wire up the PostToolUse handler to call memory-search --hook, passing through the hook JSON on stdin. This drains pending context chunks saved by the initial UserPromptSubmit load, delivering them one per tool call until all chunks are delivered. --- poc-memory/src/bin/poc-hook.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/poc-memory/src/bin/poc-hook.rs b/poc-memory/src/bin/poc-hook.rs index 52cfa58..4d1ad77 100644 --- a/poc-memory/src/bin/poc-hook.rs +++ b/poc-memory/src/bin/poc-hook.rs @@ -178,6 +178,27 @@ fn main() { } } "PostToolUse" => { + // Drip-feed pending context chunks from initial load + if let Ok(output) = Command::new("memory-search") + .arg("--hook") + .stdin(std::process::Stdio::piped()) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::null()) + .spawn() + .and_then(|mut child| { + if let Some(ref mut stdin) = child.stdin { + use std::io::Write; + let _ = stdin.write_all(input.as_bytes()); + } + child.wait_with_output() + }) + { + let text = String::from_utf8_lossy(&output.stdout); + if !text.is_empty() { + print!("{text}"); + } + } + if let Some(ref t) = transcript { check_context(t, true); }