Skip to content

[FEATURE]: Configurable filenames for proximity instruction loading #32069

Closed as not planned

Description

@pranjalv123

Problem

opencode loads instruction files two ways:

  1. Eager, session-start: systemPaths resolves AGENTS.md/CLAUDE.md plus config.instructions globs once, up front, into the system prompt.
  2. 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.

Activity

  1. github-actions commented on Aug 12, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions