# Agent rules

One set of instructions for every agent, in every tool and on every machine, instead of a rules file per tool.

This is a recipe from flie: a person can read it first, and an agent follows
it. It makes one folder in the person's flie, with a README in it that holds
the rules, so every agent that opens the folder later works the same way.

## 1. Make sure flie is set up

If the `flie` command is not found or `flie whoami` says nobody is signed in,
and you have no flie tools over MCP, set flie up first, with the person's
authorization, by following https://flie.sh/setup.md
Then come back here.

The steps below are `flie` commands. Over MCP, call the tools of the same
names, with the same arguments written as named arguments, and pass a file's
text as `content` instead of `--from`.

## 2. Make the folder

`flie whoami` prints the person's Root folder. Make the folder there unless
the person names another place. If a folder called "Agent rules" is already
there (`flie agent list <root ID>`), use it: read its README and follow it
instead of starting again.

    flie agent mkdir <root ID> "Agent rules"

Each command prints the new item's name and its ID; every later command names
the item by that ID. Laid out, the folder is:

    Agent rules/
      README.md              the rules
      how we write code.md   one file per topic
      how we test.md

## 3. Write the README, then start

Write this README into the folder, adapted where the person says so, with the
text on stdin:

    flie agent create --from - <folder ID> "README.md"

~~~markdown
# Agent rules

The rules every agent follows when working for <the person's name, or their
team's>, whatever the tool. Repositories point here instead of keeping their own copy.

- One file per topic, named for what it covers: "how we write code.md",
  "how we test.md", "how we review.md".
- Each rule is one line, an instruction, with the reason when it is not obvious.

## Rules about these rules

- Read every file here before you start work.
- When the person gives you a new standing instruction, add it to the file it
  belongs in, and tell them you did.
- Rules that apply to one repository only stay in that repository.
- Where two rules disagree, ask the person which holds, then fix the other.
~~~

Then create how we write code.md and how we test.md the same way.

Find the rules files in this repository (AGENTS.md, CLAUDE.md, .cursorrules, .cursor/rules/, .github/copilot-instructions.md) and merge what they say into the topic files now. Where two rules disagree, leave both out and ask the person which holds. Keep anything that applies to this repository only where it is. Then show the person the change you would make to the repository’s rules files, the line below in place of the rules you moved, and make it once they agree.

Every rule in those files ends up in exactly one place: a topic file, this repository (if it applies here only), or the list of disagreements you give the person. Don’t drop any. In your reply, list the disagreements and the repository change you propose.

## 4. Add one line to the repository

Add this line to the repository's AGENTS.md, or to CLAUDE.md if that is the
file it has, with the folder's real ID in place of fld_…:

    Read and follow the rules in the flie folder "Agent rules" (fld_…) before you start; its README says how.

If it has neither, create AGENTS.md with just this line. Tell the person, since
the change is theirs to commit.

## Done

Tell the person what you made and give them the folder's link
(`flie agent link <folder ID>`).
Editing its README changes the rules for every agent that reads it. How to
change a file without losing anyone's edits: https://flie.sh/skill.md.
