# Session History Extraction

## Quick Commands

**Find latest session:**
```bash
ls -lht ~/.claude/projects/-home-odouhou-locale-projects-ai-stack-deployer/ | head -5
```

**Extract last 5 messages:**
```bash
tail -100 ~/.claude/projects/-home-odouhou-locale-projects-ai-stack-deployer/SESSION_ID.jsonl | \
  jq -r 'select(.message.role == "assistant") | .message.content[] | select(.type == "text") | .text' 2>/dev/null | \
  tail -5
```

**Search for keywords:**
```bash
grep -i "keyword" SESSION_FILE.jsonl | tail -10
```

## One-liner

```bash
# Get last 5 messages from most recent session
ls -t ~/.claude/projects/-home-odouhou-locale-projects-ai-stack-deployer/*.jsonl | head -1 | \
  xargs tail -100 | \
  jq -r 'select(.message.role == "assistant") | .message.content[] | select(.type == "text") | .text' 2>/dev/null | \
  tail -5
```

## Session Structure

```json
{
  "message": {
    "role": "assistant",
    "content": [{"type": "text", "text": "message here"}]
  }
}
```
