‹ 首页

context-loading

@developersglobal · 收录于 1 周前

Load minimum necessary context into agent context windows. Prevents token bloat, reduces cost, and improves focus. Only load what the current task needs.

适合你,如果经常因上下文过长导致高成本或注意力分散

/ 下载安装
context-loading.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add developersglobal/ai-agent-skills/context-loading
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- developersglobal/ai-agent-skills/context-loading
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify developersglobal/ai-agent-skills/context-loading
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
64GitHub stars
~515上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · f47f948
Overview

More context is not better context. Irrelevant context dilutes attention, increases cost, and slows inference. This skill enforces disciplined context loading: only the files, docs, and history that the current task requires.

When to Use
  • Before starting any complex agent task
  • When designing system prompts for production agents
  • When context windows are filling up
Process
Step 1: Identify Required Context
  1. List the files/docs the agent needs to read to complete THIS specific task.
  2. For each item, ask: "Can the agent complete the task without this?" If yes, don't include it.
  3. Prioritize: system prompt → task definition → directly relevant code → supporting references.

Verify: Every item in context is directly necessary for the current task.

Step 2: Summarize, Don't Dump
  1. Long conversation history → summarize to key decisions and current state.
  2. Large files → extract only the relevant functions/sections.
  3. Entire docs → extract only the relevant sections.
  4. Previous agent output → extract only the conclusions and next steps.

Verify: No item in context exceeds what's needed from that source.

Step 3: Set Context Budgets
  1. Define token allocation for each context section:
  2. System prompt: ≤ 2,000 tokens
  3. Task definition: ≤ 500 tokens
  4. Code context: ≤ 4,000 tokens
  5. Conversation history (summarized): ≤ 1,000 tokens
  6. Stay well within model context limits (leave 30% buffer for output).

Verify: Total prompt fits within 70% of model context limit.

Step 4: Refresh Context for New Tasks
  1. Don't carry over context from a completed task to a new task.
  2. Start each distinct task with a fresh, minimal context.
  3. Re-introduce only what the new task genuinely needs.
Verification
  • [ ] Context items limited to task-required items only
  • [ ] Long content summarized before inclusion
  • [ ] Token budget defined and respected
  • [ ] Context window at ≤70% capacity
References
  • [rag-and-memory skill](../rag-and-memory/SKILL.md)
  • [multi-agent-orchestration skill](../multi-agent-orchestration/SKILL.md)
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。