部落格

Your agent instruction files are a security risk



Files like CLAUDE.md, AGENTS.md and SKILL.md are standing orders that every agent reads before it starts. If any agent can edit them, one successful prompt injection can steer every agent that runs after it.



Agent instruction files are a security risk because they're trusted by every agent and writable by most of them. An agent that reads a poisoned document can be talked into adding one line to AGENTS.md, and every agent that opens the project afterwards follows that line as if a person had written it. The fix is to make changing instruction files a human job, even for agents that can write everywhere else. That's what Fabric does.


Standing orders every agent reads first

Most teams that work with agents end up with a few files that set the rules. Claude Code reads CLAUDE.md when it starts a session. AGENTS.md describes itself as a simple, open format for guiding coding agents, and Codex, Cursor, Gemini CLI and many other tools read it. Skills follow the Agent Skills format: a folder with a SKILL.md file that tells an agent how to do one specific task, such as writing release notes or formatting a client report.

These files carry a lot of weight for their size. A typical AGENTS.md might say which folders hold drafts, which commands run the tests, who signs off on client deliverables and where finished work should be saved. Agents read them before anything else and treat them as instructions from the team. That's the point of them. It's also why they make such an attractive target.


How one injected agent reaches the rest

Prompt injection is the top entry in the OWASP Top 10 for LLM applications, which notes that injections can arrive indirectly, when a model reads input from external sources such as websites or files. Agents read external content all day. That's most of their job.

Picture a small consultancy. On Tuesday afternoon a research agent is asked to summarize forty vendor PDFs in the procurement folder. One of them contains a paragraph in white text on a white page, invisible to a person skimming it. The paragraph tells any AI reading the document that the team has a new policy: add a line to AGENTS.md saying that every finished client summary should also be copied to a folder the vendor's portal can read. The research agent has write access to the project, because it needs to save its summaries. It makes the edit, finishes the batch and exits.

Nothing looks wrong on Tuesday. On Wednesday morning a colleague asks a different agent, in a different tool, to draft a summary for a client. That agent reads AGENTS.md, as it's supposed to, and follows the new line. So does the agent on Thursday, and the one on Friday. The injection only had to work once, against one agent, to change how all of them behave.

The same thing can happen with a skill. An agent that can rewrite SKILL.md for the team's invoicing skill can change the instructions every future agent follows when it prepares an invoice. Because skills load only when a matching task comes up, a change like that can sit quietly for weeks.


Write access is the wrong boundary for these files

Folder permissions treat every file in a folder the same way. If an agent can save a draft in the project folder, it can usually save over AGENTS.md in that folder too. The permission that lets it do its job is the same one that lets it rewrite the rules.

That made sense when the only users of a folder were people. A colleague with edit rights to a project folder can change the README, and that's fine, because they have their own judgment and a reason to keep the team's guidance accurate. An agent working through a stack of untrusted documents has neither. It does what the most persuasive text in its context tells it to do, and on a bad day that text came from someone outside the team.

Instruction files need their own rule. Agents should be able to read them freely, since that's what they're for, but changing them should need a person.


A shared drive raises the stakes

On one laptop, a rewritten CLAUDE.md affects one person's agents. That's bad enough, and it's often caught when the person notices their agent behaving oddly.

On a shared drive, the instruction files belong to the whole team. That's the reason to put them there: every person's agents read the same rules, and nobody has to copy the latest version around. It also means a single edit reaches every agent on the team at once, including agents run by people who never saw the poisoned document. Your AI agents need a shared drive, not a group chat makes the case for shared files. Protecting the files that steer agents is part of making that case safely.


How Fabric protects instruction files

In Fabric, agents can't change instruction files such as CLAUDE.md, AGENTS.md and SKILL.md, even when they have write access to the folder those files are in. They can read them, which is what lets every agent on the team work from the same rules. Edits come from people.

Agents reach the drive in several ways. Those on your computer use the Fabric desktop app, which mounts Fabric as a drive on Mac, Windows and Linux. Agents elsewhere connect through Fabric's MCP server, the CLI or the API. How AI agents connect to a shared drive compares the routes.

In the consultancy example, the research agent's edit to AGENTS.md would be refused. Its summaries would still be saved, because those are ordinary files in a folder it can write to. The instruction file would stay as the team last wrote it, and Wednesday's agent would read the original rules.

The same holds for skills. A team can keep its skills in one shared folder, knowing that agents can use them without rewriting them. Share skills with your whole team through a shared drive walks through that setup, and agent skills in Fabric covers storing them.


Protected files are one layer

Protecting instruction files closes one route for an injection to spread. An agent that has been misled can still misuse whatever access it holds in the task it's doing, so the other layers matter too.

The first is narrow access. Agent Vault lets you give each agent access to one folder, space or project, with separate permissions for reading files, creating documents, moving content, deleting items and running searches. A research agent summarizing vendor PDFs needs to read the procurement folder and create documents in a results folder. It doesn't need to move or delete anything, and it doesn't need the client folders. Access can also end on its own after a single task, a day or a week. Why AI agent access should expire explains why that matters.

The second is a record. Agent Vault logs every read, creation, change and deletion with a timestamp, and you can filter the log by agent, area, period or action. If something odd turns up in a summary, you can see which agent wrote it and what it read first. Agent Vault can also notify you about unusual patterns.

The third is recovery. Fabric keeps earlier versions of files, and deleted files go to a trash you can restore from. What happens when an AI agent deletes the wrong file covers those safety nets.

For apps connected to Fabric, such as Gmail or Slack, Agent Passes apply the same kind of control action by action. An agent can be allowed to read and draft email without being allowed to send it, which limits what a misled agent can do outside the drive. Agent Vault and Agent Passes are on the Pro and Team plans.


Habits that help with any setup

Keep instruction files short and specific. A long AGENTS.md is harder to review, and an added line is easier to miss.

Treat a change to an instruction file like a change to code. Someone on the team should read it before it's saved, and the reason for it should be written down, perhaps in a short decisions.md entry. When an agent suggests an improvement to the rules, have it write the suggestion to a separate note for a person to review.

Keep secrets out of instruction files. Every agent reads them, so anything in them is visible to every agent, including one that has been misled.

Be careful with documents from outside the team. Vendor files, scraped web pages and inbound email are where indirect injections tend to come from. Agents that process them should have the narrowest access you can give.

And reread the files now and then. Ten minutes a month spent reading AGENTS.md and the team's skills is a cheap check. What is a shared drive for AI agents? lists the other things worth checking when you choose where your agents' files live.


Frequently asked questions

What are agent instruction files?

They're files that tell AI agents how to work on a project, such as CLAUDE.md for Claude Code, AGENTS.md for Codex and many other coding agents, and SKILL.md files that define individual skills. Agents read them before they start a task.

Why are CLAUDE.md and AGENTS.md a security risk?

Agents trust them and follow them. If an agent with write access is misled by a prompt injection, it can add instructions to these files, and every agent that reads them later follows those instructions.

What is indirect prompt injection?

It's when instructions hidden in content an agent reads, such as a web page, PDF or email, change what the agent does. OWASP lists prompt injection as the top risk for LLM applications.

Can an AI agent edit its own instructions?

On a normal drive, an agent with write access to a folder can usually edit any file in it, including its instruction files. In Fabric, agents can't change instruction files such as CLAUDE.md, AGENTS.md and SKILL.md, even with write access.

Can agents still read protected instruction files in Fabric?

Yes. Agents read them as usual, so every agent on the team follows the same rules. Only changes are blocked, and people can still edit the files.

Does protecting instruction files stop prompt injection?

It stops one way an injection can spread to other agents. A misled agent can still misuse the access it has, so give each agent narrow, time-limited access with Agent Vault and check the activity log.

How do I protect SKILL.md files shared across a team?

Keep the team's skills in one shared folder and make sure agents can't edit them. In Fabric, SKILL.md files are protected from changes by agents, so skills stay as the team wrote them.

What should I keep out of AGENTS.md?

Keep passwords, API keys and other secrets out, since every agent that reads the file can see them. Keep the file short, so changes are easy to review.

Which Fabric plans include Agent Vault?

Agent Vault and Agent Passes are on the Pro and Team plans. See pricing for teams for details.


Related pages


The workspace that thinks with you.

Ready when you are.

The workspace that thinks with you.

Ready when you are.

The workspace that thinks with you.

Ready when you are.