Skip to content

opencode doesn't respect CLAUDE_CONFIG_DIR environment variable #6551

@ramarivera

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

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