Skip to content

fix(skill): skill directory context missing or URL-encoded in system prompt and slash-command paths #33786

Description

@shyuan

Description

Skills with bundled resources (references/, scripts/) fail to resolve file paths in two distinct code paths. The agent cannot locate files relative to the skill's install directory.

#18370 documented the surface symptom ("paths resolved against CWD instead of skill dir") but was closed by #33580, which only fixed one of three occurrences. Two gaps remain:

1. System prompt <available_skills> still URL-encodes <location>

Skill.fmt() in packages/opencode/src/skill/index.ts emits <location>${pathToFileURL(skill.location).href}</location>. This is the same pathToFileURL bug #33580 fixed in the skill tool's base directory output, but this second occurrence in the system prompt was missed. When a skill lives in a git-tagged plugin cache dir (e.g. ...git#v1.3.0), the agent sees ...git%23v1.3.0 in the system prompt and cannot use the path.

2. Skills invoked as slash commands get no directory context at all

When a user types /skill-name, the skill is registered as a command (packages/opencode/src/command/index.ts) whose template is just item.content — the raw SKILL.md body. Unlike the skill tool output, there is no Base directory hint and no <skill_files> list. The agent has no idea where the skill's files are, so relative paths in SKILL.md resolve against CWD. This is the broader issue @zcutlip and @micha149 described in #18370 comments.

Plugins

writing-humanizer@git+https://github.com/shyuan/writing-humanizer.git#v1.3.0 (triggers bug 1); any skill with references/ or scripts/ invoked via /skill-name (triggers bug 2)

OpenCode version

1.17.5

Steps to reproduce

Bug 1: Install a plugin from a git URL with #tag. The <available_skills> block in the system prompt shows <location> with %23 instead of #.

Bug 2: Create a skill with a references/ folder. Invoke it via /skill-name. The agent receives only the SKILL.md text — no base directory, no file list. Ask it to read a reference file; it resolves the path against CWD and fails.

Screenshot and/or share link

Related: #18370 (closed, not fully resolved), #23885 (ACP file:/// prefix), #33580 (fixed the skill tool's base directory but not these two paths)

Operating System

macOS 15.5

Terminal

iTerm2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions