mining-claude-sessions
Skill6 starsChanged 9 days agoMITView on GitHub
Use when asked to find or resume a past Claude Code session ("find the session where we...", "resume the one that built X"), to say what a session did, or to audit Claude Code usage (which tools, skills, commands, agents or prompts recur), and before you parse ~/.claude/projects transcripts by hand.
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adding-an-add-to-claude-buttonSkill
- bd-to-br-migrationSkill
- codex-plan-reviewSkill
- codex-reviewSkill
- debugging-kubernetes-rolloutsSkill
- debugging-nodejs-appsSkill
- de-sloppingSkill
- detect-overengineeringSkill
- evaluating-third-party-toolsSkill
- finding-latest-versionsSkill
- git-reconSkill
- humanizerSkill
- hyprland-luaSkill
- minto-pyramidSkill
- nonstopSkill
- operating-frappe-on-kubernetesSkill
- presentation-blueprintSkill
- pr-fixSkill
- pr-landSkill
- prSkill
- watching-pr-bot-reviewsSkill
The file
Files
Mining Claude sessions
cc-sessions reads Claude Code's local transcripts and answers the common questions in one command. Without it, agents wrote a new JSONL parser for each audit and each "find that session" request.
Commands
| Question | Command |
| Which session did X, and how do I resume it? | cc-sessions find handbrake transcode |
| Only recent sessions in one project | cc-sessions find invoice --days 14 --project finance |
| What did that session do? | cc-sessions show 9548d7af |
| What do we use, and what recurs? | cc-sessions stats --days 30 |
| The same, as JSON | cc-sessions stats --days 30 --json |
| Masked events for your own analysis | cc-sessions export /tmp/events.jsonl --days 30 |
findneeds every word to appear in a session: its title, typed prompts, edited file paths or commands. Title and prompt hits rank highest. Each hit ends with acd <dir> && claude --resume <id>line.showtakes a session id or a unique prefix of one.--days Nkeeps sessions whose file changed in the last N days.--project TEXTmatches the project directory name.cc-sessions --helplists the rest.
cc-sessions is on PATH where skillsync installed this skill. In a plugin install, call <this skill's base directory>/bin/cc-sessions by its full path.
Masking
Transcripts hold everything a session saw, secrets included. Every line cc-sessions prints or exports goes through a masker first. It masks API keys, tokens, auth headers, cookies and long random strings. It also masks passwords piped into sudo -S, sshpass -p values, and the credential options of curl, wget and httpie. It reads shell commands word by word, so quotes and escapes do not hide a secret. Pass your own literal values with --mask-file FILE, one per line, or set CC_SESSIONS_MASK_FILE. export writes its file with mode 600.
Masking is best effort: patterns cannot catch every secret. It lowers exposure, it does not remove it, so treat the output as sensitive too. The masker does not touch the transcripts themselves. Quote them through cc-sessions, never with cat or grep.
The transcript format
The tool relies on these facts:
- Main sessions are
~/.claude/projects/<project>/<session-id>.jsonl. Subagents are<session-id>/subagents/agent-*.jsonl.CLAUDE_CONFIG_DIRmoves the root. - Each line is one JSON record with a
type. - A prompt a person typed is a
userrecord withorigin.kindset tohuman. Task notifications and tool results areuserrecords too: skip them. - Tool calls are
tool_useblocks inassistantrecords (name,input). Results come back astool_resultblocks, withis_erroron failures. ai-titlerecords hold the session title.pr-linkrecords holdprUrl, repeated each turn.- Timestamps are UTC.
When the answer is not there
- Claude Code deletes a transcript after
cleanupPeriodDays(default 30) without activity. Older sessions are gone unless something else kept them. - Each machine keeps its own transcripts. Run
cc-sessionson the machine where the session ran.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

