Problem
opencode loads instruction files two ways:
- Eager, session-start:
systemPaths resolves AGENTS.md/CLAUDE.md plus config.instructions globs once, up front, into the system prompt.
- Proximity, on-read: when a file is read,
Instruction.find walks up from that file's directory and loads the nearest instruction file — directory-scoped context, pulled in only when you're actually working in that subtree.
The proximity loader only checks a hardcoded list (packages/opencode/src/session/instruction.ts):
const files = (disableClaudeCodePrompt: boolean) => [
"AGENTS.md",
...(disableClaudeCodePrompt ? [] : ["CLAUDE.md"]),
"CONTEXT.md", // deprecated
]
config.instructions doesn't feed this path — so a custom-named file can't be loaded on proximity. A config.instructions glob would load it eagerly into every session, defeating the point.
Use case
We run dedicated review agents and want directory-scoped review instructions — what to review for, and importantly what not to flag — colocated with the code they apply to.
Today we can add a line in AGENTS.md pointing the agent at a separate review file, but that's non-deterministic: the agent has to decide to read it, it costs a tool call, and it can be skipped. We'd rather the review instructions load deterministically via the same proximity mechanism — guaranteed in context whenever the agent touches that subtree — under their own filename rather than overloading AGENTS.md.
Request
Let the proximity loader (Instruction.find / instructionFiles) honor a configurable list of instruction filenames — e.g. a config key like localInstructionFilenames: ["AGENTS.md", "REVIEW.md"] that extends the hardcoded list.
Happy to send a PR if the team's open to it — the change looks contained to instruction.ts plus the config schema.
Problem
opencode loads instruction files two ways:
systemPathsresolvesAGENTS.md/CLAUDE.mdplusconfig.instructionsglobs once, up front, into the system prompt.Instruction.findwalks up from that file's directory and loads the nearest instruction file — directory-scoped context, pulled in only when you're actually working in that subtree.The proximity loader only checks a hardcoded list (
packages/opencode/src/session/instruction.ts):config.instructionsdoesn't feed this path — so a custom-named file can't be loaded on proximity. Aconfig.instructionsglob would load it eagerly into every session, defeating the point.Use case
We run dedicated review agents and want directory-scoped review instructions — what to review for, and importantly what not to flag — colocated with the code they apply to.
Today we can add a line in
AGENTS.mdpointing the agent at a separate review file, but that's non-deterministic: the agent has to decide to read it, it costs a tool call, and it can be skipped. We'd rather the review instructions load deterministically via the same proximity mechanism — guaranteed in context whenever the agent touches that subtree — under their own filename rather than overloadingAGENTS.md.Request
Let the proximity loader (
Instruction.find/instructionFiles) honor a configurable list of instruction filenames — e.g. a config key likelocalInstructionFilenames: ["AGENTS.md", "REVIEW.md"]that extends the hardcoded list.Happy to send a PR if the team's open to it — the change looks contained to
instruction.tsplus the config schema.