agentsclimarketplace

Wiki prune

Skill eliransu/digital-brain/skills/wiki-prune

Claude + Obsidian knowledge companion. A persistent, compounding wiki vault based on Karpathy's LLM Wiki pattern — drop sources, ask questions, knowledge compounds.

Install
npx -y skills add eliransu/digital-brain --skill wiki-prune

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

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".

SKILL.md

7.1 KB, as published. Nobody here has run it

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 via mv back.
  • 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-fold hasn'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 retention days stays in place.
  • Skip non-date folders. Only YYYY-MM-DD/ entries are candidates. _config.json and anything else is left alone.

Inputs / flags

FlagEffect
(none)Dry run. List candidates, suggest next run. No filesystem changes.
--commitMove matching folders into wiki/.archive/YYYY-WW/.
--hardAfter archiving, delete archive entries older than 30 days. Requires Y/N in chat.
--retention=NOverride the 7-day window. Rare — default is 7.
--skip-fold-checkDon't warn about stale wiki-fold.

Workflow

  1. Compute cutoff. today = date +%Y-%m-%d (local time). cutoff = today - retention (default 7 days). Anything strictly older than the cutoff is a candidate.

  2. 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.

  3. 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.

  4. 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>/.
  5. 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).

  6. 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.
  7. 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 -rf them. On anything else, abort.
  8. 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/ — only mv to archive.
  • Never archive folders that aren't named in YYYY-MM-DD format (skip + warn).
  • Never archive folders inside the live retention window.
  • --hard requires explicit chat confirmation. No silent deletes.
  • If mv fails (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 --commit

Or 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:sync writes the daily folders that this skill prunes.
  • /digital-brain:wiki-fold preserves long-term signal before prune drops the raw daily files.
  • /digital-brain:wiki-lint may reference items from old daily folders — run lint before prune to flag anything load-bearing.

Typical Monday routine:

  1. /digital-brain:wiki-fold — roll up last week.
  2. /digital-brain:wiki-lint — audit for orphans/dead refs.
  3. /digital-brain:wiki-prune (dry run) → review → --commit.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.