본문으로 건너뛰기
Skillpedia
에이전트18k · #10637

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-compression/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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:

  1. 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.

  2. 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.

  3. 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.

repo: muratcankoylan/Agent-Skills-for-Context-Engineering

인기도

GitHub 스타
18k
순위
#10637
라이선스
MIT
업데이트
2026. 10. 11.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