The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix(session-end): always update session summary content (#317)
wille000bbe5e4b8
diff --git a/scripts/hooks/session-end.js b/scripts/hooks/session-end.jsindex dd6355ca6..d33ac655d 100644--- a/scripts/hooks/session-end.js+++ b/scripts/hooks/session-end.js@@ -167,14 +167,15 @@ async function main() {log(`[SessionEnd] Failed to update timestamp in ${sessionFile}`);}- // If we have a new summary and the file still has the blank template, replace it+ // If we have a new summary, update the session file contentif (summary) {const existing = readFile(sessionFile);- if (existing && existing.includes('[Session context goes here]')) {- // Use a flexible regex that tolerates CRLF, extra whitespace, and minor template variations+ if (existing) {+ // Use a flexible regex that matches both "## Session Summary" and "## Current State"+ // Match to end-of-string to avoid duplicate ### Stats sectionsconst updatedContent = existing.replace(- /## Current State\s*\n\s*\[Session context goes here\][\s\S]*?### Context to Load\s*\n```\s*\n\[relevant files\]\s*\n```/,- buildSummarySection(summary)+ /## (?:Session Summary|Current State)[\s\S]*?$/ ,+ buildSummarySection(summary).trim() + '\n');writeFile(sessionFile, updatedContent);}