opencode icon indicating copy to clipboard operation
opencode copied to clipboard

`OPENCODE_CONFIG_DIR` ignored for global `AGENTS.md`

Open ThomasGormley opened this issue 1 week ago • 1 comments

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

ThomasGormley avatar Jan 05 '26 22:01 ThomasGormley