✨ feat(work): an hourly sweep closes a Work item whose last slice closed some other way
This adds the hourly sweep from spec v1 of https://github.com/veda-hq/niyam/issues/655, approved 2026-11-26. It closes a Work item whose last slice was closed some other way than a merge here.
niyam work-done, the new command in src/work-done.ts, lists the repository's open Work items (GET /repos/{owner}/{repo}/issues?state=open&type=Work%20item, the filter src/board.ts already uses). It reads further only those whose body says **Slices:** all filed, and closes each one that is done by the rules Slice done uses (https://github.com/veda-hq/niyam/pull/683), with the same comment, naming no pull request. It prints one line for each Work item it judged, or one line when none has the line. Where work-rules is off, the repository has not adopted niyam, or the repository is personal, it is off, as pr-merged is.
The new Work item done job in .github/workflows/checks.yml runs it on the 41 * * * * cron, which the client's niyam-asks job calls with issues: write. A run by hand goes through niyam-weekly, also with issues: write. So no client workflow changes: a client gets the job when its pin moves to a release that carries it. The job's concurrency group keeps two runs from commenting on one Work item at once.
Why a sweep and not issues: closed: "events triggered by the GITHUB_TOKEN will not create a new workflow run" (https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow#triggering-a-workflow-from-a-workflow, read 2026-11-25). That trigger would miss every close Slice done makes.
Guards: this changes .github/workflows/checks.yml, which #657 names under Guards:.
Evidence
pnpm checkpasses (totals in the comment below).pnpm exec agnipariksha --lane src --files src/work-done.ts --no-reuse: 311 killed of 311, 0 blocking.- Tests in
src/work-done.test.ts, "workDone":- a done Work item closes;
- only bodies with the line are read further, and pull requests are skipped;
- with none to judge, one line;
- work rules off, not adopted, or a personal repository closes nothing and lists nothing;
- missing environment, and a list that cannot be read.
src/run.test.tsrunswork-doneas that command.
The five open Work items whose slices are all closed (#430, #453, #468, #517, #638) get the line after the release, as #655 says. That is not this pull request.
Slice: #657
🤖 Generated with Claude Code
Summary by cubic
Adds an hourly sweep that closes a Work item whose last slice was closed some way other than by a merge here, per spec v1 of #655.
niyam work-donelists open Work items, reads only those whose body says**Slices:** all filed, and closes each one done by the Slice done rules.- A sweep is required because a close made with a workflow's
GITHUB_TOKENstarts no workflow run, so noissues: closedevent could catch it. - The new Work item done job in
.github/workflows/checks.ymlruns on the41 * * * *cron and on manual dispatch, reusing the asks job'sissues: write; no client workflow changes. - The command stays off when
work-rulesis off, before the repository adopts niyam, or in a personal repository.