Back to Skills

learn-from-session-history

verified

Analyze my Claude Code local session history and suggest CLAUDE.md, hook, skill, agent, or permission revisions

View on GitHub

Marketplace

clipboard

ClipboardHealth/core-utils

Plugin

core

Repository

ClipboardHealth/core-utils
30stars

plugins/core/skills/learn-from-session-history/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/ClipboardHealth/core-utils/blob/main/plugins/core/skills/learn-from-session-history/SKILL.md -a claude-code --skill learn-from-session-history

Installation paths:

Claude
.claude/skills/learn-from-session-history/
Powered by add-skill CLI

Instructions

## Scope

$ARGUMENTS

- Blank or "all": analyze all projects
- Project name/path: analyze only that project

## File Locations

| Path                                                       | Contents          |
| ---------------------------------------------------------- | ----------------- |
| `~/.claude/projects/<hash>/*.jsonl`                        | Conversation logs |
| `~/.claude/projects/<hash>/<session-id>/subagents/*.jsonl` | Subagent logs     |
| `~/.claude/projects/<hash>/sessions-index.json`            | Session metadata  |
| `~/.claude/projects/<hash>/settings.local.json`            | Project settings  |

## JSONL Structure

Each line is a JSON object with different structures:

- `.message.content[]` - incremental messages (one per line)
- `.data.normalizedMessages[]` - **cumulative history** (contains all prior messages)

Always filter out `normalizedMessages` to avoid over-counting:

```bash
rg -v '"normalizedMessages"'
```

Key content `type` values within `.message.content[]`:

- `"tool_use"` → fields: `name`, `input` (tool name and parameters)
- `"tool_result"` → fields: `tool_use_id`, `content`
- `"text"` → assistant text responses

## Analysis

Analyze my session history for:

1. Repeated permission denials
2. Tool calls that failed then succeeded with different approaches
3. Commands blocked by hooks
4. Multi-step patterns that could be simplified

Output actionable recommendations:

1. `CLAUDE.md` rules to add
2. Hooks, skills, or slash commands to create

## Extraction Patterns

```bash
# Count all tool usage
rg --files ~/.claude/projects -g "*.jsonl" | head -300 | \
  xargs cat 2>/dev/null | rg -v '"normalizedMessages"' | rg '"tool_use"' | \
  rg -o '"name":"[^"]*"' | sort | uniq -c | sort -rn

# Tool call sequences (what tools follow what)
rg --files ~/.claude/projects -g "*.jsonl" | head -300 | \
  xargs cat 2>/dev/null | rg -v '"normalizedMessages"' | rg '"tool_use"' | rg -o '"name":"[^"]*"' | \
  awk 'NR>1{print prev" -> "$0} {prev=$0}'

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6876 chars