Skip to content

feat(core): choose which instruction file names load - #63830

Closed
Lukk17 wants to merge 1 commit into
anomalyco:devfrom
Lukk17:instruction-files
Closed

Lukk17 wants to merge 1 commit into
anomalyco:devfrom
Lukk17:instruction-files

Conversation

@Lukk17

@Lukk17 Lukk17 commented Nov 13, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #54489
Related: #53402
Related: #32069

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

I use Claude Code and OpenCode on the same repos and did not want to keep AGENTS.md and CLAUDE.md in sync by hand. Saw #54489 and #53402 ask for this too, so I made the file names configurable. Running it in my fork for some weeks now.

{
  "experimental": {
    "instruction_files": true
  },
  "instruction_files": ["AGENTS.md", "CLAUDE.md"]
}

Without the experimental flag only AGENTS.md is read, as before. The names apply in the three places where AGENTS.md was hard coded: the global config folder, the walk up from the workspace, and the files found near a path the read tool opens. Each entry must be a plain file name. A list with no valid entry falls back to AGENTS.md.

How did you verify your code works?

I put a CLAUDE.md with the line The secret test word is PINEAPPLE-42. in a project and asked the model, without tools, for the secret word from its instructions. It answered PINEAPPLE-42. After I removed CLAUDE.md from the list, a new session answered NONE.

New tests in packages/core cover the config check, the discovery and the read tool. bun run check passes.

Screenshots / recordings

The model reads the word from CLAUDE.md:

instruction-files-1-reply

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #53402

Public API: adds the instruction_files config key and the experimental.instruction_files flag (backwards compatible)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change works as described. With the simulated model, the base branch sends only AGENTS.md to the model, even with the new config set. This branch also sends CLAUDE.md when the flag is on and the file is listed. The core tests closest to the change pass, and tsc passes for core and schema.

Public API (all additions, backwards compatible): a top-level config key instruction_files (an array of unique plain file names), a flag experimental.instruction_files (boolean), and a schema Config.InstructionFileName in the OpenAPI spec and generated client types. Without the flag, behaviour is unchanged: only AGENTS.md is looked up.

Letting a project config choose file names doesn't add new exposure, since a project's instructions array can already load ~/ and absolute paths. Global file names come only from config outside the project, as the docs say.

I found no blocking concerns.

Related: #53402

Before

After

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new head is a rebase onto newer dev. The read tool now reads config through its existing config observer instead of calling config.entries() on every read, and the generated OpenAPI spec and client types were rebased around the new upstream flags.

I checked again with the simulated model. The base sends only AGENTS.md to the model; this branch also sends CLAUDE.md when the flag is on and the file is listed. The core tests closest to the change pass, and tsc passes for core and schema.

The public API impact is the same as before, all additions and backwards compatible: the instruction_files config key, the experimental.instruction_files flag, and the Config.InstructionFileName schema in the OpenAPI spec and client types.

No new concerns.

Before

After

@Lukk17

Lukk17 commented Nov 18, 2026

Copy link
Copy Markdown
Author

Closing this. CLAUDE.md now loads as a fallback since #64474, and the instructions setting already loads exact files, so most of this is not needed anymore.

@Lukk17 Lukk17 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: allow instruction files to be named after the project instead of hardcoded AGENTS.md

1 participant