Create or update the diary.md file in the project root with development activity from Claude Code history and git logs.
Run this to get project history grouped by day with active time (excluding gaps >30 min):
cat ~/.claude/history.jsonl | python3 -c "
import sys, json
from datetime import datetime
from collections import defaultdict
import os
cwd = os.getcwd()
days = defaultdict(list)
for line in sys.stdin:
try:
data = json.loads(line.strip())
ts = data.get('timestamp', 0)
display = data.get('display', '')
project = data.get('project', '')
if ts and display and '/clear' not in display and len(display) > 10 and cwd in project:
dt = datetime.fromtimestamp(ts/1000)
days[dt.strftime('%Y-%m-%d')].append(dt)
except: pass
for day in sorted(days.keys(), reverse=True):
entries = sorted(days[day])
if len(entries) < 2:
continue
# Calculate active time (excluding gaps > 30 min)
active_minutes = 0
for i in range(1, len(entries)):
gap = (entries[i] - entries[i-1]).total_seconds() / 60
if gap <= 30:
active_minutes += gap
else:
active_minutes += 5 # 5 min per isolated interaction
active_minutes += 5 # add time for last interaction
first = entries[0].strftime('%H:%M')
last = entries[-1].strftime('%H:%M')
print(f'=== {day} ({first} - {last}) [~{active_minutes/60:.1f}h active] [{len(entries)} entries] ===')
"For each day you need to update, get the actual prompts:
cat ~/.claude/history.jsonl | python3 -c "
import sys, json
from datetime import datetime
import os
cwd = os.getcwd()
TARGET_DATE = 'YYYY-MM-DD' # Replace with target date
for line in sys.stdin:
try:
data = json.loads(line.strip())
ts = data.get('timestamp', 0)
display = data.get('display', '')
project = data.get('project', '')
if ts and display and '/clear' not in display and len(display) > 10 and cwd in project:
dt = datetime.fromtimestamp(ts/1000)
if dt.strftime('%Y-%m-%d') == TARGET_DATE:
print(f'{dt.strftime(\"%H:%M\")} | {display[:150]}')
except: pass
"git log --since="7 days ago" --pretty=format:"%ad|%h" --date=format:"%Y-%m-%d" --shortstatIf diary.md doesn't exist: Create it with all available history.
If diary.md exists: Only update/add entries for the last 4 days. Do NOT modify older entries.
Use this exact format for each day entry:
## YYYY-MM-DD (Weekday)
**Duration:** HH:MM - HH:MM (~Xh active)
**Commits:** N | **Files:** N | **Lines:** +N / -N
- What I did, in plain English
- Another thing I accomplished
---- Keep it short: 2-4 bullets max per day
- Plain English: Write what you did, not how. Say "Added news monitoring" not "Implemented NewsMonitoringService with AI clustering"
- No technical jargon: Avoid class names, method names, architectural details
- Action words: Start with verbs like "Added", "Fixed", "Built", "Set up", "Connected"
- Order: Most recent day at the top
- Active Time: Calculate by summing gaps ≤30 min between prompts
- Skip days with no activity
# Development Diary
## 2025-11-21 (Friday)
**Duration:** 09:12 - 15:22 (~4.5h active)
**Commits:** 1 | **Files:** 66 | **Lines:** +1,831 / -409
- Added change detection to spot website updates
- Built a command to run it automatically
---
## 2025-11-20 (Thursday)
**Duration:** 09:14 - 19:02 (~4.5h active)
**Commits:** 4 | **Files:** 88 | **Lines:** +2,704 / -1,003
- Reorganized how we find competitor URLs
- Added caching so we don't hit external APIs too often
---Now analyze the history and git logs, then create or update diary.md accordingly.