LESSHISTFILE
Name of the history file used to remember search commands
and shell commands between invocations of less. If set to
"-" or "/dev/null", a history file is not used. The
default is "$XDG_STATE_HOME/lesshst" or
"$HOME/.local/state/lesshst" or "$XDG_DATA_HOME/lesshst"
or "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on
DOS and Windows systems, or "$HOME/lesshst.ini" or
"$INIT/lesshst.ini" on OS/2 systems.
LESSHISTSIZE
The maximum number of commands to save in the history
file. The default is 100.
again, taking a page from less:
https://man7.org/linux/man-pages/man1/less.1.html