We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

OpenCode Config

opencode.jsonc is OpenCode's main runtime config file. It controls things like:

  • Providers and models
  • Permissions
  • Agents
  • MCP servers
  • Context management

For example, this config selects the opencode/deepseek-v4.1-flash-free model and forces the agent to ask for permission before ever running git push:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "opencode/deepseek-v4.1-flash-free",
  "permissions": [
    {
      "action": "shell",
      "resource": "git push *",
      "effect": "ask",
    },
  ],
}

The $schema field gives compatible editors validation and autocomplete features.

And if you didn't know, JSONC is "JSON with Comments" (and trailing commas). Alternatively, you can use opencode.json if convenience change is scary.

Global vs. Project Config

OpenCode merges configuration from multiple locations. Your personal, global config is stored in your home directory:

~/.config/opencode/opencode.jsonc

Then you can optionally also have a project-level opencode.jsonc in a repo's root for shared project-specific settings. Project values override matching global values, while unrelated settings from both files remain active.

Should You Gitignore the Config?

Project-level configuration is designed to be checked in. We made it so that you can avoid putting credentials in there. It's for things that you want to apply for your whole team. Any personal settings should go in your global config.

Substitution

Use {env:VARIABLE} or {file:path} to substitute credentials without committing them. For example:

{
  "providers": {
    "anthropic": {
      "settings": {
        "apiKey": "{env:ANTHROPIC_API_KEY}",
      },
    },
    "openai": {
      "settings": {
        "apiKey": "{file:~/.secrets/openai-key}",
      },
    },
  },
}

Assignment

Configure OpenCode so it can run and submit your bootdev CLI checks without asking for permission.

  1. - "action": "shell"
    - "resource": "bootdev run *"
    - "effect": "allow"
    

Submit the tests with OpenCode. Confirm that it runs the CLI directly.