跳到正文
Skillpedia
提示词与 LLM8.6k · #12423

context-engineering

它能做什么

这项技能讲解如何组织 AI 智能体在工作时所看到的信息。适合搭建或修复那些容易遗忘细节或重复内容的智能体配置的人。它是较早的版本快照,请对照当前模型检查其建议。

适用场景

  • ✓当智能体在任务进行到一半时偏离方向、重复内容或忘记重要限制的时候。
  • ✓当你在决定哪些指令应在开始时加载,哪些只在需要时加载的时候。
  • ✓当你在规划一个智能体如何将工作交给另一个智能体时。

技能链接

https://github.com/mvschwarz/openrig/blob/main/packages/daemon/specs/agents/shared/skills/process/context-engineering/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mvschwarz/openrig/blob/main/packages/daemon/specs/agents/shared/skills/process/context-engineering/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的 AI 智能体在长任务进行到一半时总是忘记我的规则。我应该如何设置它的上下文?”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能描述智能体窗口中的信息如何被选择、裁剪和共享。它是 2024 和 2025 年实践的快照,因此智能体在依赖这些建议之前应先加以核实。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Traditional Context Engineering — 2024–2025 Snapshot

Status: provisional historical research snapshot

This skill is a provisional historical research snapshot of context-engineering practice as published in 2024–2025. It is NOT normative. Do not apply it prescriptively to current frontier models without re-verification. On any conflict, OpenRig current skills, explicit user rulings, and directly measured OpenRig practice PREVAIL over this document. Treat these areas as particularly suspect pending re-verification: compaction/summarization guidance, minimal-upfront versus broad orientation, just-in-time lookup assumptions, fixed context ceilings, and single-agent versus multi-agent advice.

Curated distillation of the best publicly available expertise on context engineering for coding agents, drawn from primary sources at Anthropic, OpenAI, and leading practitioners (Manus, Cognition, Chroma, LangChain, Drew Breunig, and others). Load on the moments the description names; it is deliberately not part of any base walk.


1. The mental model: what context engineering is

Definition. Context engineering is "the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference" — everything that lands in the window: system instructions, tool definitions, retrieved data, message history, and tool outputs, not just the prompt text (Anthropic, Effective context engineering for AI agents). Andrej Karpathy's framing, popularized via LangChain: "the delicate art and science of filling the context window with just the right information for the next step" — the LLM is a CPU and the context window is its RAM, and your job is deciding what gets loaded into RAM at each step (LangChain, Context Engineering for Agents).

Why it superseded prompt engineering. A chatbot answers one question with whatever fits in one turn. An agent runs in a loop, accumulating tool results, file contents, and history across dozens or hundreds of steps. The improvements stop coming from rewording instructions and start coming from rewiring — what the agent retrieves, in what order, and what gets evicted when the window fills (Anthropic, ibid.). Philipp Schmid's formulation of the practical consequence: "Agent failures aren't only model failures; they are context failures." Most of the time when a capable model does something dumb, the context it was given made the dumb thing likely (Schmid, The New Skill in AI is Context Engineering).

The physical constraint: attention is a budget, not a bucket. Three mechanisms make context a scarce resource rather than free storage:

  1. Quadratic attention. In a transformer, every token attends to every other token — n² pairwise relationships. Longer sequences stretch the model's ability to capture them, and models are trained on distributions where short sequences dominate, so they have fewer specialized parameters for context-wide dependencies. The result is "a performance gradient rather than a hard cliff" (Anthropic, Effective context engineering).
  2. Context rot. Chroma's study of 18 frontier models showed reliability degrades as input length grows even on trivially simple tasks like retrieval and text replication — and degradation starts well before the window is full. What matters is not just length: distractor presence, needle–question similarity, and haystack structure all change how fast performance collapses (Chroma, Context Rot).
  3. Position effects. Models exhibit a U-shaped attention curve: information at the beginning or end of a long context is used far better than information in the middle (Liu et al., Lost in the Middle).

The one-sentence discipline. From Anthropic: "Find the smallest set of high-signal tokens that maximize the likelihood of some desired outcome." Everything else in this pack is a technique in service of that sentence.

The components you are engineering. Schmid's inventory is a useful checklist of what actually occupies the window: (1) system instructions, (2) the user's immediate request, (3) state/history of the current session, (4) long-term memory, (5) retrieved external information, (6) tool definitions, (7) output-format specifications (Schmid, ibid.). Each is a separate dial. When an agent misbehaves, walk this list asking "which of these is missing, stale, bloated, or contradictory?"


2. Core principles (and the why behind each)

**

常见问题

这些建议仍然适用吗?

它是 2024 和 2025 年实践的快照,这项技能说明在依赖之前应先进行验证。

它只适用于单个智能体吗?

不是。它还涵盖何时使用子智能体,以及如何在智能体之间交接工作。

什么算是上下文?

智能体所看到的一切,例如指令、工具定义、检索到的数据和过去的消息。

详情

作者的原始描述

Use when designing, reviewing, or debugging how an agent's context window gets filled, pruned, or shared — choosing what loads at boot versus on demand, sizing an install or an always-loaded file, fixing an agent that drifts, repeats itself, or forgets constraints mid-task, planning compaction or summarization, deciding single-agent versus subagents, engineering handoffs between agents, or picking a tool loadout. NOT for rewording a prompt's tone, choosing which model to pin, or debugging business logic — those are adjacent moments this skill does not serve. Historical 2024–2025 snapshot; not

repo: mvschwarz/openrig

热度

GitHub 星标
8.6k
排名
#12423
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能