The idea is simple.
To remember what your code do. I thought of a simple solution. Just split the desktop screen in two window parts.
On one half of it you have the relevant code and on the other half you could have explaining text, images, ?flowcharts, webpages, a pdf page and more.
With open source textbooks you could just place the pdf page one side and explaining text notes on the other. Here you could just take a photo of your notes and then a screenshot with them side by side with the page.
So my idea is to make simple but effective screenshot comments to code and notes to open source books and wiki pages.
Maybe a database could be used but I thought this was a simple solution.