Mindfulness in mental tasks?

Hi, I’m only recently coming to learn about Buddhism, and I’ve read some books about the practice of mindfulness in different situations, for example, walking, drinking tea and doing the dishes. However it seems like most of examples I’ve read about are things that predominantly physical.

What I’m curious about is how can mindfulness be applied for tasks are mostly mental in nature, such as writing, or as a software engineer myself, coding?


Hi @Fezmaster
Welcome to Discover and Discuss (D&D) forum. We hope you find the discussions here beneficial and enjoyable. Please make use of the various resources, FAQs, and previous threads; you can use the search function for topics and keywords you are interested in. Forum guidelines are here:

If you have any questions or need further clarification regarding anything, feel free to contact the moderators by including @moderators in your post or a PM.
With Metta,
On Behalf of the Moderators,

1 Like

The Satipatthana sutta (Majjhima Nikaya 10) has four foundations, the first of which is body and the third being mind.

This is Analayo’s instruction for the initial stage of mind contemplation, which is just a single skill comprising part of a broader framework (Right Effort of the noble eightfold path does involve intervention in thought processes):

“It is noteworthy that contemplation of the mind does not involve
active measures to oppose unwholesome states of mind (such as lust
or anger). Rather, the task of mindfulness is to remain receptively
aware by clearly recognizing the state of mind that underlies a particular train of thoughts or reactions. Such uninvolved receptivity is
required because of one’s instinctive tendency to ignore whatever
contradicts or threatens one’s sense of importance and personal integrity. The habit of employing self-deception to maintain one’s self
esteem has often become so ingrained that the first step to developing accurate self-awareness is honest acknowledgment of the existence of hidden emotions, motives, and tendencies in the mind,
without immediately suppressing them.6
Maintaining non-reactive
awareness in this way counters the impulse towards either reaction
or suppression contained in unwholesome states of mind, and
thereby deactivates their emotional and attentional pull.7”


Mindfulness as described in the suttas is about remembering broader themes of the experience, and there are a multitude of different references points for this. If you plan on being mindful of any of these themes while doing certain tasks, it may be at the expense of doing those tasks well since - when done rightly - are pointing in the direction of knowledge of the condition of existence, which can be profound and may not lend well to focus on getting work done.

Now if you just want to apply the principle of remembrance to your tasks, I would suggest doing so when you aren’t engrossed in the task itself. When you have some free time bring to mind your reasons for doing well in your career, your goals in life, the value of diligence, or any other factors that would help fortify your understanding of the reasons for doing the task well. With that, when the time comes to bear down you won’t be confused about your motives and can tap into some consistent energy.


You could be mindful of whether you’re coding with kindness or not. When there’s a bug in the code, how do you react? How are you relating to the work meeting that could (should?) have been an email?

To my mind, mindfulness outside of meditation is more about awareness of the ethical quality of one’s behavior. Am I being kind to my coworkers? Am I protecting my own energy by avoiding gossipy conversations that I don’t enjoy?

Like, I don’t think it’s useful to practice mindfulness of breathing while programming, though I would love to hear anecdotes to the contrary :slight_smile:

Another type of programming mindfulness is just “do I need a break?” – I love programming but sometimes I exhaust my poor brain by sitting too long. Knowing when to take 5 minutes to meditate rather than another cup of coffee can be a good idea too :cowboy_hat_face: :nerd_face:


Thank you, Erik, you bring up excellent points! I think it’ll be good to be mindful if I’m currently rage-coding my way out of a bug/problem.

1 Like

This sutta addressed to a layperson lists six appropriate recollections:

"Mahanama, you should develop this recollection… while you are walking, while you are standing, while you are sitting, while you are lying down, while you are busy at work, "

—Anguttara Nikaya 11.13

Hi Paul,

I think you meant AN 11.12:

…You should develop this recollection of the Buddha while walking, standing, sitting, lying down, while working, and while at home with your children.

Furthermore, you should recollect the teaching … the Saṅgha … your own ethical conduct … your own generosity … the deities … When a noble disciple recollects the faith, ethics, learning, generosity, and wisdom of both themselves and the deities their mind is not full of greed, hate, and delusion. At that time their mind is unswerving, based on the deities. A noble disciple whose mind is unswerving finds inspiration in the meaning and the teaching, and finds joy connected with the teaching. When they’re joyful, rapture springs up. When the mind is full of rapture, the body becomes tranquil. When the body is tranquil, they feel bliss. And when they’re blissful, the mind becomes immersed in samādhi. You should develop this recollection of the deities while walking, standing, sitting, lying down, while working, and while at home with your children.”

Very important to note that the instruction is not to be mindful of walking, standing, etc., but of those various recollections no matter the position or bodily action.

Either Anguttara Nikaya 11.13 or 12.

Sure, Nandiya was also a layman. Was just pointing that Mahanama was in the previous sutta just in case he was the only example you were pointing out.

Correct, Anguttara Nikaya 11.13 (and 11.12) establish the Buddha’s realistic expectations in meditation for laypeople. The mindfulness of body positions as described in the Satipatthana sutta is a higher level reserved for monks.

1 Like

Hi Paul,

Not disagreeing that satipatthana is for those with more understanding, but it cannot be stressed enough that for each of the ways to dwell recollecting the body in body (kāye kāyānupassī viharati) there is the following guidance:

…this way he abides contemplating the body as a body internally, or he abides contemplating the body as a body externally, or he abides contemplating the body as a body both internally and externally. Or else he abides contemplating in the body its nature of arising, or he abides contemplating in the body its nature of vanishing, or he abides contemplating in the body its nature of both arising and vanishing. Or else mindfulness that ‘there is a body’ is simply established in him to the extent necessary for bare knowledge and mindfulness. And he abides independent, not clinging to anything in the world. That is how a bhikkhu abides contemplating the body as a body. - MN 10

So, it isn’t so much that one just relentlessly observes postures (or breath or anything), but uses them to discern the body to that necessary extent.


Bringing this back to the topic, a layperson can - as described in AN 11.12/13 - recollect various things (sati) for the purposes of joy and eventual samadhi, but that capability would not apply to cases of being directly focused on specific tasks with the intention to complete the task successfully. I have little doubt that joy on account of those recollections would contribute towards clarity and diligence, and therefore allow a person to perform their duties well, but it is important to attribute those qualities accurately to the basis from which they arise. In other words, a person who frequently recollects worldly goals and desires (which is not a Dhamma specific practice), and has a clear understanding of them, has a higher probability of performing a task well (pending they possess the skill and/or determination to do it), but it is equally likely that a Buddhist layperson, also possessed of the same skill, but accomplished in the joy associated with their good conduct and understanding, would be able to use that to their advantage to perform a task very well. There is a key difference, however: while both are partaking in the principle of recollection to consolidate their effort, the former is using clarity of desire as fuel while the latter - established in joy (on account of virtue) - is inherently more comfortable and less susceptible to anxiety and distraction.

In the end, a person who partakes in the principle of recollection, but does so without knowledge or experience of the Dhamma themes, is not capable of tapping into joy to the extent described in the suttas, which results from not only recollecting those themes, but having recollected one’s own development of them on account of previous effort. We cannot forget that there is both wrong mindfulness and wrong samadhi, which may both contain a degree of joy available on account of being established in things that have nothing to do with the eightfold path. Anyone who has experienced the so-called “flow state” can attest to being able to establish the mind upon something that may be entire sensual or environmentally dependent. By all means go for it if accomplishment in that respect is meaningful, just don’t mistake that for the rapture available on account of work in Dhamma. There is rapture available on both sides of ignorance, which is a very crucial thing to bear in mind (cf. SN 36.31).

1 Like