

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: AGENTS.md
incomplete
2: Rule Precedence
incomplete
3: Writing an AGENTS.md
incomplete
4: AGENTS vs. README
incomplete
5: Updating Rules
incomplete
This lesson's interactive features are locked, please to keep using them
In a large project, you might store agent rules in several places:
AGENTS.mdAGENTS.md in a subdirectory for a specific package~/.config/opencode/AGENTS.md on your machineThose rules are all combined into your agent's context window. OpenCode doesn't throw out one set of rules just because another exists.
You can put AGENTS.md files in subdirectories within your project, and they'll be loaded dynamically when the agent reads files in that directory. Say you have a monorepo with the following rules files:
AGENTS.md # root-level rules
packages/api/AGENTS.md # API-specific rules
packages/web/AGENTS.md # web-specific rules
The root AGENTS.md is always part of the initial instructions, but OpenCode only loads packages/api/AGENTS.md once the agent successfully reads a file or lists a directory inside packages/api/. It then adds those rules to the session once and keeps them for the rest of the conversation.
We have a monorepo at Boot.dev, and we use nested AGENTS.md files for our frontend, backend, and course content directories. No sense injecting a bunch of frontend-specific rules into context when a session only cares about backend code.
Give OpenCode parser-specific instructions.
Tell OpenCode to run and submit the CLI tests from the project root.