context-compression
하는 일
이 스킬은 긴 에이전트 대화를 짧은 요약으로 압축하면서도 중요한 결정, 파일, 다음 단계는 잃지 않는 방법을 설명합니다. 긴 AI 세션을 운영하거나 다른 에이전트에게 작업을 넘기는 사람을 위한 스킬입니다.
사용하는 경우
- ✓긴 AI 세션의 공간이 곧 바닥나 요약이 필요할 때.
- ✓에이전트가 앞서 어떤 파일을 바꿨는지, 무엇을 결정했는지 잊을 때.
- ✓다른 에이전트가 작업을 이어갈 수 있도록 인계 요약이 필요할 때.
스킬 링크
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-compression/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 긴 코딩 세션을 요약해서, 새 에이전트가 우리가 정한 내용을 잃지 않고 작업을 이어갈 수 있게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 결정, 바뀐 파일, 열린 위험, 다음 행동을 담은 구조화된 요약을 쓰는 방법을 보여 줍니다. 그리고 요약이 여전히 작동하는지 확인하는 방법도 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Context Compression Strategies
When agent sessions generate millions of tokens of conversation history, compression becomes mandatory. The naive approach is aggressive compression to minimize tokens per request. The correct optimization target is tokens per task: total tokens consumed to complete a task, including re-fetching costs when compression loses critical information.
When to Activate
Activate this skill when:
- Agent sessions exceed context window limits
- Codebases exceed context windows (5M+ token systems)
- Designing conversation summarization strategies
- Debugging cases where agents "forget" what files they modified
- Building evaluation frameworks for compression quality
- Creating durable handoff summaries that preserve decisions, files, risks, and next actions
Do not activate this skill for adjacent work owned by other skills:
- General token-efficiency tactics such as masking, prefix caching, or partitioning:
context-optimization. - Diagnosing why a long context is failing before choosing a mitigation:
context-degradation. - Writing raw outputs, logs, or plans to files without summarizing them:
filesystem-context. - Designing long-term semantic memory across sessions:
memory-systems. - The model deciding when and where to rewrite its own context:
self-managed-context. This skill still owns what the replacement text must preserve.
Core Concepts
Context compression trades token savings against information loss. Select from three production-ready approaches based on session characteristics:
Anchored Iterative Summarization: Implement this for long-running sessions where file tracking matters. Maintain structured, persistent summaries with explicit sections for session intent, file modifications, decisions, and next steps. When compression triggers, summarize only the newly-truncated span and merge with the existing summary rather than regenerating from scratch. This prevents drift that accumulates when summaries are regenerated wholesale — each regeneration risks losing details the model considers low-priority but the task requires. Structure forces preservation because dedicated sections act as checklists the summarizer must populate, catching silent information loss.
Opaque Compression: Reserve this for short sessions where re-fetching costs are low and maximum token savings are required. It produces compressed representations optimized for reconstruction fidelity, achieving 99%+ compression ratios but sacrificing interpretability entirely. The tradeoff matters: there is no way to verify what was preserved without running probe-based evaluation, so never use this when debugging or artifact tracking is critical.
Regenerative Full Summary: Use this when summary readability is critical and sessions have clear phase boundaries. It generates detailed structured summaries on each compression trigger. The weakness is cumulative detail loss across repeated cycles — each full regeneration is a fresh pass that may deprioritize details preserved in earlier summaries.
Detailed Topics
Optimize for Tokens-Per-Task, Not Tokens-Per-Request
Measure total tokens consumed from task start to completion, not tokens per individual request. When compression drops file paths, error messages, or decision rationale, the agent must re-explore, re-read files, and re-derive conclusions — wasting far more tokens than the compression saved. A strategy saving 0.5% more tokens per request but causing 20% more re-fetching costs more overall. Track re-fetching frequency as the primary quality signal: if the agent repeatedly asks to re-read files it already processed, compression is too aggressive.
Solve the Artifact Trail Problem First
Artifact trail integrity is often the weakest dimension in compression evaluations (claim-context-compression-factory-benchmark). Address this proactively because general summarization cannot reliably maintain it.
Preserve these categories explicitly in every compression cycle:
- Which files were created (full paths)
- Which files were modified and what changed (include function names, not just file names)
- Which files were read but not changed
- Specific identifiers: function names, variable names, error messages, error codes
Implement a separate artifact index or explicit file-state tracking in agent scaffolding rather than relying on the summarizer to capture these details. Even structured summarization with dedicated file sections st
자주 묻는 질문
좋은 요약에는 무엇이 담겨야 하나요?
내린 결정, 바뀐 파일, 남은 위험, 다음 행동입니다.
그냥 전체를 짧게 만들면 안 되나요?
스킬은 완료된 작업당 전체 토큰을 줄이는 것을 목표로 합니다. 세부 내용을 잃으면 에이전트가 같은 일을 반복할 수 있기 때문입니다.
장기 메모리와 같은 것인가요?
아니요. 이 스킬은 한 세션을 요약하는 데 집중하며, 세션 간 메모리는 별도의 주제입니다.
상세 정보
작성자의 원본 설명
This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.
인기도
- GitHub 스타
- 18k
- 순위
- #10637
- 라이선스
- MIT
- 업데이트
- 2026. 10. 11.
댓글
- …
이 저장소의 다른 스킬
context-engineering-collection
18k에이전트가 AI 모델의 컨텍스트 창에 들어가는 내용을 관리하도록 돕습니다. 메모리와 도구부터 다중 에이전트 구성, 평가까지 다룹니다.
advanced-evaluation
18k에이전트가 다른 AI를 이용해 AI 답변을 평가하는 방법을 가르칩니다. 점수 매기기, 나란히 비교, 편향 점검을 포함합니다.
bdi-mental-states
18k에이전트가 BDI 방식으로 믿음, 목표, 계획을 모델링하도록 가르쳐서, 결정을 추적하고 설명할 수 있게 합니다.
context-degradation
18k에이전트가 긴 대화에서 점점 나빠지는 AI 답변을 찾아내고 고치도록 돕습니다. 중간에 놓인 세부 내용을 놓치는 경우도 포함합니다.
비슷한 스킬
add-model-provider
394k에이전트가 안전한 설정 명령으로 새 AI 모델 제공자를 OpenClaw에 연결하고, API 키를 평문으로 두지 않으며, 실시간 테스트를 실행하도록 돕습니다.
acp-router
394k에이전트가 OpenClaw를 통해 Claude Code나 Cursor 같은 코딩 도우미에 작업을 전달해, 작업이 그 도구에서 실행되도록 돕습니다.
browser-automation
394k에이전트가 로그인, 탭, 페이지 응답이 멈췄을 때의 복구를 포함해 웹 페이지를 단계별로 조작하도록 가르칩니다.