# OpenCode Features and Practical Usage
๐ Tired of re-explaining your project's conventions every single session? `AGENTS.md` fixes that: write it once, and the agent always operates with your rules in mind.
๐ท๏ธ Title: AGENTS.md
๐ URL:
๐ Overview
`AGENTS.md` is the file you use to give OpenCode custom instructions. Document your project's conventions, architecture, and build steps there, and that content is always included in the LLM's context so the agent behaves the way your team expects.
โ๏ธ How It Works
Rules live at two levels:
ใปProject-level: an `AGENTS.md` at the repo root, applied only within that directory tree.
ใปGlobal-level: `~/.config/opencode/AGENTS.md`, shared across all sessions and best for personal preferences.
At startup OpenCode searches in order: local `AGENTS.md` or `CLAUDE.md` (walking up from the current directory) โ global `~/.config/opencode/AGENTS.md` โ the Claude Code compatibility file `~/.claude/CLAUDE.md`. The first match in each category wins. The design is close to Cursor-style rules and makes migration easy.
๐ ๏ธ Practical Usage
To pull in external docs as instructions, list them in the `instructions` field of `opencode.json`, e.g. `"instructions": ["CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md"]`. Globs are supported.
If writing from scratch feels like a chore, run `/init`: it scans important files, may ask targeted questions, and generates or improves `AGENTS.md` for you. Commit the result to Git so the whole team shares it.
๐ก Use Cases
Capture tacit knowledge like "commit messages in Japanese," "tests use pytest," or "never import this layer directly" in `AGENTS.md`, and both new teammates and the agent share the same assumptions, cutting down on review churn. In monorepos, `instructions` globs let you bundle per-package conventions.
โ ๏ธ Caveats
File references hand-written inside `AGENTS.md` are not expanded automatically. When you need multiple files reliably loaded, the `instructions` field of `opencode.json` is the dependable choice. An existing `CLAUDE.md` is recognized for compatibility, but consolidating new content into `AGENTS.md` keeps things tidy. Remote URL references carry a 5-second timeout.
#
OpenCode# #
AGENTSmd#