wiki-prune
Skill1 starsChanged 7 months agoMITView on GitHub
Weekly janitor for the Obsidian wiki. Archives `wiki/daily/YYYY-MM-DD/` folders older than 7 days into `wiki/.archive/YYYY-WW/`, keeping the rolled-up summaries that `wiki-fold` produced. Dry-run by default; `--commit` moves the folders; `--hard` deletes archive entries older than 30 days. Suggested cadence: every Monday morning. Triggers on: "/digital-brain:wiki-prune", "/prune", "prune wiki", "clean old dailies", "weekly cleanup", "garbage collect wiki".
- Deletes or force-pushes
In this repository19 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/digital-brain.mdcCursor rule
- autoresearchSkill
- canvasSkill
- defuddleSkill
- noteSkill
- obsidian-basesSkill
- obsidian-markdownSkill
- pplSkill
- saveSkill
- supSkill
- syncSkill
- taskSkill
- wiki-foldSkill
- wiki-ingestSkill
- wiki-lintSkill
- wiki-querySkill
- wikiSkill
- writeSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Fold before prune (recommended): If wiki-fold hasn't run in the last 7 days, warn before pruning so context isn't lost.
- Very specific: line 24
Skip non-date folders: Only YYYY-MM-DD/ entries are candidates.
- Very specific: line 61
Ensure wiki/.archive/<iso_week>/ exists (mkdir -p).
- Very specific: line 126
Never delete anything in the original wiki/daily/ — only mv to archive.
- Very specific: line 127
Never archive folders that aren't named in YYYY-MM-DD format (skip + warn).
- Distinctive: line 128
Never archive folders inside the live retention window.
- Very specific: line 130
If mv fails (permissions, target exists), abort the run and print the error — don't keep going.
- Distinctive: line 131
Default to printing first, mutating second.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
wiki-prune: Weekly Daily-Folder Janitor
/digital-brain:sync writes a folder per day under wiki/daily/. Left alone, those pile up forever and /sup slows down. wiki-prune is the janitor: every Monday it archives folders older than 7 days into a per-ISO-week directory under wiki/.archive/, so the live wiki/daily/ directory only ever holds the current week.
Rules of engagement:
- Dry run by default. Print what would happen. Move nothing until
--commit. - Archive, don't delete. Move folders into
wiki/.archive/YYYY-WW/, preserving structure. Originals stay recoverable viamvback. - Hard delete only on explicit opt-in. With
--hard, delete archive entries older than 30 days from the archive root. Use sparingly. - Fold before prune (recommended). If
wiki-foldhasn't run in the last 7 days, warn before pruning so context isn't lost. - Never touch the live week. Anything dated within the last
retentiondays stays in place. - Skip non-date folders. Only
YYYY-MM-DD/entries are candidates._config.jsonand anything else is left alone.
Inputs / flags
| Flag | Effect |
| (none) | Dry run. List candidates, suggest next run. No filesystem changes. |
--commit | Move matching folders into wiki/.archive/YYYY-WW/. |
--hard | After archiving, delete archive entries older than 30 days. Requires Y/N in chat. |
--retention=N | Override the 7-day window. Rare — default is 7. |
--skip-fold-check | Don't warn about stale wiki-fold. |
Workflow
- Compute cutoff.
today = date +%Y-%m-%d(local time).cutoff = today - retention(default 7 days). Anything strictly older than the cutoff is a candidate. - Scan
wiki/daily/. For each entry, check whether its name matches^[0-9]{4}-[0-9]{2}-[0-9]{2}$. Skip everything else (e.g._config.json). Compare the date against the cutoff. - Fold-freshness check. Find the newest mtime under
wiki/folds/. If older than 7 days (or the folds directory does not exist), print:⚠️ wiki-fold last ran <N> days ago — run /digital-brain:wiki-fold first to preserve context, or pass --skip-fold-check.Continue, do NOT abort — the user may consciously want to prune without folding. - Group candidates by ISO week. For each candidate folder, compute:
iso_week = date -j -f "%Y-%m-%d" "<folder-date>" "+%G-W%V"(macOS) — yields e.g.2026-W19.archive_dir = wiki/.archive/<iso_week>/<folder-date>/.
- Always print a report. Table with: folder name, file count, total size, archive target, ISO week. Plus the list of folders being kept (live week).
- If
--commit:- Ensure
wiki/.archive/<iso_week>/exists (mkdir -p). - For each candidate,
mv wiki/daily/<date> wiki/.archive/<iso_week>/<date>. Idempotent: if the target already exists, abort with an error — never overwrite. - Print the new paths.
- Ensure
- If
--hard:- List archive subdirectories under
wiki/.archive/whose mtime is > 30 days old. - Print them and ask in chat:
Delete <N> archive entries permanently? (y/N). - On
y,rm -rfthem. On anything else, abort.
- List archive subdirectories under
- Print next-run suggestion. Compute the next Monday strictly after today. Print:
Suggested next run: Mon <YYYY-MM-DD> 09:00 — automate via /digital-brain:schedule "every Monday 09:00" /digital-brain:wiki-prune --commit.
Output shapes
Dry run
## wiki-prune — <today HH:MM> (dry run)
Retention: 7 days · cutoff: <YYYY-MM-DD>
Would archive (<N> folders → wiki/.archive/):
wiki/daily/2026-05-04/ 3 files 18 KB → wiki/.archive/2026-W18/2026-05-04/
wiki/daily/2026-05-03/ 3 files 12 KB → wiki/.archive/2026-W18/2026-05-03/
wiki/daily/2026-05-02/ 3 files 14 KB → wiki/.archive/2026-W18/2026-05-02/
Live week kept (within retention):
wiki/daily/2026-05-12/ wiki/daily/2026-05-11/ wiki/daily/2026-05-09/
⚠️ wiki-fold last ran 12 days ago — consider running /digital-brain:wiki-fold first.
No changes made. Re-run with --commit to archive.
Suggested next run: Mon 2026-05-18 09:00.Commit
## wiki-prune — <today HH:MM> (committed)
Archived 3 folders into wiki/.archive/2026-W18/.
Live wiki/daily/ now holds 3 days (2026-05-09 → 2026-05-12).
Suggested next run: Mon 2026-05-18 09:00.Hard delete (with confirmation prompt)
## wiki-prune — <today HH:MM> (hard delete preview)
Archive entries older than 30 days:
wiki/.archive/2026-W14/ (mtime 2026-04-08, 32 days old)
wiki/.archive/2026-W13/ (mtime 2026-04-01, 39 days old)
Delete 2 archive entries permanently? (y/N)Safety rules
- Never delete anything in the original
wiki/daily/— onlymvto archive. - Never archive folders that aren't named in
YYYY-MM-DDformat (skip + warn). - Never archive folders inside the live retention window.
--hardrequires explicit chat confirmation. No silent deletes.- If
mvfails (permissions, target exists), abort the run and print the error — don't keep going. - Default to printing first, mutating second. The user reviews the dry run, then commits.
Cadence
Suggested: every Monday at 09:00. Monday morning is the natural week boundary — the previous week's signal has either been captured by wiki-fold or is no longer load-bearing, and starting fresh keeps /sup snappy because there's only one current week of daily files to scan.
To automate:
/digital-brain:schedule "every Monday 09:00" /digital-brain:wiki-prune --commitOr wire a SessionStart hook to run the dry-run version every Monday so you see candidates the first time you open Claude that week and decide whether to commit. The dry run is the safe default to schedule — it never mutates.
Relationship to other skills
/digital-brain:syncwrites the daily folders that this skill prunes./digital-brain:wiki-foldpreserves long-term signal before prune drops the raw daily files./digital-brain:wiki-lintmay reference items from old daily folders — run lint before prune to flag anything load-bearing.
Typical Monday routine:
/digital-brain:wiki-fold— roll up last week./digital-brain:wiki-lint— audit for orphans/dead refs./digital-brain:wiki-prune(dry run) → review →--commit.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

