Sub topic 1
The habit loop: what a plan is made of
Prerequisites
This chapter assumes you have tried to build or change at least one habit, such as exercising, reading, or going to bed earlier. You do not need any background in psychology. You should be willing to track one behavior for a few weeks, because later chapters rely on that record to diagnose problems. If you have never tried to change a habit, pick a small one now and keep it in mind as you read.
Why start with the loop
Most habit plans fail for ordinary, fixable reasons. To find those reasons, you need a working model of what a plan is made of. This chapter gives you that model: the habit loop. Every later chapter in this tutorial points back to one of its parts.
A habit is a behavior you do with little deliberation because a situation reliably triggers it. The key word is "reliably." A habit does not run on intention. It runs on a link between a situation and an action, and that link gets stronger each time the action follows the situation.
The three parts
The habit loop has three parts.
- A cue is the trigger. It is a moment, place, time, event, or feeling that comes right before the behavior.
- A routine is the behavior itself. It is the thing you do after the cue.
- A reward is the result you get from doing the routine. It makes the brain more likely to repeat the loop next time.
Here is a familiar example that is not a deliberate habit. Your phone buzzes (cue), you pick it up and read the message (routine), and you get a small hit of information or social contact (reward). Nobody planned this loop. It formed because the cue was frequent, the routine was easy, and the reward was immediate.
Deliberate habits are harder to build because you have to design all three parts yourself. A plan that leaves any part vague or missing is likely to stall.
A plan is a loop you write down
A habit plan is a written description of the loop, plus a few rules for when the loop breaks. The template below shows one complete plan. Each line maps to a part of the loop or to a repair rule.
habit: Daily run
cue: After I pour my morning coffee
full_version: Run 20 minutes
minimum_version: Put on running shoes and walk outside for 2 minutes
environment: Shoes by the front door the night before
reward: Check off the day and drink the coffee outside
if_missed: Do the minimum version the next day
review: Sunday evening, 5 minutesRead it line by line.
| Field | What it does | Loop part or support |
|---|---|---|
| `habit` | Names the behavior in one phrase | Routine |
| `cue` | Names a specific, observable trigger | Cue |
| `full_version` | The routine on a normal day | Routine |
| `minimum_version` | A routine small enough to do on a bad day | Routine |
| `environment` | Changes your surroundings so the routine is easy | Supports the cue and routine |
| `reward` | Gives an immediate payoff | Reward |
| `if_missed` | Says what to do after a lapse | Recovery rule |
| `review` | Sets a time to check and adjust | Feedback |
The first four fields and the reward describe the loop. The last two fields, if_missed and review, are what keep the plan alive when real life interferes. Later chapters cover each of these in detail. Here, the goal is to see that a plan has parts and that each part can fail separately.
What each part needs to work
The cue
A good cue is specific, observable, and already happens reliably. "After I pour my morning coffee" meets all three tests. You can tell whether it happened, and it happens nearly every day without any effort from you.
A weak cue is "in the morning" or "when I have time." Neither is an event. You cannot notice it arriving, so nothing prompts the routine. The chapter on vague cues covers how to write a proper if-then plan.
The routine
A good routine is small enough that you can do it even when you are tired, busy, or unmotivated. This is why the template has two versions. The full version is what you aim for on a normal day. The minimum version is the floor. It is deliberately tiny, so that doing it on a bad day is almost always possible.
The minimum version is not a trick to do less. It keeps the cue-to-routine link alive. A loop that fires on a bad day, even in a weak form, is still a loop.
The reward
A good reward is immediate and felt. The benefits you actually want from a habit, such as fitness or savings, usually arrive weeks or months later. The brain responds to what happens right now. If nothing pleasant follows the routine, the link strengthens slowly or not at all.
That is why the template includes a small reward you can have in the moment: a check mark and coffee outside. It does not need to be large. It needs to be certain and close in time to the routine.
The loop is a system, so failures have locations
The most useful consequence of this model is that you can locate a failure. When a plan stalls, ask which part broke.
| Symptom | Likely broken part |
|---|---|
| "I forget to do it." | Cue is missing or vague |
| "I remember, but I do not feel like it." | Routine is too big, or the reward is weak |
| "I do it, but it never sticks." | Reward is delayed or absent |
| "I do it for a week, then miss a day and quit." | Recovery rule is missing |
| "I cannot tell if it is working." | Feedback is missing |
This table is a first pass. It is not a complete diagnosis, and a single symptom can come from more than one cause. The next chapters add detail. For now, practice thinking of a stalled plan as a loop with a specific weak spot instead of as a personal flaw.
A small tool for the recovery rule
The template's if_missed line says "Do the minimum version the next day." To apply a rule like that, you need to notice when one missed day has become two. The function below checks exactly that. It returns True when neither of the two days before today appears in your record of completed days.
from datetime import date, timedelta
def missed_twice(done, today):
"""Return True if neither of the two days before today is in done."""
return all(today - timedelta(days=n) not in done for n in (1, 2))
done = {date(2026, 11, 20), date(2026, 11, 21), date(2026, 11, 24)}
print(missed_twice(done, date(2026, 11, 26))) # False: Nov 24 was done
print(missed_twice(done, date(2026, 11, 27))) # True: Nov 25 and 26 were missedOn November 26, the day before (the 25th) was missed, but the 24th was done, so the function returns False. On November 27, both the 26th and the 25th were missed, so it returns True, and the recovery rule should start. The rule's purpose is to keep one lapse from becoming a quit. You will see it again in the chapter on recovery rules.
Common errors when writing a plan
These errors come up often, even for people who understand the loop.
- Treating the goal as the plan. "Get fit" is an outcome. It has no cue, no routine, and no reward. A plan describes what you do and when.
- Naming a routine without a cue. "I will read more" tells you what, but not when. Without a trigger, you rely on remembering.
- Choosing a cue that does not happen every day. "After I get home from the gym" only fires on gym days. If you want a daily habit, pick a daily cue.
- Skipping the reward because the habit is "good for me." Long-term benefits do not substitute for an immediate payoff.
- Writing only the full version. A plan with no minimum version has nothing to fall back on during a bad week.
- Writing the plan and never looking at it again. Without a review time, you will not notice what is going wrong until the plan has already stopped.
How the rest of this tutorial uses the loop
The remaining chapters take the loop apart and examine each way it fails. Some failures sit in the routine, such as goals that are too big. Some sit in the cue, such as vague triggers. Others come from outside the loop, such as relying on motivation, a high-friction environment, or starting too many habits at once. The last group concerns what happens after a miss: all-or-nothing thinking, missing recovery rules, and missing feedback. A weekly review ties them together.
You will return to the template in this chapter repeatedly. By the end, every field will have a tested reason for being there.
Exercise
A reader writes this plan: "Habit: exercise more. Cue: when I have time. Reward: better health." Which parts of the habit loop are weak, and how would you fix each one?
Show answer
The cue is weak because "when I have time" is not an observable event, so nothing prompts the behavior. Replace it with a specific trigger that already happens daily, such as "After I pour my morning coffee." The routine is weak because "exercise more" is vague and may be too big for a bad day. Name a concrete full version (for example, run 20 minutes) and a minimum version (put on running shoes and walk outside for 2 minutes). The reward is weak because "better health" arrives weeks or months later. Add an immediate reward, such as checking off the day and drinking the coffee outside.
Exercise
Using the missedtwice function, today is 2026-11-30 and done contains only date(2026, 11, 28). What does missedtwice(done, date(2026, 11, 30)) return, and what does that tell you?
Show answer
It returns False. The function checks November 29 and November 28. November 28 is in done, so not all of the two days are missed. One missed day (the 29th) has happened, but not two in a row, so the recovery rule does not need to start. The plan is still intact, and the next step is to do the habit today.
Exercise
Why does the plan template include a minimumversion in addition to a fullversion?
Show answer
The minimum version is small enough to do on a bad day, such as when you are tired, sick, or busy. Doing it keeps the cue-to-routine link active, so one hard day does not break the loop. It is a floor for the habit, not a way to do less on normal days.