context-compression
Fungsinya
Skill ini menjelaskan cara memadatkan percakapan agent yang panjang menjadi ringkasan lebih pendek tanpa kehilangan keputusan, file, dan langkah berikutnya yang penting. Skill ini untuk orang yang menjalankan sesi AI panjang atau menyerahkan pekerjaan ke agent lain.
Kapan dipakai
- βSaat sesi AI yang panjang hampir kehabisan ruang dan perlu diringkas.
- βSaat agent lupa file mana yang diubahnya atau keputusan apa yang dibuat sebelumnya.
- βSaat Anda membutuhkan ringkasan serah terima agar agent lain bisa melanjutkan pekerjaan.
Link skill
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-compression/SKILL.mdSalin 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
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βRingkas sesi coding panjang ini agar agent baru bisa melanjutkan pekerjaan tanpa kehilangan apa yang sudah kita putuskan.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menunjukkan cara menulis ringkasan terstruktur yang menyimpan keputusan, file yang diubah, risiko, dan tindakan berikutnya, serta cara memeriksa bahwa ringkasan itu masih berfungsi.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Apa yang harus dipertahankan ringkasan yang baik?
Keputusan yang dibuat, file yang diubah, risiko yang terbuka, dan tindakan berikutnya.
Mengapa tidak membuat semuanya lebih pendek saja?
Skill bertujuan mengurangi total token per tugas yang selesai, karena detail yang hilang bisa membuat agent mengulang pekerjaan.
Apakah ini sama dengan memori jangka panjang?
Tidak. Skill ini berfokus pada peringkasan satu sesi, sedangkan memori lintas sesi adalah topik terpisah.
Detail
Deskripsi asli dari pembuat
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.
Popularitas
- Bintang GitHub
- 18k
- Peringkat
- #10637
- Lisensi
- MIT
- Diperbarui
- 11/10/2026
Komentar
- β¦
Skill lain dari repositori ini
context-engineering-collection
18kMembantu agent Anda mengelola apa yang masuk ke jendela konteks model AI, dari memori dan alat hingga sistem multi-agent dan evaluasi.
advanced-evaluation
18kMengajari agent Anda cara menilai jawaban AI memakai AI lain, dengan skor, perbandingan berpasangan, dan pemeriksaan bias.
bdi-mental-states
18kMengajari agent Anda memodelkan keyakinan, tujuan, dan rencana dengan pendekatan BDI, sehingga keputusannya bisa ditelusuri dan dijelaskan.
context-degradation
18kMembantu agent Anda mengenali dan memperbaiki jawaban AI yang memburuk dalam percakapan panjang, seperti detail yang hilang di tengah konteks.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.