I made something very similar a couple years back, though it doesn't actually work anymore since OpenAI deprecated the model I was using
https://github.com/buckley-w-david/akashic_records