CL
ClawLab
Back to catalog

Context Hygiene

Long OpenClaw sessions drift before they fail. This skill catches the drift early.

Built for real OpenClaw workflowsLocal and auditable30s install

Quick install

$ npx clawlab-installer install context-hygiene
# paste your ClawLab license key when prompted
$ openclaw hooks list | grep context-hygiene
$ bash ~/.openclaw/skills/context-hygiene/scripts/context-hygiene-check.sh

Overview

Long OpenClaw sessions usually do not fail in one dramatic moment. They degrade. The agent starts rereading the same files, restating the same summary, carrying stale branches forward, and losing the active state that still matters.

Context Hygiene fixes that operational layer. It initializes a durable `.context-hygiene/` workspace when relevant work starts, writes structured hygiene events before the session drifts further, and refreshes a compact working brief so the agent can continue from live state instead of bloated recap.

This is not a vague "better memory" claim. It is a practical session-control skill for long coding, research, and ops workflows where repetition, drift, and compaction-like failure quietly waste time and tokens.

What you get

Real outcomes, not feature lists

Stops drift before the session goes off the rails

Catches repeat-read, repeat-search, summary-bloat, and stalled-plan patterns before they become expensive failure loops.

Writes durable session state

Logs structured HYG events and maintains a compact working brief so the next response starts from active state, not stale recap.

Stays quiet when the work is trivial

It does not inject heavy ceremony into one-shot factual answers. The hygiene machinery activates only when session degradation is plausible.

Gives visible help only when it matters

Supports silent cleanup, visible phase transitions, and one-question intervention when drift is materially affecting progress.

Tool-backed when possible, script-backed when needed

Uses the `context_hygiene_apply` tool on richer OpenClaw installs and falls back to helper scripts when the tool surface is unavailable.

Inspectable runtime, not hidden magic

Your `.context-hygiene/` files stay on disk and readable, so teams can inspect how the skill is steering long sessions over time.

Included

One purchase. Everything below. Lifetime updates.

  • Full context hygiene protocol
  • Tool-backed WAL + working brief refresh
  • Helper scripts and runtime templates
  • Lifetime updates
  • Unlimited workspaces
  • Native ClawLab installer flow

Proof in practice

What this skill changes once it is installed

Operator is debugging a repo issue and notices the agent is repeating itself instead of advancing the work

Without the skill

You

You are starting to repeat yourself. We already covered the React build failure. Keep the active state under control and stop re-summarizing the whole thread.

Agent

You’re right. Resetting state now. Current objective: fix the React app build failure by resolving package resolution issues only. Verified facts: this is a React app build failure, scope is limited to package resolution, and vite.config.ts is out of scope. Open questions: what is the first unresolved module error, which package manager is authoritative, and is this a monorepo? Next actions: paste the first Vite resolution error line, then I will map it to one exact fix path.

resetting state nowwe already coveredcurrent objectiveverified facts
With Context Hygiene

You

You are starting to repeat yourself. We already covered the React build failure. Keep the active state under control and stop re-summarizing the whole thread.

Agent

Current objective: Debug the React build failure as a package-resolution drift issue without repeating prior summaries. Verified facts: - `vite.config.ts` is assumed correct. - The failure focus is package resolution. - You want tighter, non-repetitive intervention. Open questions: - Package manager: npm, pnpm, or yarn? - Exact current error text and which import fails? Next actions: - You send those 2 details. - I return a precise, minimal command sequence to resolve it.

without repeating prior summariespackage managerexact current error textprecise, minimal command sequence
Stops drift before the session goes off the rails

Catches repeat-read, repeat-search, summary-bloat, and stalled-plan patterns before they become expensive failure loops.

Writes durable session state

Logs structured HYG events and maintains a compact working brief so the next response starts from active state, not stale recap.

Stays quiet when the work is trivial

It does not inject heavy ceremony into one-shot factual answers. The hygiene machinery activates only when session degradation is plausible.

What this skill does — and what it doesn't

OpenClaw hooks run with your full permissions. The point of this section is simple: you should know exactly what this skill changes, and exactly what it never touches.

This skill does

  • Create and update `.context-hygiene/` files inside the active workspace
  • Write structured HYG events and refresh the working brief before replying
  • Surface drift with silent cleanup or visible intervention when warranted
  • Ship readable, unminified source plus helper scripts for local inspection

This skill does not

  • Make outbound network calls or send session data off your machine
  • Spawn shells or background processes as part of the skill runtime
  • Add third-party dependencies or hidden services
  • Hide its persistence layer outside `.context-hygiene/`

Every claim above is enforced by our CHITIN 6-stage audit pipeline — automated, deterministic, and run on every release. Read the full protocol.

Changelog

Release history

v0.5.0

Mar 6, 2026

  • Tool-backed WAL and working-brief refresh via `context_hygiene_apply`
  • Dual-surface OpenClaw package with hook + plugin metadata
  • Improved bootstrap guidance for onboarding and drift recovery
  • Installer-ready release packaging
v0.4.0

Mar 6, 2026

  • Helper-script-first hygiene writes
  • Slimmer always-on hook with exact command injection
  • Production lessons captured for standardization
v0.3.0

Mar 6, 2026

  • Stronger write-before-reply enforcement
  • Conditional bootstrap injection for first relevant sessions
  • Live gateway A/B harness
$80