- Home
- Skills
- Muratcankoylan
- Agent Skills For Context Engineering
- Context Compression
context-compression_skill
- Python
12.1k
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill muratcankoylan/agent-skills-for-context-engineering --skill context-compression- SKILL.md12.1 KB
Overview
This skill helps design and implement context compression for long-running agent sessions and large codebase interactions. It focuses on minimizing tokens-per-task by preserving critical information (file artifacts, decisions, next steps) using structured summarization and incremental merging. Use it to avoid agent forgetfulness, reduce re-fetching costs, and maintain actionable summaries across many compressions.
How this skill works
The skill implements multiple compression strategies—anchored iterative summarization, opaque compression, and regenerative full summaries—and recommends triggers and evaluation methods. It produces structured summaries with explicit sections (session intent, files modified, decisions, current state, next steps) and supports incremental merging so only newly-truncated content is summarized and appended. Probe-based evaluation assesses functional retention across accuracy, artifact trail, continuity, and instruction-following dimensions.
When to use it
- Agent sessions exceed model context windows or approach limits
- Managing multi-million-token codebase exploration or long debugging runs
- You observe agents losing track of files, decisions, or recent changes
- Designing or validating conversation summarization strategies
- Optimizing tokens-per-task to reduce re-fetching costs
Best practices
- Optimize for tokens-per-task, not tokens-per-request
- Define explicit summary sections for intent, files, decisions, state, and next steps
- Trigger compression at 70–80% context utilization or use a sliding-window plus summary approach
- Use anchored iterative summarization for file-tracking and verification needs
- Evaluate compression quality with probe-based tests (recall, artifact, continuation, decision)
- Track artifact provenance separately when file integrity is critical
Example use cases
- Long debugging session where tracking modified files and test status prevents rework
- Refactoring a 5M+ token codebase into a 2,000-word implementation specification
- Production agents that must keep stable next-step plans across many interactions
- Evaluation harness that measures tokens-per-task impact and re-fetch frequency
- Migration task using a reference PR as a seed to preserve invariants and constraints
FAQ
Anchored iterative summarization; structured sections and incremental merging preserve artifact trails and make verification possible.
When should I accept higher token use?
When re-fetching costs or hallucination risks are high—slightly higher retained tokens can save large downstream retrieval or rework costs.