Memory Fills Up

A hand-written AI agent run, line by line. The lesson: when memory fills up, summarize and keep going.

task
Rename getUser → fetchUser across the codebase — 14 files.
Watch this run on the timeline →
plan
Fourteen files. Not hard, just long. Everything I read has to fit in my memory — my context window.
  1. Find every call site
  2. Rename across 14 files
  3. Update the barrel exports
  4. Verify the build
grepgetUser\( — src/**
scope the whole job before starting it
53 call sites across 14 files
53 changes to make. Everything I read stays in my memory, measured in tokens — chunks of words. Watch the gauge.
editapi/session.ts — 6 call sites
one file at a time, verified as I go
renamed (1/14)
Every edit I make, I also have to remember.
edithooks/useUser.ts — 5 call sites
renamed (2/14)
editcomponents/Profile.tsx — 4 call sites
renamed (3/14)
Eleven files to go. Same pattern every time — and my memory gauge keeps climbing.
editauth.ts, cart.ts, nav.tsx, search.ts, feed.tsx — 17 call sites
same edit five times — batching buys speed with memory
renamed (8/14)
That was faster, but it cost a lot of memory.
your call
85% full. Your call: compress, or keep every detail?
Memory is at 85% with six files left. What do I do?
“compress — trade detail for room” or “keep every detail”
The script writes both paths. Beats tagged with a pick happen only on that path.
if you picked “compress — trade detail for room
Good — I fold the finished work into a summary and free the room.
if you picked “keep every detail
editbilling.ts + admin.ts — 6 call sites
We keep everything. I push on, nearly full.
if you picked “keep every detail
context overflow — response truncated, edit incomplete
Too full to finish the edit. When memory overflows I don't slow down — I lose work mid-thought.
if you picked “compress — trade detail for room
What's finished can live as one line each. What's left is six file names.
if you picked “keep every detail
I hit the ceiling mid-edit and the work was lost. Compacting isn't optional — it's how I keep going.
compacted
This is called compacting. I rewrite my own memory: finished work folds to a summary, and room comes back.
8/14 files renamed — call-site detail summarized. Remaining: billing.ts, admin.ts, jobs/sync.ts, cli.ts, tests ×2
compacted
I lost work, and I have to compact anyway. The only choice was when to forget.
8/14 files renamed — call-site detail summarized. Remaining: billing.ts, admin.ts, jobs/sync.ts, cli.ts, tests ×2
Working from my summary now — the details are gone. That's the trade.
editbilling.ts, admin.ts, jobs/sync.ts — 9 call sites
the summary holds everything I still need
renamed (11/14)
editcli.ts + tests — 12 call sites
renamed (14/14)
All fourteen done, on a fraction of the memory.
editindex.ts — export fetchUser
the exports carry the old name too
barrel updated
bashtsc --noEmit && npm test
Last step: prove the build still works.
0 errors, 47 passed
Everything passes. The rename is real.
done
when memory fills up, summarize and keep going
  • ·Memory is finite — everything I read or edit stays until I drop it.
  • ·Compacting traded finished detail for room to keep working.
  • ·Keeping everything hits the wall mid-edit and loses work.

Every line above is a hand-written script; no model.

The same lesson with no code in sight: Memory Fills Up — “I saved 14 apartment listings. Which ones should I actually tour?

the other runs:
  • A Clean Run — “Tests are failing in utils.test.ts — find out why and fix it.
  • A Plan Fails — “/api/orders is returning 500s — fix it.
  • A Clean Run — “What can I make with what's in my fridge?
  • A Plan Fails — “I plan eight hours of work and get four. Figure out why.