Four Alarm Slots, Three Failure Modes: Building a Nightly Drain That Survives Sleep, Races, and Timeouts

2026年8月24日2 次浏览来源:Dev.to阅读原文

Every night my Mac quietly rewrites my long-term memory.

Not metaphorically — a shell script drains that day's Claude Code conversation logs into an Obsidian vault, commits them to a private repo, and leaves a briefing on my desktop.

It took three real outages to make it reliable.

This is the script, the three failures, and the design that came out of them.

Why This Setup Works Claude Code's "memory" disappears by default Claude Code sessions are independent of one another.

The root cause of a bug you found during a long working session today, the reason you settled on a particular architecture after trial and error, the accumulated knowledge that "this direction already failed once" — none of it is available in the next conversation once you close the session.

Even on a paid plan, even with the most capable model available, if context isn't carried over you have to explain everything from scratch every time.

Many people have had the experience of thinking "I already looked this up before" or "I should have failed at this once already, and yet here I am heading down the same road again." In a phase where you're shipping personal projects in volume, this problem is fatal.

Once three or four projects are running in parallel, tracking "where each project currently stands" by hand hits a wall fast.

And Claude, unable to reference previous conversations, repeats the same deliberations.

The solution is to build an environment, not a task My first attempt at this problem was "I'll write up a summary by hand every day." It didn't last.

When work has momentum you don't feel like writing a summary, and when you're tired you can write even less.

A system that depends on human willpower doesn't function during a high-volume solo-dev phase.

The answer was to build an environment that automatically drains Claude's conversation logs into Obsidian every night.

Once the environment is in place, willpower and motivation are irrelevant.

The Mac just does it.

The reason I chose Obsidian is simple.

The files are local Markdown, so Claude Code can read and write them directly.

They can be version-controlled with Git.

The syntax lets you connect pieces of knowledge to each other.

Logs flow in every morning and cross-project links grow naturally — from the moment this started functioning as an "external brain," the quality of my work changed.

Why a triple-layered structure became necessary Simply "running a script at 4:55 every day" produced three distinct kinds of failure once I actually ran it.

Each one only became apparent after it caused real damage.

Sleep freeze: If you close the lid on the Mac and go to bed, (which only takes effect on AC power) can't prevent sleep.

The script stops partway through, and that day's processing hangs in limbo until the next slot fires.

Double-execution race: An actual incident on 2026-06-10.

A scheduled launchd firing overlapped with a manual run.

Both tried to operate on the same vault with Git, and the result was a conflict.

Timeout: On 2026-06-13, every slot failed for the entire day.

Digesting 28 hours' worth of logs via didn't fit within the 40-minute timeout window and all of it got culled.

In the logs, the pattern lines up across all four slots, completely uniform.

These three real failures are what forced the triple-layered structure of "multi-slot re-firing," "caffeinate sleep prevention," and "idempotent retry via step markers." It didn't come out of a design document; it accumulated from things that actually broke.

The feeling of an environment that grows Once the system started running stably, logs pile up in Obsidian every morning.

Claude reads those logs, updates per-project articles, and this week's talking points accumulate in (a summary of recent context).

When Claude reads and in the next conversation, it can start working already knowing "last week's decisions," "the approach that failed once," and "the current state of the three projects running in parallel." That's an external long-term memory

分享
Baike.dev

baike.dev helps you discover great languages, frameworks, databases, DevOps and cloud-native tools.

Quick links

About

Contribute

Found a great developer tool? Share it with the community.

Submit a tool
© 2026 baike.dev Developer EncyclopediaUpdated daily · Discover great developer tools