context-compression
यह क्या करती है
यह स्किल बताती है कि लंबी एजेंट बातचीत को छोटे सारांश में कैसे संपीड़ित किया जाए, बिना उन फ़ैसलों, फ़ाइलों और अगले कदमों को खोए जो मायने रखते हैं। यह लंबे AI सत्र चलाने या काम किसी दूसरे एजेंट को सौंपने वालों के लिए है।
कब इस्तेमाल करें
- ✓जब कोई लंबा AI सत्र जगह खत्म होने वाला हो और उसे सारांश चाहिए।
- ✓जब कोई एजेंट भूल जाए कि उसने कौन-सी फ़ाइलें बदलीं या पहले क्या तय किया था।
- ✓जब आपको हैंडऑफ़ सारांश चाहिए ताकि दूसरा एजेंट काम जारी रख सके।
Skill का लिंक
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-compression/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस लंबे कोडिंग सत्र का सारांश बनाइए, ताकि नया एजेंट वहीं से काम उठा सके और हमारे फ़ैसले न खोएँ।”
हर हफ़्ते 5 नई skills, 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
- अपडेट की गई
- 11/10/2026
कमेंट
- …
इस repository की और skills
context-engineering-collection
18kयह आपके एजेंट को AI मॉडल की context window में क्या जाए, इसका प्रबंधन करने में मदद करती है, मेमोरी और टूल्स से लेकर मल्टी-एजेंट सेटअप और मूल्यांकन तक।
advanced-evaluation
18kयह आपके एजेंट को सिखाती है कि दूसरे AI की मदद से AI के जवाबों को कैसे परखा जाए, स्कोरिंग, आमने-सामने तुलना और पूर्वाग्रह जाँच के साथ।
bdi-mental-states
18kयह आपके एजेंट को BDI तरीके से विश्वास, लक्ष्य और योजनाओं का मॉडल बनाना सिखाती है, ताकि उसके फ़ैसले ट्रेस और समझाए जा सकें।
context-degradation
18kयह आपके एजेंट को उन AI जवाबों को पहचानने और ठीक करने में मदद करती है जो लंबी बातचीत में बिगड़ जाते हैं, जैसे बीच में खोए विवरण।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।