Langsung ke konten
Skillpedia
Agen8.2k Β· #12529

context-compression

Fungsinya

Skill ini membantu AI Anda mengelola percakapan yang sangat panjang. Skill ini merangkum bagian pekerjaan yang sudah selesai dan menyimpan keputusan penting. Skill ini untuk orang yang menjalankan sesi panjang ketika AI mulai kehilangan jejak.

Kapan dipakai

  • βœ“Saat sebuah percakapan sudah melewati sekitar dua puluh atau tiga puluh giliran.
  • βœ“Saat AI mulai mengulang saran sebelumnya atau melupakan keputusan.
  • βœ“Saat Anda menyelesaikan satu fase pekerjaan dan ingin beralih ke fase lain.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/vudovn/ag-kit/blob/main/.agents/skills/context-compression/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œChat ini sudah sangat panjang dan kita terus mengulang diri sendiri. Tolong rangkum apa yang sudah selesai dan simpan keputusan utamanya.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill mengganti keluaran alat yang panjang dan pekerjaan yang sudah selesai dengan ringkasan singkat. Keputusan utama tetap disimpan, sehingga AI dapat terus bekerja tanpa kehilangan konteks.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Kapan saya sebaiknya meminta pemadatan?

Gunakan saat sesi panjang, saat AI mengulang dirinya sendiri, atau saat Anda beralih ke fase kerja baru.

Apakah keputusan penting saya akan hilang?

Skill dirancang untuk menyimpan keputusan penting sambil merangkum sisanya.

Seberapa besar bantuannya?

Skill dimaksudkan untuk membebaskan ruang dalam sesi panjang, dan penghematannya bergantung pada sesinya.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
8.2k
Peringkat
#12529
Lisensi
MIT
Diperbarui
18/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa