flag_sweeplisted
Install: claude install-skill jedbjorn/subfloor
# flag_sweep — reconcile flags against state
Planner-owned. Run periodically or when the FnB asks for delivery-state
reconciliation; never make it a boot ritual. Working shells close the flags
their own work clears; this sweep is the
backstop for dropped handoffs + shipped work nobody documented. Two directions:
close what's provably resolved, open what's provably missing.
---
## Step 1: Load the bounded delivery audit
Run `sc mem delivery-audit`. The Planner-only API response contains
`recent_flag_names`, `open_flags`, `implemented_but_unshipped`, and
`shipped_but_undocumented`. It preserves the deterministic queries and dedup
guards below without granting arbitrary engine SQL.
`frozen_docs` counts ANY frozen document on the feature — kind='spec' AND
kind='doc' both qualify, so a fork that freezes its shipped `doc` rows is
never reported as undocumented.
Sort every open flag into exactly one bucket (Step 2 / Step 4). Auto-close
only on unambiguous evidence — any doubt -> Step 4, not a close.
---
## Step 2: Auto-close the deterministic ones
Close with `sc mem flag close <flag_id> --notes "…"`. The note MUST cite the
evidence.
**A. Docs-pending flag, doc now exists** = `[Docs]`-tagged doc-pending flag
(however worded — "doc pending", "docs pending", "feature doc pending") on a
feature with `frozen_docs > 0`:
```
sc mem flag close <flag_id> --notes "Auto: frozen spec doc now exists for feature #<id> (flag_sweep)."
```
**B. Ship-blocker, feature now shipped** = flag o