Documentation Index
Fetch the complete documentation index at: https://ocx.kdco.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Profile configuration controls what OpenCode sees in your projects. This page covers exclude/include patterns, instruction file discovery, configuration merging, and practical examples for common workflows.Controlling What OpenCode Sees
The default profile template ships an exclude list for maximum security. OCX itself does not exclude anything by default — a cleanocx.jsonc includes all project instruction files. You control visibility using exclude/include patterns in your profile’s ocx.jsonc.
How Visibility Works
| Pattern Type | Effect |
|---|---|
exclude | Hide matching files from OpenCode |
include | Override excludes, make files visible again |
**/*.md, src/**, etc.). Include patterns always override exclude patterns, following the same semantics as TypeScript/Vite configuration.
Default Configuration (Secure by Default)
The default profile template uses this exclude list:Trusting Project Files
For trusted repositories, loosen the template’s exclude list by removing patterns or adding include overrides:Instruction File Discovery
OCX discovers instruction files in this exact order (low to high priority), matching OpenCode’s behavior:| Order | Scope | Path | Priority | Filtering |
|---|---|---|---|---|
| 1 | Global | ~/.config/opencode/AGENTS.md | Lowest | Always included |
| 2 | Global Profile | ~/.config/opencode/profiles/<name>/AGENTS.md | ↓ | Always included |
| 3 | Local (Project) | ./AGENTS.md, ./src/AGENTS.md, etc. | ↓ | Filtered by patterns |
- Local project files are discovered deepest-first (walking up from current directory to git root).
- Profile instructions come last and have the highest priority.
- Global
AGENTS.mdis always included regardless of profile selection. - Claude Code compatibility: If no global
AGENTS.mdexists, OCX checks~/.claude/CLAUDE.mdas a fallback (disable withOPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1).
File Type Priority (“First Type Wins”)
OpenCode uses a “first type wins” discovery strategy:- Search for
AGENTS.mdfirst (walking up the project tree). - If any
AGENTS.mdis found: collect allAGENTS.mdfiles and stop (ignoreCLAUDE.mdandCONTEXT.mdentirely). - If no
AGENTS.md: search forCLAUDE.md(and ignoreCONTEXT.md). - If no
CLAUDE.md: search forCONTEXT.md(deprecated, will be removed).
Pattern Filtering (Local Files Only)
Profileexclude and include patterns apply only to local (project) instruction files. Global and profile instruction files are always included regardless of patterns.
Registry Isolation
Global base config registries (~/.config/opencode/ocx.jsonc) are only used for downloading profiles, never for components. When using a profile, registries come from the profile config. This isolation prevents global registries from injecting components into all projects.
Custom OpenCode Binary
To use a custom OpenCode binary (such as a development build), set thebin option in your profile’s ocx.jsonc:
binin profile’socx.jsoncOPENCODE_BINenvironment variableopencode(system PATH)
Practical Examples
Trusted Repository
Selective Inclusion
Exclude all instruction files but include specific ones:Work Profile with Custom Binary
Related Concepts
- Profiles Overview — Core concepts and mental model.
- Profile Security — Lock down recipes for untrusted repos.
- CLI: Config Commands — View and edit configuration.