Housekeeping

From FriendlyInternet/nuxt-crouton · View interactive version

Housekeeping is an AI agent skill from the GitHub repository FriendlyInternet/nuxt-crouton. Generate the weekly "๐Ÿงน Housekeeping" digest โ€” a render-only report of repo drift that needs a human eye (stale unmerged branches, mislabeled issues, stuck in-progress tickets, epics ready to close, idle PRs, label-coverage gaps). Reports only, never mutates. Use when asked for a "housekeeping repor

How to use this skill

Skill file

Housekeeping digest

A weekly, report-only sweep that catches the drift the event-driven jobs miss โ€” the

periodic backstop behind epic #633. It posts one rolling comment to a standing

"๐Ÿงน Housekeeping" issue listing everything that needs judgment but is too risky to auto-fix.

It never deletes a branch, changes a label, or edits an issue โ€” the digest issue body is

the only thing it writes.

What it reports (each section omitted when empty)

untouched for >N days. Merged-into-main branches are out of scope (lossless, not a

human-eye item).

(pkg:/app:/worker:/poc:) label.

label declared in .github/labels.yml (CLAUDE.md treats a missing label as a build

failure). Report-only โ€” never auto-prune (a destructive label sync strips the label from

every issue).

PR and no worker run (runs that ended skipped don't count) in the last hour. Never listed:

status:blocked, epics, and the fixed canary tickets in .github/canaries.json. Re-run with

gh workflow run work-issue-pidev.yml -f issue=<N> (not by re-adding the label, #2990).

action each needs (read from the status:ready-to-close / status:needs-postmortem label

the labeller stamps โ€” see below): run the postmortem then close vs *postmortem done, just

close*. Any entry whose epic/<number>-* branch still carries commits not on main

(git cherry origin/main origin/<branch> non-empty) is annotated with a โš ๏ธ warning line โ€”

the exact failure mode from #1976, where four deliverables went missing because an epic

branch was never merged (#1982). Report-only: it never blocks closing, it just says so.

status:in-progress but the epic isn't, so it reads as "open, not started" (#980). The

labeller reconciles this (see below); the digest just surfaces it.

isn't a currently-open epic: a closed epic left with unfinished work, or a parent missing

the epic label (#980).

whose citations drifted or whose stamp aged out, via scripts/skill-freshness.mjs (fs+git, no

LLM): a cited path that vanished (๐Ÿ”ด), a cited file with commits newer than the stamp

(๐ŸŸก possibly-stale), or a stamp > 90d old (๐Ÿ”ต re-verify due). Report-only โ€” a re-verified,

re-stamped skill drops off next run (#1100 WS3). Section dropped if the checker can't run.

Pipeline (deterministic โ€” no LLM, no secrets)

Mirrors .claude/skills/epic-digest/:

gather.mjs  โ†’ housekeeping.data.json   (git for branches + GitHub REST for issues/PRs/labels)
app-collection-drift.mjs --json --out app-collection-drift.json  (needs pnpm install + the crouton-auth build; read by gather.mjs via APP_COLLECTION_DRIFT_FILE โ€” missing file = 'could not run')
render.mjs  โ†’ housekeeping-<date>.md   (JSON โ†’ Markdown, sections dropped when empty)
post-comment.sh                        (upsert the one standing "๐Ÿงน Housekeeping" issue)
schedule.mjs                           (cadence-as-data: is today a send day per .github/digests.yml?)

Run it by hand

GITHUB_TOKEN=$(gh auth token) node .claude/skills/housekeeping/gather.mjs > housekeeping.data.json
node .claude/skills/housekeeping/render.mjs housekeeping.data.json --out-dir .
cp housekeeping-*.md housekeeping.md
GH_TOKEN=$(gh auth token) DIGEST_BODY_FILE=housekeeping.md bash .claude/skills/housekeeping/post-comment.sh

Branch data needs a full checkout with remote branches present (`git fetch origin

'+refs/heads/:refs/remotes/origin/'`); without it the branch section is skipped, not guessed.

Scheduling & delivery โ€” `.github/digests.yml`

Cadence and delivery channel are config-as-data, not workflow plumbing (#637). The

status app's clock starts the workflow daily (cheap wake-up, clock: true so it gates like a

timed run); schedule.mjs reads digests.yml and exits early when today isn't a send day โ€” so

changing "weekly โ†’ daily" or "Wed โ†’ Mon" is a one-line edit, never a clock-row change. Delivery is selection over rails that already exist: issue

(this standing-issue path) and email (Resend, mirrors red-team-daily.yml; degrades to a

green no-op when RESEND_API_KEY is unset).

housekeeping:
  schedule: daily        # daily | weekly:<dow> ; dow = mon|tue|wed|thu|fri|sat|sun
  deliver: [issue]       # issue | email
  # to: [you@example.com]  # required only when deliver includes email

Lossless branch sweep (separate workflow โ€” the only auto-delete)

The digest is report-only. The one auto-destructive action lives in its own workflow

(.github/workflows/weekly.yml cleanup job โ†’ prune-merged-branches.mjs), split off by

blast radius so a digest bug can never delete a branch. It deletes a branch only if it is

provably contained in main (git branch -r --merged origin/main, 0 commits ahead) โ€” lossless

by construction. It also skips any branch with an open PR, anything newer than

BRANCH_MIN_AGE_DAYS (default 1), and main/protected refs.

Report-only until enabled: it runs dry-run (lists what it would delete) unless APPLY is

on โ€” set the repo variable CLEANUP_BRANCHES_APPLY=true, or run it via workflow_dispatch with

apply: true. Confirm a dry-run looks right before flipping the variable. Complements

cleanup-epic-branches.yml (which deletes epic/* on PR merge) by sweeping whatever slipped

past an event trigger.

GITHUB_TOKEN=$(gh auth token) node .claude/skills/housekeeping/prune-merged-branches.mjs        # dry-run
GITHUB_TOKEN=$(gh auth token) APPLY=true node .claude/skills/housekeeping/prune-merged-branches.mjs  # delete

Epic status labels (separate workflow โ€” the only auto-label) (#763 / #980)

The epic sections above read labels the digest does not set: status:ready-to-close,

status:needs-postmortem, and status:in-progress. They're reconciled by a separate daily

workflow (.github/workflows/label-ready-epics.yml โ†’ scripts/label-ready-epics.mjs), split

off by blast radius exactly like the branch janitor โ€” it's the only auto-label mutation,

and the digest stays report-only. The labeller derives each open epic's status from its

children (mutually-exclusive, at most one):

on a comment (left by the postmortem skill), else status:needs-postmortem;

It removes any managed label the epic no longer qualifies for. The same labels drive the daily

epic-digest email's bands, so both digests agree. Dry-run by default; set repo var

LABEL_READY_EPICS_APPLY=true to write.

Tuning

The scheduled run lives in .github/workflows/housekeeping.yml.

Note (moved from root CLAUDE.md, #3350): label-coverage checks the packages/apps/pocs/workers dirs against .github/labels.yml; the pipeline is gather.mjs โ†’ render.mjs โ†’ post-comment.sh, same as epic-digest.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.