Rack Before You Remember

What racking wine teaches about agent memory

The bottom of a white fermenting bucket seen from above, holding a shallow pool of cloudy golden mead over a thick layer of tan sediment, with the tip of a clear siphon tube resting at the edge of the pool.

The mead’s lees on October 21, with the racking cane at the edge. Everything the siphon left behind stays here.

That layer at the bottom of my mead fermenter did most of the work of turning honey and water into something worth drinking. It’s spent yeast and the debris of a few weeks of vigorous fermentation. Without it, there’d be nothing to rack.

I left all of it behind on purpose.

What lees are, and why they stay behind

When primary fermentation winds down, the yeast that did the work drops out of suspension along with whatever solids came along for the ride. That sediment is called the lees, and the first, heaviest layer is known as the gross lees.

Racking is how you separate the wine from it. You siphon the wine off from above, carefully, into a clean vessel, and leave the sediment where it settled. I racked the pear wine on October 12, once the readings had held steady long enough to justify the move, and the mead on October 21, when its refractometer reading had settled at 3.2 Brix.

The pear racking went smoothly, and it taught me something I didn’t expect. I’d added bentonite, a clay that binds proteins and helps haze drop out, and I assumed that by racking day the wine would be close to see-through. It wasn’t. It’s not murky, but it’s not clear either. Racking had separated the wine from the heavy sediment. It hadn’t made the wine clean. The finer material still in suspension will take weeks to settle, and there will be another racking after it does.

Hold on to that distinction, because it comes back later.

The reason to rack isn’t that the lees are bad. It’s that their job is done. Left in contact with the wine too long, the heavy lees start to break down, and the compounds they release can push the wine toward off flavors that range from dull to genuinely unpleasant. Material that was essential during fermentation becomes a liability during aging.

That’s the whole article in one sentence: not everything useful during execution deserves to survive execution.

Agents have lees too

Watch an AI agent work through a nontrivial task and you’ll see the equivalent of a primary fermentation. It retrieves documents, most of which turn out to be irrelevant. It calls tools and gets back large blobs of output. It tries an approach, hits an error, and backs out. It forms hypotheses that don’t survive. It reads text from untrusted sources, some of which might contain instructions it was never supposed to follow.

All of that is essential while the task is running. The failed attempts are how it found the working one. The irrelevant documents are how it figured out which were relevant.

And then the task ends, and a surprising number of memory designs do the equivalent of never racking the wine. The transcript gets saved. The tool outputs get embedded. The scratchpad gets summarized into long-term memory without anyone deciding which parts of it were conclusions and which were sediment.

For a while, nothing seems wrong. Then the lees start to break down. A hypothesis the agent abandoned on Tuesday gets retrieved on Friday as if it were a fact. An error message from a transient outage becomes a durable belief that some service is broken. A snippet of injected text from a web page resurfaces, weeks later, in a context where it looks like a user preference. None of these were bad things to have during the task. They’re bad things to have in the cellar.

You can’t filter it out at the glass

The obvious objection is that you can sort it out later. Store everything, and let retrieval figure out what’s relevant.

Winemaking has a pretty clear answer to that. If you leave the wine on the gross lees for months, you can’t fix it by pouring carefully. The problem isn’t that sediment ends up in the glass; you could decant that away. The problem is what the sediment did to the wine while it was stored together.

Memory systems work the same way. Raw execution material doesn’t just sit inertly waiting to be filtered at read time. It gets summarized, and the summaries inherit its errors. It gets embedded, and it competes in similarity search with things that were actually true. It feeds derived facts, and those facts get cited by later tasks. By the time a read-side filter sees it, the contamination has already been folded into things that look clean.

None of this means throwing the raw record away. Transcripts and tool outputs are genuinely valuable for debugging, forensics, and compliance, and a system that can’t reconstruct what an agent did is its own kind of problem. The distinction is between keeping evidence and promoting it into memory. A raw execution log in an archive the agent never retrieves from is evidence. The same log embedded into the store the agent reasons from is sediment in the wine. Winemakers make the same split: lees you want to keep go into a separate jar, for cooking or for starting the next batch. They don’t stay in the carboy.

