#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(cli): authenticate apiFetch when AGENTMEMORY_SECRET is set (#380)
Erwan Leboucher60a650d8c9a0
diff --git a/src/cli.ts b/src/cli.tsindex 7981b27f..27885a95 100644--- a/src/cli.ts+++ b/src/cli.ts@@ -1058,7 +1058,13 @@ async function main() {async function apiFetch<T = unknown>(base: string, path: string, timeoutMs = 5000): Promise<T | null> {try {- const res = await fetch(`${base}/agentmemory/${path}`, { signal: AbortSignal.timeout(timeoutMs) });+ const headers: Record<string, string> = {};+ const secret = process.env["AGENTMEMORY_SECRET"];+ if (secret) headers["Authorization"] = `Bearer ${secret}`;+ const res = await fetch(`${base}/agentmemory/${path}`, {+ signal: AbortSignal.timeout(timeoutMs),+ headers,+ });return (await res.json()) as T;} catch {return null;