Working memory, context windows, and why my agents checkpoint
The brain has been running a resource-constrained agent for a few hundred thousand years. Some of its tricks port directly.
I read neuroscience the way some people watch football highlights. Not because I plan to do it professionally, but because it keeps showing me things that are useful somewhere else. Lately, that somewhere else has been agent design.
Start with working memory. Humans hold roughly four chunks of information in active attention at once. Not four facts, four chunks, where a chunk is whatever you have compressed into a single handle. A chess master sees a board position as one chunk. I see it as thirty-two pieces. The capacity is the same, the compression is different.
A context window is working memory with a bigger number attached. And the failure mode is identical. You can stuff a hundred thousand tokens in, but the model attends to a small fraction of it, and what it attends to is decided by salience, not by importance. Long-context benchmarks keep finding this: facts in the middle of a prompt get lost. Neuroscience has a name for the same curve in human recall. It is called the serial position effect, and it was described in 1885.
Compression beats capacity
The brain's answer to limited working memory is not to grow it. It is to compress aggressively, offload to the environment, and retrieve on demand. You do not remember your friend's phone number, you remember where it is stored. This is retrieval-augmented generation, built by evolution.
So when I build an agent, I stop trying to fit everything in the prompt. I ask what the agent needs to hold right now, and what it can look up. Structured summaries of past turns go into the context. Raw transcripts go into a store with an index. The agent's working memory stays small and legible, which also makes it debuggable.
Sleep is a checkpoint
The second trick is consolidation. During sleep, the hippocampus replays the day and moves what matters into cortex, where it is cheaper to store and slower to change. If you skip that step, the day is lost. The brain does not keep everything live; it periodically commits.
ResearchOps-AI checkpoints after every stage for the same reason. A multi-agent research run can take minutes and involve dozens of model calls. If the judge stage fails on call forty, I do not want to redo calls one through thirty-nine. Every stage writes its validated output to a store, and the graph resumes from the last good node. It is a mundane engineering pattern, but I only started treating it as non-negotiable after reading about what happens to memory when you skip sleep.
The brain is not a metaphor for agents. It is the reference implementation, and it has been in production longer than anything I will ever ship.
None of this makes me a neuroscientist. I am an engineering student who reads too much. But I have stopped believing the two fields are far apart. Attention, retrieval, consolidation, prediction error: these are the words in the papers, and they are also the names of the functions in my codebase.