That’s why I’ve come to think the decision about what persists belongs at write time, as a deliberate boundary, rather than being deferred to whatever happens to read the store later. I’ve been calling this Write-Side Custody: the system that writes memory is responsible for what it lets in, and for being able to say why.

One boundary doesn’t make it clean

Remember the hazy pear. A write-time boundary works the same way the first racking does: it removes the gross sediment, the material that’s obviously done its job and is obviously going to cause trouble. It doesn’t guarantee that what passes through is perfectly clean.

Some fine material always comes along. A conclusion that seemed confirmed turns out to rest on a shaky source. A summary carries a little of the noise it was built from. That isn’t a reason to skip the boundary. It’s a reason to expect more than one. Wine gets racked again after it has had time to settle, because time reveals what the first separation couldn’t. My blackberry wine got its second racking the same week as the mead’s first, and weeks after the heavy sediment was gone, it still left a layer of fine lees behind. Memory benefits from the same second pass: revisiting what was stored once it has been used, contradicted, or simply aged, and deciding again what still deserves to stay.

The first racking makes the problem manageable. It doesn’t make it finished.

The racking cane leaves wine behind

Here’s the part nobody mentions in the metaphor-friendly version of racking: you lose wine.

To avoid drawing up sediment, you stop siphoning a little before the bottom, which means leaving some perfectly good wine behind with the lees. In a five-gallon batch that loss barely registers. In a one-gallon batch, it’s noticeable.

A glass carboy of dark purple blackberry wine on a kitchen counter, with a red siphon tube arcing from it into a second carboy sitting lower in the sink.

The blackberry’s second racking. The receiving carboy sits lower so gravity does the work.

The pear got lucky. I’d made a little more than the carboy could hold, so the loss came out of the surplus, and the surplus was just enough for one hydrometer reading. The mead lost four ounces to its lees, about 3% of the batch. The blackberry’s second racking lost eight, about 6%, and not all of that was sediment: the auto-siphon simply couldn’t reach into the corners of the carboy. The shape of the vessel set part of the cost.

A carboy that isn’t full has headspace, and headspace is air, and air is how wine oxidizes. So the gap has to be filled with something. For the mead, I topped it back up with four ounces of honey water, made from the same fireweed honey, at 18.4 Brix, which means the mead now has a little fresh sugar in it, on purpose, and the log says so. For the blackberry, I didn’t have anything worth adding, so I used an inert gas instead. It doesn’t replace the missing wine. The carboy holds less than it did, and nothing will change that. What the gas does is protect the wine that’s left, by keeping oxygen away from it.

That’s an honest cost, and it’s the right trade. Chasing the last few ounces means stirring up the sediment you were trying to leave behind.

Memory boundaries have the same cost. A write-side filter conservative enough to keep out the sediment will sometimes discard something that would have been useful: a detail from a failed attempt, a tool output that mattered after all. That’s not a flaw in the approach. It’s the price of the boundary, and it’s usually far cheaper than the alternative. A memory store that has lost a few useful details is annoying. One that has absorbed a few confidently wrong ones is dangerous, because it doesn’t know which ones they are.

It’s worth separating the two kinds of loss, though, because the blackberry had both. Some of what stayed behind was sediment I chose to leave. The rest was wine the siphon physically couldn’t reach. Memory systems lose information the same two ways. Some is discarded by policy: a rule decided this didn’t deserve to persist. Some is lost to the equipment: a schema with no field for it, a fixed chunk size that splits it in half, a context limit that drops whatever came first. Nobody decided to lose that second kind, which is exactly why it goes unnoticed. The fixes are different, too. A bad policy gets a better rule. A bad vessel gets better equipment, and no amount of careful siphoning will reach a corner the tube can’t bend into.

And when the boundary leaves a gap, those two top-offs are worth remembering. Adding something real is fine when it’s deliberate and recorded: the mead’s top-off is a known liquid at a known strength, written down the day it went in. The trouble is filling the space with something that only looks like the real thing: a plausible guess, a synthesized summary, a default. That’s topping up with water and not mentioning it. It dilutes the record, and nobody can tell afterward which part was the wine. When there’s nothing real to add, do what the inert gas does. A record that says plainly this was discarded, and here’s why doesn’t restore what was lost. It protects everything downstream from treating the gap as something known. That’s the job: not filling the hole, but making sure nothing mistakes the hole for knowledge.

