A week after shipping the alert dedup + auto-resolve layer (commit d9b37fc), the ledger is doing its job: one live incident tracked in alert-state.json instead of ~170 duplicate ๐จ tasks. Today you review how to read it โ and why resolved incidents vanish from it.
Your Today list still shows three '๐จ PDB relay error' tasks and two 'JobHunt weekly sweep FAILED' tasks. That looks like the dedup layer failing โ it isn't. Those are pre-Jul-21 tasks created before the ledger existed, waiting for a one-time manual sweep. Knowing how to tell 'old noise' from 'live incident' is the difference between trusting your alerts and ignoring them.
The ledger (PDB/data/alert-state.json) is a statement of CURRENT reality, not a history log. Each entry is one open incident, keyed by a stable dedup_key like 'jobhunt-sweep'. When the same failure fires again, raise_alert() bumps that entry's count and last_seen instead of creating a second Things task. When the watcher sees recovery, resolve_alert() completes the ๐จ task and deletes the entry entirely.
That deletion is the subtle part. Last week plan-day failed five mornings in a row โ the ledger held a plan-day incident with count climbing to 5. Open the file today and it's not there. That's not data loss; that's the design: the incident closed itself when Jul 27's run came back green. If you want history, it's in git โ the ledger file is committed, so 'git log -p data/alert-state.json' replays every incident's lifecycle.
The fail-safe bias is worth remembering: if the ledger or Things API errors mid-raise, the code falls back to firing a fresh task anyway. The system is allowed to duplicate in a crash; it is never allowed to stay silent. That's why a stray duplicate is a curiosity, not an emergency.
Read the live ledger, then replay the plan-day incident's whole life from git:
cat ~/Claude/PDB/data/alert-state.json | python3 -m json.tool
cd ~/Claude/PDB && git log --oneline -p -- data/alert-state.json | grep -A3 'plan-day'
The ledger describes what is broken right now; git describes what was ever broken. Sweep Things freely โ anything real will re-raise itself.