technical-term · Context & knowledge · maturing · Reviewed

Context hygiene

The active practice of selecting, labeling, refreshing, compacting, and removing model-visible information so the working context stays relevant, attributable, and within budget.

Definition

Context hygiene manages the quality of an agent’s finite working set over time. It chooses the smallest sufficient instructions, state, evidence, retrieved material, and tool output; tracks provenance and freshness; summarizes with a path back to primary sources; and starts a clean context when accumulated history creates more noise than value. It does not mean deleting evidence or assuming a larger context window removes the need for selection.

Context selection and compaction are established constraints, while reusable measures and operating standards for hygiene are still developing.

Why it matters

Every token competes for model attention and can carry stale assumptions, untrusted instructions, or irrelevant detail into the next decision.

Durable state and evidence should live outside transient context. A refreshed agent can load the current task packet without losing the authoritative history.

System anatomy

Selection
Load only information relevant to the present decision.
Provenance
Retain source, trust, and recency labels for context items.
Compaction
Summarize history while preserving links to primary evidence and unresolved decisions.
Refresh
Restart with clean context and explicit state when accumulation degrades performance.

Important distinctions

Large context window
Capacity says how much can fit; hygiene determines what deserves to be present and trusted.
Deleting history
Transient context can be refreshed while durable evidence and decision records remain available.

Implementation signals

  • Separate authoritative state from conversational history
  • Load detail progressively from a compact task packet
  • Mark summaries as summaries and retain primary-source pointers
  • Test performance under realistic context noise

Failure modes

  • Old instructions silently override the current task
  • Compaction converts an uncertain claim into an apparent fact
  • Tool output floods the context with low-value detail

Sources and further study

  1. Anthropic — Effective context engineering for AI agents

    A working model for treating model-visible context as a finite resource that must be selected and maintained.

    Use in this library: First-party case study. This first-party account documents one organization, product, or implementation context and should not be generalized without local evidence.

    engineering · engineering · Published 2025-09-29
  2. Anthropic — Effective harnesses for long-running agents

    Patterns for incremental progress and durable handoffs across context windows and extended execution.

    Use in this library: First-party case study. This first-party account documents one organization, product, or implementation context and should not be generalized without local evidence.

    engineering · engineering · Published 2025-11-26
  3. AI Hero — Claude Code for Real Engineers

    The official course page frames AI-assisted engineering around planning, decomposition, steering, feedback loops, tracer bullets, sandboxing, and maintaining navigable production codebases.

    Use in this library: Practitioner perspective. This is a commercial course description and first-party outcomes narrative, not independent evidence of learner or production results; examples focus on Claude Code.

    course · course · Published 2026-03-30
  4. Matt Pocock — mattpocock/skills: A complete AI Coding workflow, end-to-end

    Demonstrates a skills-based coding workflow that develops shared domain context, writes a specification, decomposes work into tickets, implements it, and reviews against the specification and standards.

    Use in this library: Practitioner perspective. This is a first-party workflow demonstration rather than comparative evidence. A fresh-context model review is useful challenge but is not automatically an independently owned verifier.

    video · video · Published 2026-07-16