Sur lie is a decision

To be fair to the lees, some winemakers deliberately keep wine on them. Aging on the fine lees, the lighter sediment that remains after the first racking, is a traditional technique for adding texture and complexity. It’s called sur lie, and Muscadet and Champagne are built partly on it.

But notice how it’s done. It’s the fine lees, not the gross lees. It’s a specific choice made for a specific wine, often with regular stirring and attention. Nobody ends up with a sur lie wine because they forgot to rack.

The same is true in memory. Sometimes execution detail genuinely deserves to persist. A failed approach might be exactly the thing you want an agent to remember next time: we tried this, it doesn’t work, here’s why. That’s valuable. But it’s valuable because someone decided to keep it, labeled it as what it is, and recorded where it came from. A lesson learned from a failure is a different thing from the failure’s raw transcript sitting in the store, waiting to be mistaken for advice.

Keeping execution material can be the right call. Keeping it by default almost never is.

Rack at transitions, not constantly

One more practical lesson. Racking isn’t free for the wine either: every transfer exposes it to oxygen and handling. So you don’t rack constantly. You rack at transitions, when primary ends, after secondary, before bottling, at the points where the evidence says the wine has moved into a new state. The mead waited in primary until its readings held still, then moved once.

That maps well onto memory design. Rather than continuously streaming everything an agent touches into durable storage, the natural points to decide what persists are the transitions: when a task completes, when a conclusion is confirmed, when a session ends. Those are the moments when you can tell the wine from the sediment, because the process has finished producing both.

Racking your memory

Decide what persists at write time. Read-time filtering can’t undo what raw material did to summaries, embeddings, and derived facts while it sat in the store.

Archive evidence; don’t promote it. Keep raw transcripts for debugging and audit, somewhere the agent doesn’t retrieve from. Evidence and memory are different stores.

Assume execution produces sediment. Failed attempts, irrelevant retrievals, transient errors, and untrusted text are normal byproducts of useful work. Plan for them to exist; don’t plan for them to persist.

Expect more than one pass. The first boundary removes the obvious sediment. Time reveals the rest.

Accept the cost of the boundary. A good filter will occasionally discard something useful. That’s cheaper than keeping something wrong.

Know which losses are policy and which are equipment. Some information is dropped because a rule said so. Some is dropped because the schema, chunk size, or context limit couldn’t hold it. Only the first kind was a decision.

Fill gaps honestly. When the boundary leaves a hole, either add something real and record exactly what it was, or record that something was removed, so the gap is protected rather than mistaken for knowledge. Never top it up with plausible filler.

Make retention deliberate. When execution detail is worth keeping, keep it on purpose, label what it is, and record where it came from.

Rack at transitions. The best time to separate conclusions from sediment is when the process that produced them has finished.

The pear is clearing now, a few shades brighter than it was in the fermenter, though still not as clear as I’d hoped. The lees did their job. They just don’t get to come along for the rest of it.

Facebooktwitterredditlinkedinmail

Tuesday Isn’t a Valid State Transition

Calendars, evidence, and the difference between done and stuck

I expected my pear wine to spend two to three weeks in primary fermentation.

It spent nineteen days. The yeast went in on September 23, and on October 12 I siphoned the wine off its sediment and into a glass carboy.

So the calendar was right. That still isn’t why I moved it.

What the calendar is for

Every fermentation recipe comes with time estimates. Primary takes one to three weeks. Secondary takes a few more. Bulk age for a few months. Those numbers aren’t wrong. They’re averages across a lot of batches, and they’re useful for exactly one thing: planning. They tell you when to have a clean carboy ready, when to clear some space, when to stop making weekend plans.

What they can’t do is tell you that this batch is ready. Yeast doesn’t read recipes. It works at a speed set by temperature, sugar, nutrients, acidity, the particular strain, and the particular fruit, none of which the recipe author has ever met.

So the recipe gives you a forecast, and the fermentation gives you evidence. Only one of those gets to move the wine. If they happen to agree, as they did this time, that’s a pleasant coincidence, not an authorization.

The rule winemakers actually use

The traditional test for “primary is done, time to rack” is simple: take readings over several days, and when you get the same reading three times running, fermentation has finished.

