You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Agent resolves skill resource relative paths against CWD instead of skill's install directory #17101
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.
I coudl have sworn I saw this failing (I see it fail in Claude) and I must have confused the two. Re-tested and I can see it is working. Sorry about the PR Noise.. ;-)
Here's what I've observed and how I finally fixed it.
This only affects skills that in subfolders. I have plan/, dev/, tools/ folders in the reop I sync with Skillshare.
This only affects SCRIPTS, where you have node|sh|bach scipts/exmaple.
The READ commands to get referecens, works fine.
Running scripts evaluates from the project root and so if I update my SKILL.md or the othe .md files that mention the scripts to have the full plan/skill-name/scripts/ path, they work fine.
Right, so it's really not at all fixed either by what you're saying or officially, since it does a) for one case and b) for another. That's not good UX.
Activity
github-actions commentedon Mar 11, 2026
This issue might be a duplicate of existing issues. Please check:
references/andscripts/folders alongsideSKILL.md, which is exactly the scenario described here.fix: resolve skill resource relative paths against skill directory
askpatrickw commentedon Mar 16, 2026
I coudl have sworn I saw this failing (I see it fail in Claude) and I must have confused the two. Re-tested and I can see it is working. Sorry about the PR Noise.. ;-)
mikaelj commentedon Mar 18, 2026
@askpatrickw I saw it with OpenCode / GLM-5-Turbo. Still uses relative resources against CWD. Also MacOS.
askpatrickw commentedon Mar 20, 2026
Here's what I've observed and how I finally fixed it.
This only affects skills that in subfolders. I have plan/, dev/, tools/ folders in the reop I sync with Skillshare.
This only affects SCRIPTS, where you have node|sh|bach scipts/exmaple.
The READ commands to get referecens, works fine.
Running scripts evaluates from the project root and so if I update my SKILL.md or the othe .md files that mention the scripts to have the full plan/skill-name/scripts/ path, they work fine.
mikaelj commentedon Mar 20, 2026
Right, so it's really not at all fixed either by what you're saying or officially, since it does a) for one case and b) for another. That's not good UX.