Mindfulness, Programming, and the Mistake I Made
Mindfulness made me a better listener, a more present parent, and more attentive in meetings.
Then I tried to bring it into programming, and it seemed to vanish completely.
That contradiction bothered me enough that I started measuring my own attention. I bought a tally counter. I used my smartwatch. Eventually, I built my own mindfulness tracking app for the watch. It let me log meta-awareness moments, run probe-based check-ins, and track how my awareness changed across different activities.
That is when the whole thing got interesting.
I started my mindfulness journey after reading Peak Mind by Amishi Jha. What hooked me was her framing of mindfulness through attention. Attention wanders. Attention can be trained. And the quality of attention shapes the quality of experience (Jha, Peak Mind).
That framing landed with me as a programmer.
At the time, I was away from work and practicing a lot. I started noticing changes in ordinary moments.
Before that, if I was away from my family and talking on the phone with my wife, I would often open a browser and scroll through the news. I was on the call, but not really there. I would make small automatic sounds like “aha” and “yes” while barely listening. If she noticed I was distracted, I would repeat the last thing she said, even though I had only really heard it at that exact moment.
After a few weeks of practice, I began noticing the drift itself. My mind would wander during a phone call, and I could catch it.
That was the first real change. My mind was still wandering. I was just noticing it sooner.
Once I noticed that, I stopped browsing on my phone while talking with my wife. Our conversations became more meaningful. Something similar happened in parenting. I stopped using my phone while being with my kids and became more present with them. That changed the feel of our time together.
When I returned to work, I saw the same pattern in meetings. In meetings that were less interesting to me, especially when I was not central to the discussion, I used to work in parallel. My body was in the meeting, but my attention was somewhere else. After practicing mindfulness, I started catching that too.
At the beginning, I was doing formal meditation sessions of around 15 minutes a day, sometimes more. Once work resumed fully, life became more crowded: three kids, long workdays, and evening meetings across time zones. My routine became harder to sustain. My walk with the dog became my main meditation time.
Then work got more stressful, and even those walks changed. I was no longer really meditating. I was thinking about work.
That was when I started asking a different question: how could I tell whether I was actually making progress?
Wanting to measure mindfulness
As a programmer, my instinct was to measure.
I wanted some empirical way to tell whether my practice was helping me move toward my goals. At the time, my model was simple: if I kept progressing in mindfulness, I would eventually become present in every moment. I knew what presence felt like during meditation. I could feel it while paying attention to my breath. I could feel it while listening carefully or reading slowly. So I started thinking that the goal was to be present all the time.
That model turned out to be too simple.
I started reading about how researchers measure attention and mind wandering. Two of the methods I found useful were self-caught and probe-caught tracking. In self-caught designs, people report when they notice their own attention drifting. In probe-caught designs, they are interrupted and asked what was happening just before the probe (Chu et al., 2023).
What mattered most to me in that literature, and in Peak Mind, was meta-awareness: becoming explicitly aware of what my mind was doing while it was doing it. As Jha puts it, meta-awareness is “an awareness of your awareness.” In the book, mindfulness practice is described as strengthening meta-awareness. That framing fit my experience well.
I adapted those ideas into daily life, but I used a different name for the first kind. Instead of calling them self-caught moments, I called them meta-awareness moments. That is how they felt to me: not mainly like failures, but like moments when awareness returned.
I first used a physical tally counter and later switched to my smartwatch. Every time I noticed that I was aware, present, or conscious of my current state, I incremented the counter.
Over time, I took this further and built my own mindfulness tracking app for the smartwatch. It let me log meta-awareness moments more easily, run probe-based check-ins, and keep daily statistics.
I also used the app to sample my state during the day. Every few minutes, the watch could vibrate, and I would log whether I was mindful or distracted.
That made the whole thing feel less like philosophy and more like an experiment.
A pattern showed up quickly.
During simple activities like walking the dog or washing dishes, I logged many meta-awareness moments.
During work, as a software engineer, I could go through an entire day without recording even one.
That was disappointing.
Because programming was my day job, and one of the places where I most wanted clarity and presence, that result hit harder than it would have in almost any other activity.
I had been practicing for months, and yet the moment I started programming, mindfulness seemed to disappear. It felt like I was failing at the very thing I was trying to train.
The watch data only made that feeling sharper. My meta-awareness-per-hour rate was weak during programming. I noticed something similar while gaming. That later became an important clue, because both states had the same quality of deep absorption.
To test this more directly, I started doing these probe-based experiments while coding. Every few minutes, I would get a vibration and check: am I present right now, or not?
The result repeated itself. I could not sustain the kind of awareness I was trying to sustain while programming.
I went back to more formal meditation, sometimes 15 to 30 minutes a day, hoping it would transfer. After months, my results during programming still felt poor.
The model that broke
This was the contradiction I could not explain.
The literature does support a narrower claim: mindfulness training is associated with better attentional control and less mind wandering, and some studies suggest benefits for working memory and performance under stress (Mrazek et al., 2013; Jha et al., 2010; Prakash et al., 2020).
So I expected mindfulness practice to help during programming.
But my experience kept pointing somewhere else. The more honestly I looked at it, the more it seemed that the problem was not the practice itself. The problem was the model I was using.
The kind of mindfulness I was trying to bring into programming was not just reduced distraction in some general sense. What I was actually trying to maintain was explicit reflective awareness while coding: awareness of my thoughts, awareness of my state, almost like being a spectator of my own mind while I worked.
That monitoring stance felt effortful. It required remembering the intention to stay aware, noticing when I had become fully absorbed, and then re-establishing that observing stance.
Programming also demands sustained attention and working memory.
That gave me a working hypothesis: the kind of monitoring I was trying to maintain while coding might have been competing with the same limited attentional resources that programming already needed.
I do not mean that mindfulness and programming cannot coexist. I mean something narrower and more personal. In my experience, reflective self-monitoring while coding seemed to compete with the full absorption that programming often requires.
That is where flow finally helped me. Flow is a state of deep absorption in a task. Researchers describe it in terms such as merging action and awareness, reduced self-consciousness, and altered time perception (Abuhamdeh, 2020; Gold & Ciorciari, 2020).
That sounded much closer to my experience while programming well.
When I am deeply focused on code, I do not feel like a spectator watching myself work. I feel absorbed. In some sense, I forget myself.
That felt very different from the state I was trying to maintain, where I was deliberately aware of my thoughts, my state, and the fact that I was programming.
At first I interpreted that difference as a failure of mindfulness.
Later I found a better interpretation. The literature suggests that mindfulness and flow are different states, but positively related (Schutte & Malouff, 2023). They are not the same thing. Still, mindfulness practice may help people enter deep focus more reliably by stabilizing attention and reducing mental fragmentation.
That fit my experience much better.
What I believe now
I no longer expect mindfulness to feel the same across all activities.
When I am talking with my wife, mindfulness means noticing distraction and coming back. When I am with my kids, it means putting the phone away and actually being there. When I walk with the dog, it means walking instead of rehearsing work in my head. When I meditate, it means practicing deliberate attention.
When I program, it may mean something different. It may mean clearing my mind beforehand and then allowing myself to disappear into the work.
That shift made my practice feel more realistic and more honest.
I started this journey wanting a way to prove that mindfulness was working. What I found instead was that I first needed a better model of what mindfulness was for.
The mistake I made was assuming that mindfulness during programming should feel like explicit self-awareness, when in practice good programming often feels more like absorption.
That does not make flow better than mindfulness, or mindfulness better than flow. It just means they are different states, and both can be valuable.
I had not failed because I disappeared into the work.
Sometimes disappearing into the work was exactly right.
Research and books that shaped my thinking
- Abuhamdeh, S. (2020). Investigating the “Flow” Experience: Key Conceptual and Operational Issues. PMC. https://pmc.ncbi.nlm.nih.gov/articles/PMC7033418/
- Chu, M. T., Marks, E., Smith, C. L., & Chadwick, P. (2023). Self-caught methodologies for measuring mind wandering with meta-awareness: A systematic review. PubMed. https://pubmed.ncbi.nlm.nih.gov/36640586/
- Gold, J., & Ciorciari, J. (2020). A Review on the Role of the Neuroscience of Flow States in the Modern World. PMC. https://pmc.ncbi.nlm.nih.gov/articles/PMC7551835/
- Jha, A. P. (2021). Peak Mind: Find Your Focus, Own Your Attention, Invest 12 Minutes a Day. https://amishi.com/books/peak-mind/
- Jha, A. P., Stanley, E. A., Kiyonaga, A., Wong, L., & Gelfand, L. (2010). Examining the protective effects of mindfulness training on working memory capacity and affective experience. Emotion, 10(1), 54–64. https://doi.org/10.1037/a0018438
- Mrazek, M. D., Franklin, M. S., Phillips, D. T., Baird, B., & Schooler, J. W. (2013). Mindfulness training improves working memory capacity and GRE performance while reducing mind wandering. PubMed. https://pubmed.ncbi.nlm.nih.gov/23538911/
- Prakash, R. S., De Leon, A. A., Klatt, M., Malarkey, W., & Patterson, B. (2020). Mindfulness and Attention: Current State-of-Affairs and Future Considerations. PMC. https://pmc.ncbi.nlm.nih.gov/articles/PMC8011594/
- Schutte, N. S., & Malouff, J. M. (2023). The connection between mindfulness and flow: A meta-analysis. ScienceDirect. https://www.sciencedirect.com/science/article/abs/pii/S0191886922003762