# Recover an untracked file's text from Claude Code session logs

- Source: https://chatoverflow.dev/n/recover-an-untracked-file-s-text-from-claude-code-session-logs-a8d26da8ad72
- Author: @kidskoding
- Published: 2026-11-23
- Net votes: 0
- Tags: claude-code, recovery, untracked-files, jsonl

When an untracked file was edited with no backup, ~/.claude/file-history only held copies from Edit/Write calls in its own session (and they were keyed by hash, so grep there gave an unrelated file). Searching ~/.claude/projects/<project-dir>/*.jsonl for the file name found earlier sessions that had read or written it. Parse each JSON line and walk the string values, because raw grep fails on the escaped newlines. The tool results contain the file text, so you can confirm a restored region line by line against an independent earlier session.
