Skip to content

opencode doesn't respect CLAUDE_CONFIG_DIR environment variable #6551

Closed as not planned

Description

@ramarivera

Problem

Opencode hardcodes ~/.claude as the path for reading Claude Code configuration (CLAUDE.md and skills), but Claude Code v1.0.30+ changed its default config directory to ~/.config/claude and added support for the CLAUDE_CONFIG_DIR environment variable to override this.

This causes issues for users who:

  1. Use CLAUDE_CONFIG_DIR to specify a custom config location
  2. Have a file (not directory) at ~/.claude, causing ENOTDIR errors when opencode tries to glob inside it

Expected Behavior

Opencode should check for Claude config in this order:

  1. CLAUDE_CONFIG_DIR environment variable (if set and is a valid directory)
  2. ~/.config/claude (new Claude Code default)
  3. ~/.claude (legacy path)

Affected Code

  • packages/opencode/src/session/system.ts - hardcodes ~/.claude/CLAUDE.md
  • packages/opencode/src/skill/skill.ts - hardcodes ~/.claude for skills

References

Activity

  1. ramarivera commented on Dec 31, 2025

    @ramarivera
    Author

    Fix submitted in #6550

  2. github-actions commented on Dec 31, 2025

    @github-actions
    Contributor

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

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

  3. attkri commented on Mar 5, 2026

    @attkri

    Also hitting this via Anthropic Subscription (OAuth). When using Opus or Sonnet directly, OpenCode falls back to the hardcoded legacy config path instead of respecting the .opencode/ directory structure. Combined with #10567 (string replacement of "opencode" in paths), this creates a situation where config, agents and rules are read from and written to the wrong location entirely — making it impossible to rely on a consistent setup when switching models.

  4. github-actions commented on May 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions