TL;DR
When people look back on an experience, they mostly remember its most intense moment and how it ended, and they barely count how long it lasted. That pattern is called the peak-end rule. For builders, it means the worst (or best) moment in a flow and the last screen deserve extra care, as long as the ending stays honest.
- In a 1993 study, 22 of 32 people (69%) chose to repeat a longer cold-water trial, because its last 30 seconds were a little less painful.
- In a randomized trial of 682 colonoscopy patients, a gentler ending dropped pain in the final moments from 2.5 to 1.7 and made the whole procedure feel less unpleasant.
- For an AI agent, end on a short summary of what changed, explain errors in plain words, and keep surveys and upsells away from the last screen.
- The overall average still predicts memories about as well as the peak and end, so a nice ending can't rescue a bad experience, and it should never hide one.
In his 2010 TED talk, Daniel Kahneman tells a story about a man who listened to about 20 minutes of glorious symphony music, only for the recording to end with a dreadful screeching sound. The man said it ruined the whole experience. Kahneman's point was that it hadn't. The music really happened. What got ruined was the memory of it.
The things we build get remembered the same way. We polish every step of a checkout, an onboarding flow, or a task our AI agent runs, and our users judge all of it later by a couple of moments. In this article, we will figure out which moments those are and how to design for them without tricking anybody.
Onwards!
Meet Our Agent's Task
Let's say our app has a coding agent that our users hand tasks to, and here is what one of those tasks will look like, step by step:
Our user asks for dark mode on their settings page. Our agent writes a plan and edits four files. Next, two tests fail, and our user sees a big red error. Our agent fixes the tests, and our task ends on a screen of logs that scrolls on and on.
If we graph how our user feels at each of those moments, it will look something like this:
For most of our task, our user feels pretty good. Our failed tests are the worst moment by far. Our ending is a bit meh, because our user has to dig through our logs to find out what actually happened. Tomorrow, when our user tells a coworker about our agent, which parts of our line are they going to talk about? To see why it probably won't be the average of all six moments, we need to talk about some very cold water.
What Did People Remember in the Cold Water?
In 1993, Daniel Kahneman, Barbara Fredrickson, Charles Schreiber, and Donald Redelmeier published a study called When More Pain Is Preferred to Less. Each of the 32 people in it put a hand in painfully cold water twice, once for a short trial and once for a long one:
In the short trial, one hand stayed in water at 14°C for 60 seconds. In the long trial, the other hand got the same 60 seconds at 14°C and then stayed in for 30 more seconds while the water slowly warmed by about a degree, to roughly 15°C. That last stretch was still uncomfortable, just a little less so. This means the long trial has every second of pain that the short trial has, plus 30 more seconds on top.
Later on, the researchers asked each person which trial they would rather repeat:
22 of the 32 people (69%) picked...the long trial. They signed up for more total pain. The researchers' explanation is that people were not adding up the pain at all. They were judging each trial by its worst moment and its last moment, and the last moment of the long trial was a bit better.
Which Moments Do People Remember?
When we look back on an experience, our memory doesn't replay every second and average them together. It mostly keeps two snapshots: the moment that felt the most intense, and the moment at the very end. The most intense moment is called the peak, and this whole pattern of remembering has a name. It's called the peak-end rule. A peak doesn't have to be a happy moment, for it is simply the most intense moment, good or bad. Speaking of peaks, here is a famous one:
Oops! Wrong kind of peak. Here is the kind we are going to talk about, drawn on our task from earlier:
In our task, the peak is the moment our tests fail, because that is when our user feels the strongest emotion. The end is the screen of logs. Our user carries those two moments away, and the pleasant stretch at the beginning mostly fades. In another 1993 study, Fredrickson and Kahneman showed people pleasant and unpleasant film clips that ran for different lengths of time. When people rated the clips afterward, how long a clip ran barely changed their rating:
Our memory sorta kinda ignores how long something lasted, and this is known as duration neglect. It is the reason the extra 30 seconds in the cold water did not count against the long trial.
Does This Hold Up Outside a Lab?
In 1996, Donald Redelmeier and Daniel Kahneman asked 154 people having a colonoscopy (and 133 people getting their kidney stones broken up) to rate their pain every 60 seconds and, afterward, how bad the whole thing had been. Their memories tracked the worst pain and the pain in the last 3 minutes, and the long procedures weren't remembered as especially bad.
In 2003, Redelmeier, Joel Katz, and Kahneman went one step further with a randomized trial of 682 patients. For half of them, the doctor added a short stretch at the end where the scope was left in place for a little while before coming out. Their procedure got a bit longer, and their ending got gentler:
The patients with the gentler ending rated their last moments at 1.7 instead of 2.5 out of 10, and they remembered the whole procedure as less unpleasant (4.4 instead of 4.9). Over the next several years, they were also a little more likely to come back for another colonoscopy.
Kahneman later described all of this as a split between two selves. One self lives through each moment as it happens, and he calls it the experiencing self. The other one keeps the story afterward, and he calls it the remembering self. In his TED talk and his book Thinking, Fast and Slow (2011), he points out that the remembering self is the one that makes our decisions:
This matters to us as builders. When our user decides whether to use our agent again, the remembering self is the one making that call, and its story is mostly the peak and the end.
Designing Our Agent's Peak and Ending
Let's go back to our agent and fix its ending first, and we will start by putting our current last screen next to a better one:
On the left, our user has to scroll through our logs to figure out whether our agent did what they asked. On the right, our agent tells them in a few lines, and our logs are still there behind a link for anyone who wants them.
A good last screen answers the questions our user has at that exact moment:
- Did the thing I asked for actually happen?
- Did anything go wrong along the way, and is it fixed?
- What should I do next?
Next up is the bad peak, and while we can't always avoid errors, we can change how intense the error moment feels:
A red stack trace with no explanation makes our user think everything is broken. A plain note from our agent that says what failed, and that it is fixing it, is still bad news, but our user can tell that we have it under control, so their dip is not nearly as deep.
The last thing for us to watch is what we tack on after our ending, so imagine for a moment a movie that did this:
We do this to our users all the time. Our task finishes, and then our user gets a survey, an upsell, or a banner saying they are out of credits. Whatever shows up last becomes the new ending:
If we need the survey or the upgrade prompt, we can show it at a calmer time, like the next time they open our app. When we put all of these changes together, our new line will look as follows:
Our tests still fail, but the dip at Tests fail is shallower now. The new moment is Preview, where our agent shows our user their settings page in dark mode right away. Seeing the change work is a peak we actually want, and our summary after it tells our user exactly what happened.
Where the Research Gets Fuzzy
Let's be honest about what this research doesn't say. Not everybody in the cold water study even felt the ending get better. According to the paper, 11 of the 32 people reported their discomfort dropping by 1 point or less during those last 30 seconds, and 2 of them said it got worse. The people who felt a bigger drop were the ones more likely to pick the long trial.
In 2022, Balca Alaybek and her colleagues combined 174 results from many studies into one big analysis (aka a meta-analysis). The peak and the end turned out to be strong predictors of how people remember an experience, along with something that is easy to skip past:
The overall average predicted people's memories about as well as the peak and the end did. This means people do not ignore the average. It is one of several things they weigh, and if we only ever look at averages, we will miss the two moments that carry extra weight. Duration is fuzzier. Kahneman and his coauthors said it played a small role in their own studies, while this meta-analysis found its effect was close to nothing.
The other fuzzy line is an ethical one. The colonoscopy trial gave patients an ending that genuinely hurt less, and it didn't hide anything from them. The same idea can be pointed the wrong way, though:
If our agent ends with a cheerful All done! while quietly skipping two tests, we are using a nice ending to cover up a bad experience. Our user will find out eventually, and that moment of finding out will become a much worse peak. Our ending should be pleasant and true at the same time. If the honest summary feels bad, that's a sign we need to fix our task itself.
Try It This Week
Pick one flow in your product that people finish, like a checkout, an onboarding flow, or an agent task, and redesign its last screen:
- Walk through the flow yourself and sketch how each moment feels. Circle the most intense moment and the last screen.
- Rewrite the last screen so it tells people what they accomplished in a sentence or two, and move any survey, upsell, or paywall somewhere else.
- Look at your peak. If it's an error, give it a plain explanation and a next step. If it's a good moment, make sure people actually get to see it.
Conclusion
Ok! It is time to wrap things up. When our users look back on something they did in our app, they don't replay every second of it. They mostly remember the most intense moment and the ending, and they barely count how long it took. That's the peak-end rule, and the strangest evidence for it is a room full of people choosing an extra 30 seconds of cold water because those 30 seconds ended a little better.
For us, this means two moments deserve a lot more attention than they usually get: the worst (or best) moment in a flow, and the very last screen. The honest limitation is that the average still counts, so a long, frustrating task with a lovely ending is still a long, frustrating task. We fix the middle when we can, and then we give our users an ending that is both kind and true. (Our agent's wall of logs will be fine. It can live behind a link.)
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, Four Pro-Level Books for Understanding What Drives People, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

















