Skill · Human Resources
Claude code sessions
Searches, analyzes, and manages local Claude Code session history from ~/.claude/projects/ JSONL files. Use when the user wants to search past sessions, view token or model stats, list sessions, build a resume prompt for a session ID, or find and clean up tasks across sessions.
How to use it
- Start your plan and connect your AI once
- Ask for the task in your own words, or say it directly:
Use the Claude code sessions skill to help me with this.Without a connection: copy the SKILL.md below into your AI's project instructions.
Claude Code Sessions
Reads Claude Code session files from ~/.claude/projects/ to search, analyze, and manage session history. For users who want to find past work, understand token and tool usage, recover context for a session, or clean up stale tasks.
When to use
- User asks to search or find something across past Claude Code sessions, optionally within a date range.
- User asks for session statistics: token usage, model distribution, tool call breakdowns.
- User asks to list sessions, sorted by recency, size, or duration, possibly with a limit.
- User gives a session ID and wants to resume or recover context from it.
- User asks about pending or orphaned tasks across sessions, or wants to delete sessions or tasks.
Workflows
Search sessions
Inputs: Search query; optional date range.
- Read session files under ~/.claude/projects/.
- Run full-text search across all session files for the query.
- If a date range was given, filter matches by session timestamps.
- Track which sessions have already been searched and skip re-scanning unchanged files.
- Return each matching session with context snippets around the match.
Check: Every returned match comes from an actual session file; no matches are invented. Output: List of matching sessions with context snippets, plus session ID, date, and project for each.
Show session statistics
Inputs: None beyond the request; read all session files.
- Read all session files under ~/.claude/projects/.
- Compute token usage totals, model distribution, and tool call breakdowns.
- Report the numbers exactly as computed.
Check: Figures match the files exactly; nothing rounded or estimated. Output: Token totals, model distribution, and tool call breakdowns. If no sessions exist, state that plainly.
List sessions
Inputs: Sort key (recency, size, or duration); optional limit.
- Read all session files under ~/.claude/projects/.
- Sort by the requested key.
- Apply the limit exactly if one was given.
- Build a table with session ID, date, project, token count, and duration.
Check: Row count respects the limit; sort order matches the request. Output: Table of sessions with session ID, date, project, token count, and duration.
Resume a session
Inputs: Session ID.
- Read that session file.
- Summarize the conversation, active tasks, and last state.
- Generate a context recovery prompt from that summary.
- Do not modify any files.
Check: The prompt reflects only what is in the session file. Output: A draft context recovery prompt presented for the user to copy.
Manage tasks across sessions
Inputs: Request for tasks, or a deletion request.
- Scan all session files for pending and orphaned tasks.
- Group tasks by status and project.
- If the user wants to delete sessions or tasks, confirm the action first and proceed only after explicit approval.
Check: No deletion happens without explicit confirmation. Output: Tasks grouped by status and project; deletions only after approval.
Tools and data
- Use local filesystem access to ~/.claude/projects/ when available; if it is not available, ask the user to provide the session files or connect the directory.
Guardrails
- Never modify or create session files — only read, and delete only when explicitly approved.
- Never delete sessions or tasks without asking for confirmation first.
- Never estimate or round token counts or statistics — report exact figures from the files.
- If no sessions are found, say so plainly. Never invent sessions or fabricate data.
Getting started
Ask the user what they want to do: search sessions, view stats, list sessions, resume a session, or manage tasks. If they want to search, ask for a query and an optional date range.
Credits
Adapted from an open-source original (MIT): https://www.aitmpl.com/component/skills/productivity/claude-code-sessions