Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
test(cli): keep marker tests off the operator's home marker
Marcondes Maçaneiro7f9f68e8718a
diff --git a/crates/ai-memory-cli/src/commands/hook_capture.rs b/crates/ai-memory-cli/src/commands/hook_capture.rsindex e70163a7..eab66d22 100644--- a/crates/ai-memory-cli/src/commands/hook_capture.rs+++ b/crates/ai-memory-cli/src/commands/hook_capture.rs@@ -1016,6 +1016,26 @@ mod tests {use super::*;use tokio::io::{AsyncReadExt, AsyncWriteExt};+ /// Shadows [`super::marker_query_suffix`] for every test in this module,+ /// resolving against an empty operator home: the real one reads+ /// `home_dir()`, and a developer's own `~/.ai-memory.toml` applies to+ /// every cwd, so it would leak into the assertions. Tests that exercise a+ /// home marker pass one to `routing_selection_with_home` themselves.+ fn marker_query_suffix(cwd: &str, default_strategy: Option<&str>) -> String {+ let home = tempfile::TempDir::new().unwrap();+ match super::super::super::marker::routing_selection_with_home(+ cwd,+ cwd,+ Some(home.path()),+ false,+ ) {+ Ok(selection) => {+ marker_query_suffix_impl_from_selection(cwd, default_strategy, true, selection)+ }+ Err(_) => String::new(),+ }+ }+async fn serve_once(status: &'static str, body: &'static str) -> String {let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();let addr = listener.local_addr().unwrap();diff --git a/crates/ai-memory-cli/tests/suite/hook_payload.rs b/crates/ai-memory-cli/tests/suite/hook_payload.rsindex a4527cca..6d67c13b 100644--- a/crates/ai-memory-cli/tests/suite/hook_payload.rs+++ b/crates/ai-memory-cli/tests/suite/hook_payload.rs@@ -39,7 +39,11 @@ fn run_hook_full_agent(if capture_assistant {args.push("--capture-assistant".to_string());}+ // A developer's own `~/.ai-memory.toml` applies to every cwd, so the+ // hook would annotate these payloads; the empty data dir stands in for+ // a home without one.let mut child = Command::new(bin())+ .env("AI_MEMORY_HOME", data_dir).args(["--data-dir"]).arg(data_dir).args(&args)