fix(claude-memory-backup): make the no-op detectable - #17
Merged
Conversation
Installed on norm's box 2026-07-03 and did nothing for a month. `~/.dotfiles-work`
was never cloned there, so the repo check hit `|| exit 0` and returned success every
day. 86 memory files sat unbacked-up behind a backup job reporting nothing wrong —
"no repo on this machine" and "backed up fine" produced byte-identical output: none.
No-opping without the private repo is correct and unchanged. Being undetectable about
it is the bug. Three of the four exit paths were silent failures; the fourth (nothing
changed) is legitimate but went unrecorded, so the status could not distinguish
"ran, no diff" from "has not run in weeks".
Now every path writes an outcome to
${XDG_STATE_HOME:-$HOME/.local/state}/claude-memory-backup.status, and the three
meaning "you have no backup" also write stderr so launchd captures them. Success
reports the file count.
Verified all four paths against fixtures (no-repo / happy / unchanged / no-source):
loud where it should be, silent where it should be, exit 0 throughout, and the
working path still mirrors and pushes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI caught this; I had shipped the file saying shellcheck was unverified, and it was. `cd "$WORK" && git pull … || true` is pre-existing, but shellcheck is right that it is a latent bug and not just style: in `A && B || C` the `|| true` swallows a failed `cd` as well as a failed pull. With `set -eu` a bare `cd` aborts on failure, which is what we want — mirroring into the wrong directory is worse than not mirroring. Only the pull is allowed to fail (another machine may have pushed, or we may be offline). Verified with the real shellcheck 0.11.0 binary this time. The mise *shim* refuses to run inside this repo (mise.toml untrusted) and returns exit 1, which reads exactly like a finding — invoked the binary directly instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
claude-memory-backuphas been installed on norm's box since 2026-07-03 and has done nothing the entire time.~/.dotfiles-workwas never cloned there, so the repo check hit|| exit 0and returned success every day. 86 memory files, no backup, behind a backup job reporting nothing wrong — "no repo on this machine" and "backed up fine" produced byte-identical output: none.No-opping without the private repo is correct and unchanged. Being undetectable about it is the bug.
Three of the four exit paths were silent failures. The fourth (nothing changed) is legitimate, but went unrecorded — so the status couldn't distinguish "ran, no diff" from "hasn't run in weeks".
Now: every path writes an outcome to
${XDG_STATE_HOME:-$HOME/.local/state}/claude-memory-backup.status, and the three that mean you have no backup also write stderr so launchd captures them. Success reports the file count.Verified against fixtures — all four paths
SKIPPED no-clone:… - NOTHING WAS BACKED UPOK 2 files at 0ab8748UNCHANGED 2 files mirrored, no diffSKIPPED no-source:… - NOTHING WAS BACKED UPThe working path still mirrors, commits and pushes — regression-checked against a real local remote, not just read.
sh -nclean. shellcheck unavailable on this box (no mise version pinned), so that's unverified.Not fixed here
This makes the failure visible; it doesn't back anything up. Norm's 86 memory files still have no off-box copy until
~/.dotfiles-workis cloned on that machine — which is yours to decide, since it's a private repo and an agent box would be pushing to it.🤖 Generated with Claude Code