[Bug] Skill 的 description 注入模型时被硬截断为 249 字符 + "...",远低于 Agent Skills 规范允许的 1024 字符
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
技能 / Skills · Agent 能力扩展
涉及的 Agent 框架 · Agent framework
不涉及框架 · Not framework-specific
严重程度 · Severity
中等 · 功能受损(不阻塞使用,但技能触发可靠性下降)
复现频率 · Reproducibility
必现 · Always(固定 249 字符上限,任何超过该长度的 description 均被截断)
问题描述 · Description
ZCode 在会话启动阶段向模型注入技能清单(progressive disclosure 的 Metadata 阶段)时,将每个 skill 的 description 字段硬截断为固定 249 字符并追加 ...。
而 Agent Skills 规范对 description 的约束是:
Max 1024 characters. Non-empty. Describes what the skill does and when to use it.
- Must be 1-1024 characters
- Should include specific keywords that help agents identify relevant tasks
规范在 Progressive disclosure 一节还明确说明 Metadata 阶段的行为是完整加载:
Metadata (~100 tokens): The
nameanddescriptionfields are loaded at startup for all skills
即合法的 description(≤1024 字符)应当在注入时完整保留。ZCode 的 249 字符截断远低于规范上限,且规范特别建议把触发关键词写进 description——被截掉的后半段关键词全部丢失,直接导致模型无法依据完整 description 匹配技能,技能触发准确率下降。
复现步骤 · Steps to reproduce
- 在
~/.zcode/skills/<skill-name>/SKILL.md创建一个符合规范的技能,将description写为 300–1024 字符(在尾部放置触发关键词)。 - 新开会话,发送任意消息。
- 打开本地模型 IO 日志
~/.zcode/cli/rollout/model-io-<sessionId>.jsonl的第一条记录,在 request 的 system prompt 中搜索该技能名。 - 对比注入内容与 SKILL.md 源文件。
期望表现 · Expected behavior
Metadata 阶段按规范完整注入 name + description:≤1024 字符的 description 全部保留,尾部关键词可用于技能匹配。
实际表现 · Actual behavior
description 被硬截断为恰好前 249 字符 + ...。实测数据(6 个技能,含自定义技能与官方插件技能):
| 技能 | 源 description 长度 | 注入到模型请求的长度 |
|---|---|---|
| A(自定义) | 257 | 249 + ... |
| B(自定义) | 387 | 249 + ... |
| C(官方插件) | 515 | 249 + ... |
| D(官方插件) | 565 | 249 + ... |
| E(自定义) | 166 | 完整,未截断 |
| F(官方插件) | 240 | 完整,未截断 |
规律一致:源长度 >249 的一律截断在 249 字符处;<249 的原样保留。说明这是一个写死的 ~250 字符私有上限。
补充说明:所有被截断的 description 源长度均 ≤1024、符合规范,且技能加载过程无任何格式报错——说明解析层接受规范格式,仅在注入层做了额外截断。
ZCode 版本 · ZCode version
3.11.2(Desktop)
设备 / 系统 / 浏览器 · Device / OS / Browser
Desktop / Windows 11 x64
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
证据取自本地模型 IO 日志 ~/.zcode/cli/rollout/model-io-<sessionId>.jsonl(首条 request 的 system prompt 技能清单节选,路径与技能内容已脱敏):
- skill-a: Use when ... from log e... (file: ~\.zcode\skills\skill-a\SKILL.md)
- skill-e: Use when writing or running PowerShell ... or shell troubleshooting. (file: ...)
(skill-a 源 257 字符 → 注入 249 + ...;skill-e 源 166 字符 → 完整保留)
修复建议
- 将注入上限提升到规范允许的 1024 字符;或
- 改为按 token 预算动态分配,而不是固定字符数截断;或
- 至少在技能清单总量超限时给出可配置项,由用户权衡上下文占用与触发精度。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the skill metadata in each ~/.zcode/skills//SKILL.md and compare it with the first request in ~/.zcode/cli/rollout/model-io-.jsonl. Trace where the system-prompt skill list is assembled and determine why descriptions over 249 characters are shortened. Done means valid descriptions up to 1024 characters are preserved in the injected metadata, with tests covering both shortened and unshortened examples.
Written by the indexing model from the issue text.
Assessment
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100