Recovering lost code

· Source: Simon Willison's Weblog · Field: Technology & Digital — Software Development & Engineering, Artificial Intelligence & Machine Learning · Depth: Intermediate, quick

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

In practice

Topics

Best for: Machine Learning Engineer, NLP Engineer, Software Engineer, AI Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Simon Willison's Weblog.