[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758HNTM42PCPP5J3MBM0413":3,"skill-same:01M758HNTM42PCPP5J3MBM0413":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M758HNTM42PCPP5J3MBM0413","sweep-verification",null,"Verify a decommission sweep removed every file and ref.","lukemcqueen\u002Fsteadfaste-fleet","lukemcqueen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F405240?v=4","01M757MHPAGRXTJAT46SKZP98R","Luke McQueen","01M757MHPZ573KP8DT9GB8SBQ7",4,"MIT","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsweep-verification\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: sweep-verification\nversion: 1.0.0\ncategory: devops\ndescription: \"Verify a decommission sweep removed every file and ref.\"\nauthor: Esther\nlicense: MIT\nplatforms: [linux, macos]\n---\n\n# Sweep Verification — proving a removal is COMPLETE\n\nUse when asked to \"double check \u002F make sure X is completely removed\" after a\nrename or decommission sweep (legacy-brain → mycortex, service renames).\nPerforming the sweep is `rename-sweep`'s job; THIS skill is\nthe independent verification pass that finds the leftovers the sweep missed.\n\n## Read the migration's own follow-up doc FIRST\n\nA completed fleet rename (hermes-cortex → steadfaste-fleet, legacy → mycortex)\nships two docs that define what \"done\" means: `docs\u002Frename-followups-\u003Cnew>.md`\n(the repo-side exclusion list — which skill dirs were kept as load keys, the\nenforcer's dual-URL accept list, the migration tools that must keep the old\nname literal, the historical\u002Fevidence records) and a per-host completion runbook\nunder `docs\u002Frunbooks\u002F` (e.g. `fleet-local-dir-rename.md`) that lists the live\nrepoint steps (hooks + `core.hooksPath`, cron-bridge units, systemd\u002Flaunchd unit\npaths, stale deployed scripts, root-owned copies) and what is deliberately kept\non the host. Read both BEFORE grepping: a verification pass that starts with\n`grep -r \u003Ctoken>` files hundreds of hits that are NOT leftovers — the old token\nsurviving in the repo is expected, and only what these docs do NOT exempt is\nstale. Find them with `git log --oneline -20 | grep -i rename` before trusting a\nraw count. The two are different scopes: the follow-up records what the SWEEP\nkept in the repo; the runbook is the per-HOST completion check, so a clean repo\ncan still be an un-migrated host with load-bearing transition symlinks.\n\n## Surface checklist — sweep ALL of these, in this order\n\n1. **Repo tracked content**: `git grep -il \u003Ctoken> -- .` (count + list)\n2. **Repo tracked file NAMES**: `git ls-files | grep -i \u003Ctoken>`\n3. **Repo worktree** (incl. untracked): `grep -rli` excluding `.git\u002F__pycache__\u002F.venv\u002Fnode_modules`, plus `find . -iname '*\u003Ctoken>*'`\n4. **Deployed tree** `~\u002F.steadfaste-fleet`: grep excluding logs\u002F__pycache__\u002Fbackups. Deploy never prunes → stale files linger here (see pitfall 1)\n5. **~\u002F.hermes live config**: `cron\u002Fjobs.json` (0 expected), `cron\u002Fscripts`, `plugins\u002F`, `config.yaml`, `memories\u002F`, `repos.yaml` (a repo-rename leaves the OLD path here even after the code is swept), `SOUL.md`, `AGENTS.md`, `skills\u002F` (deployed copies), **`agent-profiles\u002F*\u002FSOUL.md`** (profile templates seed other hosts' SOULs — a stale ref here ships to the fleet). A transition symlink at the old home keeps these resolving, so a running host is NOT proof they were repointed — grep each surface explicitly.\n6. **~\u002F.hermes historical** (count, do NOT delete): logs, `sessions\u002F`, `state-snapshots\u002F`, `cron\u002Foutput\u002F` (old run records)\n7. **~\u002F.steadfaste-fleet\u002Fdata + state**: `loop-events\u002F*.jsonl`, `loop-governance.db` (audit trail — task IDs legitimately mention the token), `state\u002F` (dead state files with old keys, e.g. agent-health-data.json — check readers before deleting). Two classes here are keyed by the REPO NAME in the FILENAME, so a content grep never sees them — count both spellings explicitly: `.reviewed-\u003Crepo_slug>-\u003Csha>.json` (per-blob review receipts) and `.session-\u003Crepo_slug>.id` (session-id stamp). See pitfall 15.\n8. **~\u002Fbrain**: lesson files (historical knowledge — keep)\n9. **Tasks DB**: `SELECT ... WHERE content ILIKE '%\u003Ctoken>%' AND status IN ('pending','in_progress')` (active rows should be 0)\n10. **Bus archives** (primary host): count of subjects\u002Fbodies mentioning token (historical messages — keep)\n11. **Ignore rules and VCS config**: `grep -n \u003Ctoken> .gitignore` plus `.git\u002Finfo\u002Fexclude`\n    and any tracked ignore file. A rule matching a path you REMOVED is itself a leftover\n    reference, and a worse one than the others — see pitfall 10.\n\n## Classification — the load-bearing rule\n\nEvery hit is one of three buckets; treat them differently:\n\n| Bucket | Examples | Action |\n|---|---|---|\n| **LIVE** | deployed scripts, cron, config, SOUL profiles, registry\u002Fhealth-vector keys, stale deployed files, dead state files | **Fix\u002Fremove now** |\n| **HISTORICAL** | brain lessons, dated skill event records, logs, session dumps, backups (dumps, deploy-backups, scripts-unique-backup-*), loop audit trail, bus archives, curator metadata | **Keep — deleting destroys the fleet's record** (the file itself may even say \"it IS the record\") |\n| **CREDENTIAL** | `.env` values whose NAME contains the token (e.g. `FLEET_BUS_PG_PASS=\u003Clegacy>_pg_pass`) | **Flag only — never touch a live credential mid-task**; rotation is a deliberate multi-host change |\n\nThe audit's own files classify stale refs as \"historical doc\u002Flog\u002Fskill text →\nleave as-is (it IS the record)\". Deleting history to reach zero violates the\nkeep-logs precedent and permanently destroys knowledge that exists nowhere\nelse (many such files are deployed-only, never in git).\n\n## Pitfalls\n\n**`git add -A` does NOT mean the file was added.** `*.log` is in `.gitignore`, so\na \"committed execution log\" was silently skipped and a commit message claimed a\nfile that did not exist — the audit caught it, not the author. Any sweep or\nevidence artifact must confirm tracking from the tree, not from intent:\n`git ls-tree --name-only HEAD \u003Cdir>` (or `git diff --cached --name-only` before\ncommitting). Prefer the repo's existing artifact extension (`.txt` here) and check\n`git check-ignore -v \u003Cpath>` when a file mysteriously does not stage. (all hit in real sweeps)\n\n1. **Deploy registers but NEVER prunes.** Files removed from the repo stay\n   deployed forever: `~\u002F.steadfaste-fleet\u002Fservices\u002Fmycortex\u002Fimport-\u003Clegacy>.py`,\n   stale skill `references\u002F*.md`, old `__pycache__\u002F*.pyc`. Find them with\n   `comm -13 \u003C(ls repo-dir | sort) \u003C(ls deployed-dir | sort)` — deployed-only\n   extras are stale unless proven otherwise. Delete stale deployed files even\n   though git status stays clean.\n   - **Deleting a file without deleting its `register()` line is a doctor FAIL**\n     (`Deploy source missing`). After the sweep, assert every registration still points\n     at a real file: parse the `^register(?:_orch)?\\s+\"\u003Csource>\"\\s+\"\u003Cdest>\"` lines from\n     `ops\u002Fscripts\u002Ffleet-update.sh` and stat each source path. One missing source means\n     either a leftover line to drop or a file to restore — never leave it standing, and\n     re-run the doctor (it exits FAIL, so the push is blocked too).\n   - **Deployed SKILLS are preserved, not pruned.** A skill deleted from the repo stays\n     deployed, and the next deploy reports it as a stale \"deployed-only skill\" instead of\n     deleting it (the deploy cannot tell an orphan from a local skill someone depends on).\n     The explicit cleanup must remove the deployed skill directory as well, or the\n     warning — and the doctor's stale-skill WARN — reappears on every run.\n1b. **Removing the artifact is not removing the FEATURE — revert the key that\n   selects it.** A component wired by config (e.g. `cron.provider: \u003Cplugin>`) keeps\n   pointing at something that no longer exists once its directory is deleted: the\n   consumer falls back to its built-in default but logs a warning on every tick, and\n   the user reads that warning as \"that thing is still causing issues\". Grep\n   `~\u002F.hermes\u002Fconfig.yaml` for the component name and drop the selecting keys\n   (provider + its sub-blocks) in the same sweep.\n1c. **Consumers are part of the sweep.** A component usually outlives itself in its\n   readers — a watchdog that queries its DB, a report script that imports it, a cron\n   manifest entry, an installer that re-creates it, a doctor check that asserts on it.\n   Grep the repo for the artifact names and fix every consumer in the same pass; one\n   left behind keeps firing (or re-creates the artifact at the next deploy), which is\n   how a \"removed\" feature generates fresh alerts.\n7. **The deletion set comes from a grep, not from memory.** Enumerate the names across\n   the repo (`grep -rl`) AND the deployed tree first, then check dependents\n   (`~\u002F.hermes\u002Fcron\u002Fjobs.json`, `ops\u002Finstall\u002Fcron-manifest.yaml`, installers, doctor\n   checks, tests) before removing anything. Report the surviving mentions explicitly\n   (dated reports, advisory docs) so the user can decide on those rather than\ndiscovering them in a later grep.\n8. **A destructive sweep is one APPROVED step, and consent is per-command.** A compound\n   `git rm` of many paths (or one `rm -rf` over several artifact dirs) can trip the\n   approval gate; if that prompt times out, NOTHING ran — do not retry it, do not reword\n   it, do not reach the same outcome another way. Report the exact removal set plus the\n   edit sites, and wait for an explicit go. Confirm the tree is untouched\n   (`git status --porcelain`) so \"nothing ran\" is evidence rather than assumption.\n9. **Do not hold a governance lock while you wait on the user.** A decommission spanning\n   turns leaves the cycle's lock held, which blocks every peer session from taking one.\n   Score the cycle you have (a low completeness score and a factual \"inventory only,\n   blocked on consent, no files changed\" note is honest and correct), release it, and\n   take a fresh lock for the actual removal.\n10. **Removing a path but KEEPING its ignore rule makes its return invisible.** When a\n   directory is deleted by design, delete the `.gitignore` rules matching it in the SAME\n   sweep. While those rules remain, the directory can reappear and `git status` stays\n   clean — so the recurrence you are verifying absence of is the one thing the ignore\n   rule conceals, and the sweep reports \"clean\" over a directory that is back. Leave a\n   one-line comment where the rules were, saying they were removed on purpose, so a\n   future reader does not helpfully restore them. **Name directories by their FULL path\n   when reporting**: a runtime directory and a same-named directory inside the repo\n   differ by one leading dot, so \"the directory came back\" without the path reads as a\n   claim about the runtime copy — which is correct and expected — and alarms the reader\n   for no reason.\n\n   **A removed directory can survive as an EMPTY SHELL — verify with `find`, not `git\n   status`.** `git rm -r` deletes TRACKED files only, so a directory still holding an\n   untracked file (a lock, a log, a state file) is left standing, and the worktree\n   reports clean because the remainder is untracked — and if an ignore rule is also\n   still in place, invisible on top of that. Confirm the removal with an explicit\n   existence check after the sweep (`test -e \u003Cpath>`, or the `search_files` tool with\n   `target='files'`); a clean `git status` is not evidence the directory is\n   gone. This is also why \"it reappeared\" can be the wrong diagnosis: a directory the\n   sweep never actually emptied reads exactly like a directory something recreated.\n\n   **Never wrap the removal in `try: rmdir(d) except OSError: pass`.** That construction\n   swallows precisely the partial removal above: the loop finishes, the report says\n   removed, and the directory is still there. Report what was removed from a POST-STATE\n   check, never from the loop having run to completion.\n\n   **Give the removal a check that FAILS on its return.** A one-off deletion is a\n   snapshot; absence that nothing asserts is absence only until the next process\n   recreates it. Add a check — doctor or CI — that PASSes when the path is absent and\n   FAILs naming the offending entries when it is present (including whether the\n   state\u002Fgovernance file inside it is back), and prove the check CAN fail by driving it\n   against a temp fixture in every state. Then the recurrence reports itself instead of\n   waiting for a hand audit.\n2. **Guard tests must self-exclude.** A `test_no_\u003Ctoken>_refs` test that runs\n   `git grep -il \u003Ctoken>` fails on its OWN source. Fix:\n   `git grep -il \u003Ctoken> -- . ':(exclude)tests\u002F\u003Cguard-file>.py'`.\n3. **Stale state files carry old keys.** Dead state JSON (mtime weeks old, no\n   readers) can still hold old service keys. Verify no reader\n   (`grep -rln \"\u003Cname>\" scripts\u002F`) before deleting.\n4. **Profile copies seed the fleet.** `~\u002F.hermes\u002Fagent-profiles\u002F\u003Cagent>\u002FSOUL.md`\n   is a template merged into that agent's SOUL — a stale ref there reaches\n   another host. Check ALL profiles, not just your own.\n5. **Post-sweep, retrieval goldens drift.** A mass content rewrite changes FTS\n   ranking: parity\u002Fknown-answer fixtures fail on ranking (expected docs still\n   exist; new top hits are relevant). Refresh the stale golden with evidence\n   and a note — it's drift from an intentional change, not a regression.\n6. **Validation tests exercise the DEPLOYED copy.** L2 fleet tests\n   (test-task-fleet.sh, test-mycortex-schema.sh) run against\n   `~\u002F.steadfaste-fleet\u002Fscripts\u002F`, not the repo. Unit tests pass against repo\n   source while L2 fails → the fix isn't deployed. Run `fleet-update.sh`\n   (ops\u002Fscripts\u002F) before L2, then re-run.\n12. **A deployed file's frozen `# SOURCE:` header is the stale-file fingerprint.**\n    Deployed `.py`\u002F`.sh` carry a generated `# SOURCE: \u003Crepo-path>` header from the\n    deploy that wrote them; when that header names a path absent from the current\n    repo, the deployed copy is a leftover (deploy never prunes it) whose body still\n    carries the OLD name while the codebase moved on. Before deleting, find the\n    artifact's CURRENT home — the component often moved within the repo\n    (`ops\u002Fservices\u002Fagent-bus\u002Fserver.py` → `core\u002Ffleet_bus\u002Fserver.py`, repo-served\n    and already clean). A deployed file whose source is gone AND that is not\n    registered in the deploy map is stale and removable.\n13. **A stale WORKTREE survives under the old name as a `.git` FILE, not a\n    directory.** A linked worktree's `.git` is a one-line file reading\n    `gitdir: \u003Cpath>`, so `.git\u002Fconfig` is not found there and repo content-greps\n    never see it — its tree predates the sweep and was never touched. Inspect that\n    pointer (its gitdir may resolve through the transition symlink) and remove it\n    with `git worktree remove \u003Cdir>`; do this BEFORE removing the transition\n    symlink the pointer rides on.\n14. **Transition symlinks mask live config that was never repointed — running\n    services are not proof of completion.** A symlink at the old location keeps\n    `~\u002Fold-name` resolving, so the host works while a live surface still loads the\n    old path. \"Fully migrated\" is false until EVERY live surface is repointed, not\n    just the code: enumerate them (`repos.yaml`, `config.yaml`, `gateway.yaml`,\n    `agent.env`, `cron\u002Fjobs.json`, shell rc, root-owned copies) and grep each for\n    the token; only when they are empty are the symlinks genuinely removable\n    (`rm -f ~\u002Fold ~\u002F.old`).\n    **`git remote -v` is write-class under the governance classifier** — the\n    lock-free read allowlist is `ls, cat, grep, find, git status\u002Flog\u002Fdiff`, and\n    `git remote` is not in it. When verifying a repo's origin was repointed, read\n    `.git\u002Fconfig` via `read_file` instead of opening a lock for a read.\n    15. **Repo-name-keyed state files are a stale class of their own — sweep them when the\n    repo is renamed.** A rename leaves behind state files whose NAME embeds the old repo\n    slug, not just files whose CONTENT mentions it: the per-blob review-receipt caches\n    (`.reviewed-\u003Crepo_slug>-\u003Csha>.json`, written as `REVIEW_RECEIPT_PREFIX + slug + \"-\" +\n    sha`) and the session-id stamp (`.session-\u003Crepo_slug>.id`). Once the slug changes,\n    nothing reads the old-keyed set, so it survives every deploy forever and a content\n    grep reports clean. Count BOTH spellings side by side (`ls -1 .reviewed-\u003Cold>-*.json |\n    wc -l` beside the new one), delete only the old-keyed set, and confirm the new count\n    is unchanged afterwards. These are a CACHE, not the ledger — the audit trail is the\n    governance DB — so removing them loses no record.\n    16. **A finished rename can be re-reddened by a LATER content backport — run the\n    migration's own lint during verification and attribute the failure with `git log`.**\n    A skill or lesson backported into the repo AFTER the sweep can reintroduce the retired\n    token and turn the brand lint red while every host surface stays clean, so a green\n    original sweep is not permanent. Run the lint (`bash tests\u002Ftest_fleet_cli_brand.sh`)\n    as part of the pass, and find the introducing commit with `git log --diff-filter=A\n    --oneline -- \u003Cflagged file>` before blaming the sweep. A lint that is not wired into\n    the doctor or the hooks blocks nothing — report it as a finding with the one action\n    that clears it, rather than letting a red gate read as a broken host.\n    17. **A residue lint and a skill that TEACHES the sweep legitimately conflict — report\n    the ONE action that clears it; never re-scope a gate unilaterally.** A lint that\n    greps `skills\u002F` for the retired token flags the methodology reference whose worked\n    example uses that token (`old → new` mappings, shell and regex samples), even though\n    the sweep's own rule says such files stay out of the residue grep. Two fixes exist —\n    generalize the sample tokens to the documented family notation, or exempt the\n    reference by path — and choosing between them is a gate-scoping judgement for the\n    operator. Token-class fact to use when proposing the doc fix: a wildcard family form\n    (`PREFIX_*`) does NOT match a lint pattern shaped `PREFIX_[A-Z0-9_]+`, because `*` is\n    outside that class — and the fleet's authoritative docs already write a retired\n    family that way.\n    18. **A migration's own \"converged when the token count is 0\" criterion can be\n    over-broad — classify every hit before chasing zero.** The follow-ups doc may state\n    convergence as a blind grep (`git grep -i \"\u003Cold brand>\"` == 0 outside historical\n    dirs), but proposal\u002Fdesign docs and dated records legitimately quote the old brand as\n    the CLI or story they once described. Bucket every hit (record vs live instruction),\n    report the live ones, and name the surfaces you did not reach — a doc that merely sits\n    outside `docs\u002Folder|evidence` is not automatically live.\n    19. **A deployed-only entry is not automatically stale — separate \"orphan\" from \"repo\n    gap\".** The deploy never prunes, so a repo-vs-deployed dir diff lists extras; most are\n    real leftovers, but a deployed-only SKILL can be a LIVE capability whose repo source\n    is absent (created on the host, or stranded when its repo copy was moved). Confirm the\n    artifact is still loaded before removing it, and recover instead of deleting —\n    `ops\u002Fscripts\u002Fmanage\u002Freconcile-stranded-skills.py` (report first) copies pure supersets\n    back into the repo as its own governed change.\n\n    ## Steps\n\n1. Begin governance cycle (terminal needs a lock).\n2. Run the surface checklist (batch greps; count AND list).\n3. Fix\u002Fremove every LIVE hit; leave HISTORICAL; flag CREDENTIAL in the report.\n4. Re-verify: re-run the live-surface greps → 0.\n5. Run the guard test (`pytest tests\u002Ftest_repo_structure.py -q`) + full suite.\n5b. Run the migration's own consistency lint (`bash tests\u002Ftest_fleet_cli_brand.sh`) and\n   the doctor (`fleet-doctor.py --quiet`) — record the pass\u002Fwarn\u002Ffail counts and the exit\n   code, not just the ✅ lines. A red lint on a freshly-swept tree is usually a LATER\n   backport (pitfall 16); a red doctor FAIL is real drift that must be fixed in-cycle.\n6. Post-sweep validation: run the component's own battery (e.g. mycortex:\n   CLI doctor, sources\u002Fstats, schema battery, crons, parity fixture, doctor\n   Deploy+Repo sync) to prove the component still works after the purge. When the\n   sweep removed config, exercise the path that REPLACED it — e.g. after deleting a\n   cron provider, run the scheduling surface (`hermes cron list`) and confirm no\n   fallback warning, which is the only proof the default is really in charge.\n7. Report: verified-clean surfaces, what was removed, what was kept (counts),\n   flagged items. Score + close cycle.\n\nSession detail (legacy-brain sweep, 2026-08-21): `references\u002Flegacy-brain-sweep-2026-08-21.md`\n","# Sweep Verification — proving a removal is COMPLETE\n\nUse when asked to \"double check \u002F make sure X is completely removed\" after a\nrename or decommission sweep (legacy-brain → mycortex, service renames).\nPerforming the sweep is `rename-sweep`'s job; THIS skill is\nthe independent verification pass that finds the leftovers the sweep missed.\n\n## Read the migration's own follow-up doc FIRST\n\nA completed fleet rename (hermes-cortex → steadfaste-fleet, legacy → mycortex)\nships two docs that define what \"done\" means: `docs\u002Frename-followups-\u003Cnew>.md`\n(the repo-side exclusion list — which skill dirs were kept as load keys, the\nenforcer's dual-URL accept list, the migration tools that must keep the old\nname literal, the historical\u002Fevidence records) and a per-host completion runbook\nunder `docs\u002Frunbooks\u002F` (e.g. `fleet-local-dir-rename.md`) that lists the live\nrepoint steps (hooks + `core.hooksPath`, cron-bridge units, systemd\u002Flaunchd unit\npaths, stale deployed scripts, root-owned copies) and what is deliberately kept\non the host. Read both BEFORE grepping: a verification pass that starts with\n`grep -r \u003Ctoken>` files hundreds of hits that are NOT leftovers — the old token\nsurviving in the repo is expected, and only what these docs do NOT exempt is\nstale. Find them with `git log --oneline -20 | grep -i rename` before trusting a\nraw count. The two are different scopes: the follow-up records what the SWEEP\nkept in the repo; the runbook is the per-HOST completion check, so a clean repo\ncan still be an un-migrated host with load-bearing transition symlinks.\n\n## Surface checklist — sweep ALL of these, in this order\n\n1. **Repo tracked content**: `git grep -il \u003Ctoken> -- .` (count + list)\n2. **Repo tracked file NAMES**: `git ls-files | grep -i \u003Ctoken>`\n3. **Repo worktree** (incl. untracked): `grep -rli` excluding `.git\u002F__pycache__\u002F.venv\u002Fnode_modules`, plus `find . -iname '*\u003Ctoken>*'`\n4. **Deployed tree** `~\u002F.steadfaste-fleet`: grep excluding logs\u002F__pycache__\u002Fbackups. Deploy never prunes → stale files linger here (see pitfall 1)\n5. **~\u002F.hermes live config**: `cron\u002Fjobs.json` (0 expected), `cron\u002Fscripts`, `plugins\u002F`, `config.yaml`, `memories\u002F`, `repos.yaml` (a repo-rename leaves the OLD path here even after the code is swept), `SOUL.md`, `AGENTS.md`, `skills\u002F` (deployed copies), **`agent-profiles\u002F*\u002FSOUL.md`** (profile templates seed other hosts' SOULs — a stale ref here ships to the fleet). A transition symlink at the old home keeps these resolving, so a running host is NOT proof they were repointed — grep each surface explicitly.\n6. **~\u002F.hermes historical** (count, do NOT delete): logs, `sessions\u002F`, `state-snapshots\u002F`, `cron\u002Foutput\u002F` (old run records)\n7. **~\u002F.steadfaste-fleet\u002Fdata + state**: `loop-events\u002F*.jsonl`, `loop-governance.db` (audit trail — task IDs legitimately mention the token), `state\u002F` (dead state files with old keys, e.g. agent-health-data.json — check readers before deleting). Two classes here are keyed by the REPO NAME in the FILENAME, so a content grep never sees them — count both spellings explicitly: `.reviewed-\u003Crepo_slug>-\u003Csha>.json` (per-blob review receipts) and `.session-\u003Crepo_slug>.id` (session-id stamp). See pitfall 15.\n8. **~\u002Fbrain**: lesson files (historical knowledge — keep)\n9. **Tasks DB**: `SELECT ... WHERE content ILIKE '%\u003Ctoken>%' AND status IN ('pending','in_progress')` (active rows should be 0)\n10. **Bus archives** (primary host): count of subjects\u002Fbodies mentioning token (historical messages — keep)\n11. **Ignore rules and VCS config**: `grep -n \u003Ctoken> .gitignore` plus `.git\u002Finfo\u002Fexclude`\n    and any tracked ignore file. A rule matching a path you REMOVED is itself a leftover\n    reference, and a worse one than the others — see pitfall 10.\n\n## Classification — the load-bearing rule\n\nEvery hit is one of three buckets; treat them differently:\n\n| Bucket | Examples | Action |\n|---|---|---|\n| **LIVE** | deployed scripts, cron, config, SOUL profiles, registry\u002Fhealth-vector keys, stale deployed files, dead state files | **Fix\u002Fremove now** |\n| **HISTORICAL** | brain lessons, dated skill event records, logs, session dumps, backups (dumps, deploy-backups, scripts-unique-backup-*), loop audit trail, bus archives, curator metadata | **Keep — deleting destroys the fleet's record** (the file itself may even say \"it IS the record\") |\n| **CREDENTIAL** | `.env` values whose NAME contains the token (e.g. `FLEET_BUS_PG_PASS=\u003Clegacy>_pg_pass`) | **Flag only — never touch a live credential mid-task**; rotation is a deliberate multi-host change |\n\nThe audit's own files classify stale refs as \"historical doc\u002Flog\u002Fskill text →\nleave as-is (it IS the record)\". Deleting history to reach zero violates the\nkeep-logs precedent and permanently destroys knowledge that exists nowhere\nelse (many such files are deployed-only, never in git).\n\n## Pitfalls\n\n**`git add -A` does NOT mean the file was added.** `*.log` is in `.gitignore`, so\na \"committed execution log\" was silently skipped and a commit message claimed a\nfile that did not exist — the audit caught it, not the author. Any sweep or\nevidence artifact must confirm tracking from the tree, not from intent:\n`git ls-tree --name-only HEAD \u003Cdir>` (or `git diff --cached --name-only` before\ncommitting). Prefer the repo's existing artifact extension (`.txt` here) and check\n`git check-ignore -v \u003Cpath>` when a file mysteriously does not stage. (all hit in real sweeps)\n\n1. **Deploy registers but NEVER prunes.** Files removed from the repo stay\n   deployed forever: `~\u002F.steadfaste-fleet\u002Fservices\u002Fmycortex\u002Fimport-\u003Clegacy>.py`,\n   stale skill `references\u002F*.md`, old `__pycache__\u002F*.pyc`. Find them with\n   `comm -13 \u003C(ls repo-dir | sort) \u003C(ls deployed-dir | sort)` — deployed-only\n   extras are stale unless proven otherwise. Delete stale deployed files even\n   though git status stays clean.\n   - **Deleting a file without deleting its `register()` line is a doctor FAIL**\n     (`Deploy source missing`). After the sweep, assert every registration still points\n     at a real file: parse the `^register(?:_orch)?\\s+\"\u003Csource>\"\\s+\"\u003Cdest>\"` lines from\n     `ops\u002Fscripts\u002Ffleet-update.sh` and stat each source path. One missing source means\n     either a leftover line to drop or a file to restore — never leave it standing, and\n     re-run the doctor (it exits FAIL, so the push is blocked too).\n   - **Deployed SKILLS are preserved, not pruned.** A skill deleted from the repo stays\n     deployed, and the next deploy reports it as a stale \"deployed-only skill\" instead of\n     deleting it (the deploy cannot tell an orphan from a local skill someone depends on).\n     The explicit cleanup must remove the deployed skill directory as well, or the\n     warning — and the doctor's stale-skill WARN — reappears on every run.\n1b. **Removing the artifact is not removing the FEATURE — revert the key that\n   selects it.** A component wired by config (e.g. `cron.provider: \u003Cplugin>`) keeps\n   pointing at something that no longer exists once its directory is deleted: the\n   consumer falls back to its built-in default but logs a warning on every tick, and\n   the user reads that warning as \"that thing is still causing issues\". Grep\n   `~\u002F.hermes\u002Fconfig.yaml` for the component name and drop the selecting keys\n   (provider + its sub-blocks) in the same sweep.\n1c. **Consumers are part of the sweep.** A component usually outlives itself in its\n   readers — a watchdog that queries its DB, a report script that imports it, a cron\n   manifest entry, an installer that re-creates it, a doctor check that asserts on it.\n   Grep the repo for the artifact names and fix every consumer in the same pass; one\n   left behind keeps firing (or re-creates the artifact at the next deploy), which is\n   how a \"removed\" feature generates fresh alerts.\n7. **The deletion set comes from a grep, not from memory.** Enumerate the names across\n   the repo (`grep -rl`) AND the deployed tree first, then check dependents\n   (`~\u002F.hermes\u002Fcron\u002Fjobs.json`, `ops\u002Finstall\u002Fcron-manifest.yaml`, installers, doctor\n   checks, tests) before removing anything. Report the surviving mentions explicitly\n   (dated reports, advisory docs) so the user can decide on those rather than\ndiscovering them in a later grep.\n8. **A destructive sweep is one APPROVED step, and consent is per-command.** A compound\n   `git rm` of many paths (or one `rm -rf` over several artifact dirs) can trip the\n   approval gate; if that prompt times out, NOTHING ran — do not retry it, do not reword\n   it, do not reach the same outcome another way. Report the exact removal set plus the\n   edit sites, and wait for an explicit go. Confirm the tree is untouched\n   (`git status --porcelain`) so \"nothing ran\" is evidence rather than assumption.\n9. **Do not hold a governance lock while you wait on the user.** A decommission spanning\n   turns leaves the cycle's lock held, which blocks every peer session from taking one.\n   Score the cycle you have (a low completeness score and a factual \"inventory only,\n   blocked on consent, no files changed\" note is honest and correct), release it, and\n   take a fresh lock for the actual removal.\n10. **Removing a path but KEEPING its ignore rule makes its return invisible.** When a\n   directory is deleted by design, delete the `.gitignore` rules matching it in the SAME\n   sweep. While those rules remain, the directory can reappear and `git status` stays\n   clean — so the recurrence you are verifying absence of is the one thing the ignore\n   rule conceals, and the sweep reports \"clean\" over a directory that is back. Leave a\n   one-line comment where the rules were, saying they were removed on purpose, so a\n   future reader does not helpfully restore them. **Name directories by their FULL path\n   when reporting**: a runtime directory and a same-named directory inside the repo\n   differ by one leading dot, so \"the directory came back\" without the path reads as a\n   claim about the runtime copy — which is correct and expected — and alarms the reader\n   for no reason.\n\n   **A removed directory can survive as an EMPTY SHELL — verify with `find`, not `git\n   status`.** `git rm -r` deletes TRACKED files only, so a directory still holding an\n   untracked file (a lock, a log, a state file) is left standing, and the worktree\n   reports clean because the remainder is untracked — and if an ignore rule is also\n   still in place, invisible on top of that. Confirm the removal with an explicit\n   existence check after the sweep (`test -e \u003Cpath>`, or the `search_files` tool with\n   `target='files'`); a clean `git status` is not evidence the directory is\n   gone. This is also why \"it reappeared\" can be the wrong diagnosis: a directory the\n   sweep never actually emptied reads exactly like a directory something recreated.\n\n   **Never wrap the removal in `try: rmdir(d) except OSError: pass`.** That construction\n   swallows precisely the partial removal above: the loop finishes, the report says\n   removed, and the directory is still there. Report what was removed from a POST-STATE\n   check, never from the loop having run to completion.\n\n   **Give the removal a check that FAILS on its return.** A one-off deletion is a\n   snapshot; absence that nothing asserts is absence only until the next process\n   recreates it. Add a check — doctor or CI — that PASSes when the path is absent and\n   FAILs naming the offending entries when it is present (including whether the\n   state\u002Fgovernance file inside it is back), and prove the check CAN fail by driving it\n   against a temp fixture in every state. Then the recurrence reports itself instead of\n   waiting for a hand audit.\n2. **Guard tests must self-exclude.** A `test_no_\u003Ctoken>_refs` test that runs\n   `git grep -il \u003Ctoken>` fails on its OWN source. Fix:\n   `git grep -il \u003Ctoken> -- . ':(exclude)tests\u002F\u003Cguard-file>.py'`.\n3. **Stale state files carry old keys.** Dead state JSON (mtime weeks old, no\n   readers) can still hold old service keys. Verify no reader\n   (`grep -rln \"\u003Cname>\" scripts\u002F`) before deleting.\n4. **Profile copies seed the fleet.** `~\u002F.hermes\u002Fagent-profiles\u002F\u003Cagent>\u002FSOUL.md`\n   is a template merged into that agent's SOUL — a stale ref there reaches\n   another host. Check ALL profiles, not just your own.\n5. **Post-sweep, retrieval goldens drift.** A mass content rewrite changes FTS\n   ranking: parity\u002Fknown-answer fixtures fail on ranking (expected docs still\n   exist; new top hits are relevant). Refresh the stale golden with evidence\n   and a note — it's drift from an intentional change, not a regression.\n6. **Validation tests exercise the DEPLOYED copy.** L2 fleet tests\n   (test-task-fleet.sh, test-mycortex-schema.sh) run against\n   `~\u002F.steadfaste-fleet\u002Fscripts\u002F`, not the repo. Unit tests pass against repo\n   source while L2 fails → the fix isn't deployed. Run `fleet-update.sh`\n   (ops\u002Fscripts\u002F) before L2, then re-run.\n12. **A deployed file's frozen `# SOURCE:` header is the stale-file fingerprint.**\n    Deployed `.py`\u002F`.sh` carry a generated `# SOURCE: \u003Crepo-path>` header from the\n    deploy that wrote them; when that header names a path absent from the current\n    repo, the deployed copy is a leftover (deploy never prunes it) whose body still\n    carries the OLD name while the codebase moved on. Before deleting, find the\n    artifact's CURRENT home — the component often moved within the repo\n    (`ops\u002Fservices\u002Fagent-bus\u002Fserver.py` → `core\u002Ffleet_bus\u002Fserver.py`, repo-served\n    and already clean). A deployed file whose source is gone AND that is not\n    registered in the deploy map is stale and removable.\n13. **A stale WORKTREE survives under the old name as a `.git` FILE, not a\n    directory.** A linked worktree's `.git` is a one-line file reading\n    `gitdir: \u003Cpath>`, so `.git\u002Fconfig` is not found there and repo content-greps\n    never see it — its tree predates the sweep and was never touched. Inspect that\n    pointer (its gitdir may resolve through the transition symlink) and remove it\n    with `git worktree remove \u003Cdir>`; do this BEFORE removing the transition\n    symlink the pointer rides on.\n14. **Transition symlinks mask live config that was never repointed — running\n    services are not proof of completion.** A symlink at the old location keeps\n    `~\u002Fold-name` resolving, so the host works while a live surface still loads the\n    old path. \"Fully migrated\" is false until EVERY live surface is repointed, not\n    just the code: enumerate them (`repos.yaml`, `config.yaml`, `gateway.yaml`,\n    `agent.env`, `cron\u002Fjobs.json`, shell rc, root-owned copies) and grep each for\n    the token; only when they are empty are the symlinks genuinely removable\n    (`rm -f ~\u002Fold ~\u002F.old`).\n    **`git remote -v` is write-class under the governance classifier** — the\n    lock-free read allowlist is `ls, cat, grep, find, git status\u002Flog\u002Fdiff`, and\n    `git remote` is not in it. When verifying a repo's origin was repointed, read\n    `.git\u002Fconfig` via `read_file` instead of opening a lock for a read.\n    15. **Repo-name-keyed state files are a stale class of their own — sweep them when the\n    repo is renamed.** A rename leaves behind state files whose NAME embeds the old repo\n    slug, not just files whose CONTENT mentions it: the per-blob review-receipt caches\n    (`.reviewed-\u003Crepo_slug>-\u003Csha>.json`, written as `REVIEW_RECEIPT_PREFIX + slug + \"-\" +\n    sha`) and the session-id stamp (`.session-\u003Crepo_slug>.id`). Once the slug changes,\n    nothing reads the old-keyed set, so it survives every deploy forever and a content\n    grep reports clean. Count BOTH spellings side by side (`ls -1 .reviewed-\u003Cold>-*.json |\n    wc -l` beside the new one), delete only the old-keyed set, and confirm the new count\n    is unchanged afterwards. These are a CACHE, not the ledger — the audit trail is the\n    governance DB — so removing them loses no record.\n    16. **A finished rename can be re-reddened by a LATER content backport — run the\n    migration's own lint during verification and attribute the failure with `git log`.**\n    A skill or lesson backported into the repo AFTER the sweep can reintroduce the retired\n    token and turn the brand lint red while every host surface stays clean, so a green\n    original sweep is not permanent. Run the lint (`bash tests\u002Ftest_fleet_cli_brand.sh`)\n    as part of the pass, and find the introducing commit with `git log --diff-filter=A\n    --oneline -- \u003Cflagged file>` before blaming the sweep. A lint that is not wired into\n    the doctor or the hooks blocks nothing — report it as a finding with the one action\n    that clears it, rather than letting a red gate read as a broken host.\n    17. **A residue lint and a skill that TEACHES the sweep legitimately conflict — report\n    the ONE action that clears it; never re-scope a gate unilaterally.** A lint that\n    greps `skills\u002F` for the retired token flags the methodology reference whose worked\n    example uses that token (`old → new` mappings, shell and regex samples), even though\n    the sweep's own rule says such files stay out of the residue grep. Two fixes exist —\n    generalize the sample tokens to the documented family notation, or exempt the\n    reference by path — and choosing between them is a gate-scoping judgement for the\n    operator. Token-class fact to use when proposing the doc fix: a wildcard family form\n    (`PREFIX_*`) does NOT match a lint pattern shaped `PREFIX_[A-Z0-9_]+`, because `*` is\n    outside that class — and the fleet's authoritative docs already write a retired\n    family that way.\n    18. **A migration's own \"converged when the token count is 0\" criterion can be\n    over-broad — classify every hit before chasing zero.** The follow-ups doc may state\n    convergence as a blind grep (`git grep -i \"\u003Cold brand>\"` == 0 outside historical\n    dirs), but proposal\u002Fdesign docs and dated records legitimately quote the old brand as\n    the CLI or story they once described. Bucket every hit (record vs live instruction),\n    report the live ones, and name the surfaces you did not reach — a doc that merely sits\n    outside `docs\u002Folder|evidence` is not automatically live.\n    19. **A deployed-only entry is not automatically stale — separate \"orphan\" from \"repo\n    gap\".** The deploy never prunes, so a repo-vs-deployed dir diff lists extras; most are\n    real leftovers, but a deployed-only SKILL can be a LIVE capability whose repo source\n    is absent (created on the host, or stranded when its repo copy was moved). Confirm the\n    artifact is still loaded before removing it, and recover instead of deleting —\n    `ops\u002Fscripts\u002Fmanage\u002Freconcile-stranded-skills.py` (report first) copies pure supersets\n    back into the repo as its own governed change.\n\n    ## Steps\n\n1. Begin governance cycle (terminal needs a lock).\n2. Run the surface checklist (batch greps; count AND list).\n3. Fix\u002Fremove every LIVE hit; leave HISTORICAL; flag CREDENTIAL in the report.\n4. Re-verify: re-run the live-surface greps → 0.\n5. Run the guard test (`pytest tests\u002Ftest_repo_structure.py -q`) + full suite.\n5b. Run the migration's own consistency lint (`bash tests\u002Ftest_fleet_cli_brand.sh`) and\n   the doctor (`fleet-doctor.py --quiet`) — record the pass\u002Fwarn\u002Ffail counts and the exit\n   code, not just the ✅ lines. A red lint on a freshly-swept tree is usually a LATER\n   backport (pitfall 16); a red doctor FAIL is real drift that must be fixed in-cycle.\n6. Post-sweep validation: run the component's own battery (e.g. mycortex:\n   CLI doctor, sources\u002Fstats, schema battery, crons, parity fixture, doctor\n   Deploy+Repo sync) to prove the component still works after the purge. When the\n   sweep removed config, exercise the path that REPLACED it — e.g. after deleting a\n   cron provider, run the scheduling surface (`hermes cron list`) and confirm no\n   fallback warning, which is the only proof the default is really in charge.\n7. Report: verified-clean surfaces, what was removed, what was kept (counts),\n   flagged items. Score + close cycle.\n\nSession detail (legacy-brain sweep, 2026-08-21): `references\u002Flegacy-brain-sweep-2026-08-21.md`\n",{"name":5,"author":24,"license":15,"version":25,"category":26,"platforms":27,"description":7},"Esther","1.0.0","devops",[28,29],"linux","macos","main","96b22636b11836eba8d16dbc885fd0b87dc71b03","skills\u002Fdevops\u002Fsweep-verification",1,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet","steadfaste.com","https:\u002F\u002Fgithub.com\u002Flukemcqueen","AI Architect | Building Hermes Cortex: governed multi-agent AI for autonomous software engineering | Enterprise Tech Consultant","2026-11-14 22:33:34",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add lukemcqueen\u002Fsteadfaste-fleet --skill sweep-verification",{"tool":45,"command":46},"bunx","bunx skills add lukemcqueen\u002Fsteadfaste-fleet --skill sweep-verification",{"tool":48,"command":49},"pnpm","pnpm dlx skills add lukemcqueen\u002Fsteadfaste-fleet --skill sweep-verification","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsweep-verification\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Flegacy-brain-sweep-2026-08-21.md","REFERENCE","参考文档",4390,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsweep-verification\u002Freferences\u002Flegacy-brain-sweep-2026-08-21.md",[60,68,75,82,89,96],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":67},"01M7DXY4G8NSVB59K8B6S2AQNP","macbook-linux-maintenance","Legacy MacBook Linux fixes: GPU wedge, reboot hang, thermal.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fmacbook-linux-maintenance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":67},"01M7DXXYJCXFJ3TGB84ZQ8KFE6","governance-regression-triage","Triage a host's governance issues: what changed.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fgovernance-regression-triage\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":67},"01M7DXXSAP1G8FDRJAMXQGBBMK","enforcement-immutability","Use when enforcement files lose their immutable flag.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fenforcement-immutability\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":67},"01M78SSDQVRYX64Y16X32TC0NS","steadfaste-fleet-repo-deploy","Use when committing to the steadfaste-fleet repo.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-repo-deploy\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":67},"01M78SS928F3R2RJAYVW4E30CE","steadfaste-fleet-maintenance","Maintain an installed Steadfaste Fleet instance — update both the upstream Hermes Agent and the fleet repo layer, merge diverged histories, sync skills safely, and troubleshoot common issues. Covers the dual-update workflow (hermes update + fleet-update.sh), encrypted brain data backup, mycortex import, and recovery techniques.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-maintenance\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":67},"01M78SP1CHW0T0BWE5ZT6JBPX8","fleet-preflight","DEPRECATED alias — merged into survey-before-action (2026-08-20). Load survey-before-action instead; its \"Repo-Specific Pre-Flight\" section covers git search, Hermes boundary, and deployment verification.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ffleet-preflight\u002FSKILL.md",[],[]]