-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Description
Description
When running a skill that includes bundled resources (like a references/ or scripts/ folder) placed alongside its SKILL.md, the AI agent fails to read those resources.
If the SKILL.md contains an instruction like:
Read references/investigation-tools.md
The agent attempts to resolve this path against the user's current working directory (CWD), rather than the directory where the skill is installed (e.g., ~/.config/opencode/skills/<skill-name>/).
This results in an error like: Error: File not found: /Users/.../current-project/references/investigation-tools.md
Root cause: The agent resolves relative paths against the project root rather than the directory of the loaded skill. The agent's system prompt instructs resolution against project root, not skill location. It doesn't know relative paths may be intended to be relative to the skill definition itself.
Suggested Solutions:
- Add a prompt instruction: "When reading files requested by a loaded skill's instructions, resolve relative paths against the skill's absolute location (from available skills), not the project root."
- Provide a built-in context variable ({{SKILL_DIR}} or $__dirname) for skill authors to reliably reference bundled files.
Plugins
N/A
OpenCode version
1.2.24
Steps to reproduce
- Install a skill (via Skillshare or manually) with SKILL.md and a subfolder like references/.
- Invoke the skill in OpenCode from any project directory.
- Agent tries to read a reference file based on skill instructions, fails (looks in CWD).
- Error: File not found: /Users/.../current-project/references/investigation-tools.md
Expected: relative paths in skill instructions are resolved against skill's install directory.
Screenshot and/or share link
No response
Operating System
macos 26
Terminal
Kitty + TMUX