Skip to content

mission control for agent skills

fix: avoid project skill duplicates in home

Alvin Unrealca24044fe205
diff --git a/internal/agents/agents.go b/internal/agents/agents.go
index 19f52ad..3f45705 100644
--- a/internal/agents/agents.go
+++ b/internal/agents/agents.go
@@ -271,6 +271,7 @@ func LocationsWithEnv(cwd string, e Env) []Location {
var out []Location
seen := map[string]bool{}
globalRoots := map[string]bool{}
+ homeIsCwd := filepath.Clean(cwd) == filepath.Clean(e.Home)
add := func(loc Location) {
key := string(loc.Scope) + "\x00" + loc.AgentName + "\x00" + loc.Root
if seen[key] {
@@ -291,7 +292,7 @@ func LocationsWithEnv(cwd string, e Env) []Location {
}
for _, a := range registry {
projectRoot := filepath.Join(cwd, filepath.FromSlash(a.ProjectDir))
- if !globalRoots[filepath.Clean(projectRoot)] {
+ if !homeIsCwd && !globalRoots[filepath.Clean(projectRoot)] {
add(Location{Root: projectRoot, Scope: model.ScopeProject, AgentName: a.Name, Canonical: a.Universal})
}
if a.Universal && a.SupportsGlobal {
diff --git a/internal/agents/agents_test.go b/internal/agents/agents_test.go
index d6d4235..e9966be 100644
--- a/internal/agents/agents_test.go
+++ b/internal/agents/agents_test.go
@@ -163,12 +163,8 @@ func TestLocationsDoNotTreatHomeGlobalDirsAsProjectDirs(t *testing.T) {
locations := LocationsWithEnv(home, testEnv(home))
for _, loc := range locations {
- if loc.Scope != "project" {
- continue
- }
- switch filepath.Clean(loc.Root) {
- case filepath.Join(home, ".agents", "skills"), filepath.Join(home, ".claude", "skills"), filepath.Join(home, ".codex", "skills"):
- t.Fatalf("home global dir should not be project location: %#v", loc)
+ if loc.Scope == "project" {
+ t.Fatalf("home directory should not produce project locations: %#v", loc)
}
}
}