Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(opencode): refuse redirects in the handoff and recap reads

João Matheus1b64f58e96c9
diff --git a/crates/ai-memory-cli/src/commands/install_hooks.rs b/crates/ai-memory-cli/src/commands/install_hooks.rs
index a066d98b..3df6ba12 100644
--- a/crates/ai-memory-cli/src/commands/install_hooks.rs
+++ b/crates/ai-memory-cli/src/commands/install_hooks.rs
@@ -5294,8 +5294,11 @@ async function fetchHandoff(cwd: string, id: string | undefined): Promise<string
if (id) url.searchParams.set("session_id", id);
if (!applyMarkerParams(url, cwd)) return undefined;
try {{
+ // The body goes into the system prompt, so a redirect is refused: a
+ // gateway's login page must never arrive as the handoff.
const response = await fetch(url, {{
proxy: false,
+ redirect: "error",
headers: authHeaders(),
signal: timeoutSignal(1000),
}});
@@ -5319,6 +5322,7 @@ async function fetchRecap(cwd: string, id: string): Promise<string | undefined>
try {{
const response = await fetch(url, {{
proxy: false,
+ redirect: "error",
headers: authHeaders(),
signal: timeoutSignal(1000),
}});