Instructions
Put standing instructions in AGENTS.md and they apply to every task in that directory.
# AGENTS.md
Run `make check` before saying a change is done.
Prefer `edit_file` over rewriting a file.
Commit subjects are imperative; the body explains why, never what.
Instructions tell the planner how work is done here. To run a command of your own when something happens, rather than to ask the planner for it, see Hooks. For a whole procedure the planner loads only when the task calls for it, see Skills. For a kind of delegate the planner can hand a sub-task to, see Delegate definitions.
The thirteen sources
| File | Applies to |
|---|---|
~/.bravebot/AGENTS.md | every project |
~/.bravebot/projects/<id>/rules.md | the project you are working in |
~/.bravebot/skills/<name>/SKILL.md | every project |
~/.bravebot/agents/<name>.md | every project |
~/.bravebot/rules/<name>.md | every project, every turn or once a file its paths match is touched |
<workspace>/AGENTS.md, else CLAUDE.md, else .claude/CLAUDE.md | this project |
<workspace>/.bravebot/skills/<name>/SKILL.md | this project |
<workspace>/.claude/skills/<name>/SKILL.md | this project |
<workspace>/.agents/skills/<name>/SKILL.md | this project |
<workspace>/.bravebot/agents/<name>.md | this project |
<workspace>/.bravebot/rules/<name>.md | this project, every turn or once a file its paths match is touched |
<workspace>/<directory>/AGENTS.md | this project, once a turn has worked in that directory |
<workspace>/<directory>/.bravebot/skills/<name>/SKILL.md | this project, once a turn has worked in that directory |
And no others. There is no search of parent directories. A rule that walked upwards would pick up instructions from whatever happened to be above a project on this machine, which is a different set of instructions on the next machine. A file at any other path is an ordinary file, read only when something asks for it by name, or when the source points at it.
A name counts only when the file is spelled exactly as shown. AGENTS.md, CLAUDE.md and
.claude/CLAUDE.md are matched letter for letter, including the .claude directory, on every
system. On a volume that does not tell upper and lower case apart, such as the default one on macOS
and Windows, a page called docs/agents.md can be opened as docs/AGENTS.md, but it is still an
ordinary file: it is not loaded, it adds nothing to the system prompt, and you are not told it is
large. Rename it to AGENTS.md to make it instructions. A rule the planner proposes for every
project is not written to a ~/.bravebot/agents.md either (Memory). The same
holds for a skill: a directory holding skill.md is not a skill, and SKILL.md must be spelled
that way.
A project's skills are read from three directories, at the project root only.
.agents/skills, then .claude/skills, then .bravebot/skills, so a skill in .bravebot/skills
wins a name clash with either of the others. Skills you wrote for another agent work here without
being copied or symlinked. Your own ~/.claude/skills and ~/.agents/skills are read only for a
directory you name in sharedSkillDirectories in ~/.bravebot/settings.json; a project's settings
file cannot name one. ~/.bravebot/skills is read without being named, and a skill in it wins a name
clash with a skill in a directory you named.
A directory the session has worked in adds its own. Once the planner has read a file in
packages/api/, or written one, the AGENTS.md in packages/api/ and in each directory above it
down from the project root follows the project's, the deeper last so it wins, and so do the skills
under .bravebot/skills there; a skill of the same name replaces the project's. The next turn
picks it up, not the one that read the file. Each goes through the same trust check as the project's
own file, and one that fails it is left out with a notice naming the file. A pointer or an @path
import inside a nested file is not followed. A nested file whose text equals the source loaded
immediately before it, or that is the same file as that source (for example AGENTS.md linked to
agents/AGENTS.md), is left out with no notice, so the same text is not stated twice in a row. A
nested file that repeats only an earlier source is kept, so the deepest file still has the last
word. Only .bravebot/skills is read below the root, not .claude/skills or .agents/skills. A
directory is counted when a file is read or written in it, not when it is only listed or searched,
and a session remembers up to 64 of them until /cd moves the project.
A rule file loads when a turn touches a file it names. A convention that applies to one kind of
file, in any directory, does not have to be in every request. Put it in
.bravebot/rules/<name>.md (or ~/.bravebot/rules/<name>.md for every project) with a paths list
in its frontmatter:
---
paths:
- "**/*.rs"
- "Cargo.{toml,lock}"
---
Run `cargo clippy` before saying a Rust change is done.
The rule stays out of the system prompt until the planner has read or written a file one of the
globs matches, or you name one with @. It is then added before the next request, after
everything else in the prompt, and stays for the rest of the session. The prompt tells the planner
that the mode and any words you gave on the command line stand where a rule disagrees with them.
You are told once which rule was added and which file matched it. A glob with no / matches a file
name at any depth, as in *.rs, and one with a / is read from the project root. A leading /
or ./ names the project root's own files, so /Cargo.toml is the one beside .bravebot, and a
glob ending in / names everything below that directory. The
globs are the ones list_files takes: *, **, ? and {a,b}, with no [abc]. A rule with no
paths is in every turn, after the AGENTS.md of its own directory, and paths: [] never loads.
Only a name the planner typed to a file tool or you typed after @ counts. A name a listing, a
search or a command printed does not. Each rule file goes through the trust check and the deny
rules like AGENTS.md: a project directory you have not vouched for is reported with a count, and
no name or text. The session remembers up to 1024 touched files, and /cd starts with none. A
resumed session has the touched files and the rules it was told of from the session's record, so the
nested instructions and path-scoped rules an earlier turn loaded are in force from the first turn.
The project's file is looked for under three names, and the first that exists is the one. Not all three: a repository holding two of them holds one set of instructions under two names, and reading both would say everything twice in a system prompt that goes out afresh every request.
~/.bravebot is .bravebot inside the home directory the environment gives, and there is no
fallback. When there is no home, or the name is empty, everything kept there is absent. Nothing is
guessed and no other location is tried. Daemons and containers run without a home, and everything
kept there is optional, so absence is a case to do without rather than a reason to refuse to start.
HOME is what names it. Stock Windows sets no HOME, so there USERPROFILE is read after it and
the first of the two that is set wins: that is the platform stating where the profile is, the same
thing HOME does on Unix, rather than a guess past an answer. BRAVEBOT_HOME, holding an absolute
path, names the directory itself ahead of both. See
Configuration for the rest of what lives in that directory.
Note the two roots are spelled differently. Your own skills and delegate definitions sit directly
beneath ~/.bravebot; a project's sit under a dotted .bravebot directory rather than at the root
where AGENTS.md sits. A skill is a directory because it has other material to keep beside its
instructions; a delegate definition is one file, so agents/ is flat.
A file that only names another is followed
An instructions file under 500 bytes that names another file is followed to that file, and that file
is what reaches the planner. Repositories supporting several agents often keep one real document and
point the other names at it. An AGENTS.md holding nothing but
Refer to canonical agent instructions in `.claude/CLAUDE.md`.
loads .claude/CLAUDE.md.
Length is the whole test. Anything past 500 bytes is a document that happens to cite other files, so it is read as itself and its citations are left alone. Following the first name in a real conventions file would swap your instructions for whatever they mentioned in passing.
Once, not twice: what the named file names in turn is not followed. The pointer is opened by the same route as any other path, so confinement and the trust map decide whether it may be read at all, and a pointer naming something outside the workspace is refused there.
A file a deny rule covers is left out of the turn, whether the
project's instructions file is that file, points at it, or is a link to it. You are told it was left
out.
Splitting a long file with @path
In the project's instructions file, a token that begins with @ and names a markdown file is
replaced by that file's text:
Follow the style rules in @docs/style.md before writing any code.
The path is relative to the file the token is written in. Imports inside imported files are expanded too, to four hops. A token inside backticks or a fenced code block is left alone, and so is a token naming a file that does not exist.
Each import is read by the same route as a pointer, so confinement, the trust map and deny rules
decide. An import that is outside the project, denied, untrusted, part of a cycle or nested too
deeply stays as written, and you are told which file and why. ~/.bravebot/AGENTS.md is not
expanded.
Words from the command line
--append-system-prompt
adds its words as a source that is not a file. It is read last, after the project's
AGENTS.md, so where the two disagree the words win. It is held by the running process, so it is in
every turn of the run and in the stored session of none: resuming without the flag runs without it.
--system-prompt replaces the opening of the system prompt and nothing after it. The instructions
for reading a tool's output, the facts about where you are working, the mode and the goal are still
sent, because other guarantees rest on them. Neither flag is read through the trust gate, since
there is no file behind them. --append-system-prompt "$(cat x)" therefore gives the file's bytes
your authority.
What wins
The project has the last word. Sources are read least specific first: your own directory before the
project, both AGENTS.md files reaching the planner in that order, and a project skill replacing
a global one of the same name. It is the same "most specific wins" rule the trust map uses for paths.
Shadowing by name rather than merging is what lets a project override one skill without restating the
rest.
A directory opened with /add-dir during a session adds no standing instructions and no skills,
whatever it contains. Opening a directory to read one file out of it should not change how every
later turn behaves.
Where they end up
What is resolved goes into the system prompt, not into the conversation. A session running many turns carries one copy of its instructions however long it runs, rather than a copy per turn crowding out the task. The one standing text kept in the conversation is the names of your own skills and the project's skills that the listing leaves out, which are said once per session in a single message.
Sources are resolved afresh every turn, so editing AGENTS.md mid-session takes effect on the next
thing you send. A source that is not there is not an error. No AGENTS.md, no skills directory, no
user directory at all: each is the ordinary case and offers nothing.
Size
Because every request carries them, a long instructions file costs its length on every turn of the session. Two fixed figures apply to sources that have passed the trust gate, and both only ever warn: a source is never dropped or cut short for its size.
| Over | What happens |
|---|---|
| 16384 bytes in one file | The file loads, and you are told which file it is and how big |
| 32768 bytes across all sources | You are told the total, once, at the source that crosses it |
AGENTS.md is 41232 bytes, and every request this session sends carries it
However large a file is, it still reaches the prompt. Half a conventions document is worse than a whole one that cost a sentence to say so: the rules that happened to be in the second half would be gone with no sign of it, and the first half would read as the whole.
Both the figures and the notices concern files that are there. A nested AGENTS.md left out for
repeating the source loaded immediately before it adds nothing to the total and is not named. A
source that is absent is still silent. The size notices depend on a byte count only, and whether a
file loads depends on the trust check. The one comparison of text is the skip of a repeated nested
file above, which runs on text that has already passed the check. --append-system-prompt is not
measured, since there is no file behind it.
Where you are working
The system prompt also states a handful of facts about your machine, so the planner does not have to run a command to learn them:
| Line | Value |
|---|---|
| Working directory | The absolute path of the workspace root |
| Is a git repository | Whether this tree or a directory above it holds a .git |
| GitHub CLI (gh) on PATH | Whether gh is installed, looked up on $PATH the way a run would |
| Jenkins CLI (jk) on PATH | Whether jk is installed, looked up the same way |
| Platform | macos, linux, or whatever this build runs on |
| OS version | The kernel release string on Unix, as uname reports it. On Windows, the three numbers a build is named by |
| Shell | $SHELL, or /bin/sh when that is unset or empty |
| Today's date | The current UTC date, as YYYY-MM-DD |
| Scratch directory | Whether this session has a directory to itself, and what it is for. Its path is not in the system prompt: a message at the start of the conversation names it, because the path changes with every start |
| Front end | One sentence naming the terminal client, the desktop app, or an editor that hosts the session, set by the program you started it from. Not stated for a one-shot or goal run |
The working directory is an absolute path, so on most machines it contains your username, and the scratch path may too. The OS version names your build. All of it is part of every request this session sends, the scratch path in the conversation and the rest in the system prompt, and there is no setting that withholds any of it.
Nothing else about your machine is added. No environment variables beyond $SHELL, no hostname, no
username on its own, no file contents, no directory listing.
They are labelled as facts about the machine rather than as instructions. One of them asks something
of the planner as well, and only because a probe found what the request names: the scratch directory
is stated with what to put in it. Nothing is asked on the account of the rest. What an installed gh
is for is said too, just outside this block, and below is what it says. So is
what to do when something a program needs is missing.
The date is stated because a model's sense of it comes from its training and is wrong by however long
ago that was. The rest is stated because discovering any of it otherwise costs a run, and a run
costs two approvals rather than one: you approve the command, then its output comes back quarantined
and the planner has to ask to be shown it. A planner that does not know its own working directory
reaches for pwd and spends that whole exchange on a value already on your screen at every run
prompt.
This block is composed afresh every turn like the sources are, so /cd
is followed and the next turn states where the session went.
The scratch directory
The scratch directory line names a directory this session has to itself, created as the session opens in the
system temporary directory rather than anywhere in your project. It is where a file the work needs on
disk but nobody is asking to keep belongs: output to grep through, an archive to look inside. Written
into the project instead, that file is one a build, a test run, a git add -A and a reviewer each
have to deal with, and one somebody has to remember to delete.
It is removed when the session ends, with everything written in it, and a session that carries on
from another is given its own. A program started by run reads the same
path from BRAVEBOT_SCRATCH_DIR. A session that could not be given a directory says so and runs
without one, and the line is then absent rather than naming somewhere that is not there.
A delegate is told a directory of its own and not the session's: a subdirectory of the session's,
made as the delegate starts and removed when it ends, so two delegates started together do not write
the same file. A program a delegate runs reads that one from BRAVEBOT_SCRATCH_DIR, and the
delegate's system prompt says the directory is its alone. A delegate that could not be given one keeps
the session's, and is told that other delegates write there as well and to put a unique id in every
file name. A delegate can still read or write another delegate's directory if it names the path.
It is stated because no run could discover it: nothing names that directory but this program, and a
planner never told of it puts an intermediate file in the project instead. Reaching it grants nothing.
A file there is read and written by its absolute path, but it prompts exactly when a file in the
workspace would, and neither /add-dir nor /cd will take it. See
Trusted directories.
Something a program needs is missing
Where the session has a scratch directory, the planner is also told what to do when a program fails because something it needs is missing from your machine. It checks whether something installed can stand in, with a command that only reads, runs on the program's own interpreter or runtime, and answers by its exit status. Where something can, it writes what connects the two in a new directory inside the scratch directory, and runs the program again with that directory on a search path the program reads from its environment in addition to its own, set in front of it for that one command. It tries this before asking you to install anything or to edit the program. The program, your machine and your settings are left as they were, and what was written goes with the session. Where nothing installed can stand in, the planner says what is missing and what provides it.
The paragraph names no language, package or variable, so the same road is open to any of them. Only the new directory goes on the search path, because the scratch directory may hold other files the session put there. You approve each of these commands as you would any other. A session with no scratch directory is not told any of this, and neither is a delegate.
The GitHub CLI
Where gh is on your $PATH, the block says so and adds the commands that read a GitHub URL:
gh pr view, gh pr diff and gh issue view, through run, with
--comments for what a review said. Paste the URL of a pull request and that is one approval for
exactly the diff, where fetch_url fetches the page around it.
Both come back quarantined, so either way a processor reads the answer out; the difference is that
one of them carried the page to say it. The .diff address of a pull request is worse than that: it
redirects to another host, and an approval for github.com does not carry to wherever a fetch went
next, so it is refused unless a
rule names that host too.
Whether gh is installed is all this looks at. Whether you have logged in with it cannot be told
without a request, and none is made before your first turn, so the paragraph names fetch_url as
what to fall back to when gh fails for that reason.
A delegate is told the fact and not this paragraph. It has no
fetch_url at all, and run only if its kind reaches programs, so a sentence choosing between the
two would send it after a tool it was not given.
The Jenkins CLI
Where jk is on your $PATH, the block says so and adds the commands that read a Jenkins build,
through run: jk run view for the result and the stages, jk log
with --tail, --grep or --step for the console log, jk test report for the tests and
jk run ls for recent builds of a job. Each returns the part you asked for, where
fetch_url fetches the page around it.
Whether you have logged in with jk is not looked at, since that cannot be told without a request.
Where jk fails for that reason the planner says so and names jk auth login as what signs it in. It
does not fall back to fetch_url, because a Jenkins server that asks for a login refuses a fetch too.
A delegate is told the fact and not this paragraph, for the
reason given under The GitHub CLI.
Trust
~/.bravebot is trusted by provenance: it is your own directory, on the same footing as the
configuration that picks the model and the endpoint. Putting a file there is the grant, and an empty
directory offers nothing.
A project's own AGENTS.md is different. It is workspace content, so it is read through the
trust map like any other file. It loads when you vouched for the
directory and is left out when you did not:
AGENTS.md was not loaded: this directory is not trusted
2 skills in .bravebot/skills were not loaded: this directory is not trusted
1 delegate definition in .bravebot/agents was not loaded: this directory is not trusted
A source that fails the trusted-content gate is dropped entirely, never quarantined. A reference to an instruction is no use to anyone: an instruction is either followed or absent, and one from a directory nobody vouched for has to be absent.
What was skipped is counted, never named. A directory in an untrusted project can be given a name that reads like an instruction, and that name would otherwise be on your screen as though the agent had written it.
A skipped skill directory is left out of that count only when a skill with the same directory name,
from a more specific root you vouched for and that is read later, takes its place. A built-in skill,
one in ~/.bravebot and one from a less specific root do not cover it, so it is still counted.
The notice is said when it is learned, before the first request goes out, rather than when the turn ends. A turn that fails or is cancelled has already told you what it was working without.
The environment lines do not go through this gate, and cannot be refused by it. There is no file behind any of them: the working directory is where you pointed the session, the scratch directory is one this program created empty, and the rest comes from the kernel and this process's own environment, which is the same provenance a command you typed rests on. Nothing read out of the workspace may join that block, which is the whole reason it can skip the gate.