Honour `disable-model-invocation` and `user-invocable` in `Skills`, skip stray skill library paths, and find `clai2` repository skills from subdirectories
Covers the decision-free items from #10371, the post-merge review of Agent Skills in harness (#9802) and clai2 (#9803): items 1, 3, 5 (step 1 only), 6 and 8.
[!WARNING]
Compatibility impact: SkillCatalog.skipped (new in harness 0.56.0, released 2026-10-13) now holds SkippedSkill entries instead of strings. Code that compares entries with strings or calls str methods on them breaks. str(entry) and f-strings still give the old message.
Why this can ship in a minor release: Pydantic AI Harness is on 0.x, where the version policy allows API changes between minor releases. The field shipped two days ago, and the review flagged it as cheapest to change now.
Migration: read entry.message for the text, or entry.path and entry.reason instead of parsing it.
- Refs #10371
What changed, per item
- 1. A bad library path no longer fails turns or turns skills off. With
missing_directories='skip', a library path that is a file or holds aSKILL.mditself is now skipped with aUserWarningand askippedentry instead of raisingValueError.'error'still raises the same messages. Inclai2, a stray.agents/skills/SKILL.mdnow prints one notice at startup and the other folders still load. If one appears mid-session, the next turn leaves it out instead of failing. The README's "turns skills off ... until the next/reload" now describes only an unreadable folder at startup, which is the only case that still does that. - 8. Structured
SkillCatalog.skipped. Each entry is a frozenSkippedSkill(path, reason, message).reasonis aSkipReasonLiteral:'invalid','duplicate_name','not_a_directory'or'skill_package'. Both new types are exported frompydantic_ai_harness.skills. - 3. Invocation frontmatter. Harness parses
disable-model-invocationanduser-invocable(YAMLtrue/false, any letter case; any other value skips the skill as invalid) and exposes them asSkillDefinition.model_invocableand.user_invocable. Both are removed from the ignored-fields list. A run leaves skills withmodel_invocable=Falseout of the model's catalog, so there is noload_capabilitywhen those are the only skills.Skills.loadstill returns them for host commands.clai2registers/commandsonly for user-invocable skills, and prints the "ignoring unsupported frontmatter fields" advice as a startup notice, since__main__.pyhides library warnings. - 5, step 1. Subdirectory launches.
CoderSettings.skill_libraries(parents=...)puts each relative folder in the launch directory first, then in each parent up to the git root, nearest first.preparegets the parents from the newrepository_directories, next tofind_project_file, and stops at the first.gitthe same way. Outside a git repository, only the launch directory is searched, as before. There is no downward or nested discovery. - 6.
/skill-nameuses the current file. The command reloads the catalog when it runs, so it sends the currentSKILL.md, using the same precedence the model's catalog uses. If the skill is gone, it says so, with the skip message when the file became invalid. If the file now hasuser-invocable: false, it says that instead.
Docs: docs/harness/skills.md and its README twin, the harness agent skill reference, the clai2 README, PLUGINS.md and the AGENTS.md file map.
Not in this PR (need a decision from @DouweM)
Item 2 (project vs personal precedence), item 4 (trust gate for project skills), item 5 step 2 (downward discovery), and items 7 and 9. Nothing here makes them harder. Item 5's walk adds parent folders right after each relative folder, so changing project/personal order (item 2) is still only a change to the folder list.
Verification
- New regression tests in
tests/harness/skills/test_skills.pyandtests/clai2/test_coder_skills.py. I checked that each fails againstmain's source (8 harness, 9clai2). The git-root and outside-a-repository guards pass both ways, as they should. - Focused branch coverage of
skills/_loader.pyandskills/_capability.pyis 100%. The newcoder.pyandproject_settings.pylines are covered too. - Single-file Pyright and repo-wide Ruff pass.
- Manual check in tmux: launching
clai2inrepo/sub/srcfound the repository's skills and printed the skill-package and ignored-frontmatter notices./helplisted the model-disabled skill but not theuser-invocable: falseone./deployafter deleting itsSKILL.mdprinted the "gone" message.
Checklist
- No breaking changes in accordance with the version policy. (Harness 0.x; see the compatibility note above.)
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver. (The API check doesn't cover harness, so there is no waiver.)
- PR title is fit for the release changelog.
(Claude, Douwe's coding agent)