Maintaining story history like twine v1 Jonah

Twine Version: 2.2.1
Story Format: Harlowe 2.1.0

I’m attempting to help make a “texting” Twine IF, where it would be most natural if the entire chat history were available. I found some code (linked below via reddit) that suggested it would work (for sugarcube), but don’t know where to begin with harlowe. Any pointers would be much appreciated (analogs of the startup event, passage change event, etc…)

I’m /willing/ to put custom code in each passage if I have to, but doing it in js would be ideal? ((I’ve already got a python script turning simple passages into larger html/timer passages like below — ))