I use jupyter notebooks for similar purpose, with the Python kernel's memory keeping the state I want for some random stuff, and notebook being a recipe how to reproduce the calculation/processing.
some of my kernels been running for weeks, as I come back and redo or rework some processing.
the neat thing about jupyter notebooks, is you can interleave python one-liners with bash one-liners and mix them as you wish.