AgentStack
SKILL verified MIT Self-run

Wiki Prune

skill-eliransu-digital-brain-wiki-prune · by eliransu

>

No reviews yet
0 installs
5 views
0.0% view→install

Install

$ agentstack add skill-eliransu-digital-brain-wiki-prune

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Wiki Prune? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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

| 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

  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.

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

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

  1. Group candidates by ISO week. For each candidate folder, compute:
  • iso_week = date -j -f "%Y-%m-%d" "" "+%G-W%V" (macOS) — yields e.g. 2026-W19.
  • archive_dir = wiki/.archive///.
  1. 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).
  1. If --commit:
  • Ensure wiki/.archive// exists (mkdir -p).
  • For each candidate, mv wiki/daily/ wiki/.archive//. Idempotent: if the target already exists, abort with an error — never overwrite.
  • Print the new paths.
  1. If --hard:
  • List archive subdirectories under wiki/.archive/ whose mtime is > 30 days old.
  • Print them and ask in chat: Delete archive entries permanently? (y/N).
  • On y, rm -rf them. On anything else, abort.
  1. Print next-run suggestion. Compute the next Monday strictly after today. Print:

Suggested next run: Mon 09:00 — automate via /digital-brain:schedule "every Monday 09:00" /digital-brain:wiki-prune --commit.


Output shapes

Dry run

## wiki-prune —   (dry run)

Retention: 7 days · cutoff: 

Would archive ( 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 —   (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 —   (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.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.