---
name: mirror-guard-scope-and-excludes
description: "The public-mirror leak guard reads COMMITTED HEAD (not the working tree) and pins only org/repo literals — 'the guard passed' is not 'this belongs in public'; EXCLUDES is applied at mirror time from the running script, so a file can be stripped without re-tagging"
metadata: 
  node_type: memory
  type: project
  originSessionId: 2e95d9a2-6254-43fb-a2fd-119532b97f2b
  modified: 2026-08-04T01:18:25.387Z
---

Three mechanics of `ci/publish/mirror-public.sh`, all learned the hard way on 2026-08-03.

**1. The guard reads COMMITTED HEAD, never the working tree.** A redaction sitting uncommitted does
not clear it — `sh ci/run-gates.sh` keeps failing until you commit. This is the one case where the
"gates green BEFORE the commit" rule cannot hold by construction: the gate's subject IS the commit.
Sequence it as commit → re-run → require green before tagging, and say out loud that you did.

**2. The guard pins ORG AND REPO LITERALS ONLY** (`bigscreenvr`, `claude-spt-bs`, `spt-bs`,
case-insensitive, content + filenames). It knows nothing about peer agent names, incident narrative,
or internal fleet detail. **"The leak guard passed" and "this belongs in public" are different
claims, and only the first is automated.** My `TAG-VERDICT-PLAN.md` would have been the first
root-level plan ever mirrored — it named four peers and carried the whole incident — and the guard
waved it through. Plans belong in EXCLUDES; `docs/plans/MIGRATION-RELEASE-PLAN.md` is the precedent.

**3. The snapshot comes from the TAG's tree (`git read-tree "$REF^{tree}"`), but EXCLUDES is a
literal in the RUNNING script.** So a file already committed inside a published tag can still be
stripped from the mirror by adding it to EXCLUDES and re-running — **no re-tagging, no force-moving a
tag that already has a published release**. That is the clean escape when you notice something at
mirror time.

**Field instance:** the leak that had been failing the gate entered in `593a05d` (2026-07-31) and the
public mirror's last commit predated it by ~57 min. Verified against the mirror's ACTUAL CONTENT
(`gh api …/contents/… --jq .content`, decoded and grepped), not from the timeline alone — nothing
had leaked. The guard had been holding the mirror for three days exactly as designed. A red gate
that blocks publication is the gate working; check what it prevented before treating it as debt.
