context-optimizer SKILL.md skillA
context-optimizer from huangwb8/skills is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add huangwb8/skills/context-optimizer@git:20260906.d2681a7Pins git:20260906.d2681a7 in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- huangwb8/skills
- Path
skills/alpha/awesome-code/agents/context-optimizer/SKILL.md- Versions recorded
- 4
- Latest version
- git:20260906.d2681a7, committed Sep 6, 2026
- First version recorded
- Aug 25, 2026
- Size
- 14,193 bytes
- Repository stars
- 50
- License
- MIT
上下文优化专家。专注于长对话中的上下文管理、token 效率和性能优化。解决 lost-in-middle、context poisoning 等问题,提升 AI 代理在复杂任务中的表现。.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Context Optimizer - 上下文优化专家
## 核心理念
**上下文优化** 是长对话性能的关键:
```
┌─────────────────────────────────────────────────────────┐
│ 识别问题 → 压缩历史 → 掩码加载 → 缓存重用 → 性能提升 │
└─────────────────────────────────────────────────────────┘
```
**核心问题**:
- ❌ **Lost-in-Middle**:关键信息被中间内容淹没
- ❌ **Context Poisoning**:冲突信息干扰判断
- ❌ **Distraction**:无关信息浪费 token
- ❌ **Context Clash**:多信息源冲突
---
## 何时使用本技能
在以下场景时激活:
- 长对话导致性能下降
- Context window 接近限制
- AI 遗忘之前的信息
- 提到"上下文"、"token 限制"、"效率"
---
## 上下文问题识别
### 问题 1:Lost-in-Middle
**表现**:
- AI 遗忘对话中间的关键信息
- 首尾信息记住,中间信息遗忘
- 需要重复提供相同信息
**检测**:
```python
def detect_lost_in_middle(conversation: list) -> bool:
"""检测是否出现 lost-in-middle 问题"""
# 1. 检查对话长度
if len(conversation) < 10:
return False
# 2. 检查是否有重复提问
questions = [msg for msg in conversation if '?' in msg]
unique_questions = set(questions)
if len(questions) > len(unique_questions) * 1.5:
return True # 存在重复提问
# 3. 检查中间内容是否被引用
middle_start = len(conversation) // 3
middle_end = len(conversation) * 2 // 3
middle_content = conversation[middle_start:middle_end]
# 检查后续对话是否引用中间内容
later_refs = sum(
…Read the whole file at its exact version.
How to install
mdr add huangwb8/skills/context-optimizer@sha256:8d638616992aff7aThe line at the top of this page pins the label git:20260906.d2681a7, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_fwesku6r5nuuuvea)
4 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 4 versions of this file, between Aug 25, 2026 and Sep 6, 2026, about one every 4 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20260906.d2681a7 latest | 2026-09-06 | d2681a7 | 14,193 B | A | view · diff |
| git:20260905.a346b91 | 2026-09-05 | a346b91 | 14,189 B | A | view · diff |
| git:20260905.7c0ea7c | 2026-09-05 | 7c0ea7c | 14,150 B | A | view · diff |
| git:20260825.4f192d9 | 2026-08-25 | 4f192d9 | 13,150 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (14193 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
huangwb8/skills · 50 stars · license MIT · pushed 2026-10-17 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_fwesku6r5nuuuvea GET https://markdownregistry.com/api/v1/resolve?ref=huangwb8/skills/context-optimizer GET https://markdownregistry.com/api/v1/blob/8d638616992aff7abbe1a447b5fa8b2fe09fc06ce106b23b1fbe4e4406aa9f54
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.