On this page
Every rule in this series exists because it was learned the hard way. This capstone is for readers who are already living in the mess — divergent copies, a secret in history, folders reorganized on a whim — and need a way out. It’s the ⚠️ recovery chapter: how to reconcile a messy brain into a single clean authority.
Freeze → choose → reconcile → rebuild. Stop writing everywhere, quarantine every copy read-only, pick one authority, merge in the unique content from the others, then rebuild all projections from the clean source. Do not skip the freeze — reconciling a target that’s still being written to never converges.
The paths here are examples — use your own. /tmp/quarantine, the /path/to/… copies, and the-leaked-secret-value are placeholders; substitute your real copy locations and the actual string you’re purging before running anything.
The four mistakes, and their fixes
Everything below is recovery from one of these — each has a “right from day one” post earlier in the series:
The reconciliation
Make every existing copy read-only so nothing diverges further while you work. You’re taking a snapshot of the mess before untangling it.
# Clone each copy into a read-only quarantine area (never edit these)
for c in laptop-copy cluster-copy old-backup; do
git clone --mirror /path/to/$c /tmp/quarantine/$c.git
done
chmod -R a-w /tmp/quarantine
Pick the most complete copy as the starting authority, then find what exists only in the others so nothing unique is lost.
# Files present in a loser but not the chosen authority
git -C /tmp/quarantine/cluster-copy.git ls-files > /tmp/cluster-files.txt
git -C /tmp/quarantine/laptop-copy.git ls-files > /tmp/laptop-files.txt
comm -23 <(sort /tmp/cluster-files.txt) <(sort /tmp/laptop-files.txt)
# For files in both, diff to see divergent content to merge by hand
git --git-dir=/tmp/quarantine/cluster-copy.git show HEAD:notes/x.md > /tmp/a
git --git-dir=/tmp/quarantine/laptop-copy.git show HEAD:notes/x.md > /tmp/b
diff -u /tmp/a /tmp/b
If a secret was ever committed to the copy you’re keeping, rotate it and purge history with git-filter-repo (the maintainers’ recommended history-rewriting tool) before it becomes your new authority — you don’t want to carry the leak forward.
# 1. Rotate the exposed credential at its source (do this first).
# 2. Purge it from the chosen copy's history:
git filter-repo --replace-text /tmp/replacements.txt
Promote the reconciled copy to the canonical vault, put it behind the controlled-write lock, and rebuild every projection clean from it.
# Rebuild each derived consumer from the new authority, then verify
node scripts/build-topic-map.mjs . --write --date 2026-07-15
verify-projection && verify-index
git -C /path/to/mirror reset --hard origin/master
Keep the read-only quarantine copies until every projection verifies against the new authority and you’ve confirmed no unique content was lost. Then, and only then, delete them. They’re your undo button.
Right from day one beats recovery every time
Reconciliation works, but it’s a day of careful, nerve-wracking work you can skip entirely. Everything in this capstone is the expensive version of a cheap rule adopted early: one authority (post 2), no secrets (post 3), identity over status (post 5), a lock not a sync (post 7). If you’re reading this before the mess — go adopt those. If you’re reading it during the mess — you now have a way out.
The swap-in box
Any Git-based notes: the freeze → choose → reconcile → rebuild order is tool-agnostic; only the commands change. Notion/Confluence tangles: export every space to Markdown first, then treat the exports as the quarantined copies and reconcile in Git where diffing is sane. The universal rule: never reconcile onto a moving target — freeze first, salvage unique content, and rebuild derived views only after a single authority exists.
The series, end to end
You now have the whole arc: why a second brain matters, the vault, secrets discipline, the graph, identity over status, projections, the write lock, AI cold-starts, multi-machine access, local RAG, health checks, and recovery. Build it right from day one and it compounds for years. Build it wrong and this last post gets you back to one clean brain.
Related posts:
- Your Homelab Needs a Second Brain — Here’s Why — where the series (and the rules) begin
- Never Commit a Secret to Your Knowledge Base — the rotate-and-purge step in detail
- Never Move a Note When a Project Ends — the fix for status-based moves
- Why Auto-Syncing Your Notes Repo Will Corrupt It — the write path the rebuilt authority sits behind
- Prove Your Homelab Docs Are Actually Up to Date — verifying the clean rebuild actually landed
Comments
Comments are powered by GitHub Discussions — sign in with a GitHub account to join the conversation.