feat(agent/agentcontextconfig): fall back to AGENT.md and CLAUDE.md#26282
Draft
tracyjohnsonux wants to merge 1 commit into
Draft
feat(agent/agentcontextconfig): fall back to AGENT.md and CLAUDE.md#26282tracyjohnsonux wants to merge 1 commit into
tracyjohnsonux wants to merge 1 commit into
Conversation
Coder Agents previously read a single configurable instruction filename (default AGENTS.md). Users coming from other agent tooling expect CLAUDE.md (and to a lesser extent AGENT.md) to work as well. Per directory, the package now searches a comma-separated, priority-ordered list of filenames. The first existing file wins; files that are empty after sanitization fall through to the next candidate, matching Coder's existing empty-file semantics. Default list: AGENTS.md,AGENT.md,CLAUDE.md. The configuration env var is renamed to match the rest of the package (CODER_AGENT_EXP_*_DIRS / *_FILES use the plural form for lists): CODER_AGENT_EXP_INSTRUCTIONS_FILE -> CODER_AGENT_EXP_INSTRUCTIONS_FILES The var is experimental and the rename is a straight swap with no backcompat alias. Setting it to a single name still works and disables the default fallback, which preserves the behavior of users who pinned the old single-name override. Linear: CODAGT-338
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an ordered fallback chain so Coder Agents picks up
AGENTS.md, thenAGENT.md, thenCLAUDE.mdper directory. The first existing file wins; a file that sanitizes to empty falls through to the next candidate, matching Coder's existing empty-file semantics.The configuration env var is renamed to follow the rest of the package convention (
*_DIRS,*_FILESfor comma-separated lists):CODER_AGENT_EXP_INSTRUCTIONS_FILE→CODER_AGENT_EXP_INSTRUCTIONS_FILESThe var is experimental, so the rename is a straight swap with no backcompat alias. Setting it to a single name still works and disables the default fallback, preserving the behavior of any user who pinned the old single-name override.
Refs https://linear.app/codercom/issue/CODAGT-338
Design plan and decision log
Behavior
AGENTS.md,AGENT.md,CLAUDE.mdby default).Env var
One env var, pluralized to match
CODER_AGENT_EXP_INSTRUCTIONS_DIRS,CODER_AGENT_EXP_SKILLS_DIRS, andCODER_AGENT_EXP_MCP_CONFIG_FILES. The closest precedent isCODER_AGENT_EXP_MCP_CONFIG_FILES, which already takes a comma-separated list in dogfood (~/.mcp.json,.mcp.json).Divergences from Mux
Mux already has comparable fallback behavior. We adopt the same priority list but deliberately diverge on two points:
AGENTS.mdfalls through toCLAUDE.md.AGENTS.local.mdfrom the same directory. Not in scope for this change.Scope
agent/agentcontextconfig/api.go— env var rename,Configfield rename, default fallback list,ResolveandContextPartsFromDirparse the list and pass a[]stringof candidate filenames toreadInstructionFileFromDir, which iterates in priority order.agent/agentcontextconfig/api_test.go— six new subtests coveringAGENTS.md > AGENT.md > CLAUDE.mdprecedence, fallback when onlyCLAUDE.mdexists,AGENT.md > CLAUDE.md, emptyAGENTS.mdfalls through, single-name env var disables the default fallback, and per-directory fallback is independent.coderd/x/chatd/chatd_test.go— env var identifier rename only.No downstream changes.
agent/proto,coderd/x/chatd/chatd.go, andcodersdktreat the instruction file as opaque path + content.Authored by Coder Agents on behalf of @tracyjohnsonux.