Skip to content

Overview

gh-maintainer is an autonomous maintenance agent for the repositories of one GitHub user or organization. It runs as a Kubernetes CronJob every two hours, does one pass over your repositories, and streams every step live to a web widget and a desktop tray app.

It is built around guarded autonomy: routine, low-risk work happens on its own, and anything that could break a repository waits for a human.

For each repository that is not archived and not a fork, the agent runs three modules in order:

  1. Dependabot. It looks at every open pull request opened by dependabot[bot]:
    • A green patch or minor bump is squash-merged, pinned to the head SHA whose checks it just read.
    • A bump with merge conflicts gets an @dependabot rebase comment.
    • A bump with failing CI is handed to the fixer: headless Claude Code, sandboxed, at most one attempt per PR per 24 hours.
    • A major bump, an unparseable bump, or any PR with a non-Dependabot commit goes to the approval queue.
  2. Branches. Branches whose pull request was merged, and branches older than 90 days without an open pull request, are deleted. The default branch, protected branches and kept names are never deleted.
  3. Security. It collects Dependabot, code scanning and secret scanning alerts, checks repository hygiene, audits GitHub Actions workflows and, at most once per 24 hours per repository, runs trivy, gitleaks and osv-scanner on a fresh clone.

The user manual describes each module in detail.

gh-maintainer has four parts. Two run in your cluster, two run wherever you look at the results.

Kubernetes namespace gh-maintainer
+--------------------------------------------------------------------+
| |
| Agent (CronJob, every 2 h) ---- POST /events (bearer token) ---+ |
| | | | |
| | +-- failing Dependabot PR --> Claude Code (fixer) v |
| | | |
| | Status server (Fastify, | |
| | SQLite, SSE) <-------------+ |
| | | | |
+----|------------------------------------|-------|------------------+
| | |
v | v merge / comment
GitHub REST API <-----------------------+ (on Approve / Reject)
|
Ingress (TLS + basic auth): /, /state, /stream,
/approve/*, /reject/*, /assets/*
|
+-------------------+-------------------+
v v
Web widget (React) Desktop tray app (Tauri)
  • Agent. A Node.js CronJob (gh-maintainer-agent, schedule 0 */2 * * *). It reads the config from the ConfigMap gh-maintainer-config and its tokens from files under /secrets. It posts every step as an event to the status server. If the status server is unreachable, it writes the events to its log and keeps working.
  • Status server. A Fastify service with a SQLite database on a persistent volume. It stores events, runs, repositories, findings and approvals, serves a /state snapshot and a live Server-Sent Events stream at /stream, and serves the web widget. Approve and reject requests go through it: it re-checks the pull request on GitHub before it merges.
  • Web widget. A React page served by the status server. It loads /state, then follows /stream.
  • Desktop tray app. A Tauri app that shows the same widget in a window and the overall state as a coloured tray icon, with native notifications. See Desktop app.

Only the UI paths are exposed through the ingress, behind basic auth. The agent-only routes, such as /events, are reachable inside the cluster only.

These rules are enforced in code, not by configuration:

  • Dry run first. The shipped config has dryRun: true. Every write to GitHub becomes an action.would_* event, so you can watch a week of runs before anything changes.
  • Only clean Dependabot bumps merge on their own. The PR must be opened by dependabot[bot], every commit must be Dependabot’s, the bump must be patch or minor, all checks must be green, and GitHub must report the PR as mergeable (mergeable_state clean or has_hooks).
  • Merges are pinned. Every merge passes the head SHA whose checks were read. If someone pushes in between, GitHub refuses the merge and the PR waits for the next run.
  • AI fixes always need a human. A PR the fixer pushed to is never merged automatically, even after its CI turns green.
  • The fixer never pushes .github/. Workflow changes always need a human. The GitHub token has no Workflows permission as a second line of defence.
  • Secrets stay out of fixes. The fixer refuses any diff that contains one of the agent’s tokens.
  • Merging a major or unparseable version bump.
  • Merging a PR that contains any commit not made by Dependabot, including the fixer’s own commits and human edits.
  • Changing workflow files under .github/.
  • Deleting the default branch, a protected branch, main, master, develop, release/*, a branch in your keep list, or a branch with an open pull request.
  • Resolving security findings. gh-maintainer reports them; you fix them.

Approving from the widget is the only path to merge these pull requests, and the status server re-checks the PR before it merges.