This is what I am doing with my pi-brains extension for pi

https://github.com/gitsense/pi-brains

I will make another update by the end of this week that contains what I call "brain checkpoints" that will make it easier for developers to debug and understand AI reasoning.

The idea is after a task has been finished, you would commit lessons, notes, and "brain checkpoints" that are designed to live with the code.