Skip to content

Conversation

@elithrar
Copy link
Contributor

@elithrar elithrar commented Jan 2, 2026

The instructions config array was being replaced instead of merged when combining global and project configs. This meant global instructions (e.g. from ~/.config/opencode/opencode.json) were lost when a project had its own instructions array.

this PR:

  • renames mergeConfigWithPlugins to mergeConfigConcatArrays to reflect its broader purpose
  • adds instructions array merging alongside the existing plugin array handling
  • adds tests for instructions merging and deduplication

The plugin array already had this fix (PR #4724), but instructions was missed.

Paths are deduplicated by their raw string value, not their resolved location. Resolving paths at merge time isn't feasible since globs need filesystem access and project context isn't fully established yet.

Config location instructions value Resolves to
~/.config/opencode/opencode.json ["INSTRUCTIONS.md"] Looks in project dir (not global config dir)
~/.config/opencode/opencode.json ["~/.config/opencode/INSTRUCTIONS.md"] Correctly resolves to global file
./opencode.json ["INSTRUCTIONS.md"] Looks in project dir

Users should use absolute or ~/ paths in global config to ensure they resolve correctly.

@elithrar
Copy link
Contributor Author

elithrar commented Jan 2, 2026

before fix:

$ opencode debug config | jq '.instructions'
[
  "STYLE_GUIDE.md"
]

after:

$ cd packages/opencode && bun run build
$ ./packages/opencode/dist/opencode-darwin-arm64/bin/opencode debug config | jq '.instructions'
[
  "/Users/matt/.config/opencode/INSTRUCTIONS.md",
  "STYLE_GUIDE.md"
]

@rekram1-node rekram1-node merged commit 66bc046 into anomalyco:dev Jan 2, 2026
2 checks passed
@elithrar elithrar deleted the fix/merge-instructions-config branch January 2, 2026 20:30
ruuxi pushed a commit to ruuxi/ngmicode that referenced this pull request Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants