Fatigue Is a Brain-Derived Emotion that Regulates to Ensure Protection (2012)
'Protection' might be the goal of physical fatigue, but it doesn't work for intellectual effort - what are you being 'protected from breaking' by not being able to write another line of code? Carpal tunnel? In that case, it looks more like it's about conserving energy or rotating to another task after having spent so much time on one task: "A Meta-Analysis of Blood Glucose Effects on Human Decision Making" http://www.gwern.net/docs/2016-orquin.pdf , Orquin & Kurzban 2016
"An opportunity cost model of subjective effort and task performance" https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3856320/ , Kurzban et al 2013