From e154c4f54d511eed3d46324ee4ff29a7b2974ae7 Mon Sep 17 00:00:00 2001 From: codebit0 <34156842+codebit0@users.noreply.github.com> Date: Sun, 21 Jun 2026 06:02:43 +0900 Subject: [PATCH] fix(skills): resolve {baseDir} placeholder in DB-backed skill content (#1145) Both PG and SQLite skill stores returned SKILL.md content without the {baseDir} substitution that skills.Loader.LoadSkill performs for file-based access. Agents reading SKILL.md via this RPC saw the literal placeholder, breaking script-invocation lines that expect absolute paths. Mirror the loader's substitution in both store implementations so behavior is consistent regardless of access path. Co-authored-by: Claude Opus 4.7 (1M context) --- internal/store/pg/skills_content.go | 5 +++++ internal/store/sqlitestore/skills_content.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/internal/store/pg/skills_content.go b/internal/store/pg/skills_content.go index eac99043..df3aca0c 100644 --- a/internal/store/pg/skills_content.go +++ b/internal/store/pg/skills_content.go @@ -40,6 +40,11 @@ func (s *PGSkillStore) LoadSkill(ctx context.Context, name string) (string, bool if err != nil { return "", false } + // Resolve {baseDir} placeholder so SKILL.md script-invocation lines hold + // absolute paths regardless of agent CWD. Mirrors skills.Loader.LoadSkill + // substitution; without it, agents reading SKILL.md via this RPC see the + // literal placeholder. + content = strings.ReplaceAll(content, "{baseDir}", info.BaseDir) return content, true } diff --git a/internal/store/sqlitestore/skills_content.go b/internal/store/sqlitestore/skills_content.go index e47c06a4..1c497660 100644 --- a/internal/store/sqlitestore/skills_content.go +++ b/internal/store/sqlitestore/skills_content.go @@ -35,6 +35,11 @@ func (s *SQLiteSkillStore) LoadSkill(ctx context.Context, name string) (string, if err != nil { return "", false } + // Resolve {baseDir} placeholder so SKILL.md script-invocation lines hold + // absolute paths regardless of agent CWD. Mirrors skills.Loader.LoadSkill + // substitution; without it, agents reading SKILL.md via this RPC see the + // literal placeholder. + content = strings.ReplaceAll(content, "{baseDir}", info.BaseDir) return content, true }