Skip to content

feat(skill): support preloading skills into the agent instruction - #1272

Open
HarveyBase wants to merge 1 commit into
cloudwego:mainfrom
HarveyBase:feat/skill-preload
Open

feat(skill): support preloading skills into the agent instruction#1272
HarveyBase wants to merge 1 commit into
cloudwego:mainfrom
HarveyBase:feat/skill-preload

Conversation

@HarveyBase

@HarveyBase HarveyBase commented Sep 9, 2026

Copy link
Copy Markdown

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

feat(skill): 支持将指定 Skill 预加载进 Agent 系统指令

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
Skills are currently loaded on demand: the model has to call the skill tool and the content comes back as a tool result. This adds Config.PreloadSkills to the skill middleware so that the listed skills are loaded from the Backend at middleware creation and their full content is inlined into the system instruction (bilingual prompt sections included), saving a tool round-trip for skills that should always be active.

Details:

  • Unknown skill names fail fast at creation.
  • Skills using context: fork / fork_with_context are rejected: they run in sub-agents and cannot be inlined.
  • The "model" frontmatter override does not apply to preloaded skills (it only takes effect via the skill tool), documented on the field.
  • The skill tool keeps its on-demand behavior and still lists every skill.
  • Covered by new unit tests (English/Chinese prompt, unknown skill, fork rejection, deprecated New, custom system prompt).

zh(optional):
当前 Skill 为按需加载:模型需要先调用 skill 工具才能拿到完整说明。本 PR 为 skill 中间件新增 Config.PreloadSkills,在创建中间件时即从 Backend 加载指定 Skill 并将其完整内容注入系统指令(含中英文提示词模板),省去一次工具调用。未列出的 Skill 保持原有按需行为;fork / fork_with_context 模式的 Skill 不允许预加载;未知名称在创建时报错。

(Optional) Which issue(s) this PR fixes:

Implements #867

(optional) The PR that updates user documentation:

Not yet — will add to the user docs repo if maintainers want this documented there.

Add Config.PreloadSkills to the skill middleware: the listed skills are
loaded from the Backend when the middleware is created and their full
content is inlined into the system instruction, so the model starts with
their instructions without calling the skill tool.

Preloading is rejected for skills running in fork or fork_with_context
modes, since those are executed by sub-agents. The skill tool keeps its
on-demand behavior and still lists every skill.

Implements cloudwego#867
@CLAassistant

CLAassistant commented Sep 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants