This is the feature I've been looking for:

"log exit code, cwd, hostname, session, command duration, etc"

you can mostly do that in bash:

    export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/stuff/logs/bash-history-$(date "+%Y-%m-%d").log; fi'
makes files like

    stuff/logs/bash-history-2023-05-06.log
that contain

    2023-05-06.11:42:38 /home/dv  3737  2023-05-06 11:42:38 cat .bashrc
then you can make some commands to grep through this
Or use the excellent bash-preexec plugin that atuin itself relies on to achieve this in a cleaner way: https://github.com/rcaloras/bash-preexec