Metadata-Version: 2.4
Name: repo-steward
Version: 0.1.0
Summary: An AI maintainer that runs your repository: requests from Discord, plans worked one pull request at a time, two models reviewing each other, CI deciding
Keywords: ai-agents,claude-code,codex,maintainer,discord,github,kanso,automation
Author: datenwissenschaften
License-Expression: MIT
License-File: LICENSE
License-File: src/repo_steward/skills/LICENSE-caveman
License-File: src/repo_steward/skills/LICENSE-ponytail
License-File: src/repo_steward/skills/LICENSE-superpowers
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: No Input/Output (Daemon)
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Typing :: Typed
Requires-Dist: cachetools>=6,<9
Requires-Dist: claude-agent-sdk>=0.2.175,<0.3
Requires-Dist: httpx>=0.28,<1.0
Requires-Dist: kanso-runner>=0.1.0,<0.2
Requires-Dist: loguru>=0.7,<1.0
Requires-Dist: ops-gate>=0.1.0,<0.2
Requires-Dist: pydantic>=2.10,<3.0
Requires-Dist: pyyaml>=6.0,<7.0
Requires-Dist: sentry-sdk>=2.20,<3.0
Requires-Dist: tenacity>=9,<10
Requires-Dist: typer>=0.15,<1.0
Requires-Python: >=3.12, <4.0
Project-URL: Repository, https://github.com/datenwissenschaften/repo-steward
Project-URL: Used by, https://github.com/datenwissenschaften/retro-speedlab-suite
Description-Content-Type: text/markdown

# repo-steward

![Two AI maintainers at a workbench: one tends the branches, the other reviews and gives a thumbs up, and the CI light is green](https://raw.githubusercontent.com/datenwissenschaften/repo-steward/main/assets/banner.webp)

[![CI](https://github.com/datenwissenschaften/repo-steward/actions/workflows/ci.yml/badge.svg)](https://github.com/datenwissenschaften/repo-steward/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/repo-steward.svg)](https://pypi.org/project/repo-steward/) ![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

**An AI maintainer that runs your repository.** You talk to it in Discord, it works your plans one pull request at a time, two models review each other, and CI decides what merges.

- **You steer from your phone.** Each request in the Discord channel gets its own thread and a card with *Work on it*, *Done, check again* and *Dismiss*. Replies in the thread continue the work.
- **Your plans move while you sleep.** Between requests it takes the next open step of your [Kanso](https://github.com/datenwissenschaften/kanso) implementation plans, one session and one pull request per step, through [`kanso-runner`](https://pypi.org/project/kanso-runner/).
- **Nothing merges on one model's word.** Claude Code writes and Codex reviews the exact commit against a JSON verdict schema, the other way round for the alerts Codex fixes. A rejected commit is dropped, and its reason goes back to the next session.
- **CI decides.** It squash-merges only a green pull request whose head commit was approved. A red one is closed, and its failed steps' logs feed the retry. Pull requests that touch your owner paths, such as `.github/` or `deploy/`, wait for your merge.
- **It respects your limits.** A Claude or Codex usage limit pauses the sessions until the reset. Quiet windows hold merges and plan sessions while other jobs run.
- **Optional:** [Bugsink](https://www.bugsink.com) alerts become cards it fixes, and server repairs run through [`ops-gate`](https://pypi.org/project/ops-gate/): read verbs at once, destructive ones only after you press *Approve*.

## Used in production by RetroSpeedLab

[RetroSpeedLab](https://www.retrospeedlab.com) is a game studio run by AI agents ([suite](https://github.com/datenwissenschaften/retro-speedlab-suite)). Its maintainer is repo-steward: it keeps the search, the stream, the website and the lakehouse running, fixes Bugsink alerts and works the suite's plans. Its real configuration is the worked example here: [`steward.yaml`](examples/retrospeedlab/steward.yaml) and the product brief [`brief.md`](examples/retrospeedlab/brief.md).

```text
owner    → #maintainer: "The HUD clock is too small on the stream"
steward  → opens a thread: 🔧 Working on it
Claude   → commits the fix with a test on maintainer/2026-12-03T0910
steward  → runs every check of AGENTS.md again, as the agent user
Codex    → APPROVE: "the clock scales with the overlay and the test covers it"
steward  → 🔀 Opened …/pull/412; once CI is green: 🔀 Merged
```

## How it works

```text
Discord ─┐                        ┌─ Claude Code session as the agent user, with the shipped and your own skills
Bugsink ─┼─▶ inbox ─▶ one queue ─┤        │ commit + report
plans   ─┘     │                  │        ▼
               │                  └─ checks from your rules file ─▶ the other model's review ─▶ pull request
               └─ every 2 minutes: CI green + approved head + no owner path + no quiet window ─▶ squash merge
```

- `repo-steward inbox` is the long-running process: Discord, alerts, plans, cards and merges.
- `repo-steward run` is one scheduled session on the most important work, for a cron.
- `repo-steward ask --message "…"` is one session on a request.

Sessions run as a separate `agent` user through the [`deploy/sandbox`](deploy/sandbox) wrappers, so the agent never sees the steward's tokens; the steward pushes the reviewed commit itself. [`deploy/Dockerfile`](deploy/Dockerfile) builds that image.

## Configure

One YAML file, passed with `--config` or `REPO_STEWARD_CONFIG` and validated once at start. Unknown keys and missing values stop the steward. `${NAME}` reads an environment variable, so private ids stay in your vault:

```yaml
repository:
  name: your-org/your-repo
  owner: your-github-login          # its open issues with the label become instructions
  issue_label: maintainer
  branch_prefix: maintainer/
  owner_paths: [.github/, deploy/, AGENTS.md]
  rules: AGENTS.md                  # its "## Checks" section lists the commands every commit must pass
  brief: docs/steward-brief.md      # what the product is and what matters most, in your words
  skills: null                      # or a folder of your product's own skills
git: {name: Your steward, email: steward@your-domain.example}
sessions: {model: opus, summary_model: haiku, minutes: 90, poll_seconds: 30, readable: []}
quiet: {starts: ["01:35"], minutes: 45}
backend: {url: https://api.your-domain.example, record_runs: false}
plans: {hold_url: null}
discord: {channel: "${DISCORD_CHANNEL_ID}", owner: "${DISCORD_OWNER_ID}"}
bugsink: null                       # or {url, team, server_projects}
ops: null                           # or {table: deploy/ops/verbs.toml}
```

Secrets come from the environment: `GITHUB_TOKEN`, `DISCORD_BOT_TOKEN`, `BACKEND_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, and `BUGSINK_API_TOKEN` with Bugsink. `BUGSINK_DSN` reports the steward's own errors. Codex signs in once inside the container with `codex-as-agent login --device-auth`.

**Backend.** Discord delivers button clicks to an HTTPS interactions endpoint, so the steward needs a small backend you host. Each call carries `X-API-Key: $BACKEND_API_KEY`:

| Call | Purpose |
| --- | --- |
| `GET /maintainer/actions?wait=20`, `DELETE /maintainer/actions/{id}` | the owner's clicks, recorded by your Discord interactions endpoint |
| `POST /maintainer/ops-proposals`, `GET /maintainer/ops-proposals/{id}/approval` | destructive steps the owner approves, signed with `ops_gate.approval.sign_run` |
| `PUT /maintainer/runs/{name}` | run statistics, only with `record_runs: true` |
| `GET <hold_url>` answering `{"paused": true}` | an optional switch that holds plan sessions back |

RetroSpeedLab's backend implements it in its suite, in `src/retrospeedlab/backend/maintainer`.

## Claude Code plugin

The steward's generic skills (fix-a-bug, ci-triage, focused-tdd, systematic-debugging, ponytail-review, ops, owner-request and more) also work in your own Claude Code sessions:

```text
/plugin install repo-steward --marketplace datenwissenschaften/repo-steward
```

Vendored skills keep their licences: [superpowers](src/repo_steward/skills/LICENSE-superpowers) (MIT, Jesse Vincent), [ponytail](src/repo_steward/skills/LICENSE-ponytail) (MIT, DietrichGebert) and [caveman](src/repo_steward/skills/LICENSE-caveman) (Apache-2.0).

## Development

```bash
uv sync && uv run ruff check && uv run mypy && uv run pytest
```

The acceptance scenarios in [`tests/features`](tests/features) describe the configuration and the merge gate in plain language.

MIT © Dr. Franke Datenwissenschaften OÜ. Built by [Dr. Franke Datenwissenschaften](https://www.datenwissenschaften.com): AI agents and data platforms that run in production.
