Skip to content

The maintainer loop

repo-steward inbox is one long-running process. Every sessions.poll_seconds (30 at RetroSpeedLab) it polls its sources, starts the next session when none is running, and checks the open pull requests. Every change to its state runs on one thread, so the console, the sessions and the polls never race.

flowchart LR
    console[Console request or reply] --> queue
    bugsink[Bugsink alert] --> queue
    queue[One queue] --> session[Session as the agent user]
    plans[Next open plan step] -- when the queue is empty --> session
    session --> checks[Checks from the rules file]
    checks --> review[Codex's review]
    review --> pull[Pull request]
    pull --> gate{Merge gate, every 2 minutes}
    gate -- green, approved, no owner path, no quiet window --> merged[Squash merge]
    gate -- red --> retry[Closed, back to the queue with its logs]

Where work comes from

Source What it becomes
A request from the console A new thread and its card; a reply in the thread continues the work
An open GitHub issue by repository.owner with the repository.issue_label label An instruction every session reads first
A red CI on main The next most important work, with the failed steps of its log
An open Bugsink issue A card of its own, and a session that fixes it
An open step of a Kanso implementation plan One session and one pull request per step, when nothing else waits

Only one session runs at a time. While one runs, the next request waits in the queue and its card says ⏳ Queued.

A session

A session is one Claude Code run in the agent's checkout, on a fresh branch named {branch_prefix}{timestamp}, for example maintainer/2026-12-03T0910. Its prompt holds your product brief, the team's instructions, the red CI on main, the steward's own open pull requests, and the checks to pass. The agent gets the shipped skills (fix-a-bug, ci-triage, focused-tdd, systematic-debugging and more) plus your own from repository.skills, and reads the folders in sessions.readable. It has sessions.minutes to commit a change with a test and write its report.

Sessions run as the agent user through the deploy/sandbox wrappers. The agent clones only the steward's bare mirror, never sees the GitHub token, and cannot push: the steward pushes the reviewed commit itself.

Checks, then Codex

When the session ends with a commit, the steward checks it before anyone opens a pull request:

  1. A report. A session without a report is dropped: the report becomes the pull request's description.
  2. The checks again. Every command of the ## Checks section of your rules file on main runs again, exactly as listed, as the agent user. One failure drops the commit.
  3. Codex's review. Codex reviews Claude's commit, read-only, against a JSON verdict schema. Every commit is Claude's, a Bugsink fix included, and every review is Codex's. A rejected commit is dropped, and its reason goes back to the next session.

An approved commit is pushed, and the pull request opens with the approval of that exact commit in its body. The card shows 🔀 Opened and your phone gets a push. A dropped commit is retried once with its reason; a second failure in a row asks you on the card with 🧑 Needs the owner.

The merge gate

Every two minutes the steward looks at its own open pull requests, those whose branch starts with branch_prefix. It squash-merges one and deletes its branch only when:

  • CI passed on its head commit;
  • the head commit was approved: the body names an approval of exactly that commit, so a commit pushed later is never merged unreviewed;
  • no quiet window is open;
  • no owner path is touched. A pull request that changes a path starting with one of repository.owner_paths, such as .github/ or deploy/, waits for your merge, and its thread says so.

A pull request whose CI fails is closed, its branch deleted, and its thread queued again with the failed steps' logs, so the next session fixes the cause. When the failure has nothing to do with the change, the session is told to fix the tests or the CI setup instead.

Plans

Between requests, the steward works your Kanso implementation plans through kanso-runner. A plan is a file docs/<name>-implementation-plan.md on main with a ## Steps list; each numbered or bulleted item is one step, and items tagged (owner) are left to you. A plan with only a ## Design gets a first session that splits it into steps.

Every five minutes, when no request waits, no session runs, no quiet window is open and no usage limit holds, the steward takes the next open step and starts a session on it. The session implements exactly that step and removes it from the plan in the same commit. The next step waits until that pull request is merged. A step that fails twice pauses its plan with a card that names the step and the last failure.

You steer the plans from the console with three commands, sent like a request:

Command Effect
pause plans No plan session starts until you resume
resume plans Plan sessions start again
work on <name> The plan docs/<name>-implementation-plan.md goes first, also after it paused

With plans.hold_url set, the steward asks your backend before each plan session and holds back while it answers {"paused": true}.

Limits and quiet windows

  • Usage limits. When Claude or Codex reports a usage limit, the sessions pause until its reset plus five minutes, or for an hour when the reset is unknown. Cards show ⏸️ Paused for the usage limit until ….
  • Quiet windows. quiet.starts lists daily start times in UTC, and quiet.minutes how long each lasts. No merge and no plan session starts inside one, so a nightly job runs undisturbed. Requests from the console still run.

Bugsink alerts

With a bugsink section, every open issue in your Bugsink projects becomes a card with a short summary. A Claude session with the Bugsink tools fixes it, its request names the issue and holds the stack trace of the newest event, and Codex reviews the commit. The pull request names the issue. The card stays until Bugsink resolves the issue: an issue of a project in bugsink.server_projects when its signal clears, any other once a merged pull request names it. An issue that comes back shows ♻️ Regressed.

Issues of server projects get no stack trace and are not named in a pull request: their cause is on a server, such as a full disk or a stopped service, so the session repairs them with the ops tools.

Server repairs through ops-gate

With an ops section, Claude's sessions get the verbs of your ops-gate table (ops.table on main) as tools, and reach servers only through them, over SSH with the config mounted at /ops/ssh_config. Read verbs run at once. A destructive verb becomes a proposal: the card shows Approve and Deny, and the step runs once, only with the signature your backend gives after you approved it there. A merge that changes the verb table asks you to enable the new verbs on each host the same way. See the console for how an approval reaches the backend.