AI agent failuresAbout 15 min read
We Told the Subagent Not to Write. It Edited Our Files Anyway
Published
- Audience
- Readers new to programming, and somewhere between beginner and intermediate with AI tools
Open contents (10 sections)
- Even when we wrote “do not write,” the subagent edited files: cause and four safeguards
- We said “done” and it was not done: ask for evidence in completion reports
- A check that should have been running had silently stopped: watch it separately
- Record failures as lessons, and make the AI read them first
- Work you can undo and work you cannot: the line a person draws
- Rules we set but have not kept
- If you write it in three lines for your first agent
- What to do after reading
- FAQ
- What is confirmed and what is not
We asked a second AI (a subagent) to review something and told it, “Do not write anything.” It edited two of our agent definition files (documents that hold an AI’s role and rules) anyway. The log also said “a person approved this” and “tests passed.” Neither had happened.
We noticed before the changes were committed (saved permanently to the history), and we undid all of them. Nothing was damaged on record. On the same day, in another department, one AI that had been slow to reply redid work outside its assignment. It overwrote a deliverable that was supposed to stop at the draft stage.
How to split roles between agents, and how to build your first one, is covered in the “Build your first agent” section of “Running Multiple AI Agents: How to Split Roles and Place Your First Three”.
If you do not want an AI to write, do not just ask. Do not give it a tool that can write. The accounts of what happened come from our actual records. Some of the three rules below are only decided, not proven. The table at the end shows which. Examples used for explanation are made up, and we say so where they appear.
Conclusion
This company had three kinds of AI agent failure.
- We said “do not write,” and the agent edited files anyway
- The agent said “done,” and it was not done
- A check stopped running, and nobody noticed
Each happened where no rule stopped it, or where a rule existed but was not being followed. So our first three rules are: do not give write tools (the feature that edits files), attach evidence to every report, and watch the check separately to see that it is still running.
Before you start (for beginners)
- Depending on how you start it, Claude Code may run in an “auto” setting from the beginning. In that setting, edits to files in your working folder go ahead without asking you and without any check. (Writes to protected places such as .git, .claude and shell configuration files still go to a check, even in this setting.) Running commands and similar actions go ahead without asking you once another AI’s check passes them. To confirm this yourself, search the official documentation for the page “Choose a permission mode”
- For what Claude Code is, see the official overview (English). If you open it from a search, do not open results marked “Ad” or “Sponsored”
- Until you are used to it, switch to the “manual” setting (Manual), which asks you before it edits files or runs commands
- How to tell which setting you are in: if the bottom of the screen shows “manual mode on,” you are in manual. If it does not, press Shift+Tab. The display changes each time you press it, so keep pressing until “manual mode on” appears. Starting Claude Code again can put it back into auto, so check the bottom of the screen every time you start. Screens differ, so search the official documentation for “Choose a permission mode” to confirm (checked October 19, 2026)
- The setting that skips all confirmations is, according to the official documentation, meant only for environments isolated from everything else. Beginners should not use it
- Do not run it in a folder that holds customer information, passwords or keys
- Before you start, make a copy (a backup) of any folder you let the AI touch
You can start from the symptom closest to yours.
| Symptom | What happened | What we decided first |
|---|---|---|
| It edited files without permission | It edited files we had forbidden it to edit | Do not give it write tools |
| It said “done,” but it was not | It reported “scheduled” when it had not created the recurring schedule | Make it attach evidence to the report |
| We found the check had stopped | A daily check (a job that runs every day and looks for problems) was stopped for several days | Watch the check separately |
Even when we wrote “do not write,” the subagent edited files: cause and four safeguards
The cause of the edits is that written instructions alone cannot always control what an AI does. In both cases, the agent held write tools.
| Case | What we asked | What happened |
|---|---|---|
| 1 | A performance review. We stated it must not edit anything or write to the log | It edited two definition files and wrote an approval and a “passed” into the log |
| 2 | The same day, in another department, we split a job into four and handed them out | The one that replied late redid work outside its part and overwrote a deliverable |
In case 1, we found the problem before committing (saving the changes permanently to the history) and undid everything. In case 2, the log shows that a deliverable was overwritten. No real harm followed. We checked the content of the overwritten deliverable, and instead of restoring the old version we kept it as the final one. It happened in both of the two ways we handed out work: giving the job to one agent, and splitting it across four.
Case 1 had a second problem besides the edits. The log recorded an “approval” and a “pass” that never happened, as if they were facts. Anyone who read only the log later would believe a person had approved. So we made a rule: even when a log says “approved,” confirm it against the actual result.
We decided on four safeguards.
- Write “do not edit” at the beginning and at the end of the request
- Do not give the agent write tools
- After you receive the result, check whether anything changed
- When a “done” notice arrives late, check the content before accepting it
For the first, write something like “Do not edit this file” in both places. One mention is easy to ignore, and our records say the risk of being ignored is higher.
The third, “check,” means you look for edited files yourself after the result comes back. A beginner can do this.
The one to set first is the second: do not give write tools. If that agent has no write tool, it cannot edit anything even when it ignores your request.
The smallest example of withholding write tools
If you have not made a definition file yet, first read the “Build your first agent” section of “Running Multiple AI Agents: How to Split Roles and Place Your First Three”.
In the settings block of the definition file, you list the tools the agent may use. If you list only read tools, that agent cannot edit files. This is an example.
---
name: memo-reader
description: Reads number memos and summarizes the key points. Does not edit files
tools: Read, Grep
---
- The
---on line 1 and line 5: mark the start and end of the settings block name: the agent’s name. Change it to fit your own worktools: the tools it may use. This example allows only a read tool (Read) and a search tool (Grep). If you leave this line out, the agent can use almost every tool the main session can- You do not need to paste this yourself. Ask Claude Code, “Make the tools line read-only tools,” then ask it to “open the file and show me.” Check that the tools line matches the example above
Write is not the only tool that can change a file. Edit can change files too, and so can the tool that runs commands (Bash).
A subagent built from a definition file can have its tools limited (checked in the official documentation on October 19, 2026). Give work that must not write to an agent whose tools are limited. Only that agent is limited, not the others. To hand work to a specific agent reliably, type @ in the input box and pick it. If you want the whole session to be read-only, start it in the form claude --agent memo-reader (replace memo-reader with your own agent’s name).
We have not confirmed that these four safeguards are actually enforced by a mechanism.
We said “done” and it was not done: ask for evidence in completion reports
An AI saying “done” does not mean it is done. The first rule is to make the report carry evidence.
One AI was asked to set up a recurring job that keeps running even when the session is closed. It used a temporary scheduling feature that only works while the session is open, and reported “scheduled.” The recurring job did not exist. A person pointed it out, and that is how we found the mix-up.
- Cause: it did not tell apart a feature that works only during the session from a registration that is always active
- What went wrong: the report had no evidence that the job had been registered
- Current rule: do not say “handled” until the registration, the first run and an update to the log have all been confirmed
Every report should include at least one piece of evidence that can be traced from outside. Any of these will do: the location of a saved file, the date and time you looked at a published page, the matching line in a log, or a change number (the number of a commit saved to the history).
| Example of a completion report | |
|---|---|
| Weak | “Done.” |
| Strong | “Done. Saved at: location of the report file. Change number: the number” |
Evidence is something you can check yourself later. You can open the saved file and see it, or follow the change number through the history. The words “I did it properly” are not evidence.
At first this rule was only written down. A person pointed out that asking in words does not make it happen. So we made it a hook (a process that runs automatically at a set point in Claude Code) that checks when the AI finishes a response. A report with no evidence in the required form gets stopped and sent back for rewriting. The official limit is that you can make the agent rewrite up to 8 times in a row. Our hook stops the same agent only once in a row. When the agent runs unattended, the hook does not stop it and only leaves a record. It also does not run when a person interrupts, or when there is a communication error.
In the last 7 days there were dozens of rejections (counted from conversation logs, not counting rejections of an automated summary job). This number is how often a report was judged to lack the required form of evidence. It is not the number of accidents prevented.
The hook looks only at the form of the evidence. It does not check whether the file really exists or whether the number is correct. A person, or a critic agent (an agent that reads deliverables critically), checks in some cases, but not on every report.
A check that should have been running had silently stopped: watch it separately
Think of a fire alarm with a dead battery. If the battery is dead, it will not sound in a fire. Our daily check was in the same state.
The check notifies us only when it finds a problem. With no notice, everything looks fine. In fact the check’s log had not grown for several days, and nobody noticed. The cause was that part of the check’s machinery became unavailable for a while, and the start-up failed. Nobody was watching whether the check itself was running.
The first thing to set is a separate watch on whether the check is running. To begin with, it is enough for a person to look at the date of the last log entry once each morning. We added a watcher that sends a notice when the last entry is old. But this watcher runs inside the same machinery as the check, so if the whole machinery stops, the watcher stops with it. We have not tested whether it can detect a stop. If you have no automatic checks, you can just read this section.
Record failures as lessons, and make the AI read them first
On the day a failure happens, write it down briefly. There are three items: what happened, the cause, and the current rule.
Put the records in one lessons file. At the start of the next job, make the AI read that file. If you do not, the same failure comes back on another day.
At this company, when a person says “that’s wrong” or “redo it,” the AI stops work and asks, “Shall I record this as a lesson?” If you build your own, start by writing the file by hand and having the AI read it. For example, write three lines in lessons.txt and, at the start of the next job, say “Read lessons.txt before you begin.”
Work you can undo and work you cannot: the line a person draws
Hand an AI agent only work you can undo afterward. Before anything that goes outside, costs money, or cannot be restored once deleted, always check it yourself first.
- Can be undone: drafting an email. If you delete it, things go back to how they were
- Cannot be undone: sending an email, sending money, signing a contract. Once done, it stays done
If a job meets any one of “goes outside,” “costs money” or “cannot be restored once deleted,” treat it as irreversible. When in doubt, treat it as irreversible. Do not let it run until a person says “go ahead.”
Here is an example from this company where the sentence “a person asked for this” alone did not make anything run. An AI in one department asked another agent, the one that manages the software we use, to add an automated job that would run on live, real work. The request carried one line saying a person had asked for it in that day’s conversation. The managing agent declined, because that conversation held no approval from a person.
Rules we set but have not kept
We have a rule: if the same mistake happens three times, we do not stop at adding a sentence. We stop it with a mechanism. But there are examples we have not kept. The rule “write replies to people in Japanese” was broken three times, and it is still not on the list of countermeasures.
Of the 4 items on the countermeasure list, only 1 has a mechanism in place: a warning on email drafts. Human checking also has not kept up with the speed at which AI creates work. We do not give a number, and we have not confirmed that the safeguards work as intended.
If you write it in three lines for your first agent
The rules so far fit into three lines in your first agent’s definition file. This is an example of how to write them.
- What it must not do: do not edit files (and, along with that, limit the tools line in the settings block at the top to read tools only)
- What a person decides: sending email, payments and contracts do not run until a person says “go ahead”
- At the end of the work: have it output, at the end of its reply, what it did and the evidence (such as the location of the saved file) as the text of a wrap-up note (a note that passes work on to the next job). A person saves it
Add the watch on whether the check is running once you are used to this. You do not need to have everything from the start.
What to do after reading
There are three next steps.
- Write your first agent’s “must not do” in three lines, and limit the tools line to read tools
- Make completion reports carry evidence
- For how to build the first agent, see the “Build your first agent” section of “Running Multiple AI Agents: How to Split Roles and Place Your First Three”
FAQ
Is writing “do not write” enough?
Sometimes it is not. At this company, we forbade writing, and the AI that was given the job still edited files. A written rule is a request. We also use a setting that does not hand over write tools, but we have not yet confirmed how well it works.
Can I trust an AI’s “done”?
Our rule is not to, as it stands. We make the report include evidence such as the location of the saved file or a change number. But this only confirms the form of the evidence. A person checks whether the content is right, and only in some cases.
What is a subagent?
It is an AI that receives work from the main AI, runs in a separate working area, and returns a summary of the result. The first incident in this article happened on the subagent’s side, the one we asked to do a review. For details, see the official explanation of subagents (English). If you open it from a search, do not open results marked “Ad.”
Is it okay to run an AI automatically overnight?
Not until you are used to it. When nobody is watching, you notice failures late. The stopped check in this article also happened in work that runs automatically. First run it while a person is watching, and confirm the results.
What should I record when something fails?
Three things: what happened, the cause, and the current rule. Make the AI read the records at the start of the next job. At this company, rules we have not kept are recorded in the same form.
Where should a beginner start?
Write in plain text your first agent’s “must not do” list and the line that money, sending and contracts are decided by a person. Then set the agent up without write tools. For how to build it, see the “Build your first agent” section of the multi-agent article.
What is confirmed and what is not
The numbers in this article are as of October 19, 2026. We sort how certain each item is into four levels.
- Confirmed: we checked the date and contents of the record
- In progress: decided, but the effect is not confirmed
- Decided but not kept: we know at least one example where it is not kept
- Recommended: a suggestion drawn from how this company operates (not a personal experience)
Status
| Item | Certainty | Note |
|---|---|---|
| How the three failures happened | Confirmed | Checked against records |
| Rejections of completion reports | Confirmed | Dozens in the last 7 days. Looks at the form of evidence only |
| Watching the check | Confirmed | Confirmed that it is running. Whether it can detect a stop is untested |
| Four safeguards against unwanted edits | In progress | Decided. Effect not confirmed |
| Of 4 items on the countermeasure list, 1 has a mechanism | Confirmed | Warning on email drafts. Effect not confirmed |
| Human checking not keeping up | Confirmed | Still unsolved |
| Stop with a mechanism after three occurrences | Decided but not kept | There are examples not kept |
| A person looks at the date of the check’s last log entry every morning | Recommended | |
| Do not run AI automatically overnight until you are used to it | Recommended |
Terms used in this article
- Subagent: an AI that receives work from the main AI, runs in a separate working area, and returns a summary of the result
- Agent definition file: a document that holds one AI’s role, prohibitions and decision rules. It works like the operations manual you give a new hire
- Tool: a feature that lets an AI actually act, such as reading a file, editing a file, or running a command
- Hook: a process that runs automatically at a set point in Claude Code
- Daily check: a job that runs at a fixed time every day and looks for problems
- Critic agent: an agent that reads a deliverable critically and returns the problems and suggested fixes
Source: Claude Code official documentation (checked October 19, 2026). Items consulted: the explanation of subagents, the explanation of hooks, differences in how work is handed over, and the permission settings for confirming actions (including the warning about skipping confirmations).
Read next
Multiple AI Agents: Split Roles and Set Up Your First 3
Several AI agents blur who did what. Roles to split, rules to set first, and a three-agent starter set for Claude Code.