Skip to main content

Overview

Profiles give you a global configuration system that lives outside your project directories. Instead of initializing .opencode/ in every repository, you define your settings once and bring them anywhere.

When to Use Profiles

  • When you work across multiple repositories and want consistent configuration.
  • When you contribute to open source projects and need zero-footprint configuration.
  • When you need to control what OpenCode sees in untrusted repositories.
  • When you maintain separate configurations for work, personal, and client projects.

Core Concepts

Global vs Local Mode

What Is Inside a Profile

Each profile lives in ~/.config/opencode/profiles/<name>/ and contains:
  • ocx.jsonc — OCX settings (registries, exclude/include patterns, custom binary)
  • opencode.jsonc — OpenCode configuration
  • AGENTS.md — Instructions for AI agents

How It Works

  1. Profile Resolution: OCX resolves the active profile using a priority chain (local config → CLI flag → env var → default profile → none).
  2. Instruction Discovery: OCX discovers instruction files walking up from the project directory to the git root.
  3. Pattern Filtering: Exclude/include patterns from the active profile filter which project instruction files OpenCode receives.
  4. Launch: OpenCode starts with the profile configuration and filtered instructions.

Profile Selection Priority

Profiles are resolved in this order:
  1. profile field in .opencode/ocx.jsonc (project-specific profile)
  2. --profile <name> / -p <name> flag (explicit override)
  3. OCX_PROFILE environment variable
  4. default profile (if it exists)
  5. No profile (base configurations only)

Directory Structure

Global Profiles

Local Project Config

See Also