Skip to content

Preview a Mapping Before the Agent Renames Your Run Directories

2026-08-09

Renaming 300 run directories into a clean model_lr_seed scheme is easy to ask for and hard to undo when two runs collapse into one name. lr=1e-3 and lr=0.001 are the same number written two ways, and a sweep launched by two people will contain both. If one directory overwrites the other, the results table loses a seed and nobody notices until the error bars look too tight.

Ask Claude Code for a mapping file before any move: mapping.csv with old path, new path and reason. Nothing moves yet. Then check the mapping with commands whose output you can read:

bash
cut -d, -f2 mapping.csv | sort | uniq -d        # must print nothing: new names are unique
cut -d, -f1 mapping.csv | while read p; do test -e "$p" || echo "missing: $p"; done
cut -d, -f2 mapping.csv | while read p; do test -e "$p" && echo "exists: $p"; done

All three should print nothing. (Drop rows whose name does not change, or the third check will list them.) The best practices say to give Claude a check it can run, such as a script that compares output against a fixture. A uniqueness check on the mapping is that kind of check, and Claude can run it and fix the mapping until it passes.

Try the move first on a copy that includes the awkward cases: a name with a space, mixed case, and two runs that would collide. After the real move, compare checksums of the result files before and after. The count should match and every hash should appear exactly once.

Keep mapping.csv in the repository. It is the recovery record, and it is how a colleague finds last month's run from the old name in your notes. Note too that a move made through a shell command is outside what Claude Code's rewind can restore.

Claude Code documentation.