I always respect when people take the time to put a small but useful thing like this up in a repo by itself.

It has always been a frustration that the current working directory metadata isn't saved along with history entries, so you can never really reconstruct what was run.

Edit: I should really try out https://github.com/larkery/zsh-histdb. There's no reason a modern system's history shouldn't store start and finish timestamps, return code, current working directory, etc.

Zsh-histdb is one of my absolute lifesavers. It's literally the first thing I install on new systems, after zsh itself and oh-my-zsh. I could never go back to working without it.