Skip to main content

Overview

Profiles provide fine-grained control over what OpenCode sees in any repository. This page covers the lock-down recipe for maximum isolation, visibility patterns, and practical workflows for untrusted code.

Lock Down Recipe

For maximum isolation when working in untrusted repositories, the default profile template already excludes everything. No changes are needed — the template ships with a secure exclude list out of the box.

Default Secure Configuration

This prevents any project-level instruction files from influencing your OpenCode session. Only your profile’s own AGENTS.md and the global ~/.config/opencode/AGENTS.md are included.

When to Use Lock Down

  • Open source contributions: Prevent untrusted repositories from injecting instructions into your AI agent.
  • Client codebases: Ensure project-level configurations cannot override your team’s policies.
  • Security-sensitive work: Guarantee your agent operates only with vetted instructions.

Loosening Restrictions for Trusted Repos

When you trust a repository, selectively loosen the exclude list:

Option 1: Remove Patterns from Exclude

Option 2: Use Include Overrides

Option 3: Selective Inclusion

Allow only the root-level instruction file:

Workflow: Context Switching

Maintain separate profiles for different trust levels:
ocx oc is a shorthand alias for ocx opencode. Both are interchangeable. See ocx opencode for full usage details.

Registry Isolation

Each profile has its own isolated registry scope. Global base config registries (~/.config/opencode/ocx.jsonc) are only used for downloading profiles, never for components. This prevents global registries from injecting components into all projects. For teams, see Registry Locking to prevent developers from adding unapproved registry sources.