If you use both OpenCode and Claude Code, you may notice that OpenCode automatically picks up your ~/.claude/CLAUDE.md file.
This is intentional but undocumented behavior for Claude Code compatibility.
OpenCode loads instruction files from multiple locations:
- Project-level (documented):
AGENTS.md,CLAUDE.md, orCONTEXT.mdin your project directory - Global (documented):
~/.config/opencode/AGENTS.md - Claude Code compat (undocumented):
~/.claude/CLAUDE.md
The relevant code is in packages/opencode/src/session/system.ts:
const GLOBAL_RULE_FILES = [path.join(Global.Path.config, "AGENTS.md")]
if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_PROMPT) {
GLOBAL_RULE_FILES.push(path.join(os.homedir(), ".claude", "CLAUDE.md"))
}If you don't want OpenCode to read your ~/.claude/CLAUDE.md file, set the environment variable:
export OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1The official Rules documentation only mentions:
- Project-level
AGENTS.mdfiles - Global
~/.config/opencode/AGENTS.md
It does not mention the ~/.claude/CLAUDE.md compatibility feature.
If you have different instructions for Claude Code vs OpenCode, you may get unexpected behavior. Your Claude Code instructions will be applied to OpenCode sessions automatically.
OpenCode also scans ~/.claude/skills/ for agent skills, as shown in packages/opencode/src/skill/skill.ts:
// Also include global ~/.claude/skills/
const globalClaude = `${Global.Path.home}/.claude`