Opencode adds stuff to global config folder #2115

Open
opened 2026-02-16 17:34:12 -05:00 by yindo · 3 comments
Owner

Originally created by @einarpersson on GitHub (Oct 15, 2025).

Originally assigned to: @thdxr on GitHub.

I noticed that opencode added some random stuff to the global config folder $HOME/.config/opencode

.config/opencode via 🥟
❯ ll
total 12K
drwxr-xr-x. 1 einar  22 Oct 14 18:33 agent
drwxr-xr-x. 1 einar  30 Oct 15 15:24 node_modules
-rw-r--r--. 1 einar 689 Oct 15 15:24 bun.lock
-rw-r--r--. 1 einar  45 Oct 15 15:24 .gitignore
-rw-r--r--. 1 einar  63 Oct 15 15:24 package.json

Why? These aren't config files (expect my agent folder), but rather lookes like some internal concerns that should be somewhere else, eg $XDG_CACHE_HOME or something. I like to keep my dotfiles folder nice and clean and only have stuff there which I control.

If i delete node_modules, bun.lock, package.json and .gitignore and start opencode everything works still. The files are recreated.

I am not an expert in the XDG spec but my feeling is that these files should live elsewhere.
https://specifications.freedesktop.org/basedir-spec/latest/

Originally created by @einarpersson on GitHub (Oct 15, 2025). Originally assigned to: @thdxr on GitHub. I noticed that `opencode` added some random stuff to the global config folder `$HOME/.config/opencode` ``` .config/opencode via 🥟 ❯ ll total 12K drwxr-xr-x. 1 einar 22 Oct 14 18:33 agent drwxr-xr-x. 1 einar 30 Oct 15 15:24 node_modules -rw-r--r--. 1 einar 689 Oct 15 15:24 bun.lock -rw-r--r--. 1 einar 45 Oct 15 15:24 .gitignore -rw-r--r--. 1 einar 63 Oct 15 15:24 package.json ``` Why? These aren't config files (expect my `agent` folder), but rather lookes like some internal concerns that should be somewhere else, eg `$XDG_CACHE_HOME` or something. I like to keep my dotfiles folder nice and clean and only have stuff there which I control. If i delete `node_modules`, `bun.lock`, `package.json` and `.gitignore` and start opencode everything works still. The files are recreated. I am not an expert in the XDG spec but my feeling is that these files should live elsewhere. https://specifications.freedesktop.org/basedir-spec/latest/
Author
Owner

@github-actions[bot] commented on GitHub (Oct 15, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1124: Discusses XDG Base Directory Specification compliance and proper directory usage for opencode files
  • #2432: Requests environment variable control for cache folder location, similar concern about files being placed in unexpected locations
  • #2793: Reports unexpected directory creation in ~/.opencode
  • #2794: Issues with restrictive validation of directories inside .config/opencode

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 15, 2025): This issue might be a duplicate of existing issues. Please check: - #1124: Discusses XDG Base Directory Specification compliance and proper directory usage for opencode files - #2432: Requests environment variable control for cache folder location, similar concern about files being placed in unexpected locations - #2793: Reports unexpected directory creation in ~/.opencode - #2794: Issues with restrictive validation of directories inside .config/opencode Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 15, 2025):

opencode automatically adds those so you can take advantage of the plugins and custom tools easily since the dependency will already be installed

@rekram1-node commented on GitHub (Oct 15, 2025): opencode automatically adds those so you can take advantage of the plugins and custom tools easily since the dependency will already be installed
Author
Owner

@xiaotian commented on GitHub (Jan 17, 2026):

Second this as a very annoying bug. I like my ~/.config to be for config files only, so I don't have to write custom .gitignore rules just to exclude them. Runtime artifacts like lock files have no place in such directory.

Also installing ~100M npm packages and binaries under ~/.opencode/ is an odd choice. they are for dot files.

Amazing project BTW, but if we can make LLM to do years worth software development in a week, we can find a way to respect XDG conventions.

@xiaotian commented on GitHub (Jan 17, 2026): Second this as a very annoying bug. I like my ~/.config to be for config files only, so I don't have to write custom .gitignore rules just to exclude them. Runtime artifacts like lock files have no place in such directory. Also installing ~100M npm packages and binaries under ~/.opencode/ is an odd choice. they are for *dot* files. Amazing project BTW, but if we can make LLM to do years worth software development in a week, we can find a way to respect XDG conventions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2115