Add new skill for finding and recovering content from Claude Code session history files (.claude/projects/). Features: - Search sessions by keywords across project history - Recover deleted files from Write tool calls - Analyze session statistics and tool usage - Track file evolution across multiple sessions Best practice improvements applied: - Third-person description in frontmatter - Imperative writing style throughout - Progressive disclosure (workflows in references/) - No content duplication between SKILL.md and references - Proper exception handling in scripts - Documented magic numbers Marketplace integration: - Updated marketplace.json (v1.13.0, 20 plugins) - Updated README.md badges, skill section, use cases - Updated README.zh-CN.md with Chinese translations - Updated CLAUDE.md skill count and available skills list - Updated CHANGELOG.md with v1.13.0 entry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Workflow Examples
Detailed workflow examples for common session history recovery scenarios.
Recover Files Deleted in Cleanup
Scenario: Files were deleted during code review, need to recover specific components.
# 1. Find sessions mentioning the deleted files
python3 scripts/analyze_sessions.py search /path/to/project \
DeletedComponent ModelScreen RemovedFeature
# 2. Recover content from most relevant session
python3 scripts/recover_content.py ~/.claude/projects/.../session-id.jsonl \
-k DeletedComponent ModelScreen \
-o ./recovered/
# 3. Review recovered files
ls -lh ./recovered/
Track File Evolution Across Sessions
Scenario: Understand how a file changed over multiple sessions.
# 1. Find sessions that modified the file
python3 scripts/analyze_sessions.py search /path/to/project \
"componentName.jsx"
# 2. Analyze each session's file operations
for session in session1.jsonl session2.jsonl session3.jsonl; do
python3 scripts/analyze_sessions.py stats $session --show-files | \
grep "componentName.jsx"
done
# 3. Recover all versions
python3 scripts/recover_content.py session1.jsonl -k componentName -o ./v1/
python3 scripts/recover_content.py session2.jsonl -k componentName -o ./v2/
python3 scripts/recover_content.py session3.jsonl -k componentName -o ./v3/
# 4. Compare versions
diff ./v1/componentName.jsx ./v2/componentName.jsx
Find Session with Specific Implementation
Scenario: Remember implementing a feature but can't find which session.
# Search for distinctive keywords from that implementation
python3 scripts/analyze_sessions.py search /path/to/project \
"useModelStatus" "downloadProgress" "ModelScope"
# Review top match
python3 scripts/analyze_sessions.py stats <top-result-session.jsonl>
Batch Recovery Across Multiple Sessions
Scenario: Recover files containing a keyword from all matching sessions.
# Find relevant sessions
sessions=$(python3 scripts/analyze_sessions.py search /path/to/project \
keyword --limit 999 | grep "Path:" | awk '{print $2}')
# Recover from each session
for session in $sessions; do
output_dir="./recovery_$(basename $session .jsonl)"
python3 scripts/recover_content.py "$session" -k keyword -o "$output_dir"
done
Custom Extraction from Raw JSONL
For extraction needs not covered by bundled scripts:
import json
with open('session.jsonl', 'r') as f:
for line in f:
data = json.loads(line)
# Custom extraction logic
# See references/session_file_format.md for structure