02Context & memory Pillar

An agent has no memory — it has a small, finite desk

What to keep, what to drop, and when not to spend a line of the AI's thinking on what a script can do

Published2026-05-31
Read3 min read
TypeField notes
TL;DR

An agent has no real memory; each turn it just has a finite "desk" — its context. Anything you put on it costs space and dilutes what matters; anything you leave off it simply cannot see. Managing an agent's memory means clearing that desk, persisting what must be remembered outside of it, and — most of all — knowing when a deterministic job belongs to a script, not to a single line of the AI's thinking.

Early in the session you settle it with the agent: "this project uses single quotes, not double." Twenty messages later it writes a new file — all double quotes. You're a little annoyed: "I said single quotes?" It apologizes instantly, fixes it, polite as if nothing happened.

It isn't defying you. It forgot — literally. And this is the most disorienting thing when you start: the "shared memory between us" you assumed existed never did.

01It has no memory — it has a desk

Drop the picture of "the agent remembering the conversation." Instead: each turn, the agent sits down at a desk of fixed size. On that desk is everything it can see right now — what you just typed, a few snippets you pasted, part of the chat history. That's it. Anything not on the desk, to it, does not exist.

That single-quotes decision didn't vanish because it's stubborn — it slid off the edge as the desk filled up. There's no drawer underneath to dig it back out of. Once you see this, a whole set of baffling behaviors clicks: it repeats old mistakes, re-asks what was just said, "forgets" a constraint — all the same thing, a full desk shedding the old stuff.

02A full desk isn't a rich desk

The first reflex everyone has: if it keeps forgetting, cram in more — paste the whole file, the whole doc, the whole history. Sounds right, and it's wrong, because the desk doesn't get better the more you pile on.

Two reasons. One, the desk has an edge: overfill it and the most important thing is what gets pushed off. Two, subtler: buried in a heap of information, the core gets diluted. The agent has to guess, in everything you handed it, what you actually care about — and it guesses wrong sometimes. Ten on-point lines steer it better than five hundred "just in case" ones.

So the skill isn't filling the desk. It's clearing it: putting up only what this turn truly needs, and stashing the rest.

03Most "memory" doesn't need the AI at all

This is the most important flip in the whole cluster, and where the savings live: a lot of what you're asking the agent to remember or do never needed a brain.

Wasteful — AI on a deterministic job

"Read these 200 log lines, count the 500 errors"
Costs tokens, slow, and might miscount

Right tool — a script does the deterministic part

One grep | wc counts it exactly, instantly, 0 tokens
Save the desk for what actually needs reasoning

The line is sharp once you watch for it: any job with one determinate right answer — counting, filtering, formatting, extracting by a pattern — is a script's job, not the AI's. Hand it to a command and it's exact, instant, and free of a single token. Save the agent's finite desk for what only it can do: judgment, synthesis, the parts that need understanding, not just computing.

04Three questions before anything goes on the desk

Folded into a habit, before each heavy turn:

  • Does this need to be on the desk right now? If not yet — leave it off; bring it when needed.
  • Is this reasoning, or is it deterministic? Deterministic → a script. The desk is for reasoning.
  • Have I stashed what must be remembered, outside? An important decision goes into a file, a note — don't entrust it to the desk, because the desk gets cleared.

An agent's memory isn't something you have, it's something you build — by choosing what stays on the desk, what's stashed off it, and never making a brain do a command's work. The three pieces ahead go deeper into each: treating tokens as a budget, knowing when a script beats the AI, and choosing what's worth a spot on the desk.

End of pieceCluster 02 · 1/4
The author

craftagent is the notebook of someone still building — told over coffee, each story wrapped around a lesson paid for in full.