# Context, Memory, and Compaction Contract

## Purpose

Keep the active model context decision-ready across long-running work.

## Context rules

- Preserve the current user objective, current steering, current source facts,
  recent mutations, current verification evidence, and active unresolved gaps.
- Remove historical controller prose, retired failure recaps, and duplicate
  wrappers before they crowd out actual evidence.
- Keep one current recovery/action record, not a growing stack of old advice.
- A compacted item must be auditable: record exactly what was removed, why,
  and what summary/evidence remains model-visible.

## Provenance rules

- Label whether a message is user input, system/runtime state, tool evidence,
  source content, inference/extract, or operator telemetry.
- Do not present a partial extract as a full file body.
- Do not make a model infer that a source is visible from an evidence handle;
  track visibility separately from path/hash/range identity.
- Full bounded source reads are first-class. Branch extraction is an isolated,
  inference-driven reduction mechanism for overwhelming material or an explicit
  request; it is not a blanket replacement for reading.

## Compaction rule

Compaction is a transformation with an audit trail, not a cosmetic status line.
The user and agent must be able to inspect removed model-visible messages
without feeding that audit transcript back into ordinary model history.
