Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(hooks): preserve raw PowerShell hook stdin
AkitaOnRails96087c896ef2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 86471a4a..7005bd8a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -36,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0Code's `--yolo`, and kimi joins the automatic bare-run harness pool.### Fixed-- Windows PowerShell fallback hooks now force text input/output and silence+- Windows PowerShell fallback hooks now force text output and silencenon-interactive progress records. This prevents nested PowerShell runnerssuch as Antigravity CLI from reporting serialized `CLIXML` progress on everyhook while preserving the hook's JSON stdout. Existing script-fallbackdiff --git a/crates/ai-memory-cli/src/commands/render_shared.rs b/crates/ai-memory-cli/src/commands/render_shared.rsindex 6ae648e7..a655f917 100644--- a/crates/ai-memory-cli/src/commands/render_shared.rs+++ b/crates/ai-memory-cli/src/commands/render_shared.rs@@ -1025,8 +1025,9 @@ fn hook_command(}HookCommandPlatform::Windows => {// Hook runners launch this child with redirected streams. Force- // text transport and suppress non-interactive progress so Windows- // PowerShell does not serialize progress records as CLIXML.+ // text output and suppress non-interactive progress so Windows+ // PowerShell does not serialize progress records as CLIXML. Leave+ // input formatting at its default: the hook reads raw Console.In.let mut setup = format!("$ProgressPreference='SilentlyContinue'; $env:AI_MEMORY_HOOK_URL={}",powershell_quote(server_url)@@ -1046,7 +1047,7 @@ fn hook_command(let program = format!("{setup}; & {}", powershell_quote(&script.to_string_lossy()));let encoded = powershell_encoded_command(&program);format!(- "powershell.exe -NoLogo -NoProfile -NonInteractive -InputFormat Text -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand {encoded}"+ "powershell.exe -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand {encoded}")}HookCommandPlatform::WindowsBash => {@@ -2150,7 +2151,7 @@ check(activeKeep.disposition === "keep" && activeKeep.protocol?.version === 1 &&.and_then(|s| s.as_str()).unwrap();assert!(cmd.starts_with(- "powershell.exe -NoLogo -NoProfile -NonInteractive -InputFormat Text -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand "+ "powershell.exe -NoLogo -NoProfile -NonInteractive -OutputFormat Text -ExecutionPolicy Bypass -EncodedCommand "));assert!(!cmd.contains("$env:"),@@ -2197,8 +2198,8 @@ check(activeKeep.disposition === "keep" && activeKeep.protocol?.version === 1 &&"{pointer}: {command}");assert!(- command.contains(" -InputFormat Text -OutputFormat Text "),- "{pointer}: nested PowerShell transport must stay textual: {command}"+ command.contains(" -OutputFormat Text "),+ "{pointer}: nested PowerShell output must stay textual: {command}");assert!(!command.contains("$env:")diff --git a/docs/mcp-install.md b/docs/mcp-install.mdindex d8e118b4..15e8fa50 100644--- a/docs/mcp-install.md+++ b/docs/mcp-install.md@@ -415,8 +415,8 @@ The rendered hooks config looks like:- Native Windows Docker-wrapper installs render hook entries as`powershell.exe ... -EncodedCommand <payload>` so Antigravity's outer commandrunner cannot expand the inner `$env:` setup. The child also forces text- input/output and disables progress so PowerShell does not serialize progress- records as `CLIXML` hook stderr. Rerun+ output and disables progress so PowerShell does not serialize progress records+ as `CLIXML` hook stderr. Rerun`install-hooks --agent antigravity-cli --apply` after upgrading to refreshexisting entries.- The `PreInvocation` event fires before each model call (not just atdiff --git a/docs/windows.md b/docs/windows.mdindex a3466dae..d65a6e32 100644--- a/docs/windows.md+++ b/docs/windows.md@@ -111,10 +111,10 @@ the CLI to render hook commands for the native Windows agent:use native single command strings matching their hook schema. The wrapperrenders those `.ps1` fallback commands with PowerShell `-EncodedCommand` so ahook runner cannot expand their `$env:` setup before the inner PowerShell- process receives it. Those commands force text input/output and suppress- progress records so nested PowerShell runners do not emit `CLIXML` hook- stderr. PowerShell/Git Bash script bundles are compatibility fallbacks and do- not enforce capture-policy v1.+ process receives it. Those commands force text output and suppress progress+ records so nested PowerShell runners do not emit `CLIXML` hook stderr.+ PowerShell/Git Bash script bundles are compatibility fallbacks and do not+ enforce capture-policy v1.After upgrading the wrapper/image, rerun `install-hooks --agent <agent> --apply`for each native Windows agent so existing hook entries receive the current