Have you tried zsh with histdb? It's been an absolute gamechanger. Having a complete, precise, and effectively infinite history is like a second brain.
I know not everyone is on the zsh train, but it might be able to be ported to bash (it's just pre-hooks and some sqlite)