Janitor

$npx mdskill add aaronjmars/aeon/Janitor

Today is ${today}. Your task is to delete stale ephemeral files that accumulate from normal skill operation.

SKILL.md

.github/skills/JanitorView on GitHub ↗
---
name: Janitor
description: Weekly cleanup of accumulated temp files — .notify-* root-level files, .pending-notify-temp/, and stale .outputs/ chain artifacts older than their TTL
tags: [meta]
---

Today is ${today}. Your task is to delete stale ephemeral files that accumulate from normal skill operation.

Three classes of files pile up with no automated cleanup:

1. **Root-level `.notify-*` files** — written by skills before `./notify -f`, never deleted after send.
2. **`.pending-notify-temp/` files** — brace+quote-gate workaround artifacts.
3. **`.outputs/` chain artifacts** — skill output files written for chain `consume:` steps. Still around weeks after the chain ran.

Do not touch:
- `.pending-notify/` — active undelivered notifications. Leave these alone.
- `memory/pending-disclosures/` — vuln disclosure drafts (committed). Leave these alone.
- Any file created today or yesterday (within 2 days).

## Steps

### 1. Scan root-level `.notify-*` files

List all files matching `.notify-*.md` and `.notify-*.txt` in the repo root.

For each: check the date suffix in the filename (format: `YYYY-MM-DD` or `YYYYMMDD`). If the file's date is **7 or more days before today**, mark for deletion.

If the filename has no parseable date, check file modification time. If older than 7 days, mark for deletion.

Count: how many total, how many marked.

### 2. Scan `.pending-notify-temp/`

List all files in `.pending-notify-temp/`. Same 7-day rule based on filename date suffix or mtime.

Count: how many total, how many marked.

### 3. Scan `.outputs/`

List all files in `.outputs/`. These are chain step outputs. TTL is **14 days** — chain runs are short-lived, outputs don't need to persist beyond two weeks.

Mark files with mtime older than 14 days for deletion.

Count: how many total, how many marked.

### 4. Delete marked files

Delete all marked files using `node -e` to avoid bash brace/glob issues:

```
node -e "
const fs = require('fs');
const files = [/* list of full paths */];
let deleted = 0;
for (const f of files) {
  try { fs.unlinkSync(f); deleted++; } catch(e) {}
}
console.log('deleted ' + deleted);
"
```

Build the file list as a JSON array of strings. Do NOT use shell glob expansion — construct paths explicitly from the listing step.

### 5. Log results

Append to `memory/logs/${today}.md`:

```markdown
## Janitor
- Root .notify-* files: ${total_notify} total, ${deleted_notify} deleted (7d TTL)
- .pending-notify-temp/: ${total_temp} total, ${deleted_temp} deleted (7d TTL)
- .outputs/: ${total_outputs} total, ${deleted_outputs} deleted (14d TTL)
- Total deleted: ${total_deleted}
- JANITOR_OK
```

If nothing was deleted: still log `JANITOR_OK` with zeros.

### 6. Notify (only if something was deleted)

If `total_deleted > 0`, write to `.pending-notify-temp/janitor-${today}.md` and send:

```
./notify -f .pending-notify-temp/janitor-${today}.md
```

Notification format:
```
*Janitor — ${today}*

cleaned ${total_deleted} stale files:
- ${deleted_notify} root .notify-* (7d TTL)
- ${deleted_temp} .pending-notify-temp/ (7d TTL)
- ${deleted_outputs} .outputs/ (14d TTL)
```

If nothing was deleted: skip notification entirely. No noise.

## Sandbox Note

All file operations are local. Use `node -e` for deletion to avoid bash brace+quote gate issues. No network calls needed.

## Environment Variables

None required.

More from aaronjmars/aeon

SkillDescription
[REPLACE: SKILL_NAME]Daily price and volume tracker for [REPLACE: TOKEN_SYMBOL] with anomaly alerts above [REPLACE: ALERT_THRESHOLD_PCT]% movement
Action Converter5 concrete real-life actions for today, leverage-scored against open loops with specificity and anti-fluff gates
Agent BuzzCurated AI-agent tweets, clustered into narratives with insight summaries
agent-displacementWeekly tracker of AI agent substitution signals — which roles, companies, and industries show real headcount displacement. Named roles + real deployments only.
AI Framework WatchWeekly competitive-intelligence digest on the AI agent framework space — momentum, releases, breaking changes across a curated watchlist
AIXBT PulseCross-domain market pulse from AIXBT's free grounding endpoint — crypto, macro, tradfi, geopolitics. Refreshes taxonomy references (clusters, chains) as a bonus.
api-health-probeDaily pre-batch API provider health check — detects credit exhaustion or auth failure for every configured provider key before the morning batch runs, giving the operator a window to act before skills degrade
Approval AuditList a wallet's live ERC-20 token approvals on Base and flag unlimited / risky spender grants. Keyless via Base RPC (eth_getLogs + eth_call) — no explorer key needed.
article-queueWeekly article idea synthesizer — ranks signals from topic-momentum, beat-tracker, and narrative-tracker into a prioritized queue the article skill reads on next run
atrium-catalog-watcherWeekly diff of the Atrium marketplace catalog at https://atriumhermes.tech/.well-known/skills/index.json against the prior snapshot — surfaces newly-published skills, removed skills, and updated descriptions. Supply-side complement to sparkleware-catalog (curated skill-packs.json registry) and skill-update-check (version drift of installed skills).