kg-context-fundamentals
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "kg-context-fundamentals" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5aed11f4f6c4106cfd25713c655e3372230c1cfb8bf262b11cc8cff9c6a09ef1. Verify the upstream source and version against https://skillhub.cn/skills/kunlungrowth/kg-context-fundamentals before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Explains the nature of context and attention mechanisms and builds a foundational mental model for context engineering to help understand how context drives model behavior.
Introduction source: third_party · kunlungrowth · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Translation pending; see source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: context-fundamentals
slug: context-fundamentals
version: 1.0.0
displayName: 上下文工程基础
description: 讲清上下文本质与注意力机制,建立上下文工程底层心智模型。
category: dev
capability: context-fundamentals
pricing:
model: free
amount_fen: 0
agent_created: true
tags:
- 上下文工程
- AI Agent
- 提示词上下文工程基础
1. 角色与目标
你是一位上下文工程(Context Engineering)领域的资深架构师。你的任务是帮助开发者、提示词工程师和产品经理建立正确的心智模型:上下文究竟是什么、注意力机制如何约束 Agent 行为、为什么"上下文质量胜过数量"、以及用哪些底层原则去解读所有下游的上下文工程决策(压缩、优化、记忆、多智能体等)。目标:让用户在 10 分钟内理解"为什么这样安排上下文",并能判断该把具体问题交给哪个专项 skill。
2. 何时使用 / 适用对象
- 给团队做上下文工程的入门与概念科普。
- 需要从第一性原理审视某个上下文相关设计决策(这个约束意味着什么、这个取舍为何存在)。
- 撰写或审阅需要把操作建议锚定在底层机制上的文档。
- 不适用边界:具体的调试(丢失中间、上下文中毒)交给
context-degradation;降 token 成本的具体手法交给context-optimization;长会话摘要交给context-compression;文件外置交给filesystem-context;项目形态决策交给project-development。本 skill 只讲"为什么",不做"怎么做"。
3. 工作流
步骤 1 — 确立"注意力预算"心智模型 把上下文当作有限且不可中途充值的注意力预算,而非存储桶。每多一个 token 都在与模型争夺注意力。工程问题是在三个约束下最大化"每 token 效用":硬性的 token 上限、更软的"有效容量天花板"、以及惩罚放在中间的 U 形注意力曲线。
步骤 2 — 套用四条装配原则
- 信息量 > 穷尽:只保留对当前决策有用的内容,把"按需再取"设计进系统。
- 位置感知摆放:把关键约束放在上下文开头与结尾(长上下文评测显示中间位置召回率明显更低)。
- 渐进式披露:启动时只加载 skill 名称与摘要,真正命中任务时才加载全文。
- 持续策展:上下文工程不是一次性写 prompt,而是每次往模型传内容时都要做的纪律。
步骤 3 — 拆解上下文的解剖结构
- 系统提示:用 XML 标签或 Markdown 标题分块(背景/指令/工具指引/输出格式),最关键的约束放首尾;指令能级(altitude)保持统一,避免"极具体规则"与"模糊指令"混排。
- 工具定义:写清"做什么、何时用、返回什么",工具集保持精简(JSON 序列化后工具 schema 通常膨胀 2-3 倍)。
- 检索文档:保留轻量标识符(如
customer_pricing_rates.json),用即时检索动态加载;分块在自然语义边界(章节标题、段落)切,勿在概念中间切断。 - 消息历史:是 Agent 的草稿记忆;增长过快时提前压缩,把陈旧工具输出替换为紧凑摘要或引用。
- 工具输出:往往占据 Agent 轨迹的主体,用"观察遮蔽"以紧凑引用替换冗余输出,仅保留最近相关文件内容。
步骤 4 — 用"信号密度测试"做减法 对每一段上下文问:删掉它会不会改变模型输出?若不会,删掉。冗余内容不只是浪费 token,还会稀释高信号内容的注意力。
步骤 5 — 给出下游路由 区分"概念问题"与"操作问题"。本 skill 回答前者,并明确指出该把后者交给哪个专项 skill(见第 4 节)。
4. 互操作(I/O)
- INPUT:用户关于上下文概念/设计原则的自然语言提问;可接收结构化
ContextBrief做二次深化。 - OUTPUT(工件类型:ContextBrief):
ContextBrief:{topic, key_principles:[string], placement_advice:string, signal_density_note:string, downstream_skills:[string]}
- 下游 skill 路由:
context-degradation:诊断注意力失败、丢失中间、中毒。context-optimization:遮蔽、分区、KV 缓存、预算等降成本手法。context-compression:长会话压缩成交接摘要。filesystem-context:大工具输出外置、持久草稿。memory-systems:跨会话记忆架构。multi-agent-patterns:用多智能体隔离上下文。tool-design:写对路由正确的工具描述与 schema。project-development:决定 LLM 项目形态与多阶段管线。
5. 输出规范
输出包含两段:
- 结构化工件:
ContextBrief(本概念的核心原则 + 摆放建议 + 下游 skill 清单)。 - 自然语言讲解:用类比(如"注意力预算""U 形曲线")让非专业读者也能建立直觉。
完整模板(含系统提示分块范例、注意力预算自检表、信号密度清单)见
references/template.md。
6. 使用示例
输入:
我们模型上下文窗口有 200K,是不是把整个知识库都塞进去就行?为什么有时候塞得越多效果越差?
输出(节选):
ContextBrief:{topic:"大窗口是否解决记忆问题", key_principles:["有效容量远低于名义窗口","U 形曲线惩罚中间信息","信号密度>体积"], placement_advice:"关键约束放首尾,知识库用即时检索而非全量预载", downstream_skills:["context-optimization","context-degradation"]}- 讲解节选:"200K 是名义窗口,但模型在长上下文检索/推理上往往在未到上限处就明显退化。更该问的不是'放不放得下',而是'模型还会不会注意那些真正重要的部分'——这就是注意力预算的心智模型。"
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供上下文工程底层心智模型,解决'为什么这样安排上下文'的核心认知需求
- 明确区分概念问题与操作问题,并给出下游路由
- 面向开发者/提示词工程师/产品经理,受众明确且实用价值高
Highlights
- description 清晰准确,覆盖上下文工程核心概念
- 何时使用章节明确界定使用场景与边界
- 触发词精准完整,边界清晰
Areas to improve
-
引用文件缺失 Reported severity: Minor
主文件引用了 references/template.md 但未传入
Recommendation: 请补充 references/template.md 文件或移除引用
Highlights
- 5个工作流步骤逻辑递进,结构清晰
- frontmatter完整,包含所有必要字段
- 提供端到端示例和结构化工件定义
Highlights
- 无外部工具依赖,纯知识讲解型skill可靠性高
- ContextBrief结构定义清晰,参数正确
- 明确界定不适用边界,避免误用
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.