Last time I was using llama cpp you could just do:
llama_state_save_file
or llama_state_seq_save_file
and the load equivalents.That was a year or so ago though...