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

context-compression

하는 일

이 스킬은 아주 긴 대화를 AI가 잘 다루도록 돕습니다. 끝난 작업 부분을 요약하고 중요한 결정은 남깁니다. AI가 맥락을 놓치기 시작하는 긴 세션을 운영하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓대화가 대략 스무 턴이나 서른 턴을 넘어 길어졌을 때.
  • ✓AI가 앞선 제안을 반복하거나 결정을 잊기 시작할 때.
  • ✓작업의 한 단계를 마치고 다음 단계로 넘어가려는 경우.

스킬 링크

https://github.com/vudovn/ag-kit/blob/main/.agents/skills/context-compression/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

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

Use this skill to help me: https://github.com/vudovn/ag-kit/blob/main/.agents/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분.

작동 방식

이 스킬은 긴 도구 출력과 끝난 작업을 짧은 요약으로 바꿉니다. 핵심 결정은 남기므로, AI는 맥락을 잃지 않고 계속 작업할 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Context Compression — Long Session Management

Keep sessions productive by compressing completed work while preserving key decisions.

Overview

Long sessions (30+ turns) cause context degradation — the AI loses track of earlier work, repeats itself, or forgets decisions. Context compression proactively summarizes completed phases so the context window stays focused on active work.

Token Impact: Recovers 5,000-15,000 tokens in long sessions by replacing verbose tool outputs with semantic summaries.


When to Compress

Signal Action
Session has 20+ turns Consider proactive compression
Agent repeats earlier suggestions Context is saturated — compress now
User says "we already discussed this" Compress immediately
Switching to a new phase of work Compress the completed phase
Large tool output (500+ lines) Micro-compact the output

Compression Levels

Level 1: Micro-Compact (Tool Output)

Compress individual tool outputs while retaining semantic content:

❌ Before (raw grep output — 200 lines, ~4,000 tokens):
src/auth/jwt.ts:15: import { verify } from 'jsonwebtoken'
src/auth/jwt.ts:23: export function validateToken(token: string) {
src/auth/jwt.ts:24:   try {
src/auth/jwt.ts:25:     const decoded = verify(token, SECRET)
... (195 more lines)

✅ After (micro-compact — 5 lines, ~100 tokens):
Grep results for "jwt": Found 8 files, 42 matches.
Key files: src/auth/jwt.ts (main JWT logic), src/middleware/auth.ts (middleware),
src/api/login.ts (token creation). Token validation at jwt.ts:23-40.
Error handling at jwt.ts:42-55. Secret loaded from env at jwt.ts:8.

Level 2: Phase Summary

Replace a completed work phase with a summary:

❌ Before (full research transcript — ~3,000 tokens):
[turn 1] Read package.json...
[turn 2] Read src/index.ts...
[turn 3] Grep for "auth"...
[turn 4] Found 8 files related to auth...
[turn 5] Read src/auth/jwt.ts...
... (10 more turns of exploration)

✅ After (phase summary — ~200 tokens):
## Research Phase Complete
- Project: Next.js 15 app with JWT auth
- Auth files: 8 files in src/auth/, src/middleware/, src/api/
- Token flow: login → create JWT → store in httpOnly cookie → validate in middleware
- Bug location: src/auth/jwt.ts:45 — expiry check uses `<` instead of `<=`
- Decision: Fix the comparison operator, add edge case test

Level 3: Session Checkpoint

Full session summary for long-running work:

## Session Checkpoint (Turn 35)

### Completed
- [x] Researched auth system (8 files, JWT flow mapped)
- [x] Fixed token expiry bug in jwt.ts:45
- [x] Added edge case test in jwt.test.ts
- [x] Verified: all 42 tests passing

### In Progress
- [ ] Update API documentation
- [ ] Review related middleware

### Key Decisions
1. Keep httpOnly cookies (not localStorage) for token storage
2. Use `<=` for expiry check to include exact-moment expiry
3. Add 5-minute grace period for clock skew

### Files Modified
- src/auth/jwt.ts (line 45: comparison fix)
- tests/auth/jwt.test.ts (added 3 edge case tests)

Compression Protocol

Step 1: Identify Completed Phases

What work is DONE and won't be revisited?
→ Research findings already synthesized
→ Implementation already verified
→ Decisions already made and applied

Step 2: Extract Key Information

From the completed phase, preserve:
✅ Decisions made and WHY
✅ File paths and line numbers of changes
✅ Key findings that inform ongoing work
✅ Error messages or test results (summarized)

Discard:
❌ Step-by-step tool invocation details
❌ Full file contents that were read
❌ Exploratory dead-ends that didn't lead anywhere
❌ Verbose error stack traces (keep the message only)

Step 3: Write Summary

Use the Phase Summary format above.
Keep to 100-300 tokens per completed phase.
Include enough detail to resume work without re-reading.

Best Practices

  1. Compress phases, not facts — Individual decisions should stay, full transcripts should go
  2. Preserve "why" over "what" — Why a decision was made matters more than the exact commands run
  3. Never auto-compress — Always tell the user "I'm summarizing the completed research phase to keep context focused"
  4. Keep file references — Always preserve file paths and line numbers in summaries
  5. Checkpoint on phase transitions — Natural compression point when switching from research to implementation
자주 묻는 질문

언제 압축을 요청해야 하나요?

세션이 길어졌을 때, AI가 같은 말을 반복할 때, 또는 새 작업 단계로 넘어갈 때 사용하세요.

중요한 결정을 잃지 않나요?

이 스킬은 나머지를 요약하면서도 핵심 결정을 남기도록 설계되어 있습니다.

얼마나 도움이 되나요?

긴 세션에서 여유 공간을 확보하도록 만들어졌으며, 절약되는 정도는 세션에 따라 다릅니다.

상세 정보

작성자의 원본 설명

Manage and compress conversation context in long sessions. Detect when context is growing large, summarize completed work phases, archive old findings while preserving key decisions. Prevents context degradation.

repo: vudovn/ag-kit

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