Compare commits
3 Commits
89255cc6fa
...
1b432f1c3f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b432f1c3f | ||
|
|
383e2cbf38 | ||
|
|
1f5029cbb0 |
150
plans/fizzy-puzzling-candy.md
Normal file
150
plans/fizzy-puzzling-candy.md
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
# Plan: Session Summarization Hook
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Sessions are tracked in `~/.claude/state/personal-assistant/history/index.json` but:
|
||||||
|
1. No conversation logs are captured to our history folder
|
||||||
|
2. Sessions never get marked as summarized
|
||||||
|
3. Memory files remain empty (decisions, preferences, projects, facts)
|
||||||
|
|
||||||
|
## Root Cause
|
||||||
|
|
||||||
|
Missing `SessionEnd` hook to trigger summarization when sessions end.
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
Add a `SessionEnd` hook that:
|
||||||
|
1. Reads the transcript from Claude's built-in storage (`transcript_path`)
|
||||||
|
2. Extracts key information (decisions, preferences, project context, facts)
|
||||||
|
3. Saves to appropriate memory files
|
||||||
|
4. Updates history index to mark session as summarized
|
||||||
|
|
||||||
|
## Files to Modify
|
||||||
|
|
||||||
|
| File | Action |
|
||||||
|
|------|--------|
|
||||||
|
| `~/.claude/hooks/hooks.json` | Add `SessionEnd` hook entry |
|
||||||
|
| `~/.claude/hooks/scripts/session-end.sh` | **Create** - orchestrates summarization |
|
||||||
|
| `~/.claude/hooks/scripts/summarize-transcript.py` | **Create** - Python script to process transcript |
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
### 1. Hook Configuration (`hooks.json`)
|
||||||
|
|
||||||
|
Add `SessionEnd` hook that calls the summarization script:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"SessionEnd": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "~/.claude/hooks/scripts/session-end.sh",
|
||||||
|
"timeout": 120
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Session End Script (`session-end.sh`)
|
||||||
|
|
||||||
|
- Receives JSON via stdin with `session_id`, `transcript_path`, `reason`
|
||||||
|
- Calls Python summarization script
|
||||||
|
- Handles errors gracefully (session end shouldn't fail)
|
||||||
|
|
||||||
|
### 3. Summarization Script (`summarize-transcript.py`)
|
||||||
|
|
||||||
|
The script will:
|
||||||
|
|
||||||
|
1. **Parse transcript** - Read the `.jsonl` file from `transcript_path`
|
||||||
|
2. **Extract key items** - Use heuristics to identify:
|
||||||
|
- Decisions: "let's use", "we decided", "I'll go with"
|
||||||
|
- Preferences: "I prefer", "always", "never", "I like"
|
||||||
|
- Project context: file paths, config references
|
||||||
|
- Facts: environment info, tool locations
|
||||||
|
3. **Deduplicate** - Check against existing memory items
|
||||||
|
4. **Save to memory files** - Append new items with UUIDs
|
||||||
|
5. **Update history index** - Mark session as summarized, add topics
|
||||||
|
|
||||||
|
### Processing Approach: Hybrid (Decision)
|
||||||
|
|
||||||
|
**Step 1: Threshold check**
|
||||||
|
- Skip sessions with < 3 user messages
|
||||||
|
- Skip sessions that are only quick commands (no substantive discussion)
|
||||||
|
|
||||||
|
**Step 2: Heuristic extraction (fast, no API)**
|
||||||
|
- File paths mentioned → project context
|
||||||
|
- Environment facts (tool locations, versions)
|
||||||
|
- Simple preferences with clear keywords
|
||||||
|
|
||||||
|
**Step 3: LLM extraction (if substantive content)**
|
||||||
|
- Complex decisions with rationale
|
||||||
|
- Nuanced preferences
|
||||||
|
- Project context requiring interpretation
|
||||||
|
- Use Claude API (Haiku for cost efficiency)
|
||||||
|
|
||||||
|
### Transcript Storage (Decision)
|
||||||
|
|
||||||
|
Reference Claude's existing transcript location (`~/.claude/projects/.../[uuid].jsonl`) rather than copying to our history folder. The history index will store the transcript path for future reference.
|
||||||
|
|
||||||
|
### Memory File Format
|
||||||
|
|
||||||
|
Each item:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "uuid",
|
||||||
|
"date": "YYYY-MM-DD",
|
||||||
|
"content": "Brief description",
|
||||||
|
"context": "Additional context",
|
||||||
|
"session": "session-id"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Steps
|
||||||
|
|
||||||
|
### Step 1: Update hooks.json
|
||||||
|
|
||||||
|
Add `SessionEnd` entry to `~/.claude/hooks/hooks.json`
|
||||||
|
|
||||||
|
### Step 2: Create session-end.sh
|
||||||
|
|
||||||
|
Shell wrapper at `~/.claude/hooks/scripts/session-end.sh`:
|
||||||
|
- Parse JSON input from stdin
|
||||||
|
- Extract session_id, transcript_path, reason
|
||||||
|
- Call Python summarization script
|
||||||
|
- Handle errors silently (don't break session exit)
|
||||||
|
|
||||||
|
### Step 3: Create summarize-transcript.py
|
||||||
|
|
||||||
|
Python script at `~/.claude/hooks/scripts/summarize-transcript.py`:
|
||||||
|
|
||||||
|
```
|
||||||
|
Arguments: --session-id <id> --transcript <path> [--reason <reason>]
|
||||||
|
|
||||||
|
1. Load transcript (.jsonl)
|
||||||
|
2. Count user messages → skip if < 3
|
||||||
|
3. Heuristic pass:
|
||||||
|
- Extract file paths → projects.json
|
||||||
|
- Extract env facts → facts.json
|
||||||
|
4. If substantive content detected:
|
||||||
|
- Call Claude API (Haiku) for decisions/preferences
|
||||||
|
- Parse response → decisions.json, preferences.json
|
||||||
|
5. Update history/index.json:
|
||||||
|
- Set summarized: true
|
||||||
|
- Add transcript_path
|
||||||
|
- Add extracted topics
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Update history index schema
|
||||||
|
|
||||||
|
Add `transcript_path` field to session entries in `history/index.json`
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
1. Start a test session with substantive discussion
|
||||||
|
2. Exit session normally
|
||||||
|
3. Verify:
|
||||||
|
- Hook fired (check with `--debug`)
|
||||||
|
- Memory files updated
|
||||||
|
- History index marked summarized
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"repo": "anthropics/claude-plugins-official"
|
"repo": "anthropics/claude-plugins-official"
|
||||||
},
|
},
|
||||||
"installLocation": "/home/will/.claude/plugins/marketplaces/claude-plugins-official",
|
"installLocation": "/home/will/.claude/plugins/marketplaces/claude-plugins-official",
|
||||||
"lastUpdated": "2026-01-03T20:00:09.379Z"
|
"lastUpdated": "2026-01-04T20:00:29.464Z"
|
||||||
},
|
},
|
||||||
"superpowers-marketplace": {
|
"superpowers-marketplace": {
|
||||||
"source": {
|
"source": {
|
||||||
|
|||||||
34
reports/archive/2026-01-04.md
Normal file
34
reports/archive/2026-01-04.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Morning Report - Sun Jan 04, 2026
|
||||||
|
|
||||||
|
## 🌤 Weather
|
||||||
|
Weather unavailable: <urlopen error timed out>
|
||||||
|
|
||||||
|
## 📧 Email
|
||||||
|
10 unread, 0 urgent
|
||||||
|
|
||||||
|
- Chase - Your Chase Freedom Unlimited Visa balance is...
|
||||||
|
- Chase - Your rewards balance has reached 0 POINTS
|
||||||
|
- USPS - PO Box Price Changes Coming
|
||||||
|
- Uber Receipts - Your Saturday evening trip with Uber
|
||||||
|
- Chase - You made an online, phone, or mail transaction...
|
||||||
|
|
||||||
|
## 📅 Today
|
||||||
|
• 2:00 PM - Seattle Saturday (SAM + QED + Lecosho) (5h)
|
||||||
|
|
||||||
|
## 📈 Stocks
|
||||||
|
CRWV $79.32 +10.8% ▲ NVDA $188.85 +1.3% ▲ MSFT $472.94 -2.2% ▼
|
||||||
|
|
||||||
|
## ✅ Tasks
|
||||||
|
⚠️ Could not fetch tasks: ('invalid_scope: Bad Request', {'error': 'invalid_scope', 'error_description': 'Bad Request'})
|
||||||
|
|
||||||
|
## 🖥 Infrastructure
|
||||||
|
K8s: 🟢 | Workstation: 🟢
|
||||||
|
|
||||||
|
## 📰 Tech News
|
||||||
|
• Anti-Aging Injection Regrows Knee Cartilage and Prevents Art... (Hacker News)
|
||||||
|
• How I archived 10 years of memories using Spotify (Hacker News)
|
||||||
|
• Can I finally start using Wayland in 2026? (Lobsters)
|
||||||
|
• Saying goodbye to the servers at our physical datacenter - S... (Lobsters)
|
||||||
|
|
||||||
|
---
|
||||||
|
*Generated: 2026-01-04 08:00:33 PT*
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
# Morning Report - Sat Jan 03, 2026
|
# Morning Report - Sun Jan 04, 2026
|
||||||
|
|
||||||
## 🌤 Weather
|
## 🌤 Weather
|
||||||
Weather unavailable: <urlopen error _ssl.c:1063: The handshake operation timed out>
|
Weather unavailable: <urlopen error timed out>
|
||||||
|
|
||||||
## 📧 Email
|
## 📧 Email
|
||||||
10 unread, 2 attention-worthy
|
10 unread, 0 urgent
|
||||||
|
|
||||||
- [!] Google - Help strengthen security of your Account
|
- Chase - Your Chase Freedom Unlimited Visa balance is...
|
||||||
- [!] coreweave@myworkday.com - Security Alert: Signon from New Device (2x)
|
- Chase - Your rewards balance has reached 0 POINTS
|
||||||
- E*TRADE - Your Statement Is Now Available
|
- USPS - PO Box Price Changes Coming
|
||||||
- Capital One - Your requested balance summary
|
- Uber Receipts - Your Saturday evening trip with Uber
|
||||||
- Mindful Support Services - Your statement is now available
|
- Chase - You made an online, phone, or mail transaction...
|
||||||
|
|
||||||
## 📅 Today
|
## 📅 Today
|
||||||
• 2:00 PM - Seattle Saturday (SAM + QED + Lecosho) (5h)
|
• 2:00 PM - Seattle Saturday (SAM + QED + Lecosho) (5h)
|
||||||
Tomorrow: 1 event, first at 2:00 PM
|
|
||||||
|
|
||||||
## 📈 Stocks
|
## 📈 Stocks
|
||||||
CRWV $79.32 +10.8% ▲ NVDA $188.85 +1.3% ▲ MSFT $472.94 -2.2% ▼
|
CRWV $79.32 +10.8% ▲ NVDA $188.85 +1.3% ▲ MSFT $472.94 -2.2% ▼
|
||||||
@@ -26,10 +25,10 @@ CRWV $79.32 +10.8% ▲ NVDA $188.85 +1.3% ▲ MSFT $472.94 -2.2% ▼
|
|||||||
K8s: 🟢 | Workstation: 🟢
|
K8s: 🟢 | Workstation: 🟢
|
||||||
|
|
||||||
## 📰 Tech News
|
## 📰 Tech News
|
||||||
• ParadeDB (YC S23) Is Hiring Database Engineers (Hacker News)
|
• Anti-Aging Injection Regrows Knee Cartilage and Prevents Art... (Hacker News)
|
||||||
• X-Clacks-Overhead (Hacker News)
|
• How I archived 10 years of memories using Spotify (Hacker News)
|
||||||
• I'm brave enough to say it: Linux is good now, and if you wa... (Lobsters)
|
• Can I finally start using Wayland in 2026? (Lobsters)
|
||||||
• Who's Hiring? Q1 2026 (Lobsters)
|
• Saying goodbye to the servers at our physical datacenter - S... (Lobsters)
|
||||||
|
|
||||||
---
|
---
|
||||||
*Generated: 2026-01-03 08:00:20 PT*
|
*Generated: 2026-01-04 08:00:33 PT*
|
||||||
@@ -182,6 +182,13 @@
|
|||||||
"ended": null,
|
"ended": null,
|
||||||
"summarized": false,
|
"summarized": false,
|
||||||
"topics": []
|
"topics": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2026-01-03_13-58-37",
|
||||||
|
"started": "2026-01-03T13:58:37-08:00",
|
||||||
|
"ended": null,
|
||||||
|
"summarized": false,
|
||||||
|
"topics": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user