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

Open
opened 2026-02-16 17:41:43 -05:00 by yindo · 2 comments
Owner

Originally created by @ptoche on GitHub (Dec 25, 2025).

Originally assigned to: @rekram1-node on GitHub.

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.
Originally created by @ptoche on GitHub (Dec 25, 2025). Originally assigned to: @rekram1-node on GitHub. ### 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. >
yindo added the docs label 2026-02-16 17:41:43 -05:00
Author
Owner

@philipkocanda commented on GitHub (Jan 20, 2026):

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
@philipkocanda commented on GitHub (Jan 20, 2026): 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. ```sh # 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 ```
Author
Owner

@adam-ah commented on GitHub (Feb 4, 2026):

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/

@adam-ah commented on GitHub (Feb 4, 2026): 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/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3862