context-clean-up

Use when: prompt context is bloating (slow replies, rising cost, noisy transcripts) and you want a ranked offender list + reversible plan. Don't use when: yo...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
5 · 1.8k · 6 current installs · 7 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (context-clean-up, audit-only) match the included script and instructions: the tool locates large session items and workspace bootstrap files. Required binary (python3) and the script's behavior are proportional to the stated purpose.
Instruction Scope
SKILL.md is explicit about being audit-only and forbids automatic deletions and use of exec/read tools by the agent. The bundled script reads local session JSONL files and workspace bootstrap files (default ~/.openclaw and current workspace) — this is necessary to find prompt bloat but does access potentially sensitive local transcripts. The skill asks the user to run the script locally and paste results rather than having the agent read files itself, which reduces risk.
Install Mechanism
No install spec — instruction-only with a small, dependency-free Python script. No third-party downloads or archive extraction; only python3 is required.
Credentials
No credentials or secret environment variables requested. The script honors OPENCLAW_STATE_DIR if present (reasonable for locating session files). The scope of environment access is narrow and justifiable.
Persistence & Privilege
Skill is not always-on (always=false) and has disable-model-invocation=true, so it cannot be autonomously invoked by the model; it does not modify other skills or system-wide configs.
Assessment
This skill is an audit helper and is coherent with its stated purpose, but be aware it reads local OpenClaw session transcripts and workspace bootstrap files (e.g., ~/.openclaw/agents/main/sessions/*.jsonl and AGENTS.md, MEMORY.md, etc.). Only run the bundled script on machines you trust, inspect the produced JSON/report before sharing it externally, and avoid posting raw transcripts. The skill will not make changes automatically — follow the recommended rollback and verification steps when applying any fixes. If you want extra caution, run the script in an isolated environment or review the script source (included) before running.

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

Current versionv1.0.7
Download zip
latestvk971gtpq012d2hvqp06chqkwz182grgm

License

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

Runtime requirements

🧹 Clawdis
Binspython3

SKILL.md

Context Clean Up (audit-only)

This skill identifies what is bloating prompt context and turns it into a safe, reversible plan.

Contract

  • Audit-only by default.
  • No automatic deletions.
  • No unattended config edits.
  • No silent cron/session pruning.
  • If you ask for changes, the skill should propose:
    1. exact change,
    2. expected impact,
    3. rollback plan,
    4. verification steps.

Safety model

  • No exec tool usage.
  • No read tool usage.
  • If you want file-level analysis, run the bundled script manually and paste the JSON.

Quick start

  • /context-clean-up → audit + actionable plan (no changes)

Optional manual report generation:

python3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json

Windows variant:

py -3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json

What to measure (authoritative, not vibes)

When available, prefer fresh-session /context json receipts over subjective claims like “it feels leaner”.

High-signal fields:

  • eligible skills
  • skills.promptChars
  • projectContextChars
  • systemPrompt.chars
  • promptTokens

If exact receipts are unavailable, fall back to ranked offenders + change scope, but label confidence lower.

Common offender classes

  1. Tool result dumps

    • oversized exec output
    • large read output
    • long web_fetch payloads
  2. Automation transcript noise

    • cron jobs that say “OK” every run
    • heartbeat messages that are not alert-only
  3. Bootstrap reinjection bloat

    • overgrown AGENTS.md / MEMORY.md / SOUL.md / USER.md
    • long runbooks embedded directly in SKILL.md
  4. Ambient specialist surface

    • too many always-visible specialist skills that should be on-demand workers/subagents instead
  5. Summary accretion

    • repeated summaries that keep historical detail instead of restart-critical facts only

Recommended trim ladder (lowest-risk first)

Phase 1 — Noise discipline

  • Make no-op automation truly silent (NO_REPLY or nothing on success).
  • Keep alerts out-of-band when possible.

Phase 2 — Bootstrap slimming

  • Keep always-injected files short.
  • Move long guidance to references/, memory/, or external notes.

Phase 3 — Ambient surface reduction

  • Remove low-frequency specialist skills from always-on prompt surface.
  • Prefer worker/subagent invocation for specialist flows.

Phase 4 — Higher-risk changes

  • Tool-surface or deeper runtime/config narrowing.
  • Only propose with stronger rollback and explicit approval.

Workflow (audit → plan)

Step 0 — Determine scope

You need:

  • workspace dir
  • state dir (<OPENCLAW_STATE_DIR>)

Common defaults:

  • macOS/Linux: ~/.openclaw
  • Windows: %USERPROFILE%\.openclaw

Step 1 — Run the audit script

python3 scripts/context_cleanup_audit.py --workspace . --state-dir <OPENCLAW_STATE_DIR> --out context-cleanup-audit.json

Interpretation cheatsheet:

  • huge tool outputs → transcript bloat
  • many cron/system lines → automation bloat
  • large bootstrap docs → reinjection bloat

Step 2 — Produce a fix plan

Include:

  • top offenders
  • lowest-risk fixes first
  • expected impact
  • rollback notes
  • verification plan

Step 3 — Verify

After changes:

  • confirm automation is silent on success
  • check context growth flattens
  • if possible, compare fresh-session /context json before/after

Important caveat

Many OpenClaw runtimes snapshot skills/bootstrap per session. So skill/config slimming often does not fully apply to the current session. Use a new session for authoritative verification.

References

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

Files

4 total
Select a file
Select a file to preview.

Comments

Loading comments…