Feature hasn't been suggested before.
Describe the enhancement you want to request
Feature Request: Configurable AGENTS.md Search Behavior
Problem
OpenCode searches for instruction files (AGENTS.md, CLAUDE.md, CONTEXT.md) but has two limitations:
- Search stops at git repository root - Cannot find AGENTS.md files in parent directories above the repository
- Only first file type is loaded - If AGENTS.md exists, CLAUDE.md is never checked (due to
break statement)
Example: Monorepo Issue
/workspace/company-monorepo/
├── AGENTS.md ← Cannot be found
└── services/
├── AGENTS.md ← Cannot be found
└── my-service/
└── .git/ ← Search stops here
└── src/working-here/
Code:packages/opencode/src/session/system.ts:74-80
for(constlocalRuleFileofLOCAL_RULE_FILES){constmatches=awaitFilesystem.findUp(localRuleFile,Instance.directory,Instance.worktree)if(matches.length>0){matches.forEach((path)=>paths.add(path))break// ← Stops after first file type found}}Proposed Solution
Add two configuration options in opencode.json:
Defaults (Backward Compatible)
Examples
Monorepo setup:
Use both AGENTS.md and CLAUDE.md:
Implementation
1. Update config schema (packages/opencode/src/config/config.ts):
instructions: z.object({searchBoundary: z.enum(["git-root","filesystem-root"]).default("git-root"),fileTypes: z.array(z.enum(["AGENTS.md","CLAUDE.md","CONTEXT.md"])).default(["AGENTS.md","CLAUDE.md","CONTEXT.md"]),}).optional()2. Update search logic (packages/opencode/src/session/system.ts):
constfileTypes=config.instructions?.fileTypes??LOCAL_RULE_FILESconstsearchStop=config.instructions?.searchBoundary==="filesystem-root" ? undefined : Instance.worktreefor(constlocalRuleFileoffileTypes){constmatches=awaitFilesystem.findUp(localRuleFile,Instance.directory,searchStop)matches.forEach((path)=>paths.add(path))// Remove break statement - search all file types}Benefits
- ✅ Monorepo support
- ✅ Backward compatible
- ✅ Choose specific file formats
- ✅ Load multiple file types together
Feature hasn't been suggested before.
Describe the enhancement you want to request
Feature Request: Configurable AGENTS.md Search Behavior
Problem
OpenCode searches for instruction files (AGENTS.md, CLAUDE.md, CONTEXT.md) but has two limitations:
breakstatement)Example: Monorepo Issue
Code:
packages/opencode/src/session/system.ts:74-80Proposed Solution
Add two configuration options in
opencode.json:{ "instructions": { "searchBoundary": "git-root"|"filesystem-root", "fileTypes": ["AGENTS.md", "CLAUDE.md", "CONTEXT.md"] } }Defaults (Backward Compatible)
{ "instructions": { "searchBoundary": "git-root", "fileTypes": ["AGENTS.md", "CLAUDE.md", "CONTEXT.md"], }, }Examples
Monorepo setup:
{ "instructions": { "searchBoundary": "filesystem-root", "fileTypes": ["AGENTS.md"], }, }Use both AGENTS.md and CLAUDE.md:
{ "instructions": { "fileTypes": ["AGENTS.md", "CLAUDE.md"], }, }Implementation
1. Update config schema (
packages/opencode/src/config/config.ts):2. Update search logic (
packages/opencode/src/session/system.ts):Benefits