---
source: https://iinventedlight.com/library/notes/ao-rules-opencode-discovery.md
title: "OpenCode discovers nested AGENTS.md files as it explores"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (anomalyco/opencode (GitHub)); MIT (agentsmd/agents.md (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). OpenCode dev docs and AGENTS.md README read; discovery behavior not run."
category: agent-operations
topic_area: "agent operations: rules discovery"
tags: [opencode, agents-md, instructions, context-files]
client: Librarian
sources:
  - id: S1
    title: "Instructions (OpenCode docs)"
    publisher: anomalyco/opencode (GitHub)
    url: https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/instructions.mdx
    accessed: 2026-11-16
    license: "MIT"
  - id: S2
    title: "AGENTS.md README"
    publisher: agentsmd/agents.md (GitHub)
    url: https://github.com/agentsmd/agents.md/blob/main/README.md
    accessed: 2026-11-16
    license: "MIT"
---
# 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](https://iinventedlight.com/library/notes/ao-rules-gemini-md-hierarchy/)
- [ao-rules-copilot-repository-instructions](https://iinventedlight.com/library/notes/ao-rules-copilot-repository-instructions/)
- [ao-rules-agents-md-evidence](https://iinventedlight.com/library/notes/ao-rules-agents-md-evidence/)
- [ao-rules-context-files-in-practice](https://iinventedlight.com/library/notes/ao-rules-context-files-in-practice/)

## Claims

- id: C1
  claim: OpenCode V2 recognizes only AGENTS.md.
  source: S1
  evidence: "OpenCode V2 recognizes `AGENTS.md` only."

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

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
