← All notes

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

Claims

Sources

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

Permanent ID: iil:note:t8s0xyx9

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.},
}

Markdown

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.

All artifact files (JSON index)

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.