Skill
Core
Context-Window Self-Clearing
Default-off orchestrator contract for checkpoint-before-reset context compaction/clearing at deterministic pressure thresholds — snapshot-first continuity across Claude Code and Codex.
Overview
The context-window-self-clearing skill preserves Datarim task continuity while orchestrated Claude Code or Codex sessions compact or clear their context window. It applies only to orchestrator-launched sessions that explicitly enable context-window automation — it is default-off.
Key Concepts
- Checkpoint before reset — the active task snapshot is read first; the task-description path, last completed snapshot stage, snapshot path, and snapshot digest are bound into a private transaction before any reset instruction is sent.
- Deterministic pressure thresholds — below 75% pressure is
no_op, 75–89% isselective_drop(compaction), 90–100% isfull_clear. A policy may select a mode only at or above its declared floor. - Fixed instructions only — selective compaction and full clear use a closed set of reset instructions; nothing is improvised per session.
- Transactional continuity — after a full clear the session revalidates the snapshot digest and resumes via
/dr-next; after compaction a matching post-compact marker completes the transaction exactly once. A failed or crashed claim is ambiguous and is reconciled, never replayed automatically. - Trust boundary — HMAC tags protect private-state integrity, ordering, replay, and pane correlation; automation requires the runtime trust settings to be explicitly enabled. Raw pane, prompt, assistant, notify, or rollout content is never persisted.
Canonical source
Full contract in the Datarim repo: skills/context-window-self-clearing/SKILL.md. Continuity source of truth: the snapshot-replay skill.