← Back to PRs

#6858: feat(hooks): improve session-memory with LLM summarization

by alauppe open 2026-02-02 04:04 View on GitHub →
## Summary The session-memory hook now generates proper summaries instead of capturing just 15 lines of raw content. ## Changes - Read full session transcript instead of last N lines - Filter out noise (heartbeats, NO_REPLY, tool blocks, system messages) - Use LLM to generate structured summary with: - Topics discussed - Decisions made - Outcomes achieved - Open items remaining - Fall back to raw content if LLM summarization fails - Update HOOK.md documentation ## Why This makes `/new` actually preserve useful session context for future memory recall, rather than capturing mostly heartbeat noise. ## Example Output ```markdown # Session: 2026-01-31 14:30:00 UTC **Topics**: T3ch5 website deployment, Veritas MI prospect research **Decisions**: - Use Hugo over WordPress - Deploy to htel.me **Outcomes**: - Website live at t3ch5.com - 28 prospect companies identified **Open Items**: - Wire contact form to Formspree ``` <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR enhances the bundled `session-memory` hook so `/new` writes more useful context into `<workspace>/memory/YYYY-MM-DD-<slug>.md`. Instead of capturing the last N raw transcript lines, the handler now parses the full JSONL session file, filters out common noise, generates a smaller-context slug, and makes a second LLM call to produce a structured Markdown summary (topics/decisions/outcomes/open items), falling back to a raw excerpt if summarization fails. The core change lives in `src/hooks/bundled/session-memory/handler.ts`, adding transcript parsing and a new embedded-agent summarization step; `src/hooks/bundled/session-memory/HOOK.md` is updated to document the new behavior and token usage. <h3>Confidence Score: 3/5</h3> - This PR is reasonably safe but has a high-likelihood failure mode that can prevent the LLM summary from being generated. - Main logic is self-contained and has a fallback path, but the summarization call likely won’t persist the prompt because the temp session file is created without initializing a session header, which the embedded session manager is known to require for correct persistence. This could cause frequent raw-excerpt fallbacks and reduce the feature’s effectiveness. - src/hooks/bundled/session-memory/handler.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs