Getting started¶
This guide takes one repository from no maintainer to the first merged pull request. The examples use RetroSpeedLab's steward, which maintains the RetroSpeedLab suite; replace its names with yours.
What you need¶
- A repository with a rules file. Usually
AGENTS.md. Its## Checkssection lists every command a commit must pass, each in backticks: the steward reads them frommainand runs them again after every session. - A product brief. A Markdown file in the repository that says what the product is, which signals show it works, and what matters most. RetroSpeedLab's
brief.mdis a worked example. - A server with Docker and a reverse proxy that terminates TLS on the console's domain, such as
steward.retrospeedlab.com. - Accounts: a GitHub token for the repository, a Claude subscription for Claude Code, a ChatGPT account for Codex, and a Discord account to sign in with.
1. Build the image¶
The image holds two users: maintainer runs the steward, agent runs every session, check and review, so the agent never sees the steward's tokens. Pass the system packages your repository's checks need, or an empty string:
git clone https://github.com/datenwissenschaften/repo-steward
cd repo-steward
docker build --file deploy/Dockerfile \
--build-arg PRODUCT_PACKAGES="ffmpeg openjdk-21-jre-headless" \
--tag repo-steward .
The package is also on PyPI (pip install repo-steward), but the sessions need the agent user and the deploy/sandbox wrappers, which only the image sets up.
2. Prepare the workspace¶
The steward keeps its state, its bare mirror of your repository and the agent's checkout under /workspace. Give the folder to the maintainer user (uid 10001) and its agent subfolder to the agent user (uid 10002):
sudo install --directory --owner=10001 --group=10001 steward-workspace
sudo install --directory --owner=10002 --group=10002 steward-workspace/agent
3. Create the Discord application¶
The console signs you in with Discord OAuth2; no bot is involved.
- In the Discord developer portal, create an application.
- Under OAuth2, add the redirect
https://steward.retrospeedlab.com/auth/discord, that is{console.url}/auth/discord. - Note the client id and the client secret.
- Copy your own Discord user id (Developer Mode, then Copy User ID on your profile). It becomes
console.owner, the only account that may sign in.
4. Write the config¶
One YAML file, validated once at start: an unknown key or a missing value stops the steward. ${NAME} reads an environment variable, so private ids stay in your vault. Every key is explained in the configuration reference.
repository:
name: datenwissenschaften/retro-speedlab-suite
owner: datenwissenschaften # open issues by this login with the label become instructions
issue_label: maintainer
branch_prefix: maintainer/
owner_paths: [.github/, deploy/, AGENTS.md]
rules: AGENTS.md
brief: deploy/maintainer/brief.md
skills: null
git: {name: Speedlab maintainer, email: "${STEWARD_GIT_EMAIL}"}
sessions: {model: opus, summary_model: haiku, minutes: 90, poll_seconds: 30, readable: []}
quiet: {starts: [], minutes: 0}
backend: {url: https://api.retrospeedlab.com, record_runs: false}
plans: {hold_url: null}
console:
url: https://steward.retrospeedlab.com
owner: "${DISCORD_OWNER_ID}"
theme: null
bugsink: null
ops: null
With ops: null, record_runs: false and no hold_url, the steward never calls the backend, and BACKEND_API_KEY is not needed.
5. Set the secrets¶
GITHUB_TOKEN=... # pushes branches, opens, merges and closes pull requests, reads issues and CI runs
CLAUDE_CODE_OAUTH_TOKEN=... # from `claude setup-token`
DISCORD_CLIENT_ID=...
DISCORD_CLIENT_SECRET=...
DISCORD_OWNER_ID=... # read by ${DISCORD_OWNER_ID} in the config
STEWARD_GIT_EMAIL=... # read by ${STEWARD_GIT_EMAIL} in the config
CONSOLE_SESSION_SECRET=... # a long random string
VAPID_PRIVATE_KEY=... # the private key from `npx web-push generate-vapid-keys`
CONSOLE_API_KEY=... # a long random string for the producer API
A fine-grained GitHub token needs Contents, Pull requests and Issues (read and write where it pushes, merges and closes), and Actions (read) for the CI runs and their logs. A random string for the session secret and the API key:
python -c "import secrets; print(secrets.token_urlsafe(32))"
6. Start the steward¶
docker run --detach --name steward \
--env-file steward.env \
--env REPO_STEWARD_CONFIG=/config/steward.yaml \
--volume "$PWD/steward.yaml:/config/steward.yaml:ro" \
--volume "$PWD/steward-workspace:/workspace" \
--publish 127.0.0.1:8000:8000 \
repo-steward
Point the reverse proxy for the console's domain at port 8000. Then sign Codex in once for the reviews, with device code login enabled in your ChatGPT security settings:
docker exec -it steward codex-as-agent login --device-auth
The log ends its first round with Every poll step was answered.
7. Your first request¶
- Open
https://steward.retrospeedlab.comand sign in with Discord. - Install the console as an app from the browser menu, and press Notify me to get pushes. On an iPhone, pushes need the app on the home screen.
- Write a request, for example The HUD clock is too small on the stream, and send it.
A card appears with š§ Working on it. When the session ends, the steward runs your checks again, Codex reviews the commit, and the card shows š Opened with the pull request. Once its CI is green, the steward squash-merges it and the card shows š Merged. The maintainer loop explains each step.
Scheduled and one-off sessions¶
Besides the long-running inbox, two commands run one session and exit, for example from a cron:
repo-steward run --config steward.yaml # the most important work of the repository
repo-steward ask --config steward.yaml --message "ā¦" # one request
RetroSpeedLab runs repo-steward run every three hours next to the inbox. Only one session runs at a time; a second one started meanwhile logs Another maintainer run is active and ends.