I came looking for this question as well. I read here that recompilation happens when methods are at risk of being invalidated (or julia version changes). So I guess maybe a more direct question is “How do I make sure that a big project or notebook never (or rarely) has invalidated methods?”