What I like about that rule is what it isn’t. It isn’t a date. It also isn’t a single reading, because one measurement tells you where the fermentation is, not whether it’s still moving. It’s evidence sustained over a window. Time is part of the test, but only as the space in which the evidence has to hold still.

Here’s what the pear’s refractometer readings actually looked like:

Date Raw Brix
Sep 23 12.9 (before the yeast)
Sep 25 6.0
Sep 30 6.0
Oct 2 5.7
Oct 4 5.6
Oct 7 5.6
Oct 10 5.6
Oct 11 5.6
Oct 12 5.6

Two things in that table are worth a closer look.

First, the early plateau. Most of the sugar was gone within two days, and then the reading sat at exactly 6.0 for five days. If I’d been looking for stillness and nothing else, that looked a lot like the end. It wasn’t. The fermentation was slowing down, not stopping, and over the next week it crept down further before it finally held. Two matching readings were a pause, not a verdict, which is precisely why the rule asks for three.

Second, I didn’t stop at three. By October 10 I had three consecutive readings at 5.6, which satisfies the rule. I kept reading anyway, and waited until five readings across eight days agreed.

Then the racking itself handed me one more piece of evidence. There was more wine in the primary fermenter than the glass carboy could hold. Rather than pour the extra down the drain, I filled a hydrometer jar with it: a completely different instrument, measuring a completely different physical property. The refractometer, once corrected for alcohol, put the wine at about 1.004. The hydrometer said 1.002. Two independent instruments, close enough to agree, and the second one confirmed that the correction formula I’d been trusting for three weeks was doing its job.

I like that this happened by accident, because it isn’t really an accident. A hydrometer needs a large sample, which in a one-gallon batch is too expensive to take routinely. At the moment of a transition, when wine is being moved anyway, that same sample costs nothing. The transition is when the more trustworthy evidence becomes cheap.

None of that is the calendar talking. That’s a guard, and it was satisfied before the wine moved.

Status is a column anyone can write

In a lot of systems, state is a string in a database, and a transition is an UPDATE statement.

UPDATE orders SET status = 'shipped' WHERE id = 4417;

Nothing in that statement requires that anything was shipped. It’s a label, and anyone with write access can apply it for any reason: a cron job that marks orders shipped two days after payment because that’s usually true, a release train that promotes whatever’s on the branch because it’s Tuesday, a support tool that flips a flag to make a ticket go away.

Each of these is the software version of racking the wine because the recipe said two to three weeks. Most of the time it’ll even be right, just as my calendar was. The transition happens on schedule, the dashboard updates, and the system now asserts a state that nobody verified.

The fix isn’t elaborate. A transition should have a guard, a condition that has to be true, based on evidence, before the state can change. “Shipped” should require a carrier scan. “Released” should require the checks that define releasable. “Primary complete” should require stable readings. The state machine’s job is to refuse the transition when the evidence isn’t there, however much the calendar insists, and to keep refusing even on the days the calendar happens to be right.

Same evidence, two states

Here’s where it gets interesting. “Three consistent readings” is the signal for done. But a fermentation that has stalled also produces three consistent readings.

Mead is notorious for this. Honey has very little natural buffering, so as fermentation proceeds the pH drifts down, and past a certain point the yeast slows or quits entirely, often well short of dry. From the refractometer’s point of view, a stuck mead and a finished mead look exactly the same: a number that has stopped moving.

My fireweed mead is a few days from that question right now. Its pH started at 3.5 and dropped to 3.1 within the first four days, where it has mostly stayed. Here are its last few readings:

Date Raw Brix Corrected Brix Estimated ABV
Oct 7 11.8 4.3 10.4%
Oct 10 9.0 -0.3 12.8%
Oct 11 8.6 -1.0 13.1%
Oct 12 8.4 -1.3 13.3%

Look at the corrected column. The calculator now claims the mead contains less than no sugar, which is impossible. That’s a model being pushed past the range it was built for, and it’s a nice reminder that a derived number can confidently assert something no physical system can be. If my guard were “corrected Brix at or below zero,” I’d have racked the mead two days ago.

