phenomenoner/openclaw-context-clean-up · Archived

context-clean-up

Audit and slim OpenClaw prompt context to prevent context overflow and reduce cost. Use when the user says /context-clean-up, or asks to reduce prompt bloat, shrink session history, tame noisy cron or heartbeat output, or investigate a Context overflow error.

First seen Jul 5, 2026

Installation

$ npx skills add phenomenoner/openclaw-context-clean-up --skill context-clean-up

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

License MIT
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

LicenseMIT
Allowed toolsread, write, edit, exec, process, cron, sessions_list, sessions_history, session_status
Declared agents clawdbot
More metadata
openclaw
{"emoji":"🧹"}

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,326 B
  • docs SUMMARY.md 283 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Context Clean Up

Runbook-style workflow to audit and (optionally) apply safe fixes that keep OpenClaw sessions lean.

Principle: the fastest way to lose to context overflow is letting recurring automation (cron/heartbeat/reporting) write long outputs back into the same interactive session transcript.

Quick start

  • User command:

- /context-clean-up → audit + actionable plan (no changes) - /context-clean-up apply → apply low-risk changes (with backups / reversible patches)

Workflow (audit → plan → apply)

Step 0 — Determine scope

  1. Identify the OpenClaw workspace dir (usually current directory).
  2. Identify the OpenClaw state dir (usually ~/.openclaw).

If unsure, run:

bash -lc 'echo "$HOME" && ls -ld ~/.openclaw'

Step 1 — Audit what is actually bloating context

Run the bundled audit script (short stdout; writes detailed JSON to file):

bash -lc 'cd "${WORKDIR:-.}" && python3 context-clean-up/scripts/context_cleanup_audit.py --out memory/context-cleanup-audit.json'

If the repo is not in the current workdir, adapt the path accordingly.

Interpretation:

  • If you see huge entries under toolResult (exec/read/web_fetch): those are transcript bloat.
  • If you see repeated System: Cron: lines: that is automation bloat.
  • If workspace bootstrap docs are huge: that is reinjected rules bloat.

Step 2 — Plan fixes (batch, lowest-risk first)

Create a short plan with:

  • Top offenders (largest N transcript entries)
  • Noisiest cron jobs (frequent + non-empty output)
  • Quick wins (reversible)

Use these standard levers:

Lever A — Make no-op cron jobs truly silent

Goal: cron jobs that do maintenance should output exactly NO_REPLY.

Heuristic:

  • If a cron job is deliver=false, it should never output long text.
  • If a cron job is a “heartbeat” or “harvester” and has no anomalies, it should output NO_REPLY.

Implementation pattern: update the job prompt to end with:

  • Finally output ONLY: NO_REPLY

Lever B — Keep scheduled reports, but avoid transcript injection

If the user wants notifications but you still want a lean interactive session:

  • Prefer out-of-band delivery from the isolated worker:

1) send a message (Telegram/Slack/etc.) using the platform tool 2) output NO_REPLY

This keeps the main session transcript cleaner while the user still receives the report.

Lever C — Keep workspace bootstrap context small and stable

If the injected bootstrap docs are large:

  • move “rarely-needed” notes into memory/.md or references/.md
  • keep only restart-critical rules in MEMORY.md
  • keep persona files short (SOUL.md, USER.md, etc.)

Always create .bak.<date> backups before edits.

Step 3 — Apply (only when user asked for apply)

If the user ran /context-clean-up apply:

  1. Patch noisy cron jobs (safe edits only):
  • Convert success/no-op outputs to NO_REPLY
  • Leave user-facing reports alone unless the user explicitly agrees
  1. (Optional) Propose a bootstrap docs compaction PR:
  • Only do this with explicit confirmation because it edits the user’s rules/persona.

Step 4 — Verify

  • Confirm the next cron run no longer injects Cron: ok / Cron: HEARTBEAT_OK noise.
  • Watch for compaction events in the session (context ratio should drop).

Notes / best-practice hints

  • Telegram auto-delete helps your chat app, but OpenClaw still has its own local session logs; auto-delete alone usually does not shrink the model prompt.
  • For long-running agents, pair this with a memory layer (e.g., openclaw-mem) so you can retrieve state on demand instead of dragging the full transcript forward.

References

  • references/out-of-band-delivery.md
  • references/cron-noise-checklist.md