← build-log

Where was I? My agents resume work they don't remember starting

· #build-log#agents#continuity

The last memory post ended on a distinction: context is what an agent is holding right now; memory is everything it has earned and kept. Persistent memory takes care of the second half — the durable facts, decisions, and lessons that compound across weeks.

This post is about the first half, and what happens to it when a session ends.

The gap memory doesn’t close

Long-term memory is excellent at the things worth remembering for months. It is useless at the thing you need to remember for the next twenty minutes.

Right now, mid-task, an agent is holding a particular kind of state: that it’s three steps into a five-step migration, that the file open in the editor is half-rewritten, that it ruled out the obvious approach ten minutes ago for a reason it hasn’t written down anywhere. None of that belongs in long-term memory — it’s not a durable fact about the project, it’s the position of the work in flight. And it lives in exactly one place: the context window.

That’s the gap. The knowledge base remembers what the desk concluded last week. It has no idea where the current sentence trails off.

Two ways a session dies

The context window is rented, and the lease ends two ways.

It compacts. Long sessions outgrow the window, so the older turns get summarized to make room. A summary is lossy by design — it keeps the gist and drops the specifics, which is precisely backwards for resuming work. The gist (“we were migrating the site”) is the part you already know; the specifics (the exact path, the ID, the reason you skipped the third option) are what you actually needed.

Or it ends. You close the laptop. The session terminates, the window evaporates, and the next session opens blank — a brilliant colleague with total amnesia about the last four hours, staring at a half-finished task with no idea it was the one who started it.

In both cases the cheap escape hatch is “just re-read the transcript.” But replaying a four-hour transcript is slow, burns the new window on history instead of work, and still leaves the agent to reconstruct intent from a wall of tool calls. There’s a better handoff.

The fix is a handoff, not a summary

The scratchpad is one file per workspace — .claude/scratchpad.md — written by a small agent whose entire job is to answer “if I had to hand this session to someone else right now, what would they need?”

The crucial design choice is in the negative space. The curator is told, in as many words, that it is not writing a summary:

So the scratchpad isn’t prose. It’s a structured handoff with a fixed shape, and each section earns its place:

  • Current Target — one sentence: what is actively being worked on.
  • Open Threads — every in-flight item, with the exact references needed to resume it and the next concrete step.
  • Decisions Made — what was chosen, why, and what was rejected. This is the part that’s gone forever if you only keep the transcript’s last screen.
  • Dead Ends — what was already tried and didn’t work, so the next session doesn’t cheerfully repeat it.
  • Verified vs. Assumed — two columns, and the split matters: it stops the resuming agent from treating a hopeful guess as established fact.
  • Key References — the flat list of IDs, paths, and URLs that will be needed again.

That Verified vs. Assumed split is the one I’d point a skeptic at. An agent that can’t tell what it checked from what it hoped is the agent that confidently builds on sand. Writing the line forces the distinction.

When it’s captured

The scratchpad is regenerated at the two exact moments the thread would otherwise snap: just before the window compacts, and when the session ends. Catch it at the seams and there’s never a gap to fall through.

The curation runs on a separate, cheaper sub-agent — a smaller model, no tools, and a stripped-down prompt that replaces the usual agentic instructions entirely, because distilling notes doesn’t need the full toolbox. It’s fired detached and time-boxed, so it can never wedge or slow down the session it’s closing. If it fails, it fails silently and the worst case is a slightly staler note.

And when it’s read back

At the start of the next session, a hook injects context back in — and this is where two of these posts meet. It emits two blocks, in order:

1. CEO Desk directives   ← the agenda, from the master desk (top-down)
2. Session scratchpad     ← where I left off       (bottom-up)

The directives come first, on purpose. Top-down agenda before bottom-up continuity: here’s what the desk wants this week, then here’s where you actually were. The governance layer from the last post and the continuity layer from this one arrive stacked in the same breath, and the agent reads its marching orders and its own half-finished work as one briefing.

One more borrowed instinct: freshness. A scratchpad more than a week old is dropped rather than injected — stale continuity is worse than none, the same way the memory layer lets unused facts decay. Old “where I left off” notes describe a world that has moved on.

Honest close

None of this is exotic. There’s no message queue and no new service — it’s a pair of session hooks, a one-file note, and a small model with a narrow prompt, riding on top of machinery that already existed. It’s a single-operator setup I run every day, and the whole thing is deliberately fail-soft: if a hook misses, a runtime isn’t synced, or the note is stale, the session just starts clean. Worst case, it degrades to the default everyone already has — an agent with amnesia — and never to something broken.

That’s the through-line of these three posts. Memory is what the desk has earned and kept. Governance is how a roomful of agents stays coherent. Continuity is the small, unglamorous bridge between them: the thing that lets the work survive the gap between one session and the next, so progress accrues in days instead of resetting every time the window fills.