From 35d8f6f1b615074a0af8361f80c35d939a7059ed Mon Sep 17 00:00:00 2001 From: buidackim <221586880+buidackim@users.noreply.github.com> Date: Wed, 6 May 2026 06:18:44 +0700 Subject: [PATCH] fix(skills): instruct agent to use exact absolute path for skill files The system prompt had conflicting guidance: the Skills section told the agent to read SKILL.md at the provided location path, while the Workspace section said 'do not guess absolute paths'. Weaker models (e.g. MiniMax-M2.7) would try to reconcile both instructions by stripping the absolute prefix and converting to a relative path, causing 'file not found' errors. This change: - Adds '(use the EXACT absolute path provided)' to skill reading instructions in both inline and search modes - Clarifies workspace guidance: relative paths for user files, exact absolute paths for skills - Updates skill_search result instruction with the same emphasis --- internal/agent/systemprompt.go | 6 +++--- internal/tools/skill_search.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/agent/systemprompt.go b/internal/agent/systemprompt.go index 031bfc1ad6..711e554f01 100644 --- a/internal/agent/systemprompt.go +++ b/internal/agent/systemprompt.go @@ -640,7 +640,7 @@ func buildSkillsSection(skillsSummary string, hasSkillSearch, hasSkillManage boo "## Skills (mandatory)", "", "Before replying, scan `` below.", - "If a skill clearly applies, read its SKILL.md at the `` path with `read_file`, then follow it.", + "If a skill clearly applies, read its SKILL.md at the `` path with `read_file` (use the EXACT absolute path provided), then follow it.", "If multiple could apply, choose the most specific one. Never read more than one skill up front.", "If none apply, proceed normally.", "", @@ -655,7 +655,7 @@ func buildSkillsSection(skillsSummary string, hasSkillSearch, hasSkillManage boo "Before replying, check if a skill applies:", "1. Run `skill_search` with **English keywords** describing the domain (e.g. \"weather\", \"translate\", \"github\").", " Even if the user writes in another language, always search in English.", - "2. If a match is found, read its SKILL.md at the returned `location` with `read_file`, then follow it.", + "2. If a match is found, read its SKILL.md at the returned `location` with `read_file` (use the EXACT absolute path provided), then follow it.", "3. If multiple skills match, choose the most specific one. Never read more than one skill up front.", "4. If no match, proceed normally.", "", @@ -688,7 +688,7 @@ func buildSkillsSection(skillsSummary string, hasSkillSearch, hasSkillManage boo func buildWorkspaceSection(workspace string, sandboxEnabled bool, containerDir string) []string { // Matching TS: when sandboxed, display container workdir; add guidance about host paths for file tools. displayDir := workspace - guidance := "All file tool paths resolve relative to this directory. Use relative paths (e.g. \"docs/notes.md\", \".\") — do not guess absolute paths." + guidance := "All file tool paths resolve relative to this directory. Use relative paths (e.g. \"docs/notes.md\", \".\") for your own files. For skills, use the EXACT absolute path provided." if sandboxEnabled && containerDir != "" { displayDir = containerDir guidance = fmt.Sprintf( diff --git a/internal/tools/skill_search.go b/internal/tools/skill_search.go index ec2e55c73c..271e833908 100644 --- a/internal/tools/skill_search.go +++ b/internal/tools/skill_search.go @@ -134,7 +134,7 @@ func (t *SkillSearchTool) Execute(ctx context.Context, args map[string]any) *Res // Include explicit next-step instruction in the result so the model follows through. instruction := fmt.Sprintf( - "\n\nACTION REQUIRED: Call use_skill with name \"%s\", then read_file with path \"%s\" to read the skill instructions, then follow them.", + "\n\nACTION REQUIRED: Call use_skill with name \"%s\", then read_file with path \"%s\" (use the EXACT absolute path provided) to read the skill instructions, then follow them.", results[0].Name, results[0].Location, )