session-recovery — скилл для Claude Code: что делает и как установить
Скилл session-recovery диагностирует и восстанавливает потерянные сессии Claude Code, если команда claude -r не находит историю диалогов или файлы пишутся не туда.
MIT 135 установок ★ 3 обновлён 2026-10-25
npx skills add terrylica/cc-skills --skill session-recovery -a claude-codeЧто делает session-recovery
Claude Code сохраняет историю диалогов в формате JSONL внутри каталога ~/.claude/projects/, кодируя абсолютный путь проекта в названии папки. Если переменная окружения $HOME настроена неверно или различается между терминалом и редактором, сессии улетают в директорию /tmp/ либо полностью исчезают из списка возобновления.
Скилл сопоставляет реальное и ожидаемое значения переменной $HOME, ищет потерянные файлы .jsonl по путям системы и проверяет права на запись. Он также выявляет повреждённые UUID-файлы, возникшие из-за незавершённой записи, и находит расхождения в кодировании путей каталогов.
Для выполнения диагностических шагов скиллу требуется доступ к инструментам Read и Bash.
Какие задачи решает
- восстановить сессии при ошибке «No conversations found to resume»
- найти файлы диалогов, попавшие в
/tmp/из-за сбоя$HOME - исправить расхождения в истории сессий между терминалом и средой IDE
- удалить повреждённые JSONL-файлы после прерванной записи
Примеры запросов агенту
- Проверь, почему claude -r не видит мои прошлые сессии в этом проекте
- Найди, куда сохранились диалоги Claude Code, если в ~/.claude/projects/ пусто
- Диагностируй переменную HOME и проверь каталог проектов на битые файлы .jsonl
Как установить session-recovery
1Через Skills CLI (Vercel)
npx skills add terrylica/cc-skills --skill session-recovery -a claude-code2Вручную: положить файлы
~/.claude/skills/session-recovery/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/session-recovery/
1Через Skills CLI (Vercel)
npx skills add terrylica/cc-skills --skill session-recovery -a codex2Вручную: положить файлы
.agents/skills/session-recovery/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add terrylica/cc-skills --skill session-recovery -a cursor2Вручную: положить файлы
.cursor/skills/session-recovery/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install terrylica/cc-skills plugins/devops-tools/skills/session-recovery2Вручную: положить файлы
.github/skills/session-recovery/SKILL.md1Через Skills CLI (Vercel)
npx skills add terrylica/cc-skills --skill session-recovery -a gemini-cli2Командой платформы
gemini skills install https://github.com/terrylica/cc-skills --path plugins/devops-tools/skills/session-recoveryВручную: положить файлы
.devin/skills/session-recovery/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add terrylica/cc-skills --skill session-recovery -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о session-recovery
Как установить session-recovery в Claude Code?
Выполните команду npx skills add terrylica/cc-skills --skill session-recovery -a claude-code. Также можно сохранить файл напрямую в ~/.claude/skills/session-recovery/SKILL.md.
Что делает скилл session-recovery?
Он локализует и исправляет проблемы с хранением сессий Claude Code, проверяя системные пути, значение $HOME и целостность файлов диалогов.
Какие инструменты нужны скиллу для работы?
Скиллу требуются инструменты Read и Bash, через которые он считывает настройки окружения и сканирует файловую систему.
Исходный текст
SKILL.md · MIT
---
name: session-recovery
description: "Diagnose and recover Claude Code session problems: 'No conversations found to resume', sessions in the wrong location, missing or corrupted session files."
allowed-tools: Read, Bash
---
# Claude Code Session Recovery Skill
> **Self-Evolving Skill**: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
## When to Use This Skill
Use this skill when:
- "No conversations found to resume" when running `claude -r`
- New conversations not creating session files
- Sessions appearing in wrong locations (`/tmp/` instead of `~/.claude/projects/`)
- Session history missing after environment changes
- IDE/terminal settings affecting session creation
- Need to migrate or recover 600+ legacy sessions
## Quick Reference
## Official Session Storage
**Standard Location:** `~/.claude/projects/`
**Structure:**
```
~/.claude/projects/
├── -home-username-my-project/ # Encoded absolute path
│ └── 364695f1-13e7-4cbb-ad4b-0eb416feb95d.jsonl
└── -tmp-another-project/
└── a8e39846-ceca-421d-b4bd-3ba0eb1b3145.jsonl
```
**Format:** One JSON event per line (JSONL), UUID-based filenames
## Critical Pitfall: HOME Variable
### Problem
Claude Code uses `$HOME` environment variable to determine session storage location. If `$HOME` is incorrect, sessions go to wrong directory or disappear.
### Symptoms
- `claude -r` shows "No conversations found to resume"
- New conversations work but files don't appear in expected location
- Sessions found in `/tmp/` or other unexpected paths
- Works on one machine but not another
### Diagnosis
```bash
/usr/bin/env bash << 'PREFLIGHT_EOF'
# Step 1: Check current HOME
echo "Current HOME: $HOME"
# Step 2: Check system expectation
echo "Expected HOME: $(getent passwd $(whoami) | cut -d: -f6)"
# Step 3: Find where Claude is actually writing
find /tmp -name "*.jsonl" -path "*/.claude/projects/*" 2>/dev/null
PREFLIGHT_EOF
```
---
## Reference Documentation
For detailed diagnostic steps and solutions, see:
- [Troubleshooting Guide](./TROUBLESHOOTING.md) - Detailed diagnostic procedures and fixes
---
## Troubleshooting
| Issue | Cause | Solution |
| ---------------------------- | ------------------------------ | ---------------------------------------------------- |
| "No conversations found" | Wrong HOME variable | Verify `$HOME` matches expected user directory |
| Sessions in /tmp/ | HOME set incorrectly | Fix HOME in shell profile, restart terminal |
| Session files missing | Disk space or permissions | Check `~/.claude/projects/` permissions and disk |
| Wrong project sessions shown | Path encoding mismatch | Check encoded path matches current working directory |
| Sessions not persisting | File system issues | Verify write permissions to `~/.claude/projects/` |
| IDE sessions separate | Different HOME per environment | Ensure consistent HOME across terminal and IDE |
| Legacy sessions not visible | Migration not complete | See migration section in TROUBLESHOOTING.md |
| UUID filename corruption | Incomplete writes | Check for partial .jsonl files, remove corrupt ones |
## Post-Execution Reflection
After this skill completes, check before closing:
1. **Did the command succeed?** — If not, fix the instruction or error table that caused the failure.
2. **Did parameters or output change?** — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
3. **Was a workaround needed?** — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.
Only update if the issue is real and reproducible — not speculative.
© terrylica · MIT · terrylica/cc-skills