# Compress Long Agent Contexts Reliably

Long agent sessions can lose decisions, file history, and next steps during compression. This skill provides structured methods and probes that preserve operational context.

## Install

```bash
npx skillstore add muratcankoylan/context-compression
```

## Metadata

- Status: approved
- Slug: muratcankoylan-context-compression
- Skillstore revision: r2
- Version status: missing
- Tree hash: a3ce3bb18aeb8f0fcec60260ee205ecdb8c0bca8c500ded73fbbf5b8d55c7b1c
- Author: muratcankoylan
- GitHub username: muratcankoylan
- License: MIT
- Repository: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/context-compression
- Ref: 02be9409c79ca1183f7844009c14d9df684d0cf9
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 81
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/muratcankoylan-context-compression
- Manifest: https://skillstore.pages.dev/api/skills/muratcankoylan-context-compression/manifest

## Capabilities

- Compares anchored iterative, opaque, and regenerative compression methods.
- Creates structured summaries for session intent, files, decisions, current state, and next steps.
- Generates recall, artifact, continuation, and decision probes from conversation history.
- Scores probe responses across six compression quality dimensions.
- Tracks token efficiency through task completion and context re-fetching costs.

## Use Cases

- Preserve Coding Session State: Create durable summaries that retain changed files, technical decisions, test status, and immediate next actions.
- Evaluate Compression Quality: Generate targeted probes and compare compression methods across accuracy, continuity, completeness, and artifact retention.
- Design Agent Handoffs: Build readable handoff summaries that let another agent or person continue work without repeating exploration.

## Prompt Templates

### Summarize This Session

```
Compress this session into intent, files modified, decisions, current state, and next steps. Preserve exact paths and error messages.
```

### Choose a Compression Method

```
Compare anchored iterative, opaque, and regenerative compression for this session. Recommend one based on duration, artifact needs, and re-fetching cost.
```

### Build Retention Probes

```
Create recall, artifact, continuation, and decision probes for this history. Include expected answers and identify the context each probe tests.
```

### Audit a Compression Pipeline

```
Audit this compression pipeline for cumulative loss, artifact drift, weak triggers, and probe blind spots. Propose measurable improvements and acceptance thresholds.
```

## Limitations

- The included evaluator uses heuristic scoring instead of a live LLM judge.
- Regex extraction can miss unusual file references, decisions, and task wording.
- Opaque compression requires external implementation and separate fidelity testing.
- Benchmark figures are source-specific and require validation for each workflow.

## Best Practices

- Preserve file paths, identifiers, errors, and numeric values exactly.
- Merge newly truncated content into stable sections instead of regenerating the full summary.
- Measure re-fetching frequency and tokens per completed task.

## Anti Patterns

- Do not optimize only for the smallest context on each request.
- Do not compress tool schemas, API specifications, or essential function signatures.
- Do not trust a compressed summary without probe-based validation against source material.

## Security Audit

- Audited at: 2026-08-09T09:31:16.59\+00:00
- Summary: All 22 static findings are false positives caused by Markdown backticks, prose examples, or ordinary Python membership checks. No command execution, system reconnaissance, prompt injection, or malicious intent was found.

## Stats

- Views: 290
- Downloads: 48
- Favorites: 1
- Popularity score: 0
