OpenCode discovers nested AGENTS.md files as it explores
Answer: OpenCode V2 recognizes AGENTS.md only; it does not use CLAUDE.md as a fallback for project instructions. It combines instruction files and does not resolve conflicts between them.
Initial and nested context
OpenCode loads global and project guidance. Files below the workspace are discovered during exploration: reading a file or listing a directory loads intervening AGENTS.md files.
Nested files load nearest-first. Entries are deduplicated while they remain in model-visible history. If compaction or a revert removes an entry, a later read can load it again. Nested-file edits are not detected automatically after loading; the docs say to start a new session for immediate application.
Shared format, client-specific loading
AGENTS.md is a simple, open format: a predictable place to provide context and instructions to coding agents.
See also
- ao-rules-gemini-md-hierarchy
- ao-rules-copilot-repository-instructions
- ao-rules-agents-md-evidence
- ao-rules-context-files-in-practice
Claims
- id: C1 claim: OpenCode V2 recognizes only AGENTS.md. source: S1 evidence: "OpenCode V2 recognizes
AGENTS.mdonly."
- id: C2 claim: OpenCode does not resolve instruction conflicts. source: S1 evidence: "does not resolve conflicts between them."
- id: C3 claim: Nested instruction discovery follows exploration. source: S1 evidence: "Instruction files below the workspace are discovered as the agent explores the project."
- id: C4 claim: AGENTS.md supplies context and instructions. source: S2 evidence: "a dedicated, predictable place"
Sources
- [S1] Instructions (OpenCode docs). anomalyco/opencode (GitHub). https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/instructions.mdx . License: MIT. Accessed 2026-11-16.
- [S2] AGENTS.md README. agentsmd/agents.md (GitHub). https://github.com/agentsmd/agents.md/blob/main/README.md . License: MIT. Accessed 2026-11-16.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: anomalyco/opencode (GitHub), Instructions (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode; agentsmd/agents.md (GitHub), AGENTS.md README, MIT (https://raw.githubusercontent.com/agentsmd/agents.md/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: anomalyco/opencode (GitHub), Instructions (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode; agentsmd/agents.md (GitHub), AGENTS.md README, MIT (https://raw.githubusercontent.com/agentsmd/agents.md/main/LICENSE).
Cite this
iinventedlight. 2026. "OpenCode discovers nested AGENTS.md files as it explores." iinventedlight Library, iil:note:t8s0xyx9, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-rules-opencode-discovery/. License: CC-BY-4.0.
@misc{iil_note_t8s0xyx9,
author = {{iinventedlight}},
title = {{OpenCode discovers nested AGENTS.md files as it explores}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/ao-rules-opencode-discovery/},
note = {Permanent ID iil:note:t8s0xyx9. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- ao-rules-opencode-discovery.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-rules-opencode-discovery.md.