Skip missing and unreadable skill libraries and skills by default, add `SkillCatalog.advice`, and search `pax` skill folders nearest directory first

Merged
DO
8d ago
+491-130

Follow-ups from #10378, which left four questions open. Douwe has decided each one; this PR implements those decisions.

What changed, per item

  1. SkippedSkill keeps its name. It shipped in #10378 (v2.57.0, harness 0.57.0). Its entries describe skills that were left out, and skipping a library path also skips the skills in it, so the name still fits. Its docstring and the docs now say it covers skipped library paths too.
  2. pax searches skill folders nearest directory first. For each directory from the launch directory up to the git root, CoderSettings.skill_libraries() tries every relative folder, in the configured order, before moving up a level. Launched in repo/src, repo/src/.claude/skills now beats repo/.agents/skills. Before, it was folder name first: every .agents/skills up the tree, then every .claude/skills.
    • Why this order: harness RepoContext loads instruction files the same way, with the directory as the major key and the filename order breaking ties within one directory. Codex, OpenCode and our own RepoContext all tell the model that a more deeply nested AGENTS.md takes precedence. OpenCode orders skill folders folder name first, but nearest directory first keeps skills consistent with instruction files.
    • ~/ and absolute folders keep their place in the configured list. The default list puts the project folders before the personal ones, so project skills win, as in Codex, OpenCode and Gemini CLI. Consecutive relative folders are searched together, which only matters for custom lists that mix them.
    • Updated: the skill_libraries() docstring, the skill_folders description shown in /plugins configure coder, the pax reference and PLUGINS.md.
  3. New SkillCatalog.advice: Sequence[str]. It holds the run-time advice harness otherwise only warns about: descriptions over the 1,024-character limit, and frontmatter fields whose behavior isn't implemented. A run builds its warnings from the same list, so it still warns exactly as before. The field defaults to empty, so code that builds a SkillCatalog keeps working. pax does not show it: #10633 made coder report only skipped skills, since fields such as allowed-tools belong to other clients sharing the folders.
  4. Skipping is the default.
    • Skills(missing_directories=...) now defaults to 'skip'. A library directory that doesn't exist is left out quietly. A path that is a file, is a skill package, or can't be read (PermissionError when it is stat'ed or listed) is left out with a SkippedSkill and a UserWarning. Pass missing_directories='error' to fail the run instead. SkipReason gains 'unreadable'.
    • A skill directory or SKILL.md inside a readable library that can't be read is now skipped in both modes, with reason='unreadable', like an invalid SKILL.md. Before, it failed the run.
    • In pax, an unreadable project skills folder or skill prints one notice, and the other skills still load. Before, skills were turned off at startup, and if a folder became unreadable mid-session every turn failed.

Docs: docs/harness/skills.md and its README twin, the harness agent skill reference (KNOWLEDGE-AND-MEMORY.md), the pax reference and PLUGINS.md.

Behavior changes to be aware of

  • Skills(...) without missing_directories no longer fails the run for a missing, non-library or unreadable library path; it skips it, with a warning for every case except a missing directory. Pass missing_directories='error' to keep failing (item 4).
  • An unreadable skill directory or SKILL.md is skipped with a warning instead of raising PermissionError, in both modes (item 4).
  • pax launched in a subdirectory can pick a different skill when two directories have one with the same name in folders with different names (item 2).
  • SkipReason gains a value, so type checkers will flag an exhaustive match on it.

This has the compatibility impact label, and API-compatibility waivers against v2.76.0 for the added SkipReason value and the new missing_directories default on Skills.__init__ and Skills.from_spec. Harness and pax are on 0.x.

Verification

  • New regression tests in tests/harness/skills/test_skills.py and tests/pax/test_coder_skills.py cover the new default, unreadable libraries, skill directories and SKILL.md files, and pax's "Skills are off" guard for an error Skills doesn't catch. The permission tests use the existing skip for root and Windows.
  • tests/harness/skills, tests/pax/test_coder_skills.py, tests/pax/test_coder_plugin.py and the docs-parity tests pass (269 tests).
  • Focused branch coverage: skills/_loader.py and skills/_capability.py 100%. The lines changed in coder.py are covered.
  • Pyright on each changed file and Ruff pass.

Checklist

  • No breaking changes in accordance with the version policy. (Harness and pax are 0.x; see "Behavior changes" above.)
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver. (See "Behavior changes" above.)
  • PR title is fit for the release changelog.

(Claude, Douwe's coding agent)