context-compression/SKILL.md
This skill should be used when the user asks to "compress context", "summarize conversation history", "implement compaction", "reduce token usage", or mentions context compression, structured summarization, tokens-per-task optimization, or long-running agent sessions exceeding context limits.
npx skillsauth add lidge-jun/cli-jaw-skills context-compressionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When agent sessions generate millions of tokens of conversation history, compression becomes mandatory. Optimize for tokens per task (total tokens to complete a task, including re-fetching costs), not tokens per request.
Anchored Iterative Summarization: Maintain structured, persistent summaries with explicit sections for session intent, file modifications, decisions, and next steps. On compression, summarize only the newly-truncated span and merge with existing summary. Structure forces preservation by dedicating sections to specific information types.
Opaque Compression: Produce compressed representations optimized for reconstruction fidelity. Achieves highest compression ratios (99%+) but sacrifices interpretability.
Regenerative Full Summary: Generate detailed structured summaries on each compression. Readable output but may lose details across repeated cycles due to full regeneration rather than incremental merging.
Key insight: structure forces preservation. Dedicated sections act as checklists the summarizer must populate.
Artifact trail integrity is the weakest dimension across all compression methods (2.2–2.5/5.0). Coding agents need to track:
This likely requires specialized handling beyond general summarization: a separate artifact index or explicit file-state tracking.
## Session Intent
[What the user is trying to accomplish]
## Files Modified
- auth.controller.ts: Fixed JWT token generation
- config/redis.ts: Updated connection pooling
## Decisions Made
- Using Redis connection pool instead of per-request connections
## Current State
- 14 tests passing, 2 failing
## Next Steps
1. Fix remaining test failures
2. Run full test suite
| 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 |
Sliding window with structured summaries provides the best balance for most coding agent use cases.
Traditional metrics (ROUGE, embedding similarity) fail to capture functional quality. Use probe questions after compression:
| Probe Type | What It Tests | Example | |------------|---------------|---------| | Recall | Factual retention | "What was the original error message?" | | Artifact | File tracking | "Which files have we modified?" | | Continuation | Task planning | "What should we do next?" | | Decision | Reasoning chain | "What did we decide about the Redis issue?" |
For large codebases or agent systems exceeding context windows:
| Approach | Best when | |----------|-----------| | Anchored iterative | Long sessions (100+ messages), file tracking matters, need verifiability | | Opaque | Maximum token savings needed, short sessions, low re-fetching costs | | Regenerative | Summary interpretability critical, clear phase boundaries |
| Method | Compression | Quality (5.0) | Notes | |--------|-------------|---------------|-------| | Anchored Iterative | 98.6% | 3.70 | Best quality | | Regenerative | 98.7% | 3.44 | Good quality | | Opaque | 99.3% | 3.35 | Best compression, quality loss |
The 0.7% additional tokens retained by structured summarization buys 0.35 quality points — worthwhile when re-fetching costs matter.
tools
Use only on the Codex CLI for native image generation or image editing without an API key. Save final PNG files under ~/.cli-jaw/uploads, report web-ready absolute-path markdown, and send to Telegram or Discord only when explicitly requested.
tools
Ranked repository structure map via `cli-jaw map`. Use for codebase overview, structure map, symbol overview, unfamiliar codebase exploration, architecture orientation. Triggers: repo map, structure map, codebase overview, 와꾸, project structure, unfamiliar code.
tools
cli-jaw Design workspace: create, preview, run, and export design pages from the right sidebar. Covers panel UX, direct-write workflow, artifact lifecycle, wireframe generation, design system, and Open Design adapter.
development
MUST USE for infrastructure and delivery work — container builds, deploy pipelines, Kubernetes, Infrastructure as Code, SRE foundations, edge/serverless, ML infrastructure. Triggers: Dockerfile, K8s manifests, CI/CD pipeline, Terraform/IaC, release/deploy, devops/infra/deploy or release_cd task_tags.