Wiki cleanup

From stevehuang0115/crewly · View interactive version

Wiki cleanup is an AI agent skill from the GitHub repository stevehuang0115/crewly. Detect + remove low-quality pages from a wiki vault (low confidence, agent memory dumps, per-agent overflow). Default dry-run; archives every deletion; idempotent.

How to use this skill

Skill file

Wiki Cleanup

Removes low-quality pages from a wiki vault. Origin: the 2026-05-27 migrate pass dumped every agent's memory.json roleKnowledge[] entries as their own wiki page (~3,277 pages across 6 project vaults). Many are stream-of-consciousness daily memory rather than team-level patterns. This skill identifies + deletes them safely.

Two modes

scan (default) — dry-run

Walks <vault>/llm-curated/**/*.md, parses each page's frontmatter, and returns the list of pages flagged by at least one cleanup rule. No filesystem mutation. Use this to eyeball what would be deleted before running apply.

bash execute.sh --vault /Users/me/proj/.crewly/wiki
bash execute.sh --vault /Users/me/proj/.crewly/wiki --min-confidence 0.4
bash execute.sh --vault /Users/me/proj/.crewly/wiki --max-per-agent 20

Output:

{
  "candidates": [
    { "relPath": "llm-curated/patterns/x.md", "reasons": ["confidence 0.3 < 0.5"], ... }
  ],
  "scannedCount": 526,
  "summary": { "lowConfidence": 412, "agentMemoryDump": 380, "perAgentCapped": 18 },
  "truncated": false
}

apply — execute deletes

Deletes the explicit --pages list and archives each page's body + frontmatter to <vault>/.wiki-cleanup-archive.json. The migrate manifest (.migration-state.json) is deliberately left intact so that wiki-migrate --apply sees "already migrated" for the cleaned-up sourceIds and skips re-import. Touching the manifest would break that idempotence and the page would resurrect on the next bridge tick (the 2026-05-28 cleanup-then-migrate-resurrection bug).

bash execute.sh --vault /Users/me/proj/.crewly/wiki \
  --apply \
  --pages "llm-curated/patterns/a.md,llm-curated/patterns/b.md"

Output:

{
  "deleted": ["llm-curated/patterns/a.md", "llm-curated/patterns/b.md"],
  "skipped": [],
  "archivePath": "/Users/me/proj/.crewly/wiki/.wiki-cleanup-archive.json",
  "manifestEntriesInvalidated": 2
}

Scan rules

| Rule | Default | Disables via | What it catches |

|---|---|---|---|

| --min-confidence FLOAT | 0.5 | --min-confidence 0 | Pages with frontmatter confidence < threshold. Migrate sets this when the classifier was uncertain — usually correlates with low-quality content. |

| (drop agent memory dumps) | ON | --no-drop-agent-memory | Pages with migrated_from: "agent/<id>/memory.json". These are verbatim daily-memory dumps, NOT team-level patterns. |

| --max-per-agent INT | 0 (off) | omit flag | Keeps top-N pages per original_author (by confidence desc, original_date desc). Useful for taming pathological cases where one agent dumped 100+ entries. |

A page is a candidate if it matches any rule (union, not intersection). The per-agent cap only considers pages NOT already flagged by other rules — so a low-confidence page doesn't "use up" a cap slot.

Safety guarantees

When to invoke

Failure modes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.