---
library: "bootstrap"
slug: "ContextCompress"
name: "ContextCompress"
ref: "ContextCompress#0bf5"
hash: "sema:ContextCompress#mh:SHA-256:0bf5ce89d0ad9cac74bb69f253f06331989714d3c34bb0b385f9674439ce30b0"
type: "Memory"
layer: "Mind"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/ContextCompress"
---

# ContextCompress

Semantic compression for long-running contexts

Mind · Memory

## Mechanism

A memory management primitive that uses [Compress](https://semahash.org/vocabularies/bootstrap/patterns/Compress.md) to reduce the token footprint of a [Context](https://semahash.org/vocabularies/bootstrap/patterns/Context.md) while preserving critical [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md). It explicitly retains active [Constraint](https://semahash.org/vocabularies/bootstrap/patterns/Constraint.md)s and unresolved goals.

## Invariants

- Reduces the [Context](https://semahash.org/vocabularies/bootstrap/patterns/Context.md)'s token footprint by at least `min_reduction`.
- Retains every active [Constraint](https://semahash.org/vocabularies/bootstrap/patterns/Constraint.md) and every unresolved goal.
- Re-evaluates which constraints are active and which goals unresolved on each pass.

## Parameters

- min_reduction: type=Ratio, range=(0.0, 1.0), description=Share of the token footprint a pass must remove to count as a compression.

## Failure modes

- Silent over-compression: a discarded [Constraint](https://semahash.org/vocabularies/bootstrap/patterns/Constraint.md) surfaces only when a later step violates it.
- Stale activeness: a pass reuses an earlier pass's list of active constraints instead of recomputing it, so a lapsed constraint is preserved and a new one is dropped.

## Where this came from

—

## Builds on

- [Context](https://semahash.org/vocabularies/bootstrap/patterns/Context.md) (references)
- [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) (references)
- [Compress](https://semahash.org/vocabularies/bootstrap/patterns/Compress.md) (references)
- [Constraint](https://semahash.org/vocabularies/bootstrap/patterns/Constraint.md) (references)

## Used by

- [CapacityPressure](https://semahash.org/vocabularies/bootstrap/patterns/CapacityPressure.md) (references)
- [DataMinimization](https://semahash.org/vocabularies/bootstrap/patterns/DataMinimization.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: ContextCompress#0bf5
- Hash: sema:ContextCompress#mh:SHA-256:0bf5ce89d0ad9cac74bb69f253f06331989714d3c34bb0b385f9674439ce30b0

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/ContextCompress
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/ContextCompress.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
