Recovering lost code
Summary
A developer experienced a "parallel agent psychosis" event, losing a feature they had worked on the previous day, unable to locate it across various development environments like branches, worktrees, cloud instances, or checkouts. The lost code was eventually discovered to have been developed in a temporary directory (`/tmp`) and subsequently lost due to a computer crash and reboot. Fortunately, the code was recoverable from `~/.claude/projects/` session logs, with Claude Code capable of extracting and restoring the missing feature.
Key takeaway
For developers who frequently prototype or experiment, you should be aware that work in temporary directories is vulnerable to system reboots. If you lose code, check your `~/.claude/projects/` session logs, as Claude Code can often reconstruct lost features from these records, saving significant rework.
Key insights
Lost code can be recovered from session logs, even after system crashes.
Principles
- Temporary directories are volatile.
- Session logs can preserve work.
In practice
- Check `~/.claude/projects/` for lost code.
- Utilize Claude Code for recovery.
Topics
- Code Recovery
- Claude Code
- Session Logging
- Development Workflow
Best for: Machine Learning Engineer, NLP Engineer, Software Engineer, AI Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Simon Willison's Weblog.