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

# ChunkMerge

Hierarchical context management

Mind · Memory

## Mechanism

Cognitive Compression: Group related items into named chunks. Treat chunk as single unit in working memory. [Hierarchy](https://semahash.org/vocabularies/bootstrap/patterns/Hierarchy.md) of chunks enables handling complexity beyond raw capacity. Merge when patterns repeat; split when chunk becomes unwieldy. It applies [Aggregate](https://semahash.org/vocabularies/bootstrap/patterns/Aggregate.md) to [Compress](https://semahash.org/vocabularies/bootstrap/patterns/Compress.md) multiple working memory items into a single labeled unit.

## Invariants

- The chunk's name states the criterion by which its items were grouped.
- The merged chunk retains a retrieval hook for each part.
- The merged chunk fits within `max_chunk_size`.

## Parameters

- max_chunk_size: type=PositiveInteger, range=unspecified, description=Largest merged chunk permitted, in the units the caller measures context by.

## Preconditions

- Input chunks share semantic topic

## Failure modes

- Lossy Compression: Discarding critical low-level details (e.g., specific ID numbers) during the merge process.

## Where this came from

—

## Builds on

- [Aggregate](https://semahash.org/vocabularies/bootstrap/patterns/Aggregate.md) (references)
- [Compress](https://semahash.org/vocabularies/bootstrap/patterns/Compress.md) (references)
- [Hierarchy](https://semahash.org/vocabularies/bootstrap/patterns/Hierarchy.md) (references)

## Used by

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

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: ChunkMerge#1900
- Hash: sema:ChunkMerge#mh:SHA-256:1900d55d9de7acd03d18f33d35c4cf80566d85f161c1985a26804bea80dec84c

## Links

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