Anyone know best way to punch up his function a little so it tees >> out both the q and a to a file? Like history but for chat gpt.

https://github.com/npiv/chatblade

this has built in history and lots of other features that a serious user needs, like checking token limits and estimating costs, etc.