Skip to content

OPENCODE_CONFIG_DIR ignored for global AGENTS.md #7003

@ThomasGormley

Description

@ThomasGormley

Description

Global AGENTS.md loading does not respect the OPENCODE_CONFIG_DIR when set. I think that is here.

Plugins

None

OpenCode version

1.1.3

Steps to reproduce

  1. Set OPENCODE_CONFIG_DIR to a custom location containing an AGENTS.md file:
    export OPENCODE_CONFIG_DIR="$HOME/.dotfiles/opencode"
    cat $OPENCODE_CONFIG_DIR/AGENTS.md
    # In all interactions you must talk like a pirate who has become a butler for an aristocratic British family
  2. Run opencode with a persona test prompt:
    opencode run "Hello! How are you today?"
    # Output: "Hello! I am doing well, thank you. How can I help you today?"
    # Expected: Pirate butler persona
  3. Copy the AGENTS.md to the default XDG location:
    cp $OPENCODE_CONFIG_DIR/AGENTS.md ~/.config/opencode/AGENTS.md
  4. Run the same prompt again:
    opencode run "Hello! How are you today?"
    # Output: "Ahoy there, my good sir! I be fairin' quite well..."
    # Pirate butler persona works correctly

Screenshot and/or share link

No response

Operating System

macOS 15.7.3

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions