Claude Code reads CLAUDE.md, Codex and OpenCode read AGENTS.md. Both files exist so the agent knows the project's rules before it touches the code. What usually goes wrong is a third file next to them, the plan, and how it grows.
#Two files, one set of rules
AGENTS.md is a plain Markdown file in the root of the repository that agents read before work. Codex and OpenCode pick it up on their own. CLAUDE.md is the same idea for Claude Code: it is loaded at the start of every session.
Keeping two copies of the same rules is how they drift apart. Claude Code can import other files into CLAUDE.md with an @path line, so the simplest setup is one real file and one pointer:
@AGENTS.mdThat is the whole CLAUDE.md of the Treeyard repository. The rules themselves live in its AGENTS.md.
#What goes into the rules
| Put it in | Leave it out |
|---|---|
| The stack and its versions | What the agent can see in the code itself |
| Commands: install, run, test, lint, build | The plan and the list of tasks |
| Code style that isn't enforced by a linter | Who is doing what right now |
| What never to do: commit secrets, edit generated files, push without asking | The history of decisions as a log |
| Where the documentation is | Long tutorials: link to them |
The test for a line: does it hold for every task in this project? If it holds only for the current one, it belongs to the task, not to the rules.
#The third file: PLAN.md
Rules say nothing about where the project stands, so a PLAN.md or a ROADMAP.md shows up next to them. And then:
- it grows to thousands of lines, and the agent reads all of it in every session;
- the agent ticks its own boxes, and a ticked box doesn't mean the thing works;
- two agents edit the same file and know nothing about each other;
- your own steps, and everything that waits for a server or a payment provider, get lost among the items.
#Where the plan goes instead
Treeyard leaves the rules in AGENTS.md and moves the plan into a goal tree in .tree/. Each task is a Markdown file of its own, with a status, a “done when” and a journal. A session opened from a node gets that node, the path from the root to it, its neighbours and the project's rules, not the whole plan.
To make any session in the project aware of the tree, even a plain claude started in the folder, Treeyard adds a short block to whichever of CLAUDE.md, AGENTS.md and GEMINI.md the project has. A file that only imports another one gets the block through that import. Between the markers, it reads:
## Task tree
The project is run as a goal tree in `.tree/` (treeyard). Before any task, use the `treeyard` skill (not installed — `treeyard skills install`).
- Find the task's node (`treeyard show`) and stay on it; never edit `.tree/` by hand.
- Outcome — in the journal: `treeyard log <id> "what is done; what is left"`; criterion met — `treeyard set <id> status=review`. "Done" only when the person asks for it directly.
- A side idea is a new node with a short title (2–6 words): `treeyard add "…" --parent <id> --status idea`.
- To the person, name nodes by title, not by id; ids go in commands only.
- The tree is long — `treeyard show <id> --brief` or `treeyard find "…"`, not `head` and `grep`.Six lines instead of a plan. The rest the agent gets from its node.
Questions
Do I need both AGENTS.md and CLAUDE.md?
@AGENTS.md line.Should I delete my PLAN.md?
treeyard import has an agent read the project's existing plan and build the tree from it; after that the old file can go.Is the tree locked into Treeyard?
.tree/, committed along with the code, and .tree/README.md is an overview you can read on GitHub.