diff --git a/internal/setup/plugins/opencode/engram.ts b/internal/setup/plugins/opencode/engram.ts index 9f4a27b7..9e8b6747 100644 --- a/internal/setup/plugins/opencode/engram.ts +++ b/internal/setup/plugins/opencode/engram.ts @@ -109,7 +109,9 @@ Before ending a session or saying "done" / "listo" / "that's it", you MUST: ## Relevant Files - path/to/file — [what it does or what changed] -This is NOT optional. If you skip this, the next session starts blind. +2. Call \`mem_session_end\` to formally close the session. + +This is NOT optional. If you skip this, the next session starts blind and leaves orphaned sessions. ### AFTER COMPACTION @@ -313,6 +315,9 @@ export const Engram: Plugin = async (ctx) => { const info = (event.properties as any)?.info const sessionId = info?.id if (sessionId) { + // Tell Engram the session ended + await engramFetch(`/sessions/${sessionId}/end`, { method: "POST" }) + toolCounts.delete(sessionId) knownSessions.delete(sessionId) subAgentSessions.delete(sessionId) diff --git a/internal/setup/setup.go b/internal/setup/setup.go index d0a8453f..aa0ab62b 100644 --- a/internal/setup/setup.go +++ b/internal/setup/setup.go @@ -172,7 +172,9 @@ Before ending a session or saying "done" / "listo" / "that's it", you MUST: ## Relevant Files - path/to/file — [what it does or what changed] -This is NOT optional. If you skip this, the next session starts blind. +2. Call mem_session_end to formally close the session. + +This is NOT optional. If you skip this, the next session starts blind and leaves orphaned sessions. ### PASSIVE CAPTURE — automatic learning extraction