OpenSkills – 不要让未使用的代理指令膨胀你的大型语言模型上下文

1作者: twwch13 天前原帖
你好,HN, 最近我一直在构建人工智能代理,并遇到了一个常见的“上下文膨胀”问题。当一个代理拥有20个以上的技能时,将每个系统提示、参考文档和工具定义都塞进一个请求中,很快就会达到令牌限制,从而降低模型性能(即“迷失在中间”问题)。 为了解决这个问题,我构建了OpenSkills,这是一个开源SDK,采用渐进式信息披露架构来管理代理技能。 核心概念:OpenSkills将技能分为三个层次,而不是一次性加载所有内容: 第一层(元数据):轻量级标签和触发器(始终加载以便发现)。 第二层(指令):核心的SKILL.md提示(仅在技能匹配时加载)。 第三层(资源):根据特定对话上下文有条件加载的重型参考文档或脚本。 为什么这很重要: 可扩展性:你可以拥有数百个技能,而不会让大型语言模型的上下文窗口感到不堪重负。 Markdown优先:技能以简单的SKILL.md格式定义。这种格式易于阅读,适合使用git,并且便于大型语言模型解析。 条件资源:例如,“财务技能”仅在查询实际提到税务合规时才会调用tax-code.pdf参考文档。 主要特点: - Python 3.10+ SDK。 - 自动技能匹配和调用。 - 支持脚本执行(通过[INVOKE:script_name]语法)。 - 多模态支持(通过URL/base64的图像)。 - GitHub:[https://github.com/twwch/OpenSkills] PyPI: pip install openskills-sdk
查看原文
Hello HN,<p>I’ve been building AI agents lately and ran into a common &quot;Context Bloat&quot; problem. When an agent has 20+ skills, stuffing every system prompt, reference doc, and tool definition into a single request quickly hits token limits and degrades model performance (the &quot;lost in the middle&quot; problem).<p>To solve this, I built OpenSkills, an open-source SDK that implements a Progressive Disclosure Architecture for agent skills.<p>The Core Concept: Instead of loading everything upfront, OpenSkills splits a skill into three layers:<p>Layer 1 (Metadata): Light-weight tags and triggers (always loaded for discovery).<p>Layer 2 (Instruction): The core SKILL.md prompt (loaded only when the skill is matched).<p>Layer 3 (Resources): Heavy reference docs or scripts that are conditionally loaded based on the specific conversation context.<p>Why this matters:<p>Scalability: You can have hundreds of skills without overwhelming the LLM&#x27;s context window.<p>Markdown-First: Skills are defined in a simple SKILL.md format. It’s human-readable, git-friendly, and easy for the LLM to parse.<p>Conditional Resources: For example, a &quot;Finance Skill&quot; only pulls in the tax-code.pdf reference if the query actually mentions tax compliance.<p>Key Features:<p>Python 3.10+ SDK.<p>Automatic skill matching and invocation.<p>Support for script execution (via [INVOKE:script_name] syntax).<p>Multimodal support (Images via URL&#x2F;base64).<p>GitHub: [https:&#x2F;&#x2F;github.com&#x2F;twwch&#x2F;OpenSkills] PyPI: pip install openskills-sdk