/tend-ci-runner:nightlyfrom tend-ci-runner
Runs a nightly code quality sweep: resolves bot PR conflicts, reviews recent commits, surveys code/docs, and updates tend workflow configurations.
Ships in tend-ci-runner. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Resolve conflicts on bot PRs, review recent commits, survey a slice of existing code/docs, and update tend workflows.
/tend-ci-runner:run-tend first, including its repo-specific overlay./tend-ci-runner:post-to-github, /tend-ci-runner:open-pr, /tend-ci-runner:push-commits, and /tend-ci-runner:monitor-ci before Step 1; this sweep posts, opens PRs, pushes, and polls CI./tend-ci-runner:resolve-conflicts before Step 3 and /tend-ci-runner:fix-a-bug before fixing a finding in Step 8.Run the scope audit script to check the bot PAT against tend's required classic OAuth scopes (repo, workflow, notifications, write:discussion, gist, user):
tend runtime pat-scope-audit
The script prints key=value lines. Act on STATUS:
STATUS=ok: all scopes present. Search open issues for a PAT scope audit tracking issue (gh issue list --state open --search "PAT in:title"); if found, close it with a comment noting the scopes are now granted.STATUS=fine-grained: no X-OAuth-Scopes header, so the token is not a classic PAT. GitHub's notifications endpoints accept only classic tokens. Open or update the tracking issue as for STATUS=missing, with a body saying TEND_BOT_TOKEN must be replaced with a classic PAT carrying the scopes above.STATUS=missing: open or update a tracking issue. Use a title containing "PAT" (e.g. Bot PAT: missing scopes) so future runs can dedup by title search. Before creating, run gh issue list --state open --search "PAT in:title" and update the existing issue with gh issue edit if one is already open. The body lists the values from MISSING=, names the secret to update (TEND_BOT_TOKEN), and links step 8 of the install-tend skill for remediation: https://github.com/max-sixty/tend/blob/main/plugins/install-tend/skills/install-tend/SKILL.md#8-bot-token-and-secretRun tend check to verify this repo's tend setup (branch protection, bot
permission, and where credentials live). Run the version the committed
workflows were generated by, so a newer release's checks wait for the
regeneration PR; @latest covers a checkout with no stamped workflows:
PINNED=$(tend runtime nightly-workflow-update version)
uv tool run "tend@${PINNED:-latest}" check 2>&1 | tee "$TMPDIR/tend-check.txt"
If every check line is PASS or ACCEPTED (no FAIL and no SKIP), close any
open drift issue. A run with only SKIP lines (e.g. lost API permission, a
transient gh error) is not a pass — leave the issue untouched, neither
close nor file. Scope to bot-authored issues so a maintainer-filed issue
that happens to contain "configuration drift" is never auto-closed:
gh issue list --state open --author '@me' \
--search '"configuration drift" in:title' \
--json number --jq '.[].number' \
| xargs -r -I {} gh issue close {} --comment 'tend check now passes.'
If any check is FAIL, file or update one tracking issue with title
tend check: configuration drift on <owner>/<repo>. Dedup by title,
scoped to bot-authored issues:
gh issue list --state open --author '@me' \
--search '"configuration drift" in:title' \
--json number,title,body
No labels. Body lists the current FAIL lines (one bullet per check, with
a one-line reason) plus a _Last refreshed: <YYYY-MM-DD>_ footer. Updates:
Resolve conflicts for this bot and upstream dependency bots per
/tend-ci-runner:resolve-conflicts.
Review every commit since the last nightly that succeeded, so a night that was skipped, failed, or paused leaves its commits for this one rather than dropping them:
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
git fetch origin "$DEFAULT_BRANCH"
# GitHub can answer one listing URL from a weeks-old cached snapshot. Each
# `--limit` is a different URL, so take the newest success across several reads.
LAST=$(for n in 1 2 3; do
gh run list --workflow tend-nightly --branch "$DEFAULT_BRANCH" --status success \
--limit "$n" --json headSha,createdAt
done | jq -rs 'add // [] | max_by(.createdAt) | .headSha // empty')
# No earlier success, or its commit is gone from history: the last 24 hours.
git merge-base --is-ancestor "$LAST" "origin/$DEFAULT_BRANCH" 2>/dev/null \
|| LAST=$(git rev-list -1 --before='24 hours ago' "origin/$DEFAULT_BRANCH")
git log --format='%h %s' "$LAST..origin/$DEFAULT_BRANCH"
If that lists no commits, skip this step. Otherwise get the aggregate diff:
git diff "$LAST" "origin/$DEFAULT_BRANCH"
Read the project's instruction files before reviewing. Apply the review checklist below to the diff, focusing on changes rather than unchanged code. Also check whether those instructions need updating to reflect the new code (e.g., new file paths, changed commands, removed patterns).
The bot's own open issues, which include the transient reports the close rule below targets, and this run's seventh of the rest, so every issue is checked at least every seventh run however many are open:
BUCKET=$(( GITHUB_RUN_NUMBER % 7 ))
gh api --paginate "repos/{owner}/{repo}/issues?state=open&per_page=100" \
--jq ".[] | select(.pull_request == null and (.user.login == \"$BOT_NAME\" or .number % 7 == $BUCKET)) | {number, title}"
For each of these issues, check whether recent commits or the current codebase state already resolve it. If resolved, comment with the evidence (commits, CI runs, or code state that resolves the issue) per /tend-ci-runner:post-to-github. Close the issue with gh issue close when:
main is passing. Skip this case where closing the issue is itself a signal rather than a record of resolution:
tend-outage label. Its rows identify failed runs that review-runs diagnoses before checking the live repository for missed work. Nightly's cron precedes review-runs under the generated defaults, so closing the issue here can remove those rows before that check.tend-rate-limit label; use its recovery rule below.running-tend skill) explicitly authorize closing issues.Otherwise, leave it open for a maintainer to close.
For a tend-rate-limit tracker, reconcile blocked work through Recover issue work in /tend-ci-runner:notifications. Close it with the recovery evidence only when an agent's issue or PR creation succeeded through the proxy after the latest refusal, and the blocked work is resolved or accounted for on existing issues or PRs with current owners or recovery dispositions. An elapsed retry time, UTC rollover and trusted runner reports do not establish restored agent creation; restored creation alone does not settle missed work. A bot close records recovery and grants no capacity. Leave a still-exhausted or unreconciled tracker open.
The action's "Report failure" step records a workflow run link in tend-outage issues — annotations and job logs aren't reliably available while the job is in_progress. Run the enrichment script to fetch failure details for each newly referenced run and post them as a comment. The script is idempotent: it skips runs already marked with <!-- enriched-run:RUN_ID -->.
tend runtime enrich-tend-outage-issues
Run the survey script to get today's file list (rotating through the full repo over 28 days):
tend runtime nightly-survey-files
Skip files that aren't meaningfully reviewable: lock files (uv.lock, Cargo.lock, package-lock.json), binary assets, vendored dependencies, and generated files (build output, compiled protobuf, auto-generated workflow YAML). When unsure, check the file — a quick glance is cheaper than missing something.
Check which of today's files an open PR already changes, and don't re-derive a fix that PR carries:
gh pr list --state open --limit 200 --json number,title,files \
--jq '.[] | {number, title, files: [.files[].path]}'
Before reviewing files, read the project's instruction files and any project-specific skills or review criteria they reference. Apply the review checklist below to each file in full.
Used by both Step 4 (applied to recent diffs) and Step 6 (applied to full files).
General quality:
A bug finding earns a PR only where a caller can reach it. For a defect found by reading rather than from an observed failure, name the in-repo call path that triggers it. If no caller can, the finding is a note in the Step 9 summary, not a PR — public visibility doesn't clear the bar on its own, since an item exported incidentally (a utility module under a default-on feature) promises nothing to anyone. Where it is part of a published library's documented surface, the fix stands: say so in the PR body, naming the contract rather than the visibility keyword.
Convention compliance (from project instructions and skills):
For a Codex model or CLI pin change, verify a minimal read-only request with the candidate model using the CLI version the candidate action will ship and the consumer's auth mode. Provider API availability does not establish subscription support. If verification fails or is unavailable, keep the existing pin.
Regenerate the Tend workflow files in a script-owned temporary worktree:
tend runtime nightly-workflow-update prepare
If it reports changed: false, it has cleaned up and there is no PR to open.
Otherwise its JSON supplies the title, old and new versions, compare URL, and
upstream commit subjects. It leaves the prepared worktree and state on disk for
the shipping command; do not cd into it.
Before composing the PR body, inspect compare_url's diff for a new harness
model default. Update each explicit model pin in the prepared .config/tend.yaml
only when the replacement is a newer model in the same capability and price
tier, confirmed from the provider's model and pricing docs. Leave the pin
unchanged when those docs are unreachable or the tier is unclear, and preserve
cross-tier pins as product choices. Apply Model compatibility before changing
a Codex model pin. After an edit, rerun generation without
moving this session's cwd:
( cd "<worktree from prepare output>" && uv tool run tend@latest init )
Compose the PR body at $TMPDIR/tend-update-body.md per
/tend-ci-runner:post-to-github. Its reader is deciding whether to adopt the
regenerated workflows, so explain the consumer-visible effect of the upgrade
rather than inventorying changed files or commits. When the version changed, state the old and new versions,
synthesize the upstream_commits entries into the behavior consumers will
notice, and link compare_url as support. Rewrite each (#NNN) reference as
max-sixty/tend#NNN — a bare #NNN auto-links to this repo's own issues, not
tend's. Filter out release mechanics, action-pin and lockfile bumps, and
tend-internal work with no consumer-visible effect. If upstream_commits is
empty, the comparison call failed: include only the version line and compare
link, and do not infer upstream behavior. For a same-version regeneration,
explain the generator behavior that made the committed workflows stale. Follow
Reader-facing prose in /tend-ci-runner:run-tend.
Review the prepared diff per Review the change before the push in
/tend-ci-runner:push-commits, then ship it:
tend runtime nightly-workflow-update ship
The command commits, pushes, creates or updates the PR, records the pushed OID,
removes the temporary worktree, and prints the PR number and URL. Settle that
exact commit's CI per /tend-ci-runner:monitor-ci. Where it has you poll, run this
in the foreground, with the longest command timeout the harness allows:
tend runtime poll-pr-checks \
poll <pr-number> "$(cat "$TMPDIR/tend-update-sha")"
Before acting on findings, check for duplicates and existing work:
gh issue list --state open --limit 200 --json number,title
gh pr list --state open --limit 200 --json number,title,headRefName
That projection orients you; it does not clear a finding. It omits both states a prior rejection lives in — closed PRs, and the comment bodies of an open issue — so per finding, before writing code, run the searches under Fetch the prior rejection before re-deriving a fix in /tend-ci-runner:open-pr.
The default action is a PR, not an issue. If there's a plausible fix, make it — explain uncertainty in the PR description.
Group related findings by theme and complete the supported repairs. Record unresolved findings in the Step 9 summary.
For each finding:
/tend-ci-runner:fix-a-bug, run full test suite, commit, push per /tend-ci-runner:push-commits, create the PR per /tend-ci-runner:open-pr, then poll CI per /tend-ci-runner:monitor-ci. Complete the remaining work per Complete the task before ending the turn in /tend-ci-runner:run-tend; reviews arriving during verification follow /tend-ci-runner:push-commits. Every bug fix must include a regression test that would have failed before the fix. If a test is not feasible (e.g., pure documentation changes), note why in the PR description. When uncertain about the approach, explain the trade-offs in the description./tend-ci-runner:open-pr) — design questions, problems needing maintainer input, or findings requiring investigation beyond what the survey can provide.Not run by default. Only run a step here when the project's running-tend skill explicitly enables it.
Keep the project's changelog up to date with recent changes. The running-tend skill specifies the changelog file and the branch to push to.
Report: commits reviewed, files surveyed, findings, actions taken, assessment (clean / minor issues / needs attention).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub max-sixty/tend --plugin tend-ci-runner24 skills in this plugin
/act-in-other-reposAct in another repository. Use before filing an issue, commenting, or contributing anywhere other than this repo./check-requester-accessCheck a requester's access tier. Use when a request aims you at someone else's work — close, lock, label, revert, dismiss, push./code-reviewStructured second pass over a diff — correctness and cleanup angles, a verify pass, ranked findings returned to the caller./continue-prContinue an unfinished PR with no human author, including red CI and unresolved findings after a prior response or review./dismiss-approvalDismiss a standing bot approval. Use when you conclude that a PR the bot approved should not merge./fix-a-bugWrite a code fix for a bug. Use before writing any fix, whichever workflow you are running.Other plugins' skills for the same job