---
title: "YOLO Mode Safely: 5 Rules for AI Coding Agents | AgentRQ Blog"
url: https://agentrq.com/blog/yolo-and-auto-mode-safety-rules-for-ai-coding-agents
description: "Five rules the AgentRQ team follows before YOLO or auto mode: protect main, a separate machine, strong CI, a scoped GitHub token, read-only SQL."
---

[Back to Blog](https://agentrq.com/blog/)

November 4, 2026 | AgentRQ Team

# YOLO Mode Safely: 5 Rules for AI Coding Agents

We run coding agents in [YOLO mode](https://agentrq.com/features/yolo-mode) and auto mode every day. They write most of the code and content on this site, they open their own pull requests, and nobody sits in front of them approving each shell command. It works because we decided ahead of time what an agent is allowed to break.

YOLO mode turns off the question "may I run this?". Something else has to take over that question's job. These are the five guardrails that do it for us. Each one takes minutes to set up, and together they turn "the agent might do anything" into "the agent can open a pull request and read the data you allowed".

![Five guardrails for YOLO and auto mode: protect main, a separate machine, strong CI, a scoped GitHub token and read-only database access](https://agentrq.com/assets/blog/yolo-auto-mode-safety-rules-og.png)

## 1. Do Not Allow Direct Pushes to Main

Turn on branch protection, or a ruleset, for your default branch. Require a pull request before merging, block force pushes and block deletion.

This one rule changes what a mistake costs. An agent that pushes straight to main ships its bug to everyone who pulls, and maybe to production. An agent that can only push a branch produces a pull request, and a bad pull request is just one you close.

It also makes agents easier to work with. Each task becomes a branch, and each branch becomes a diff you can review, comment on and throw away. Our agents' instructions say "always use a branch, never push to main". The ruleset makes sure it happens even when an agent forgets.

## 2. Give Agents a Machine Without Access to Production

Do not run a YOLO agent on the laptop that holds your SSH keys to production. Give it its own machine: a spare computer, a VM or a cloud box, with no SSH config for your servers, no cloud admin credentials and no production database URLs in the environment.

In YOLO mode the agent runs every command it decides on, including the ones a prompt injection talked it into. A web page, an issue or a README can contain instructions the agent reads and follows. On a machine that can reach production, that risk is real. On a machine that cannot, the worst case is that you wipe a box you were ready to wipe anyway.

AgentRQ [Machines](https://agentrq.com/features/machines) were built for this. Install `agentrqd` on the computer you set aside for agents, enrol it once, and start coding agents on it from any browser, with the live terminal in front of you. The agent works on that machine, and your own machine and its keys stay out of reach.

## 3. Let High-Quality CI Do the Reviewing

When nobody approves each step, the pipeline has to check the result. Every agent pull request should go through CI that the agent cannot skip:

- → **Tests with coverage.** Run the full suite and report coverage for the lines the change adds, not only the overall number. We ask agents for 100% coverage on new lines in every PR description.
- → **Image generation.** For anything visual, have CI render screenshots or previews, so you review what the change looks like as well as what the code says.
- → **QA.** Linting, type checks, link checks and an end-to-end pass on the real app. This site's pre-commit hook lints every generated page and blocks the commit on errors.

Make the important checks required in your branch protection, so a red pull request cannot be merged. Strong CI is what lets you merge an agent's work with confidence after reading only the diff and the reports. AgentRQ [workflows](https://agentrq.com/features/workflows) can chain these steps across workspaces, so one agent's pull request can start a review agent or a QA agent.

## 4. Use a Fine-Grained, Limited GitHub Token

Do not hand an agent your personal token or a classic token with the `repo` scope. Create a **fine-grained personal access token** for the agent:

- → **Limit the repository list.** Choose "Only select repositories" and pick the repositories the agent works on. Every other repository in your account or organization becomes invisible to it.
- → **Limit write access to pull requests and content.** Grant **Contents: Read and write** so it can push branches, and **Pull requests: Read and write** so it can open and update PRs. Leave everything else off, especially **Administration**, so the agent cannot change the branch rules from rule 1, and **Workflows**, so it cannot edit the CI from rule 3.
- → **Set an expiry.** A short-lived token that you rotate is one less secret to worry about if the agent's machine is ever compromised.

This is where the first four rules work together. The token can push, but only to branches, because main is protected. It can open pull requests, but it cannot merge past required checks, and it cannot touch the rules that protect them.

## 5. Give Database Access Read-Only, With PII Filtered First

Agents are good at answering questions from your data, and sooner or later you will want to let one run SQL. Do not paste a database URL into its environment. Put an MCP server in between, such as [SQL MCP](https://github.com/tmphost/sql-mcp), and connect it to the database as a **read-only user**.

- → **Read-only, enforced by the database.** Create a user with `SELECT` grants only. Then a `DROP`, `UPDATE` or `DELETE` fails at the database, whatever the agent was told to run.
- → **Filter PII first.** Before the agent gets any access, mark the columns that hold personal data: emails, names, phone numbers, addresses, tokens. SQL MCP rejects any query that touches a marked column and tells the agent why, so it rewrites the query without them.
- → **Keep large results out of the context.** SQL MCP saves big result sets as a short-lived CSV and gives the agent a preview and a link, so a large query does not fill the agent's context.

Do the PII step first, not later. Once a row of personal data is in an agent's context, it can end up in a log, a summary or a pull request description, and you cannot take it back.

## YOLO When Needed, but Stay Safe

None of this makes YOLO mode risk-free. It makes the risk small and easy to undo. With these five rules in place, the worst an agent can do is open a bad pull request on a machine you do not care about, in a repository it was allowed to see, after reading data with the personal fields removed. Your CI will tell you the pull request is bad before you read a line of it.

Inside that boundary, let the agent run. And where you still want a human to answer, AgentRQ lets you turn on [YOLO mode per task](https://agentrq.com/blog/what-is-yolo-mode-and-how-to-turn-it-on-in-every-coding-agent) instead of for a whole session, so the tasks you trust run without stopping and everything else still asks you first, on your phone, the web or Slack. Our [YOLO mode guides](https://agentrq.com/guidelines/yolo-mode/) show how to turn it on in each coding agent.
