Skip to content

fix: ignore legacy skill dirs in agent discovery#204

Open
affsantos wants to merge 1 commit into
nicobailon:mainfrom
affsantos:fix-ignore-legacy-skill-dirs
Open

fix: ignore legacy skill dirs in agent discovery#204
affsantos wants to merge 1 commit into
nicobailon:mainfrom
affsantos:fix-ignore-legacy-skill-dirs

Conversation

@affsantos
Copy link
Copy Markdown

@affsantos affsantos commented May 21, 2026

Summary

Legacy .agents/**/*.md discovery currently treats Pi skill files under .agents/skills/** as executable subagents when they contain name and description frontmatter. That makes valid skill packages like .agents/skills/foo/SKILL.md show up in subagent list as runnable agents.

This keeps the legacy .agents compatibility behavior, but excludes .agents/skills/** from agent discovery. The intent is to preserve custom legacy agents under .agents/ while respecting Pi's documented skill location under .agents/skills/.

Why

Pi documents both canonical and legacy skill locations, including:

  • ~/.pi/agent/skills/
  • ~/.agents/skills/
  • .pi/skills/
  • .agents/skills/

Since skills also use markdown/frontmatter, broad .agents/**/*.md agent discovery can accidentally classify skill docs as executable agents. This is confusing in subagent list, where skill instruction packages can appear to be runnable subagents.

Changes

  • Add an optional directory-skip predicate to recursive markdown discovery.
  • Skip skills subtrees only when scanning a legacy .agents root for agents.
  • Add coverage that .agents/skills/*.md and .agents/skills/*/SKILL.md are ignored while ordinary legacy .agents/*.md agents still load.

Validation

  • node --experimental-strip-types --test test/unit/agent-frontmatter.test.ts

Note: npm test -- test/unit/agent-frontmatter.test.ts starts the full unit suite in this checkout and hits unrelated missing peer dependencies for TUI-related tests (@earendil-works/pi-tui, @earendil-works/pi-coding-agent). The targeted test file passes with Node's strip-types runner.

@nicobailon nicobailon added bug Something isn't working ready-for-human Needs human implementation or product/design judgment priority: high Important user-facing bug or high-value maintenance item labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: high Important user-facing bug or high-value maintenance item ready-for-human Needs human implementation or product/design judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants