मुख्य सामग्री पर जाएँ
Skillpedia
एजेंट48k · #4249

context-compression

यह क्या करती है

यह टूल AI को लंबी बातचीत याद रखने में मदद करता है। यह सबसे ज़रूरी बातों का सारांश बनाता है, ताकि AI ज़रूरी जानकारी न भूले। इससे AI का ध्यान उस चीज़ पर रहता है जो किसी काम को पूरा करने के लिए सबसे ज़रूरी है।

कब इस्तेमाल करें

  • ✓जब AI के साथ बातचीत बहुत लंबी हो जाए और वह जानकारी भूलने लगे।
  • ✓बड़े code projects पर काम करते समय, जिन्हें AI एक साथ पूरा नहीं देख पाता।
  • ✓बातचीत का सारांश बनाने के लिए, ताकि AI बाद में उसे देखकर आगे बढ़ सके।

Skill का लिंक

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/context-compression/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/context-compression/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“AI, अब तक की हमारी बातचीत का सारांश बनाओ, और उसमें file के बदलावों और लिए गए फैसलों पर ध्यान दो।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

AI बातचीत का structured सारांश बनाता है, जिसमें इरादे, बदली गई files और अगले कदम जैसी ज़रूरी जानकारी रखी जाती है। अगर बातचीत बहुत लंबी हो जाए, तो यह नए हिस्से का सारांश बनाकर उसे पुराने सारांश के साथ जोड़ देता है।

तकनीकी सामग्री (मूल 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 Use

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

Core Concepts

Context compression trades token savings against information loss. Three production-ready approaches exist:

  1. Anchored Iterative Summarization: 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. Structure forces preservation by dedicating sections to specific information types.

  2. Opaque Compression: Produce compressed representations optimized for reconstruction fidelity. Achieves highest compression ratios (99%+) but sacrifices interpretability. Cannot verify what was preserved.

  3. Regenerative Full Summary: Generate detailed structured summaries on each compression. Produces readable output but may lose details across repeated compression cycles due to full regeneration rather than incremental merging.

The critical insight: structure forces preservation. Dedicated sections act as checklists that the summarizer must populate, preventing silent information drift.

Detailed Topics

Why Tokens-Per-Task Matters

Traditional compression metrics target tokens-per-request. This is the wrong optimization. When compression loses critical details like file paths or error messages, the agent must re-fetch information, re-explore approaches, and waste tokens recovering context.

The right metric is tokens-per-task: total tokens consumed from task start to completion. A compression strategy saving 0.5% more tokens but causing 20% more re-fetching costs more overall.

The Artifact Trail Problem

Artifact trail integrity is the weakest dimension across all compression methods, scoring 2.2-2.5 out of 5.0 in evaluations. Even structured summarization with explicit file sections struggles to maintain complete file tracking across long sessions.

Coding agents need to know:

  • Which files were created
  • Which files were modified and what changed
  • Which files were read but not changed
  • Function names, variable names, error messages

This problem likely requires specialized handling beyond general summarization: a separate artifact index or explicit file-state tracking in agent scaffolding.

Structured Summary Sections

Effective structured summaries include explicit sections:

## Session Intent
[What the user is trying to accomplish]

## Files Modified
- auth.controller.ts: Fixed JWT token generation
- config/redis.ts: Updated connection pooling
- tests/auth.test.ts: Added mock setup for new config

## Decisions Made
- Using Redis connection pool instead of per-request connections
- Retry logic with exponential backoff for transient failures

## Current State
- 14 tests passing, 2 failing
- Remaining: mock setup for session service tests

## Next Steps
1. Fix remaining test failures
2. Run full test suite
3. Update documentation

This structure prevents silent loss of file paths or decisions because each section must be explicitly addressed.

Compression Trigger Strategies

When to trigger compression matters as much as how to compress:

Strategy Trigger Point Trade-off
Fixed threshold 70-80% context utilization Simple but may compress too early
Sliding window Keep last N turns + summary Predictable context size
Importance-based Compress low-relevance sections first Complex but preserves signal
Task-boundary Compress at logical task completions Clean summaries but unpredictable timing

The sliding window approach with structured summaries provides the best balance of predictability and quality for most coding agent use cases.

Probe-Based Evaluation

…

अक्सर पूछे जाने वाले सवाल

'tokens' इतने ज़रूरी क्यों हैं?

Tokens वे छोटे टुकड़े होते हैं, जैसे शब्द या शब्दों के हिस्से, जिनसे AI text को समझता और बनाता है। लंबी बातचीत में बहुत सारे tokens इस्तेमाल होते हैं, और यह टूल ज़रूरी जानकारी खोए बिना इनकी संख्या कम करने में मदद करता है।

क्या AI भूल सकता है कि उसने कौन सी files छुई थीं?

हाँ, बहुत लंबी बातचीत में ऐसा हो सकता है। यह टूल बदली गई files का साफ रिकॉर्ड रखने की कोशिश करता है, ताकि AI भ्रमित न हो।

इस टूल का सबसे अच्छा इस्तेमाल कैसे करें?

जब बातचीत लंबी हो रही हो, या जब बड़े projects की कुछ खास बातें AI को याद रखनी हों, तब इसका इस्तेमाल करें। structured सारांश AI को काम पर केंद्रित रखने में मदद करते हैं।

जानकारी

लेखक का मूल विवरण

When agent sessions generate millions of tokens of conversation history, compression becomes mandatory. The naive approach is aggressive compression to minimize tokens per request.

repo: sickn33/agentic-awesome-skills

लोकप्रियता

GitHub स्टार
48k
रैंकिंग में स्थान
#4249
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

00-andruia-consultant

48k

आपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।

AI और एजेंटएजेंट

007

48k

आपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।

कोडिंगसिक्योरिटी

10-andruia-skill-smith

48k

आपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।

AI और एजेंटएजेंट

20-andruia-niche-intelligence

48k

आपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।

लेखन और डॉक्यूमेंटरिसर्च

मिलती-जुलती skills