Skip to content
MyDSHMy DSH Field Notes
中文
Independently maintained; not affiliated with DeepSeek. No association with mydsh.dev or other MyDSH sites.

Home/Workspace & files/Cleanup & undo

Leftover files to check after every run

After a batch of tasks the workspace has unfamiliar files and you cannot tell artifacts from debris.

VerifiedVersion and environmentChecked 2026-11-14
Scope
any task that writes files
Checked
2026-11-14

Copyable command

find . -type f -newer /tmp/before.txt -not -path './.git/*' | sort

Why does the workspace get dirty? Finishing a task usually leaves intermediates behind: throwaway scripts, split fragments, validation samples, half-written output. Not necessarily wrong, but they must be identified.

Common leftoverWhat it looks likeWhat to do
Temporary scriptsverify.py, check.sh, tmp_*.py — one-off validation logicDelete after confirming no reuse; move into scripts/ if you keep it
Intermediate fragmentsout_part1.md, chunk_*.txt, somefile.bakDelete once merged
Test samplessample.*, test_* — often fake dataDelete; make the recipe generate them instead of committing
Half-written outputIncomplete but not erroringJudge against the acceptance list; prefer rerunning
Logs and caches*.log, __pycache__, .pytest_cacheDelete; add ignore rules
Modified originalsSame name, different contentOnly a hash comparison reveals it

Screen quickly by modification time

find . -type f -newer /tmp/before.txt -not -path './.git/*' | sort

Touch /tmp/before.txt before the run, then use this afterwards to list everything created or touched by this run. Much faster than browsing directories.

Use git when available

git status --short

Untracked (??), modified ( M), deleted ( D) at a glance. The find command above substitutes when there is no repo.

A counter-intuitive trap: artifacts and debris often share a directory. Confirm the acceptance list before cleaning — 'which files should exist' is easier to judge than 'which should not'.

Cleanup order

  1. Snapshot the file list first (find . -type f | sort > /tmp/after.txt).
  2. Mark what the acceptance list says should exist.
  3. Classify the rest per the table: delete regenerable one-offs, move reusable pieces into a fixed directory.
  4. Rerun the task once to confirm nothing you deleted was required — the step most often skipped, and the most expensive to skip.

What counts as working

Check every line. All of them pass or the job is not done.

  • You can list every file created or touched by the run
  • Artifacts and debris are distinguished against the acceptance list
  • One rerun after cleanup still succeeds

Where it fails

Symptom, cause, what to do — written in the order it actually happens.

SymptomCauseWhat to do
Rerun fails after cleanupSomething the recipe depended on was deletedRestore or regenerate; move such files into a fixed directory instead of deleting
Leftovers are invisible to git statusThey are gitignoredUse find -newer instead of relying on git

Sources

Verified means measured here. Compiled means every line carries a source.