What am I running inside my bash? (2014)
Modern shells are powerful enough to help you remember, if you learn to configure them appropriately. My histories are always saved because each shell instance gets its own HISTFILE, like so:  export HISTFILE=$HOME/.history/${TTY##\*/}.$SHLVL

As I use different terminal windows for different tasks, this keeps history files rather concise thematically.And I let the shell add timestamps too, so I can grep for entries produced during a certain time span:zsh:  setopt EXTENDEDHISTORY # add timestamps

bash:  HISTTIMEFORMAT="%F %T "

I write perl or shell script files, of course, if it's more than some a handful of lines.