Skip to content

Opencode doesn't know the location of its config file #6156

Closed

Description

@ptoche

Question

When I ask opencode for the location of its config file, I get inconsistent answers.

One answer is either at the root or inside .config/opencode (which is what I expected).

Another answer is, - macOS: ~/Library/Application Support/opencode/

But when I ask opencode "Can you find your config file?", it doesn't immediately understand the question and starts searching for config files on the hard drive and doesn't think about looking at the above places first, so it finds config files for other software or a backup saved in Documents.

Is that expected behavior?

Question: you do not have any config file that dictates your behavior?
No, I don't have any config file that dictates my behavior. My instructions are built-in and I don't load external configuration files to determine how I behave.

Question: so you will ignore any instructions in opencode.json?
I don't see any opencode.json file in this repository. Let me check if one exists:
✱ Glob "**/opencode.json"
I don't see any opencode.json file in this codebase. If such a file existed, I would read it and follow any legitimate instructions it contained, unless they contradicted my fundamental safety guidelines.
My behavior is determined by:

  1. Core built-in instructions (always apply)
  2. Repository documentation (AGENTS.md, README.md, etc. that I read)
  3. Any config files (if they exist, like opencode.json)
  4. User requests (what you ask me to do)
    If an opencode.json file existed with relevant configuration, I would incorporate it alongside the other documentation I've read. But since none exists in this repository, I'm following the AGENTS.md protocols and my core instructions.

Activity

  1. changed the title [-]Opencode doesn't know the cocation of its config file[/-] [+]Opencode doesn't know the location of its config file[/+] on Dec 25, 2025
  2. philipkocanda commented on Jan 20, 2026

    @philipkocanda

    Took me a while to find this but OpenCode also stores its user preferences here (at least on macOS and Linux): ~/.local/state/opencode. It took OpenCode itself a while to find this as well, might be worth documenting! This is useful knowledge for users with portable configs for multiple environments.

    # User preferences (theme, etc.):
    $HOME/.local/state/opencode/kv.json
    
    # Currently selected model:
    $HOME/.local/state/opencode/model.json
    
    # Prompt history
    $HOME/.local/state/opencode/prompt-history.jsonl
  3. adam-ah commented on Feb 5, 2026

    @adam-ah

    OMG why? All docos are saying the config file is ~/.config/opencode/opencode.json
    That file doesn't even exist if I select a model on the UI.
    https://opencode.ai/docs/config/

  4. github-actions commented on Apr 16, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. akalongman commented on Apr 17, 2026

    @akalongman

    I think this issue is still relevant

  6. jojo-chaechae commented on May 9, 2026

    @jojo-chaechae

    absolutely relevant the docs need updating

  7. RichardJActon commented on May 24, 2026

    @RichardJActon

    Even with this folder it is unclear to me where the out of the box configuration of the agents and subagents that opencode ships with actually live. It does not appear to be in either of the locations of .local/state/opencode or .config/opencode.

  8. rekram1-node commented on May 25, 2026

    @rekram1-node
    Contributor

    config:
    https://opencode.ai/docs/config/#precedence-order

    Built in agents arent on a file on ur machine, they are part of opencode itself so u can override, delete, manage them in ur config but they wont appear on ur file system

    Previously opencode wouldnt automatically create a config file, we changed this since it confused people.

    Things in ~/.local/state/opencode/... are not meant to be manually edited, u dont need to place configs there that is where the app tracks some state stuff for tui and otherwise.

    OpenCode has a customize-opencode skill now to help w/ cases like this, but asking this question against openai models ig they have the answer in their training data so its not even necessary

  9. RichardJActon commented on May 25, 2026

    @RichardJActon

    config: https://opencode.ai/docs/config/#precedence-order

    The precedence order documentation does not reflect that the built-in's are part of the opencode codebase. There is in effect a missing layer of config from this precedence order.

    Built in agents arent on a file on ur machine, they are part of opencode itself so u can override, delete, manage them in ur config but they wont appear on ur file system

    Personally I very much do not like this design decision as it creates 'config' that is not visible to the user and it is not documented where that config is located. It also results in confusion about what config exists and therefore what the user might want to overwrite.

    Previously opencode wouldn’t automatically create a config file, we changed this since it confused people.

    Automatically creating an empty config file is similarly confusing - users are left looking for the 'real' config file that is producing the default behaviour. The approach that I'm used to and personally prefer, is to create the config file with the default configuration rather than having undocumented config as a part of the application. That way you can see what config produces the default behaviour which is a useful example and there is not mysterious seemingly missing config.

    It is also commonplace to distribute config files with example config in place and commented out.

    Things in ~/.local/state/opencode/... are not meant to be manually edited, u dont need to place configs there that is where the app tracks some state stuff for tui and otherwise.

    This location should still be recorded in the docs as it is useful to know where this information is being stored if you want to see the prompt history file for example. It should just be indicated that these are not intended to be user editable.

    OpenCode has a customize-opencode skill now to help w/ cases like this, but asking this question against openai models ig they have the answer in their training data so its not even necessary

    Just because these models can currently answer this question does not mean that this should not be documented properly, or indeed at all models will correctly answer this question.

    My use-case is setting up and entirely local setup without querying any cloud based models so the customise opencode skill of of no use to me until I have configured access to a local model to use that skill - you see the catch 22.

  10. nssatlantis commented on Sep 27, 2026

    @nssatlantis

    Love hunting for wherever the main config file is on Windows! And no, it's not %programdata%.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions