guanyang avatar

Context Compression

This handles context compression for long-running agent sessions where naive summarization causes the agent to forget which files it modified or lose track of decisions. It recommends anchored iterative summarization with structured sections (files modified, decisions made, next steps) rather than regenerating summaries from scratch each time, which causes cumulative detail loss. The key insight is optimizing for tokens per task, not tokens per request. If your agent keeps re-reading files it already processed, you're compressing too aggressively and wasting more tokens on re-fetching than you save. Use probe-based evaluation (can the agent answer "which files did we modify?") instead of metrics like ROUGE, which miss the functional details that actually matter for continuation.

skills.sh installs
128
GitHub stars
848
last updated
Jun 3, 2026

Install

$ npx -y skills add guanyang/antigravity-skills --skill context-compression --agent claude-code

Installs into .claude/skills of the current project.

Files

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

Sponsors

Details

Repository
github.com/guanyang/antigravity-skills
First seen
Jun 3, 2026

More from guanyang/antigravity-skills

All 8

Recommended

1juliusbrussee avatarcavemanjuliusbrussee/cavemanUltra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels618.3Kskills.sh installs
2mattpocock avatargrill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.5Mskills.sh installs
3shadcn avatarimproveshadcn/improveSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on s40Kskills.sh installs
4obra avatarsystematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes326.7Kskills.sh installs
5forrestchang avatarkarpathy-guidelinesforrestchang/andrej-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes through explicit assumptions, simplicity, and verifiable success criteria.17.9Kskills.sh installs
6vercel-labs avatarfind-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express int4.3Mskills.sh installs