Fair enough.
"As for flow, it works best when there is a specific, narrowly scoped piece of code that must be written."
But this is also not necessarily true. A state of flow is very desirable when doing experimental or exploratory creative work of any kind, not just programming. If you're doing something you've never done before but it's not too far out of reach, then you can most definitely enter a state of flow. Too far out of reach and anxiety kills the state. Not challenging enough and you don't get absorbed enough to enter it in the first place.
Csiksczentmihalyi's book identifies eight major components of flow:
1. We confront tasks we have a chance of completing;
2. We must be able to concentrate on what we are doing;
3. The task has clear goals;
4. The task provides immediate feedback;
5. One acts with deep, but effortless involvement, that removes from awareness the worries and frustrations of everyday life;
6. One exercises a sense of control over their actions;
7. Concern for the self disappears, yet, paradoxically the sense of self emerges stronger after the flow experience is over; and
8. The sense of duration of time is altered.
I don't think I've ever got into the flow state when just banging out a specific, narrowly scoped piece of code. It's just grunt work. It has to be done sure, but for me personally, it doesn't provoke the loss of time or complete absorption that experimental or exploratory work does.