Fast-follow for the two code-review findings on #555 (buildPiSkillArgs).
Finding 1 — all mode dropped Pi's native skill roots.mosaic launches Pi with --no-skills, which suppresses Pi's own native auto-discovery. The all catalog therefore has to re-enumerate the native roots (~/.pi/agent/skills/ and <cwd>/.pi/skills/) explicitly, or any skill living only under those roots is silently dropped. discoverPiSkills now scans them. This also fixes a latent bug in the enumerator: it skipped symlinked entries (!entry.isDirectory()), but synced fleet skills land as symlinks — so they were being dropped on every launch.
Finding 2 — discover mode double-loaded.discover keeps Pi's native auto-discovery ON (no --no-skills), but it force-loaded the fleet skills unconditionally, registering anything Pi already finds natively twice. It now filters force-loads against the native-root realpath set.
Approach
Realpath-based dedup throughout, so a skill reached via a symlink and via its canonical path collapse to one --skill:
skillRealPath — realpathSync with literal-path fallback (broken/missing links degrade gracefully).
piNativeSkillRoots(cwd) — the two roots Pi auto-discovers.
enumerateSkillDirs(roots) — scans roots, accepts dirs and symlinks bearing a SKILL.md, dedups by realpath. Exported for test coverage.
piNativeSkillRealPaths(cwd) — realpaths Pi will auto-discover, for the discover-mode filter.
mergeSkillArgs — now dedups by realpath.
buildPiSkillArgs — gains an injectable 5th param (nativeSkillRealPaths) so the discover-mode filter is deterministic under test.
No launcher/passthrough behavior changes; none mode is unchanged.
Tests
discover-mode: drops a forced skill present in the native set; keeps one that isn't; collapses an intra-forced-set duplicate.
enumerateSkillDirs real-FS coverage: symlinked-skill acceptance (the regression), cross-root realpath dedup, and SKILL.md/missing-root gating.
Independent review (author ≠ reviewer) completed before open: APPROVE-WITH-NITS; all three SHOULD-FIX nits (discover intra-set dedup consistency + the two missing-coverage items) remediated in this branch.
## Summary
Fast-follow for the two code-review findings on #555 (`buildPiSkillArgs`).
**Finding 1 — `all` mode dropped Pi's native skill roots.** `mosaic` launches Pi with `--no-skills`, which suppresses Pi's own native auto-discovery. The `all` catalog therefore has to re-enumerate the native roots (`~/.pi/agent/skills/` and `<cwd>/.pi/skills/`) explicitly, or any skill living *only* under those roots is silently dropped. `discoverPiSkills` now scans them. This also fixes a latent bug in the enumerator: it skipped symlinked entries (`!entry.isDirectory()`), but synced fleet skills land as symlinks — so they were being dropped on every launch.
**Finding 2 — `discover` mode double-loaded.** `discover` keeps Pi's native auto-discovery ON (no `--no-skills`), but it force-loaded the fleet skills unconditionally, registering anything Pi already finds natively twice. It now filters force-loads against the native-root realpath set.
## Approach
Realpath-based dedup throughout, so a skill reached via a symlink and via its canonical path collapse to one `--skill`:
- `skillRealPath` — `realpathSync` with literal-path fallback (broken/missing links degrade gracefully).
- `piNativeSkillRoots(cwd)` — the two roots Pi auto-discovers.
- `enumerateSkillDirs(roots)` — scans roots, accepts dirs **and** symlinks bearing a `SKILL.md`, dedups by realpath. Exported for test coverage.
- `piNativeSkillRealPaths(cwd)` — realpaths Pi will auto-discover, for the discover-mode filter.
- `mergeSkillArgs` — now dedups by realpath.
- `buildPiSkillArgs` — gains an injectable 5th param (`nativeSkillRealPaths`) so the discover-mode filter is deterministic under test.
No launcher/passthrough behavior changes; `none` mode is unchanged.
## Tests
- discover-mode: drops a forced skill present in the native set; keeps one that isn't; collapses an intra-forced-set duplicate.
- `enumerateSkillDirs` real-FS coverage: symlinked-skill acceptance (the regression), cross-root realpath dedup, and `SKILL.md`/missing-root gating.
- **308 pass** (was 304); `pnpm typecheck` 41/41, `pnpm lint` 23/23, `prettier --check` clean.
## Review
Independent review (author ≠ reviewer) completed before open: APPROVE-WITH-NITS; all three SHOULD-FIX nits (discover intra-set dedup consistency + the two missing-coverage items) remediated in this branch.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fast-follow for the two code-review findings on #555.
Finding 1 — `all` mode dropped Pi's native skill roots. `mosaic` passes
`--no-skills`, which suppresses Pi's own auto-discovery, so the `all`
catalog must re-enumerate the native roots (`~/.pi/agent/skills/` and
`<cwd>/.pi/skills/`) explicitly or skills living only there vanish.
`discoverPiSkills` now scans those roots too. Also fixes a latent bug:
the old enumerator skipped symlinked entries (`!isDirectory()`), but
synced fleet skills land as symlinks — they were being dropped.
Finding 2 — `discover` mode (which keeps native discovery ON) force-loaded
fleet skills unconditionally, double-registering any skill Pi already finds
natively. It now filters force-loads against the native-root realpath set.
Implementation: realpath-based dedup throughout. New `skillRealPath`,
`piNativeSkillRoots`, `enumerateSkillDirs` (accepts dirs + symlinks, dedup
by realpath), `piNativeSkillRealPaths`. `mergeSkillArgs` dedups by realpath.
`buildPiSkillArgs` gains an injectable 5th param for deterministic tests.
Tests: discover-mode native-filter + intra-set dedup cases, plus real-FS
coverage of `enumerateSkillDirs` (symlink acceptance, cross-root realpath
dedup, SKILL.md gating). 308 pass; typecheck/lint/prettier green.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QoYiBeKNh3BiYtAJS5Z587
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Fast-follow for the two code-review findings on #555 (
buildPiSkillArgs).Finding 1 —
allmode dropped Pi's native skill roots.mosaiclaunches Pi with--no-skills, which suppresses Pi's own native auto-discovery. Theallcatalog therefore has to re-enumerate the native roots (~/.pi/agent/skills/and<cwd>/.pi/skills/) explicitly, or any skill living only under those roots is silently dropped.discoverPiSkillsnow scans them. This also fixes a latent bug in the enumerator: it skipped symlinked entries (!entry.isDirectory()), but synced fleet skills land as symlinks — so they were being dropped on every launch.Finding 2 —
discovermode double-loaded.discoverkeeps Pi's native auto-discovery ON (no--no-skills), but it force-loaded the fleet skills unconditionally, registering anything Pi already finds natively twice. It now filters force-loads against the native-root realpath set.Approach
Realpath-based dedup throughout, so a skill reached via a symlink and via its canonical path collapse to one
--skill:skillRealPath—realpathSyncwith literal-path fallback (broken/missing links degrade gracefully).piNativeSkillRoots(cwd)— the two roots Pi auto-discovers.enumerateSkillDirs(roots)— scans roots, accepts dirs and symlinks bearing aSKILL.md, dedups by realpath. Exported for test coverage.piNativeSkillRealPaths(cwd)— realpaths Pi will auto-discover, for the discover-mode filter.mergeSkillArgs— now dedups by realpath.buildPiSkillArgs— gains an injectable 5th param (nativeSkillRealPaths) so the discover-mode filter is deterministic under test.No launcher/passthrough behavior changes;
nonemode is unchanged.Tests
enumerateSkillDirsreal-FS coverage: symlinked-skill acceptance (the regression), cross-root realpath dedup, andSKILL.md/missing-root gating.pnpm typecheck41/41,pnpm lint23/23,prettier --checkclean.Review
Independent review (author ≠ reviewer) completed before open: APPROVE-WITH-NITS; all three SHOULD-FIX nits (discover intra-set dedup consistency + the two missing-coverage items) remediated in this branch.
🤖 Generated with Claude Code