#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(hooks): stop also closes session for Codex (closes #493) (#579)
Rohit Ghumare355124141625
diff --git a/plugin/scripts/stop.mjs b/plugin/scripts/stop.mjsindex e0ffa350..a7dff13f 100755--- a/plugin/scripts/stop.mjs+++ b/plugin/scripts/stop.mjs@@ -31,6 +31,14 @@ async function main() {signal: AbortSignal.timeout(12e4)});} catch {}+ try {+ await fetch(`${REST_URL}/agentmemory/session/end`, {+ method: "POST",+ headers: authHeaders(),+ body: JSON.stringify({ sessionId }),+ signal: AbortSignal.timeout(5e3)+ });+ } catch {}}main();diff --git a/src/hooks/stop.ts b/src/hooks/stop.tsindex 1f2f5b8a..fedcb482 100644--- a/src/hooks/stop.ts+++ b/src/hooks/stop.ts@@ -49,6 +49,24 @@ async function main() {} catch {// summarize is best-effort}++ // Claude Code fires a separate `SessionEnd` hook that closes the+ // viewer session lifecycle. Codex does not have a SessionEnd event,+ // so the only signal we get when a Codex session ends is this Stop+ // hook (#493). Always best-effort POST /agentmemory/session/end here+ // so the viewer shows `completed` for Codex sessions; for Claude Code+ // this is a harmless idempotent second call (session-end.mjs runs on+ // SessionEnd and sets the same fields).+ try {+ await fetch(`${REST_URL}/agentmemory/session/end`, {+ method: "POST",+ headers: authHeaders(),+ body: JSON.stringify({ sessionId }),+ signal: AbortSignal.timeout(5000),+ });+ } catch {+ // session/end is best-effort+ }}main();\ No newline at end of file