One Wrong Setting Deleted Two Memories

A person looking at a laptop screen showing a plain text file with one line highlighted, a notebook and pen beside the keyboard, natural daylight

On Thursday evening, while installing a small upgrade to my laptop assistant, I deleted two memories. Not on purpose. Not by pressing the wrong button. By running a cleanup script that wrote a file with the wrong text encoding. The file looked fine. The app opened fine. And two saved moments were gone before anyone noticed they were missing.

The upgrade was version 9.1 of the living assistant. It fixed a real bug — a cough detector that had counted one sound four times. The installer cleaned up the assistant's memory file first, removing old entries, and then saved it back. The command it used wrote the file in UTF-8 with a BOM — three invisible bytes at the very start of the file that say "this is UTF-8". Most programs ignore those bytes. The assistant's file reader did not. It choked on them, decided the file was empty, and loaded a blank memory instead.

Then the next small event arrived, and the assistant saved its blank memory over the real file. That is the moment the data actually died. Not when the bad write happened, but when the next save trusted the empty load and overwrote the good file. Two automatically saved moments about a run of stressful evenings were gone. So was a person entry I had added myself as a test — my mother's name, put there by me to test whether the assistant could remember people at all. The journal still holds the stress history in its own file, so the story is not lost entirely. But the memory file itself lost two things that were only there.

Why This Bug Is Worth a Whole Post

This is not a post about an encoding flag. It is a post about the gap between "the command worked" and "the data survived". The cleanup script reported success. The file existed. The app started. Every signal said fine, and the data was gone anyway. That gap is where most quiet data loss lives — not in crashes and error messages, but in steps that look successful and are not.

The rule I wrote down afterwards is simple, and it now sits in my notes in capital letters. Never write one of the laptop's JSON files with the command that adds a BOM. Write with the method that writes plain text with no marker bytes. And if the app ever needs to read such a file, teach it to read with the encoding that skips the marker. One line in the script, one line in the reader. That is the whole fix.

But the fix is not the lesson. The lesson is the habit that should have caught it before the next save made it permanent.

The Habit: Verify the Old Data Is Still There

After any script touches a data file, two checks take less than a minute. First, open the file and confirm it still parses — that it is still valid data, not a corrupted blob. Second, confirm the old entries are still there. Count them. Look for the names and moments you expect to find. If the count dropped, stop. Do not let the app save again until the file is restored from a backup.

I did neither check that evening. The installer finished, the app restarted, the state looked alive, and I moved on to the next thing. The loss was found later, when the missing entries were noticed by absence. By then the overwrite had already happened, and the only recovery was the journal's separate copy of the stress history. The test entry about my mother had no other copy at all. It was mine to lose, and I lost it.

There is an uncomfortable honesty in that sentence. The entry was a test seed I had added myself. It was not something my family asked me to store. Losing it cost nothing in the real world. But the mechanism that lost it does not care whether the data is a test or a treasure. The same bad write, on a file that mattered, would have taken the real thing just as quietly.

What Changed After

Three things changed, and all three are boring, which is exactly why they will work. First, the rule about the encoding is written down where the next installer will see it. Second, the check-after-write habit is now part of every file edit: parse it, count the old entries, and only then let anything save again. Third, the memory file gets a backup before any installer touches it, the same way code gets a backup before it is patched.

None of this is clever. Clever is what got me here — a one-line cleanup that looked too small to verify. Boring is what keeps data alive: a backup, a parse check, and a count of what was there before.

The upgrade itself, by the way, works. The cough detector now counts each sample once, and the bout fires once. The assistant is running, the state is ticking, and the two lost moments are recorded in the journal where they can still be read. The work survived. The lesson is about the two things that did not, and the thirty seconds of checking that would have saved them.

What is the smallest command you have run that looked harmless — and what did you check, or wish you had checked, right after it?

Comments