# Janitor

> Sweep the vault clean — delete tasks marked done + deletable after verifying their info lives in a wiki page, flag orphan pages, spot duplicate topics, and report every action. Use when the user says "clean", "janitor", "sweep", "tidy", "clean up the vault", or after a large ingest batch. Never deletes wiki pages without explicit approval.

- Skill: `nathan5674312/janitor` (Agent Skill)
- Install (CLI): `npx skillmds@latest add nathan5674312/janitor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nathan5674312/janitor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: Nathan5674312 (https://skillmd.com/u/nathan5674312)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/nathan5674312/janitor

---


# Janitor Skill

Clean the vault. Remove what's done. Keep it lean.

---

## When to Run
- User says "clean", "janitor", "sweep", "tidy", or "clean up the vault"
- After a large ingest batch
- Periodically as maintenance

---

## Procedure

### Step 1 — Scan Tasks
Read every file in `tasks/`. Collect files where:
```yaml
status: done
deletable: true
```

### Step 2 — Verify Before Delete
For each candidate:
1. Read the task content
2. Check: does the useful information from this task already exist in a `wiki/` page?
   **Search only real pages — exclude `index.md`, `hot.md` and `log.md`.**
   - YES → safe to delete
   - NO → extract the useful info, add it to the correct wiki page via the intake skill, THEN delete
   - UNCLEAR → flag it for user review, do not delete

🔴 **The exclusion is the whole safety of this step.** `log.md` records the
filename of every file ingest creates, so a task called `move-docs-site.md`
puts the words "move", "docs" and "site" into `wiki/` the moment it is created.
Match against the log and every task looks preserved, including ones whose
content was never written down anywhere. `index.md` and `hot.md` fail the same
way — they name pages, they do not contain them.

**A filename is not information.** Confirm the task's actual content — its
objective and details — is readable in a real page. If the only hit is the page
title or the log line, the answer is NO.

### Step 3 — Orphan Sweep
Scan `wiki/` for orphan pages:
- No inbound wikilinks from any other page
- No outbound wikilinks to any other page
- Not `index.md`, `hot.md`, or `log.md`

For each orphan:
- If content is still valuable → link it from a relevant page or index
- If content is stale/empty → flag for user review
- Never auto-delete wiki pages without explicit user approval

### Step 4 — Inbox Check
If `inbox/` has files that look already processed (duplicates of wiki content):
- Flag them, don't delete — user decides

### Step 5 — Consolidation Pass
Look for wiki pages that cover the same topic:
- If two pages overlap significantly → flag for merge, suggest which to keep
- Do not auto-merge without approval

### Step 6 — Report
After every run, output a summary:
```
JANITOR REPORT
--------------
Tasks deleted: X
Tasks flagged for review: X
Orphan pages found: X
Duplicates flagged: X
Inbox items flagged: X
```

Append a one-line summary to `wiki/log.md`.
Update `wiki/hot.md` if anything changed.

---

## Rules
- NEVER delete `index.md`, `hot.md`, `log.md`, any skill, or any template
- NEVER delete without verifying info is preserved elsewhere
- When verifying, NEVER count a hit in `index.md`, `hot.md` or `log.md` - those
  name pages, they do not contain them. A filename match is not preservation.
- When uncertain, FLAG — don't delete
- User can override with "delete all flagged" after reviewing
- Log every deletion to `wiki/log.md`

