flag_sweeplisted
Install: claude install-skill jedbjorn/subfloor
# flag_sweep — reconcile flags against state
Admin-only. Leg 1 of the standing every-session pass -> then `git_cleanup` ->
then optional `local_skill_management`. Working shells close the flags their
own work clears (boot doc, "Finish before you stop"); this sweep is the
backstop for the stragglers they dropped + the docs nobody opened a flag for.
Two directions: close what's provably resolved, open what's provably missing.
`<self>` = your shell_id. Resolve the planner once up front:
```sql
SELECT shortname FROM shells WHERE flavor='planner' AND COALESCE(is_deleted,0)=0;
-- no planner in this fork → surface to the FnB instead of messaging.
```
---
## Step 1: Load the open flags with their state
```sql
SELECT f.flag_id, f.display_name, f.priority, f.description,
f.feature_id, r.title AS feature, r.roadmap_status,
(SELECT COUNT(*) FROM documents d
WHERE d.feature_id = f.feature_id AND d.frozen=1) AS frozen_docs
FROM flags f
LEFT JOIN roadmap r ON r.feature_id = f.feature_id
WHERE f.resolved=0 AND COALESCE(f.is_deleted,0)=0
ORDER BY f.priority, f.flag_id;
```
`frozen_docs` counts ANY frozen document on the feature — kind='spec' AND
kind='doc' both qualify (#319: forks that freeze kind='doc' rows for shipped
docs got false "undocumented" positives every sweep under a spec-only count).
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