Skip to content

bug: docs do not align with behavior of instructions #1240

Closed

Description

@rekram1-node

The instructions field is an array of file names to read instructions from so doing "instructions": ["{file:./custom-instructions.md}"] won't work. The instructions were built before support of file: prefixes so maybe they should change

Not sure if the docs should be fixed or the behavior should be updated

### Files

Use `{file:path/to/file}` to substitute the contents of a file:

```json title="opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "instructions": ["{file:./custom-instructions.md}"],
  "provider": {
    "openai": {
      "options": {
        "apiKey": "{file:~/.secrets/openai-key}"
      }
    }
  }
}

File paths can be:

  • Relative to the config file directory
  • Or absolute paths starting with / or ~

These are useful for:

  • Keeping sensitive data like API keys in separate files.
  • Including large instruction files without cluttering your config.
  • Sharing common configuration snippets across multiple config files.

Activity

  1. self-assigned this
    on Jul 23, 2025
  2. thdxr commented on Jul 23, 2025

    @thdxr
    Member

    yeah i need to fix this - i think we should get rid of the custom glob implementation for the instructions field and instead allow the general config variable replacement to support globs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions