Switching to Mercury from another coding agent
If your repository already has instruction or rule files written for another coding agent, you do not need to rewrite them before opening Mercury. With briefs.profile set to auto (the default), Mercury reads those project files on its own until you add a MERCURY.md.
Which files Mercury loads on its own
Mercury walks the project's instruction chain: the working directory and the folders above it, stopping below your home folder. When no MERCURY.md stands in that chain, Mercury loads every supported instruction and rule file it finds there, none shadowing another, identical text loaded once, outermost folder first.
Guides follow their @ imports just as MERCURY.md does. Within a folder, guides load in the order of the table below, before Mercury's own rules and the personal layers.
| If your project has | What Mercury does with it |
|---|---|
AGENTS.md, .agent/AGENTS.md, .agents/AGENTS.md |
Loads as a project guide in the first request, following @ imports, when no MERCURY.md stands in the chain. |
.agent/rules/**, .agents/rules/** (.md, .mdc) |
Loads as project rules under auto when no MERCURY.md stands in the chain. |
CLAUDE.md, .claude/CLAUDE.md |
Loads as a project guide in the first request, following @ imports, when no MERCURY.md stands in the chain. |
CLAUDE.local.md |
Loads as the project's personal layer when no MERCURY.md stands in the chain. |
.claude/rules/**/*.md (paths) |
Loads as rules: a rule with no paths in the first request, a rule with paths attached on matching files. |
GEMINI.md, .gemini/GEMINI.md |
Loads as a project guide in the first request, following @ imports, when no MERCURY.md stands in the chain. |
.github/copilot-instructions.md |
Loads as a project guide in the first request, following @ imports, when no MERCURY.md stands in the chain. |
.github/instructions/**/*.instructions.md (applyTo) |
Loads as rules by applyTo: ** or **/* in the first request, a file pattern on matching files, description with no applyTo as one offered line, neither field as manual. |
.cursor/rules/** (.mdc, .md: alwaysApply, globs, description) |
Loads as rules by frontmatter: alwaysApply: true in the first request, globs on matching files, description without globs as one offered line, none of the three as manual. |
.cursorrules |
Loads in full in the first request when no MERCURY.md stands in the chain. |
.windsurf/rules/**/*.md, .devin/rules/**/*.md (trigger, globs, description) |
Loads as rules by trigger: always_on in the first request, glob on matching files, model_decision or agent as one offered line, manual never sent automatically. |
.windsurf/global_rules.md, .devin/global_rules.md, .windsurfrules |
Loads in full in the first request. When both global_rules.md files exist, only .devin/global_rules.md loads. |
.clinerules (one file or a folder of .md files), .cline/rules/**/*.md (paths) |
Reads only the nearest folder that has them. A standalone .clinerules or a rule with no paths loads in the first request; a rule with paths attaches on matching files. |
If COPILOT_CUSTOM_INSTRUCTIONS_DIRS is set (a comma-separated list of folders, with relative entries measured from the working directory and ~/ as your home folder), Mercury loads AGENTS.md and .github/instructions/**/*.instructions.md from those folders with your own instructions before the project's, measuring applyTo patterns from the working directory, including in an untrusted folder. Under a MERCURY.md of a trusted project, or under the native profile, the variable is not read. A folder already on the working directory's chain adds nothing.
How rule scopes map
Each rule reaches the model as its own tool scopes it:
- Always: sent in the first request. Covers Cursor
alwaysApply: true,.github/instructionsapplyToof**or**/*, Windsurftrigger: always_on, a Cline or Claude Code rule with nopaths, and standalone files such as.cursorrules. - Scoped to files: nothing is sent until
Read,Edit,Write,Grep,ChangeSetorAstEdittouches a matching file; then the rule attaches once with the files it governs. Covers Cursorglobs,.github/instructionsapplyTo, Windsurftrigger: glob, and Cline and Claude Codepaths. - Offered by description: one line naming the file and its description is added at the foot of the instructions, and the body is sent only when the model reads the file. Covers Cursor
descriptionwith noglobs, Windsurftrigger: model_decisionoragent, and a.github/instructionsfile withdescriptionand noapplyTo. - Manual: never sent automatically; mention the file with
@to load it. Covers a Cursor rule with none of the three fields, Windsurftrigger: manual, and a.github/instructionsfile with neither field.
Four details differ from Mercury's own rules or from another tool's reader:
- A glob pattern with no slash matches only files directly in the folder that holds the tool's folder:
*.tsmatches root.tsfiles,**/*.tsmatches all depths, andapplyTo: "*"matches root files alone. Mercury's own rulepathskeep their gitignore reading. - A rule's body is sent as written: an
@filereference inside a rule is not followed. Guides keep their imports. - A
.mdfile under.cursor/rulesis read by the same three fields as a.mdcfile; with none of the three, it is a manual rule. - Only the nearest folder containing
.clinerulesor.cline/rulesis read. When bothglobal_rules.mdfiles exist, only.devin/global_rules.mdloads.
A non-YAML header skips its rule (a Cline rule loads whole), and an unsupported activation scope is skipped too. /health names each skipped file on the Instruction profile row as unreadable-rule-header or unsupported-rule-activation.
When MERCURY.md takes over
- Adding a
MERCURY.mdin the working directory or any folder above it switches Mercury to its own instruction files only. Another tool's file loads only whereMERCURY.mdimports it with an@line. MERCURY.local.mdis a personal layer loaded after the guide, so it does not trigger the switch and does not stopautofrom loading other tools' files.- Your personal
MERCURY.mdin Mercury's home (~/.mercury, orMERCURY_CONFIG_DIR) is the personal layer for every project and does not decide for a single project. - Nested guides attach when their files are touched under the same guide choice, and a nested folder's own
MERCURY.mddecides for that folder. - Setting
briefs.profiletonativein settings loads Mercury instruction files only, even when noMERCURY.mdexists. briefs.excludeskips named absolute paths or glob patterns, though managed instructions cannot be excluded.- An untrusted folder supplies no project instructions and decides nothing through its
MERCURY.md; your own instruction sources still load.
Importing another file with an @ line
Once you add a MERCURY.md, you can keep loading existing guides or rule folders by naming them on @ lines inside MERCURY.md:
@AGENTS.md
@.cursor/rules
@.github/instructions
@.clinerules
An @ line naming another tool's rule or rules folder keeps each rule's original scope: an always rule comes in whole, a scoped rule attaches when a matching file is touched, and an offered rule stays one line.
Running /orient when creating a MERCURY.md in a project where other tools' files load writes these @ lines for you. A file that is personal, or that stands above the project, gets its line in MERCURY.local.md.
Run /memory files in a session to see every instruction file with its tool and when it loads. Any file switched off by a MERCURY.md shows the @ line that brings it back.
To load a personal instruction file from another tool in your home folder, add an @~/... line in your own MERCURY.md.
What does not carry over
- Home-folder directories of other tools: the walk stops below your home folder, and another tool's folder in
~is never read automatically, even when Mercury starts in your home folder. - Settings files: Mercury reads its own JSON settings from
~/.mercury/settings.json(orMERCURY_CONFIG_DIR),<project>/.mercury/settings.jsonand<project>/.mercury/settings.local.json, validated against<config-home>/schema/settings.schema.json. - MCP server configurations: Mercury reads project MCP servers from
.mercury/mcp.json(merged with user, local and extension scopes; a managedmanaged-mcp.jsonreplaces them when present), managed throughmercury mcpand/mcp. It consults no external vendor registry. - Skills: skills load from Mercury's homes alone (
.mercury/skillsalong the project's instruction chain,~/.mercury/skills, the managed policy tree and approved extensions) and expand${MERCURY_SKILL_DIR}and${MERCURY_SESSION_ID}. - Extensions: Mercury ships with no extension source and adds none on its own; every source is added by you.
- Rule-body
@imports: an@filereference inside a rule file is sent as written and not expanded. - Unreadable rule headers and unsupported scopes: skipped and reported in
/healthunder Instruction profile.