#6858: feat(hooks): improve session-memory with LLM summarization
## 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
#10591: feat(hooks): add session-start-memory bundled hook
by morningstar-daemon · 2026-02-06
79.2%
#3392: fix(hooks): remove debug console.log statements from session-memory...
by WinJayX · 2026-01-28
78.9%
#14243: fix: fire session-memory hook on auto-resets + topic-aware memory p...
by TheDude135 · 2026-02-11
78.4%
#20706: feat(hooks): add outputDir config for session-memory hook
by botBehavior · 2026-02-19
78.3%
#8431: Hooks: add session-graphiti memory feed
by JorgeAlan · 2026-02-04
77.4%
#9026: fix(session-memory): sanitize content to prevent binary data in mem...
by Flamrru · 2026-02-04
77.4%
#8244: feat(hooks): add session:before_compact and session:after_compact i...
by kephail · 2026-02-03
76.3%
#19313: fix(session-memory): preserve rotated transcript selection on /new
by ayanesakura · 2026-02-17
75.7%
#18103: fix: session-memory hook reads reset file after /new or /reset
by MisterGuy420 · 2026-02-16
75.7%
#20184: feat: memory plugin compaction control
by solstead · 2026-02-18
73.9%