Mohamed Douare Logo

← Blog

Series: Software that acts · Part 7 of 12

The Risk Score: Setting an Agent's Level of Autonomy

In the previous part, we looked at how to guide agents, verify their work, and turn mistakes into lasting improvements through tests and rules.

There's still a practical question to answer: should a human really have to approve every change an agent proposes?

The answer obviously depends on what the agent is about to modify.

Automating everything or reviewing everything: two bad options

When I first started building my software factory, all changes were automatically pushed to the development branch. A simple spelling correction followed exactly the same process as a database migration.

It was convenient, but it didn't account for risk.

On the other hand, asking a human to approve every single change isn't a particularly good solution either. It creates constant interruptions, slows everything down, and eventually leads people to approve requests without giving them much thought.

So I went with a middle ground: assigning a risk score to every change.

The score determines one of three levels of autonomy:

  • Low-risk changes go through automatically.
  • Medium-risk changes require human approval.
  • High-risk changes are blocked.

The goal isn't to eliminate human involvement. It's to reserve it for situations where it actually matters.

A score based on measurable signals

The score is calculated by a script that compares the proposed change with the target branch and examines what it contains.

Each detected signal adds points to the score. The same signal is counted only once, regardless of how many files are affected. Most importantly, no AI is involved in this calculation. The rules are deterministic.

Think of it like airport security. The presence of liquids, sharp objects, or unusual baggage weight triggers additional checks. Some items can even prevent someone from proceeding altogether.

In my setup, the thresholds are:

  • Up to 3 points: the change goes through automatically.
  • Between 4 and 9 points: human approval is required.
  • 10 points or more: the change is blocked.

Here's what the scoring system looks like. You can try different combinations in the simulator to see how they affect the outcome.

  1. Automatic 0 to 3 points. The change goes through without human intervention.
  2. Approval required 4 to 9 points. The change waits for approval, and I receive a notification on my phone.
  3. Blocked 10 points or more. The change is rejected.
Figure 1. Select the elements present in a change and see the resulting risk level.

Two details are worth highlighting.

A database migration adds three points, but always requires human approval. A potential secret, on the other hand, immediately blocks the change. It doesn't matter how small the change is: a three-line secret is enough to stop the entire delivery.

Let's see what happens when we apply the scoring system to a real change.

A change with 13 points

On November 15, 2026, I used this mechanism on a real branch in my software factory. The change involved translating notifications into English.

It was fairly substantial: 1,269 lines changed, 66 files affected, and 8 repository areas involved.

The size of the change therefore added six points to the score.

One file had the word "guard" in its name, one of the terms monitored by the permissions and security signal. That added another three points.

An infrastructure file added two more points, and the delivery script itself added another two because it's part of the factory's safeguards.

That brought the total to 13 points.

With a score above 9, the change should normally have been blocked. Yet it was successfully merged. Here's why.

Measure before you block

The system has two operating modes.

ModeWhat it does
ReportThe score and its explanation are added to the change description and recorded in a log. The merge is not affected.
StrictThe score determines what happens next: human approval for medium-risk changes, automatic rejection for blocked changes.

Report mode works like a monitoring system: it shows what's happening without enforcing restrictions. Strict mode actually applies the rules.

The change with 13 points was evaluated in report mode. The score was calculated and recorded, but the merge wasn't prevented.

That's exactly why I introduced this mode: to observe how the system behaves before giving it the power to block changes.

This observation period also revealed a limitation in my approach. The permissions and security signal relied on file names rather than an actual understanding of their contents. The script had therefore assigned points based on an indicator that could be misleading.

I'd rather keep report mode running for a few weeks, review the results, and adjust the rules before enabling strict mode on a repository.

An automation system that blocks changes should prove itself reliable first.

Two rules that never change

Even though each repository can have its own settings, there are two restrictions I don't want to make configurable.

The first concerns the rules themselves. A repository can make security requirements stricter, but it can never weaken them. Otherwise, the agent writing the code could also modify the rules governing its own behavior.

The second is even simpler: no change can be merged automatically into the production branch. That step always requires a human decision.

A three-line change contains a secret key. What risk level does it receive?

Automatic, because the change is very small

Not quite. The size of a change says nothing about the severity of an exposed secret.

Approval required

Not quite. A potential secret requires more than an additional review.

Blocked

Exactly. A potential secret is worth 10 points and immediately blocks the change.

What to take away

  1. The score relies on measurable signals: up to 3 points, a change goes through automatically; from 4 to 9, it requires approval; at 10 or more, it's blocked.
  2. Report mode lets us observe the system without interfering, while strict mode actually enforces the decisions.
  3. It's better to measure and fine-tune the rules before giving them the power to block changes.

The risk score helps control what agents modify in the code. But it doesn't tell us whether an agent actually knows how to behave correctly. For that, we need another kind of verification: evaluations.

Mission 3: the delivery The agent has three changes to deliver. You set what passes alone and what waits for a human. Play →

Governance · Published on December 3, 2026Lire en français

Be told when the next part is out →

A question about this article? Send me an email, I answer.