diff --git a/pkg/agent/context.go b/pkg/agent/context.go index 01e9ec0b2..74c278f39 100644 --- a/pkg/agent/context.go +++ b/pkg/agent/context.go @@ -102,7 +102,13 @@ func NewContextBuilder(workspace string) *ContextBuilder { // Use the skills/ directory under the current working directory builtinSkillsDir := strings.TrimSpace(os.Getenv(config.EnvBuiltinSkills)) if builtinSkillsDir == "" { - wd, _ := os.Getwd() + wd, err := os.Getwd() + if err != nil { + // os.Getwd failure is extremely rare; fall back to empty + // string so that filepath.Join produces a relative "skills" + // path, preserving the original lookup behavior. + wd = "" + } builtinSkillsDir = filepath.Join(wd, "skills") } globalSkillsDir := filepath.Join(getGlobalConfigDir(), "skills")