Repository navigation
feat(skills): load Agent Skills from Workspace files, R2, or a manifest - #2771
Merged
Merged
Conversation
- agents/skills: spec-strict parseSkill, workspace() source, SkillSource returning results, loadSkillCatalog + createSkillTools, manifest() (fromManifest kept as an alias) - remove the agents:skills Vite import, agents/skills/compile, and skills-module.d.ts; esbuild is now a dev dependency - Think: drop skillWorkspace and the extension "skill" context type; reload the catalog every turn - pi harness skills() uses the shared catalog - examples: replace agent-skills and assistant with computer-skills and r2-skills
🦋 Changeset detectedLatest commit: 9a5096c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
🟡 agents import sizes: 1 entry point grew
Changed exports (28)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
3 tasks done
Keeps ai and zod out of the agents/skills entry, matching the other <feature>/tools/ai-sdk exports.
mattzcarey
marked this pull request as ready for review
October 29, 2026 13:51
…ew fixes
- skills.runner: ctx.workspace (JS, Python, Bash) resolves . and .. and
rejects paths outside /workspace
- loadSkillCatalog({ previous }): a failing source keeps its last skills;
Think passes its previous catalog
- read resources from the source object that listed the skill, so sources
sharing an id do not misroute
- r2 readResource reads the object directly instead of relisting
- move SKILL.md text parsing to markdown.ts so the pi skills extension
does not load yaml
- single-line changesets
…alog as a reminder block - an overridden getSystemPrompt() is always the top of the system prompt, above configureContext() blocks and the skills catalog, instead of being dropped once any block exists; Think's default stays a fallback - the think_skills block is whenChanged: "remind", so skill changes mid-conversation do not rebuild the frozen prompt and break the provider's prefix cache - vite: importing agents:skills fails with a migration message - manifest()/fromManifest() accept the old fields (fingerprint, version, rawContent, resource kind/size/precompiled); kind is honored
…e runner to agents/skills/runner
- parseSkill({ mode }): strict by default; sources parse leniently, loading
skills with spec-format or directory-mismatch names, long descriptions,
and invalid optional fields, and reporting each as a SkillWarning
diagnostic. Missing descriptions, unsafe names, and non-YAML frontmatter
are still rejected; unquoted ': ' values are repaired. Workspace and R2
read resources from the directory a lenient name came from.
- runner() moves to agents/skills/runner so agents/skills no longer loads
just-bash and codemode (~310 KiB gzipped -> 0.1-33 KiB per export).
Think's skills namespace still includes runner; a type test guards the
re-export list.
…uplicates' warnings
…th their validation error - remove parse modes, lenient warnings, YAML repair, and the name fallback - SkillParseError.issues lists every broken rule - sources list a skill that fails validation as invalid under its directory; the catalog keeps it (prompt section, tool enum) and activate_skill / read_skill_resource fail with InvalidSkillError - AI SDK skill tools throw (tool error); pi tools return isError
…a rule with warnings One parser, no modes. parseSkill() returns warnings for broken spec rules and fails only for skills that cannot be used (no description, unsafe name, unparseable YAML), which are skipped and logged as the guide recommends. A skill follows the spec when warnings is empty; the examples reject it on write otherwise. Skill tool failures stay tool errors.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent Skills in
agents/skillsare now files.skills.workspace(workspace)reads every/workspace/.agents/skills/<name>/SKILL.mdfrom a Computer Workspace before each turn,skills.r2()reads the same layout from a bucket, andskills.manifest()defines skills in code. The parser follows the Agent Skills spec, and Think and the pi harness share one catalog.Most of the skills code was left over from Think's first pass and only Think used it:
agents:skills, the Vite plugin,agents/skills/compile) or copied from sources into the Workspace (skillWorkspace), so a skill written in the Workspace was never foundnameand dropped invalid skills silently"skill"context block type from the removed Sessionload_contextmodelparseSkill()checksname(format, length, matches the directory),description,compatibility,metadataandallowed-tools, and keeps unknown frontmatter keys inextraFields. It follows the spec's guide for agents: a skill that breaks a rule still loads, with a warning per broken rule (SkillWarningdiagnostic). Skills with no description, an unsafe name or unparseable YAML are skipped and logged. A skill follows the spec whenwarningsis empty, which is what to check before writing one. Skill tool failures (unknown skill, missing file) are tool errors: the AI SDK tools throw and the pi tools returnisError.SkillSourceislist()+readResource(), both returning results. Invalid skills, failing sources and duplicate names become catalog diagnostics. With{ previous }, a source that fails to list keeps its last skills, and Think passes its previous catalog each turn.createSkillTools()is exported fromagents/skills/tools/ai-sdk, like the other<feature>/tools/ai-sdkexports, soagents/skillsitself does not importaiorzod.getSystemPrompt()now always renders above the context blocks, instead of being dropped once any block (including the skills catalog) exists. Thethink_skillsblock iswhenChanged: "remind", so a skill changing mid-conversation reaches the model as a reminder and does not rebuild the cached system prompt.agents:skillsimport (it now fails with a migration message),agents/skills/compile,skills-module.d.ts,SkillRegistry, Think'sskillWorkspace, andExtensionSkillBridge.esbuildmoved to dev dependencies.skills.fromManifest()is an alias ofskills.manifest()and still accepts the old fields (fingerprint,version, resourcekind).skills.runner()stays as an experimental fallback for R2 and manifest skills, with a TODO to move to Computer. It no longer compiles TypeScript. Itsctx.workspaceaccess now rejects paths outside/workspace. It lives atagents/skills/runner(Think still exposesskills.runner), soagents/skillsno longer pulls injust-bashand codemode: its exports drop from about 310 KiB gzipped to 0.1–33 KiB.computer-skills(skills as Workspace files, scripts run withexec) andr2-skillsreplaceagent-skillsandassistant. Both seed their starter skills on start, with a TODO to use a Computer loader.Docs: cloudflare/cloudflare-docs#34717.
agentsworkers, node and harness-pi suites, and Think's workers suite ran. I haven't run the two examples against a live model.