跳到正文
cccskills
免费在 GitHub 公开

context-engineering-fundamentals

Manages attention and evidence in long agent sessions. Use for lost instructions, dropped evidence, or large multi-agent contexts.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md4.1 KB
  • agents/openai.yaml139 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Context engineering fundamentals

Context engineering is the practice of managing an LLM's limited attention budget. Use this skill to keep instructions, evidence, and state available during long work.

Core concept

Context windows are constrained by attention mechanics, not only token capacity. A large context limit does not guarantee equal use of every item.

The lost-in-middle effect

The "Lost in the Middle" experiments show that retrieval quality can change with information position. The result depends on the model, task, context length, and number of documents.

PositionCommon test result
BeginningOften easier to retrieve
MiddleCan be harder to retrieve
EndOften benefits from recency

Implication: Keep critical constraints easy to find and repeat them near the decision that uses them. Do not assume position alone predicts recall.

Context degradation patterns

1. Lost-in-middle

Information in the middle of long context gets lower attention weight.

Mitigation: Structure with explicit sections. Put critical constraints at start AND end.

2. Context poisoning

Errors compound when incorrect information enters context (from tool outputs, summaries, or earlier mistakes).

Mitigation: Validate intermediate outputs. Don't blindly trust previous responses.

3. Context distraction

Irrelevant information forces attention allocation away from relevant content. Models can't "skip" irrelevant context.

Mitigation: Be selective about what goes into context. More isn't better.

4. Context confusion

Multiple task types or conflicting instructions create ambiguous responses.

Mitigation: One task per interaction when possible. Clear task boundaries.

5. Context clash

Contradictory information from multiple sources causes derailing conflicts.

Mitigation: Resolve contradictions explicitly before asking Claude to use the information.

Measure before compressing

Do not use a fixed token threshold to decide when context is reliable. Measure retrieval and reasoning quality on your own model and task. Test representative evidence at several positions, then compare the result before and after summarization.

Compress only when the measured result or the agent's behavior shows a problem. Preserve exact constraints, decisions, source links, unresolved questions, and verification evidence.

Mitigation strategies

Write externally

Do not rely on the agent to remember across turns. Write important state to files, but agree the path with the user first. Prefer a gitignored workspace so you never overwrite project-owned content:

With the user's approval, after each major step write progress to an agreed scratch file (for example a gitignored PROGRESS.md or a path they choose)
Before starting, read that file back to restore context

Select carefully

Filter irrelevant context before loading:

Instead of: "Here are all 50 files, find the bug"
Do: "Here are the 3 files involved in the error"

Compress strategically

Summarize while maintaining signal:

Instead of: Full 1000-line file
Do: Key functions and their signatures, with context on the specific area

Isolate contexts

For complex tasks, use subagents with focused contexts rather than one agent with everything.

Signs of context degradation

SymptomLikely cause
Ignores earlier instructionsLost-in-middle or context too long
Contradicts itselfContext confusion or clash
Repeats information you gaveAttention not reaching that content
Misses obvious detailsContext distraction
Gets progressively worseContext poisoning from errors

References

  • "Lost in the Middle" (Liu et al., 2023) - Position effects in long context
  • "Needle in a Haystack" benchmark - Context retrieval testing
  • RULER benchmark - Multi-hop reasoning over long context

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Scholarly writing and research compliance. Use for CRediT, preregistration, Plan S, Nelson Memo, preprints, ORCID, LLM disclosure.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

Web accessibility patterns for news and academic sites. Use for WCAG audits, alt text, accessible data viz, and assistive tech.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

Eliminates AI-generated writing patterns that erode reader trust. Use when writing or editing articles, docs, or press releases.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

API hardening for Express, FastAPI, and serverless. Use for rate limiting, CORS, input validation, API keys, or OWASP API Top 10.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

Explores intent and design before implementation. MUST use before creating or modifying any feature, component, or behavior.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

Public records requests under Brazil's Access to Information Law (LAI). Use for Fala.BR filings, e-SIC, and CGU/CMRI appeals.

中文简介正在准备中。当前显示原文说明。

jamditis/claude-skills-journalism4282026年10月17日 更新

查看 jamditis 的全部技能

报告此技能的问题