Give every stage a stable name and keep a journal file listing the stages that have completed, one per line.

Wrap each stage in a guard: if its name is already in the journal, skip it; otherwise run it and append its name only after it exits zero.

Write journal updates by appending a single line with a short shell append, which is atomic enough for a single-writer script, instead of rewriting the whole file.

Print the stage name before running it, so the last line of output after an interruption names the stage to inspect first.