The raw readings tell a different story: they’re still falling, slowly. The mead isn’t still yet, so the guard isn’t satisfied, no matter what the corrected number says. And when it does go still, the question becomes where. The yeast I used, 71B, is generally rated to tolerate around 14% alcohol, and the estimate is already over 13%. A mead that stops near its yeast’s limit with the sugar it was expected to consume gone is probably done. One that stops early, with sugar left over and the pH low, is probably stuck.

The mead has already taught me this lesson once, in miniature. Mead yeast needs nutrients added in stages early on, and the textbook guidance ties the last addition to the “one-third sugar break,” the point where about a third of the sugar has been consumed. I scheduled my three additions by day instead. As it happened, the last one landed right around the sugar break anyway. Sometimes luck happens. But luck is exactly what it was: the schedule didn’t know where the sugar was, and if the mead had been a few days slower, the same calendar would have fed it at the wrong time.

In other words, the guard for “done” can’t just be “stable.” It has to be “stable where a finished fermentation should be,” which means the guard needs a model of the expected end state, not just a test for motion. And it needs to know which of its inputs to trust when they disagree.

Software has the same ambiguity everywhere. A batch job whose progress counter hasn’t moved in an hour has either finished or hung. A queue depth sitting at zero means either everything was processed or the consumer died. A replication lag of zero might mean the replica is caught up, or that it stopped receiving anything to lag behind. In every case, “nothing is changing” is evidence consistent with two opposite states, and a transition that only checks for stillness will eventually pick the wrong one.

A transition is an event with a receipt

The row in my pear log for October 12 reads, in effect: 11:10 a.m., 5.6 Brix, hydrometer 1.002, moved to glass carboy. The transition and the evidence that justified it are on the same line.

That matters more than the new status. Months from now, if the wine turns out strange, “racked on October 12” tells me almost nothing. “Racked after five stable readings, confirmed by a second instrument” tells me what I believed, what I based it on, and whether I might have been fooled by a stall.

Systems benefit from the same habit. A state change shouldn’t just overwrite the previous state. It should be recorded as an event: what the state was, what it became, what evidence satisfied the guard, and who or what made the call. Then the current state is something you can explain, not just something you can read. When “shipped” turns out to be wrong, you can see whether the guard was bad, the evidence was bad, or the guard was never checked at all.

What time is actually allowed to do

None of this means time is irrelevant. It plays three legitimate roles, and it’s worth keeping them straight.

Time can permit a transition. Some transitions shouldn’t happen before a minimum interval no matter what the evidence says, like a waiting period before a refund clears, or a wine that needs some minimum aging before bottling. Here time is a precondition alongside the evidence, not a replacement for it.

Time can create the conditions for evidence. The three-readings rule only works because readings are spread over days. Stability over a window requires a window. The pear’s false plateau is exactly why: two readings five days apart looked still, and only more time showed they weren’t.

Time can raise a question. If a fermentation hasn’t finished long after it should have, that’s worth investigating. But notice what the timeout actually tells you: something is unusual. It doesn’t tell you the batch is done, and it doesn’t tell you the batch has failed.

That last one is where software most often goes wrong. Timeouts routinely get wired straight to a terminal state: no response in thirty seconds means failed, no update in three days means complete. A timeout is legitimate evidence that you need to look. It is rarely evidence of what you’ll find when you do. A timeout should produce a question, not an answer.

What time shouldn’t do, on its own, is cause a transition. Nineteen days arriving was not a fact about the pear wine.

Guarding your transitions

Treat schedules as forecasts. Plan with them. Don’t let them move state, even when they’re right.

Put a guard on every transition that matters. If a state can be reached by writing a string, eventually it will be reached for the wrong reason.

Test for the expected end state, not just stillness. Stable and finished are different claims. A guard that can’t tell them apart will someday declare a stall a success.

Know which evidence to trust when it disagrees. A derived value can be confidently impossible. Raw observations and independent instruments are how you catch it.

Record the evidence with the transition. The new state is the conclusion. Keep the reasons next to it.

Let timeouts ask, not answer. Route them to “needs attention,” not to “done” or “failed.”

The pear is in its carboy now, clearing slowly. October 12 was the day it moved. It happened to be a Monday. That wasn’t the reason either.

Facebooktwitterredditlinkedinmail