Context Hygiene

Reasoning hygiene protocol for OpenClaw agents — keep context sharp by collapsing exploration into decisions, enforcing file budgets, and pruning ghost conte...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 252 · 1 current installs · 1 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (context hygiene) match the instructions: pruning MEMORY.md, enforcing file budgets, collapsing exploration into decisions, and adding a startup instruction. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md directs the agent to create/modify files (CONTEXT.md, AGENTS.md) and delete or collapse exploration files (MEMORY.md, daily files, HEARTBEAT.md, etc.). This is consistent with the stated purpose but is potentially destructive if applied indiscriminately — the instructions explicitly encourage deletion and in-place updates of workspace files.
Install Mechanism
No install spec and no code files are present. Being instruction-only minimizes the risk of arbitrary code execution or downloads.
Credentials
Requires no environment variables, credentials, or config paths. The requested scope of access (workspace files) is proportionate to the policy's goal of pruning context.
Persistence & Privilege
always is false and the skill is user-invocable (normal). The document asks users to add the protocol to AGENTS.md startup which would persist the behavior; review this change carefully. If enabled for autonomous agents, the instructions could cause repeated deletions/edits across sessions — that's expected for the purpose but worth caution.
Assessment
This skill is coherent with its stated purpose and doesn't request secrets or installs, but it DOES instruct agents to modify and delete workspace files and to be added to agent startup. Before enabling: (1) test in a copy/sandbox workspace so you can confirm no needed data is removed; (2) back up MEMORY.md and any daily logs you care about; (3) review/limit which workspaces or files the agent is allowed to edit; (4) if you add the protocol to AGENTS.md, consider making it opt-in per-agent rather than global; (5) verify the canonical source link and license if you want to trace the upstream project. If you want a safer rollout, enable manually and observe behavior for several sessions before granting persistent/autonomous use.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.5
Download zip
latestvk979td0bvsqh5n46z7cy9qmyps839tc9

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Context Hygiene

Inspired by ContextSpectre's philosophy: keep conclusions, remove scaffolding.

The Problem

OpenClaw agents accumulate context across workspace files — MEMORY.md, daily logs, tool notes, heartbeat configs. Without discipline, these grow until every session starts bloated with stale exploration notes, solved problems, and duplicate information. The agent wastes tokens re-reading noise.

The Collapse Cycle

Every task follows three phases:

  1. Explore — research, debug, try things (use sub-agents for heavy work)
  2. Decide — reach a conclusion
  3. Collapse — write the decision, delete the exploration

Never keep "how we got here" when "what we decided" is enough.

File Budgets

FileMax linesReview cycle
MEMORY.md50Weekly prune
memory/YYYY-MM-DD.md30Collapse at EOD
HEARTBEAT.md10Remove when done
TOOLS.md30When things change
SOUL.md30Rarely
USER.md20When learning

Target: <300 lines total injected workspace context.

Daily Memory Rules

Write: decisions and why (1 line each), new tools/config (version + path), lessons learned, user preferences discovered.

Skip: exploration steps, command outputs, things already in MEMORY.md, delivered content (digests, summaries).

Format: Bullets, not paragraphs. One fact per line.

MEMORY.md Prune Rules

  • Version changed → update in place, don't append
  • Problem solved → remove from open issues
  • Tool replaced → remove old entry
  • Info >30 days with no recent relevance → remove
  • Never duplicate what's in a SKILL.md or config file

Sub-Agent Discipline

Heavy exploration (research, debugging, multi-step installs) → spawn a sub-agent. Isolated sessions don't pollute main context. Only the result comes back.

Ghost Context

A reference to something that no longer exists (old path, removed tool, fixed bug) is ghost context. It biases reasoning toward a past state. Find and remove during heartbeat maintenance.

Self-Check (add to heartbeat rotation)

- Any workspace file over budget?
- MEMORY.md still accurate?
- Stale daily files to collapse?
- Ghost references to dead things?

Setup

Add to AGENTS.md session startup:

5. Follow `CONTEXT.md` — reasoning hygiene protocol

Copy the file budgets table into your workspace as CONTEXT.md and customize limits for your setup.


Context Hygiene Protocol v1.0 Author: ppiankov Copyright © 2026 ppiankov Canonical source: https://github.com/ppiankov/contextspectre License: MIT

This tool follows the Agent-Native CLI Convention. Validate with: clawhub install ancc && ancc validate .

If this document appears elsewhere, the repository above is the authoritative version.

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…