Is there a way to auto-save generated python code in Blender?
An Addon

There have been some attempts (notably: Macros Recorder )
to make an addon that can record the commands to a textfile. But nothing built in like you might be familiar with in programs like ZBrush, which lets you record a session from start-to-finish.

The info log panel itself

You'll find a lot of repeated commands, and some ommited commands, and some commands that won't work when purely executed from a Text Editor. So even if you get all the output saved, unfortunately, I don't think it will do what you want.

Copy them to Text Editor

You can store a massive amount of data in bpy.data.texts, which you can access from Blender Text Editor. When saved that data will persist in the .blend until you manually delete it.

With the mouse cursor inside the Info panel and when you have the desired lines selected:


copy them to clipboard ( Ctrl + c )
open Text Editor, press + on the UI to create new Text File 
Paste ( Ctrl + v ) 
Help your future self by giving the text file a good name.
save the .blend


If all you want to do is get an idea about the operators you called during the modelling process, then I think those steps are the literal answer to your question. I don't recall seeing an addon that does that, so I made one.