Manages command history with file persistence.
Uses append-only writes for concurrent safety. Multiple agents can safely write to the same history file without corruption.
Add a command to history.
Get the previous history entry matching a substring query.
The query is captured on the first call of a navigation session
(when _current_index == -1) and reused for all subsequent calls until
reset_navigation. Passing a different value on later calls has
no effect.
Get the next history entry matching the stored query.
Uses the query captured by the most recent get_previous call.
Reset navigation state.