ops-gate¶

Let an AI agent fix your servers without handing it a root shell.
An agent that runs production needs root for real work: read logs, free a full disk, restart a stuck app. Giving it sudo or a shell means one bad prompt can do anything. ops-gate gives the agent a short menu instead:
- Three classes of verbs. Read verbs run at once, repair verbs run within a rate limit, and approval verbs run only with a human's signed, single-use approval for that exact command on that exact server.
- One table, two fences. One TOML table defines every verb. The gate checks each call against it, and the sudoers rules are generated from the same table, so the two can never drift apart.
- Signed changes only. The agent can propose a new table, but it only takes effect once an approver signs the table that is merged on
main. - Small enough to audit. About 500 lines of Python with one dependency,
cryptography.
It keeps the servers of RetroSpeedLab, a game studio run by AI agents, healthy.
Quickstart¶
pip install ops-gate
ops-gate sudoers verbs.toml # the sudoers rules a verb table allows
On the server, the agent's SSH key may run only the gate, and every command it sends is checked against the table:
agent → ssh maintainer-ops@main "app-logs retro-speedlab-backend 120" # read: runs
agent → ssh maintainer-ops@main "prune-images 96" # repair: at most 3 an hour
agent → ssh maintainer-ops@main "restart retro-speedlab-maintainer" # refused: it may not restart itself
agent → ssh maintainer-ops@main "vacuum-journal 500M" # refused: needs approval
owner → approves in the maintainer's console; the backend signs "vacuum-journal 500M" for main, valid 14 minutes
agent → ssh maintainer-ops@main "vacuum-journal 500M approval=…" # runs once, then the token is spent
Next: Getting started installs the gate on a server step by step, Concepts explains the verb table, approvals, the updater and the generated sudoers rules, and the Reference lists every setting.