Skip to content

Global config file is still named opencode.json inside ~/.config/redcode #27

Description

@filipeforattini

What

The global config directory was renamed to Redcode, but the file name inside it was not. The effective path today is:

~/.config/redcode/opencode.jsonc

A redcode directory holding an opencode.jsonc does not read as deliberate from any angle.

Side effect seen in practice

Users end up with two identical files — ~/.config/opencode/opencode.jsonc (stale) and ~/.config/redcode/opencode.jsonc (live). Editing the wrong one looks like the config silently not applying.

Product decision (decided)

Move config out of the XDG tree into the RedDB family: ~/.red/redcode/config.json (jsonc retained). Trades XDG_CONFIG_HOME coherence for coherence with ~/.red/redskilled. Data and cache directories move alongside to keep all three siblings under ~/.red/redcode/.

Scope

  • packages/core/src/config.ts:146 — global/project file names
  • packages/opencode/src/config/config.ts and packages/opencode/src/skill/index.ts reference the names
  • packages/core/src/plugin/skill/customize-opencode.md instructs the agent to edit ~/.config/opencode/
  • OPENCODE_* env family: OPENCODE_CONFIG*, OPENCODE_TEST_HOME
  • Project-level opencode.json and .opencode/ at repo root stay unchanged

Compatibility matters more than the rename. Read new path first, fall back to old.

Acceptance criteria

  • Global config is read from ~/.red/redcode/config.json first, then config.jsonc, then ~/.config/redcode/opencode.jsonc, then ~/.config/redcode/opencode.json.
  • When a legacy file is found at one of the fallback paths, the app moves it to the new path on next run (or links it) so users do not silently lose settings.
  • Data and cache directories live under ~/.red/redcode/ (siblings of config.json); existing XDG locations continue to be read as fallback.
  • OPENCODE_CONFIG, OPENCODE_CONFIG_DIR, and OPENCODE_TEST_HOME override all path discovery.
  • Project-level opencode.json and .opencode/ at the repo root are unchanged.
  • packages/core/src/plugin/skill/customize-opencode.md no longer tells the agent to edit ~/.config/opencode/.
  • README no longer references ~/.config/redcode/opencode.jsonc as the live config path.
  • bun typecheck and focused tests in packages/core and packages/opencode pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageMaintainer needs to evaluate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions