Skill Tool
Tool that exposes the live Skill catalog, activates allowed Skills, and reads their UTF-8 package files. skill is directly configurable through Tool Access Policy and seeded default-on in the Project Tool Whitelist (PROJECT_DEFAULT_ALLOWED_TOOLS).
Interfaces
- Tool name:
skill. - Registration:
register_skill_tool(registry, resolve_registry, refresh_skills)registers the Tool.resolve_registrymaps(skill_project_id, agent_id)to the live registry a call uses;refresh_skillsrescans Skills from disk (wired toRuntime.reload_skills_async, invoked once on a named Skill miss). Registry resolution, package reads, resource scans, and catalog projection use the Tool worker boundary; the async Runtime refresh builds its replacement registry in a worker and applies registry/cache/System Prompt mutations back on the Event Loop. - Schema: one flat model-facing object with optional non-blank
nameand optionalfile_path; no arguments list the live catalog,namealone activates, andnameplusfile_pathreads.file_pathacceptsSKILL.mdor a relative path belowscripts/,references/, orassets/and is handler-required whenever provided. The schema omitsadditionalProperties; the handler remains authoritative for unknown arguments and field dependencies. - Display: named calls use
nameor the support-file path as their primary; a successful no-argument catalog call derives an exact presentation-onlyresultscount from itscount; failures publish no count. ToolContext.activate_skill(name, content) -> bool | None- dedup-only session hook (ChatSession.register_skill_activation):Truefresh,Falsealready active,Noneno hook (treated as fresh). Nothing is persisted through the hook - the tool result itself is the durable carrier.
Conventions
skillis governed by Tool Access Policy plus the scoped registry's Skill policy: the Tool policy decides whether the capability is offered, while the Agent'sallowed_skillsfilters listing, activation, and reads from the ordinary shared pool. Agent-private Skills and the effective Skills granted by an active Project Context are always allowed inside that Identity-scoped registry; Project disables and shared-Skill opt-ins decide the Project grant. The no-argument result groups the current live catalog by origin.- The activation Result IS the durable carrier. A fresh
skill(name)activation returnsdata: {name, status: "loaded", content, resource_files?, environment_access?}.contentis only the SKILL.md instruction body after complete YAML frontmatter removal; it contains no<skill_content>wrapper, directory preamble, resource block, or environment notice.resource_files, when present, is{guidance, files}and tells the Model these are additional Skill files to read only when the SKILL.md instructs it; scripts are absolute paths for directbashexecution, while references/assets stay relative for this Tool. A{baseDir}marker in the body is still substituted with the absolute Skill directory (seeskills.md). Sessions reconstruct the internal wrapped activation context from the structured Result for same-epoch dedup. At a committed Compaction boundary the checkpoint retains an instruction-free digest at the same Tool Result id, while the original durable carrier remains retrievable throughhistory. - When the activated Skill declares one or more vBot
envrequirements,environment_accesscarries the Bash guidance as a sibling ofcontent. It lists the newly usable names and explains that each Bash call must request them throughenv_keys; the internal trigger/Compaction context wraps the same text before the instructions. The field is included even when permanent Agent grants already caused the System Prompt'stool:bashblock to explain the general mechanism. Project Context grants only Skill visibility; requirement checks and Bash environment grants remain unchanged. File reads remain non-activating and do not receive this field. - File reads are relative and non-activating.
skill(name, file_path)confines the path to the resolved Skill directory and supported package shape, rejects missing or non-UTF-8 files, and returnsdata: {name, status: "file_loaded", file_path, content}. Readingfile_path: "SKILL.md"returns the complete document including frontmatter and is the required source for a completeskill_manageedit; activation by name returns only the instruction body. The result contains no absolute path and does not call the Session activation hook, so support-file reads remain separately trackable without affecting activation dedup. - An already-active Skill returns a short stub (
status: "already_active",message, no content) only within the current Compaction epoch. A committed checkpoint resets dedup, so the nextskill(name)call returns a freshloadedcarrier; aborted Compaction does not. - Rescan on name miss. When a requested
nameis absent from the resolved registry,skillcallsrefresh_skillsonce and re-resolves before giving up, so a Skill hand-dropped after the Session registry was cached can activate or serve a file without a restart. A genuinely unknown name still returnsskill_not_foundafter that single rescan. The current Prompt-Epoch Catalog is deliberately left untouched - only the live lookup is refreshed, with no availability note; successful Compaction later performs the catalog refresh. A no-argument catalog call reads the resolved live registry without an additional rescan.
Constraints & Gotchas
- The loaded envelope shape (
data.name/data.status == "loaded"/data.content, plus optionaldata.resource_files/data.environment_access) is a persisted read contract:core/sessions/parses it (skill_tool_activation) for same-epoch dedup, Compaction names/digest projection, environment grants, and usage statistics. Renaming those fields breaks activation scanning over current-format Sessions. - When
skillis excluded or denied by Tool Access Policy, listing, activation, and file reads are all unavailable; when it is available, an emptyallowed_skillsyields an empty catalog and blocks activation/read access. - Keep all three modes in this one flat optional-field contract:
{}lists,{name}activates, and{name, file_path}reads. Do not add an action discriminator or split catalog listing into a companion Tool.