# The basic concepts: how your agent actually works
<!--pills: Why it forgets | The four parts | Beat context drift | Set up the four | Memory and handovers | A tool you rely on -->

<!--cover
time: 5 min read
- Picture the four parts of an agent: context, session, memory and notes.
- Catch context drift before it makes the agent sloppy.
- Reset cleanly with a handover instead of starting from zero.
-->

A handful of moving parts, demystified. Get these and the agent stops being a black box.

## The problem

**The agent that was brilliant five minutes ago suddenly forgets what you told it.** It repeats itself, mixes up a name, or loses the plot halfway through a long chat. It feels broken. It isn't.

Almost every "AI is unreliable" story comes down to not knowing the few simple parts under the hood. Learn them once, and the mistakes become predictable, and easy to dodge.

## The shift

**Stop treating the agent as magic. See its four moving parts.**

<figure class="fig" aria-label="The four parts of an agent's brain">
<svg viewBox="0 0 720 96" xmlns="http://www.w3.org/2000/svg" role="img">
<g font-family="ui-monospace,SF Mono,Menlo,monospace">
<rect x="6" y="6" width="168" height="84" rx="5" fill="#f6f0e2" stroke="#cabd9f"/>
<text x="90" y="44" text-anchor="middle" font-size="13" font-weight="700" fill="#2a2520" letter-spacing="1">CONTEXT</text>
<text x="90" y="64" text-anchor="middle" font-size="11" fill="#6c6256" font-family="-apple-system,Segoe UI,Roboto,sans-serif">its working desk</text>
<rect x="186" y="6" width="168" height="84" rx="5" fill="#f6f0e2" stroke="#cabd9f"/>
<text x="270" y="44" text-anchor="middle" font-size="13" font-weight="700" fill="#2a2520" letter-spacing="1">SESSION</text>
<text x="270" y="64" text-anchor="middle" font-size="11" fill="#6c6256" font-family="-apple-system,Segoe UI,Roboto,sans-serif">this one chat</text>
<rect x="366" y="6" width="168" height="84" rx="5" fill="#f6f0e2" stroke="#cabd9f"/>
<text x="450" y="44" text-anchor="middle" font-size="13" font-weight="700" fill="#2a2520" letter-spacing="1">MEMORY</text>
<text x="450" y="64" text-anchor="middle" font-size="11" fill="#6c6256" font-family="-apple-system,Segoe UI,Roboto,sans-serif">remembers you</text>
<rect x="546" y="6" width="168" height="84" rx="5" fill="#f6f0e2" stroke="#cabd9f"/>
<text x="630" y="44" text-anchor="middle" font-size="13" font-weight="700" fill="#2a2520" letter-spacing="1">NOTES</text>
<text x="630" y="64" text-anchor="middle" font-size="11" fill="#6c6256" font-family="-apple-system,Segoe UI,Roboto,sans-serif">your plain-text files</text>
</g>
</svg>
<figcaption>The four parts of your agent's brain</figcaption>
</figure>

- **Context** is its short-term memory, the desk it works on. Everything in the current chat sits on that desk.
- **Session** is the current conversation. One chat, one desk.
- **Memory** is the longer-term drawer: what it remembers about you between chats, once you set it up.
- **Notes** are the plain-text notes you keep and hand it: standing instructions and reference it can read.

That's the whole brain. Now the one gotcha that trips everyone up, and how to skip it.

## Watch me do it

**Context drift is the gotcha, and I'll save you the pain of learning it the hard way.** As a chat gets long, the desk fills up and the agent starts dropping older details. That's when a name slips or it contradicts itself. People call it context drift, or context rot. It's not the agent being dim, it's a full desk.

<figure class="fig illo">
<img src="playbook/illustrations/ch03-a-desk-slowly-piling.png" alt="a desk slowly piling up with paper until it overflows, and a clean fresh desk beside it" loading="lazy">
</figure>

I learned this the slow way. You don't have to. The fix is simple: **don't wait for the drift, stay ahead of it.**

- **Start fresh on a rhythm, not in a panic.** When a chat has done its job, or starts to feel sluggish, open a clean one. A clean desk just works.
- **Hand over first, every time.** Before you leave the old chat, ask it for a short handover note, then paste that into the new one and carry on without missing a beat.
- **Better still, let it warn you.** Set it up (see the tip) so the agent tells you when a session's getting long, before a single detail slips.

```
Write me a handover note I can paste into a fresh chat:
- what we're working on
- where we got to
- the key decisions so far
- what's next
Keep it short.
```

**Memory and notes are how it stops starting cold.** I keep a plain-text "how I work" file the agent reads, and chapter 4 shows you how to make yours genuinely good. Anything it should remember for good, I just tell it: "remember this." One agent, good notes and clean handovers cover everything in this guide.

<aside class="tip">
<p class="tip-label">Try this</p>
<p>make the agent watch its own desk. Add one line to its memory or instructions: "If this session gets long, tell me it's time for a fresh one and write me a handover note." Now it taps you on the shoulder before the drift starts, and writes its own handover. You never have to think about it.</p>
</aside>

## Your turn

**Set up the four parts once.**

<!--steps-->
1. **Stay ahead of drift.** Start a fresh chat when one's done its job. Don't push a tired one.
2. **Hand over every time.** Ask for a handover note, open a new chat, paste it in.
3. **Set your memory.** Tell it the handful of things it should always know about you and your work.
4. **Keep a notes file.** One plain-text page, "how I work", that you paste in or connect.

Do these and you're driving the agent's brain on purpose, instead of hoping it remembers.

## Keep it safe

- **Memory holds what you tell it.** Don't save passwords or sensitive client data into a memory you don't fully control.
- **Handover notes travel.** Keep confidential details out of them unless you genuinely need them in the next chat.

## The payoff

**The agent stops "forgetting", because you're managing its desk on purpose.** Long jobs, multi-day projects and big tasks all become possible. You can pass the thread from one fresh chat to the next without losing a thing. That's the difference between a clever toy and a tool you actually rely on.
