6 min readPost 12
When a product story became a requirement: grave notices and Docker containers
While describing how Obituary works, we pictured an agent touching a buried file and immediately learning how to resurrect it—then checked the code and realized it couldn't. That same night produced both 25ms-budgeted grave notices and full-ID, out-of-lock Docker container lifespans.

On this page
Writing a product story often exposes gaps faster than a spec does: you describe an interaction that feels completely obvious, check the implementation, and realize the code cannot actually do it. Instead of softening the story, we turned those gaps into real features.
In the early hours of 11 November, that happened twice back-to-back—yielding grave notices for missing files and Docker container lifespans.
Gap one: once a file was buried, the agent just hit ENOENT
Obituary moves expired AI-agent files into a local graveyard where they stay restorable for 7 days. Describing that flow, we naturally wrote: if you aren't sure whether a scratch file is still needed, bury it—if an agent tries to use it during the next week, Obituary tells the agent where it went so it can resurrect it.
Checking our code revealed a blind spot. Agents only saw a summary at session start; once a file sat in the graveyard, any later tool call targeting that path simply failed with No such file or directory, leaving the agent assuming the file had never existed.
Grave notices: inform without blocking, under a 25 ms lock budget
We added a lightweight notice hook. Whenever an agent's tool call references a path that does not exist on disk yet matches a restorable grave (either the buried path itself or a child inside a buried folder), Obituary attaches additionalContext stating four facts:
- The grave ID
- When it was buried
- How long it remains restorable
- The exact command:
obit resurrect <id>
The hook only informs—it never denies or mutates the tool call, and fires at most once per grave per session. Hosts that accept pre-tool context receive it on the spot; other hosts deliver it on the next context-capable event, as documented in the capability table.
Here is an isolated run: burying notes.md and feeding a PreToolUse file-read payload into obit hook claude:

Keeping PreToolUse fast
PreToolUse runs on every file and shell action and previously never touched the ledger. Four constraints keep grave notices cheap:
- Zero ledger reads when the path exists: checks trigger only when the referenced path is actually missing.
- Fast path-only index: every ledger commit rebuilds a compact path index used purely as a negative filter; only a hit reads the ledger to verify.
- Hard 25 ms shared-lock budget: if the ledger lock is busy for more than 25 ms, the hook skips the notice rather than stalling the agent.
- Exact-case matching: we prefer an occasional missed notice over expensive directory walks.
That same evening we also switched the session-start summary of recently buried files to off by default to save agent context tokens (re-enableable via [hooks] session_summary or Settings).
Gap two: stopping expired Docker containers without touching images or volumes
A second everyday annoyance landed the same night: agents routinely run docker run and docker compose up during debugging, leaving behind orphaned containers nobody remembers a few days later.
Version one drew a strict perimeter: containers only—never images, networks, or volumes. (Later volume support remained strictly opt-in via --docker-volume, and burying a container still never deletes its volumes.)
Containers enter either explicitly via obit docker add <container> <lifespan> or—when auto-proposals are enabled—as pending proposals for containers created during a session. Their lifecycle mirrors files cleanly:
| Stage | Docker action | Safety rule |
|---|---|---|
| Expiry burial | docker stop | Keeps container and writable layer intact |
| Resurrect | docker start | Restores container with writable layer untouched |
| Post-retention purge | docker rm | Never passes -v (volumes) or -f (force-kill running) |
Three invariants hold across every step:
- Every command passes the full 64-character container ID (names are display-only), re-inspecting ID and creation timestamp right before acting.
- If a container is running at purge time, someone started it again—Obituary treats it as resurrected and never removes it.
- Containers started with
--rm(AutoRemove) vanish automatically when stopped, making burial irreversible, so Obituary refuses to register them.
A subtle Docker hazard: renaming another container to a full 64-char ID
Docker resolves container references in order: full ID, then exact name, then ID prefix. If the original container disappears and a different container gets renamed to that exact 64-character hex string, docker rm <fullID> matches the unrelated container by exact name!
Before every stop, start, or rm, Obituary runs docker ps to confirm no container's name collides with the target's full ID, refusing to proceed if one does.
Testing against our fake Docker CLI captures every call made during a full add → expire → resurrect cycle, showing the ps collision checks before stop and start plus 9 total inspect calls:

Out-of-lock execution with durable intents
docker stop often waits ten seconds or more for graceful shutdown, so it can never run inside a hook or while holding store.lock. Every mutation follows a three-step protocol:
- Under
store.lock, verify the entry and persist a durable container intent (binding a unique token alongside Docker context, endpoint, andDaemonID). - Release
store.lockand invoke thedockerCLI explicitly against that pinned endpoint; if the daemon ID drifted, refuse. - Reacquire
store.lock, verify the intent token still matches, commit the outcome, and clear the intent.
Crash recovery only observes state rather than blindly replaying destructive commands: a running container is never marked buried, a confirmed removal finishes purge bookkeeping, and an unsent intent clears to retry on schedule. Two days later we tightened session container proposals further to require concrete compose working-directory or project bind-mount evidence—never guessing ownership from timestamp overlap alone.