Your AI agents have fewer rules than a pirate ship

Bartholomew Roberts' crew swore to written articles that limited their own captain. Most AI agents ship without even that page.

Around 1720, the pirate Bartholomew Roberts had a staffing problem. His lieutenant, Walter Kennedy, had just sailed off with their ship, a captured prize and most of the plunder while Roberts was away chasing another one. Roberts was left on a sloop with a small crew that had so far been, in the words of a 1724 history, "but as a rope of sand."

So they wrote articles, and every man swore to them. Each got a vote on anything important. Lights and candles out at eight. A fixed 800 dollars from the common fund for anyone who lost a limb. The musicians got Sundays off. The other six days and nights, they played on request.

The interesting part is how a ship like that treated its captain. In battle his word was final. The rest of the time, the same history says, the crew let him be captain "on condition, that they may be captain over him." Day-to-day discipline belonged to a quartermaster the crew elected. I had to look up what a quartermaster actually did. Short version: discipline, the loot, and most of the arguments.

The economist Peter Leeson later argued that written rules like these are a big part of why pirate ships worked at all. Note the order, though. Roberts' crew wrote theirs down after getting burned.

Most teams write the rules for their AI agents the same way. After the incident, if at all.

An agent is a model, a prompt, some tools and some credentials. Ask where those are written down. The prompt sits in a vendor dashboard. The tools are in a config file on one developer's laptop. The credentials are whatever token was handy that afternoon, often the developer's own. The owner is whoever built it, until they change teams. Nobody wrote the articles. The agent just started sailing.

We have done this before, with servers

Fifteen years ago, plenty of servers were configured by hand, at 2 a.m., by someone who has since left. Two "identical" machines drifted apart and nobody could say why.

Infrastructure as code mostly fixed that without asking anyone to be more careful. It moved the truth into a file: the configuration lives in the repository, every change goes through a pull request, and the running system is built from the file instead of from memory.

Agents are at the hand-configured stage now. Agents as code is the same move: whatever decides what an agent can do lives in a file next to its code, gets reviewed like code, and the runtime refuses anything the file does not allow.

Today: an agent's prompt, tools, token and owner are spread across a vendor dashboard, a developer's laptop, the developer's own admin token and whoever built it. As code: one file in the repository goes through pull-request review, is enforced on every tool call, and feeds an inventory of all agents.
Today, nobody can say what an agent is able to do without detective work. As code, the answer is one file, and the same file is what the runtime checks.

Write down what it can do, then make it a diff

The file isn't the prompt. The prompt says what you'd like the agent to do. The file says what it is able to do:

yaml code example
agent: support-triage
owner: support-platform team
purpose: label new tickets and draft replies
can_read:
  - tickets in the inbound queue
  - the customer record of the ticket it is working on
can_change:
  - labels on that ticket
can_send_data_to:
  - a draft reply to that ticket's customer
needs_a_person:
  - sending the reply
budget: 50 tool calls per ticket
review_by: 2027-03-01

In plain English: one owner, one job, the records it may touch, where data may go, the one action a person signs off, and a date to look again. A real file names tools and scopes; I wrote this one in English so you can read it. The format matters much less than having one.

Six weeks later, someone wants the agent to handle refunds. With a file, that request looks like this:

diff code example
 can_change:
   - labels on that ticket
+  - refunds on that customer's last order, up to $200
 needs_a_person:
   - sending the reply
+  - any refund over $50

That's the argument. A new power to move money arrives in a pull request, next to the code that uses it, and a reviewer approves it with their name on it.

Read the second added line carefully, though. Tickets are written by customers, so any customer can now try to talk the agent into a $49 refund, and a ticket can carry instructions as easily as complaints. Maybe that's an acceptable price. At least now it's a price somebody signed.

Without the file, the same power arrives as a wider API token or a checkbox in an admin panel, and nobody signs anything.

Checking the whole fleet at once

Once every agent has a file, you can ask questions about all of them. The most useful one comes from Simon Willison, who in 2025 named the lethal trifecta: an agent that reads private data, reads content an outsider can write, and can send data out. Each leg on its own is normal. All three together means a well-written email can talk your agent into mailing your data to a stranger.

Three overlapping circles labelled reads private data, reads outside content and can send data out. Where all three overlap, an orange area is marked as the lethal trifecta.
The lethal trifecta. Each circle alone is normal. The orange middle is where prompt injection turns into a data leak.

In dashboards the three legs live in three different places. With files, checking for all three is a short script in CI:

AgentReads private dataReads outside contentCan send data outResult
support-triagecustomer recordsincoming ticketsdrafts only, a person sendsOK
sales-researchCRM accountspublic web pagesany URL it fetchesFix
inbox-assistantall emailall emailsends emailFix

The second row is the sneaky one. Fetching a page is also a way to send data: a hostile page can tell the agent to fetch an address with your CRM data in the query string. Limit it to a search API that can't fetch arbitrary URLs, or keep it away from the CRM. For the third row, cut the easiest leg, sending: put a person in front of outgoing email, or only allow addresses listed in the file.

The trifecta is about leaks, by the way. Outside content plus a tool that moves money, like that refund, is a separate problem, and the same files let you check for it.

A file is a promise, not a lock

Even Roberts' rules leaked. The same history admits that the lights-out article did little to stop the drinking. A manifest that nothing checks is a wiki page with better indentation.

So the runtime has to compare every tool call with the file and refuse anything the file doesn't allow. The credentials should follow the file too. If the file says the agent reads tickets, its token reads tickets and nothing else. And no second way in: no spare shell, no other client holding that token. A check only covers the calls that go through it. I maintain Agent Guard, an open-source library for that enforcement step. Any layer that sits between the model and its tools and can say no will do the job.

Where teams usually get this wrong:

  • They write the file after launch, as documentation, and never open it again. If the runtime doesn't read the file, the file will drift.
  • They give the agent a developer's personal token. The file says "read tickets", the token says "admin", and the token wins.
  • No owner, no review date. Hackathon agents never die. They just stop being anyone's.
  • They review prompt changes carefully and tool changes not at all.

One thing worth understanding

An agent's prompt, plus everything it reads, shapes its intentions. Its tools and credentials set its capabilities. Attackers can change only one of those.

Tickets, web pages, emails and code comments all reach the prompt and context, which shape the agent's intentions. Only a reviewed pull request can change the file, which holds its capabilities. Every tool call passes an orange check that reads only the file.
Text can change what the agent wants. Only a reviewed change can change what it is able to do, and the check reads only that.

Prompt injection is an attack on intentions. Anyone who can put text in front of the agent can try to change what it wants, and nobody has a reliable way to stop that today. Capabilities are different. No email, however clever, can add a tool or widen a token, as long as capabilities live where text can't reach and a check enforces them on every call.

An agent is as safe as the worst thing it can do on its most confused day. You only know what that is if it's in a file a person reviewed and the runtime enforces.

So the next agent you build starts with the file, not the prompt. Who owns it, what it reads, what it may change, where data may go, which actions wait for a person. Put those lines in the repository before the first deploy, and make the runtime refuse everything else. The fleet checks come almost for free after that.

One last thing

By the time Roberts' crew stood trial in 1722, the signed original of the articles was gone. They had thrown it overboard. The 1724 history only knew some of the articles, pieced together from the pirates' own accounts.

For a crew, that was fine. Every man had sworn to it, and every man had a reason to hold the others to it.

Agents don't keep oaths. They don't even remember them between calls, and nobody on board is holding anyone to anything. So their file can't go overboard: the runtime has to read it every single time.