context-mode
它能做什么
这个技能为在 GitHub Copilot CLI 中使用 context-mode 工具的 AI 智能体设定路由规则。适合分析大型文件、日志或网页,并希望保持对话精简的人。
适用场景
- ✓当智能体需要统计、过滤、比较或解析大量数据的时候。
- ✓当任务涉及获取一个网页,而该网页否则会把原始 HTML 倾倒进对话的时候。
- ✓当某个命令产生了大量输出,需要处理而不是全部阅读的时候。
技能链接
https://github.com/mksglu/context-mode/blob/main/configs/copilot-cli/skills/context-mode/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请统计这个大型日志文件中失败的测试数量,但不要把整个日志粘贴到我们的聊天中。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能会告诉智能体编写在沙箱中运行的代码,并只返回最终答案。大型输出会被保存并搜索,而不是被完整阅读。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
context-mode — MANDATORY routing rules
context-mode MCP tools are available in GitHub Copilot CLI. These rules protect the context window from flooding — one unrouted command can dump tens of KB into the conversation. Follow them strictly.
Think in Code — MANDATORY
Analyze / count / filter / compare / search / parse / transform data: write
code via ctx_execute(language, code) and console.log() only the answer. Do
NOT read raw data into context. PROGRAM the analysis, do not COMPUTE it by
reading. One script replaces ten tool calls.
BLOCKED — do NOT use
- curl / wget — dumps raw HTTP into context. Use
ctx_fetch_and_index(url, source)thenctx_search(queries). - Inline HTTP (
node -e "fetch(...)",python -c "requests.get(...)") — usectx_execute(language, code); only stdout enters context. - Reading large files to analyze — use
ctx_execute_file(path, language, code).
Tool selection
- GATHER:
ctx_batch_execute(commands, queries)— runs all commands, auto-indexes, returns search. One call replaces dozens. - PROCESS:
ctx_execute/ctx_execute_file— sandbox; only stdout enters context. - WEB:
ctx_fetch_and_index(url, source)thenctx_search(queries)— raw HTML never enters context. - SEARCH:
ctx_search(queries: [...])— all questions in one call.
Write artifacts to FILES; return a path + one-line description, not inline dumps.
常见问题
它依赖哪些工具?
它依赖 context-mode 工具,例如沙箱代码执行、批处理命令、索引搜索和网页获取。
它会阻止普通命令吗?
它会阻止少数会倾倒原始输出的命令,例如 curl 和 wget,并要求智能体改用沙箱。
我需要安装 context-mode 工具吗?
需要。context-mode 工具必须在 GitHub Copilot CLI 中可用,这些规则才能生效。
详情
作者的原始描述
MANDATORY routing rules for context-mode. Invoke whenever you analyze, count, filter, compare, search, parse, or transform data; fetch a URL; or run a data-heavy command — so raw bytes stay out of the context window.
repo: mksglu/context-mode
热度
- GitHub 星标
- 33k
- 排名
- #8509
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
context-mode
33k教你的智能体使用 context-mode 工具来读取、搜索和运行大量数据的任务,让大型输出不占用主对话空间。
context-mode
33k教你的智能体在输出可能很大时(例如日志、JSON 或构建结果),使用 context-mode 工具代替普通的 shell 命令。
ctx-doctor
33k运行 context-mode 诊断,检查运行环境、钩子、搜索存储、插件设置和版本,然后显示清晰的通过或失败报告。
ctx-index
33k让你的智能体把本地项目或文件夹索引到可搜索的存储中,之后提问时可以直接找到相关片段,而无需重新阅读每个文件。