context-clean-up
Use when: you suspect OpenClaw prompt context is bloating (slow replies, high cost, repeated transcript noise) and you want a ranked offender list + a reversible clean-up plan. Don’t use when: you want the assistant to apply fixes automatically, or you’re asking for unrelated troubleshooting. Output: an audit summary + 3–8 concrete fix steps + rollback notes (no automatic changes).
- License 许可
- MIT
- 最近更新
- 2026-05-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- context-clean-up
- slug
- context-clean-up
- license
- MIT
- version
- 1.0.4
- metadata
- { "openclaw": { "emoji": "🧹", "requires": { "bins": [ "python3" ] } } }
- description
- Use when: you suspect OpenClaw prompt context is bloating (slow replies, high cost, repeated transcript noise) and you want a ranked offender list + a reversible clean-up plan. Don’t use when: you want the assistant to apply fixes automatically, or you’re asking for unrelated troubleshooting. Output: an audit summary + 3–8 concrete fix steps + rollback notes (no automatic changes).
- allowed-tools
- [ "read", "exec", "sessions_list", "sessions_history", "session_status" ]
- disable-model-invocation
- true
02 资源文件 4
- 参考文档_meta.json820 B
- 参考文档references/cron-noise-checklist.md1018 B
- 参考文档references/out-of-band-delivery.md962 B
- 脚本scripts/context_cleanup_audit.py8.1 KB
03 SKILL.md 正文
Context Clean Up (audit-only)
This skill is a runbook to identify what is bloating your OpenClaw prompt context and produce a safe, reversible plan.
Important: This skill is intentionally audit-only.
- It will not delete files, prune sessions, patch config, or modify cron jobs.
- If you ask for changes, it will propose an exact patch + rollback plan and wait for explicit approval.
Quick start
/context-clean-up→ audit + actionable plan (no changes)
Common offenders (what usually causes bloat)
Typical high-impact sources (roughly in descending frequency):
- Tool result dumps
- Large
execoutput pasted back into chat - Big
readoutputs (logs, JSON, lockfiles) - Web fetches that inject long pages
- Automation transcript noise
- Cron jobs that report “OK” every run
- Heartbeat outputs that are not strictly alert-only
- Bootstrap reinjection bloat
- Overgrown
AGENTS.md/MEMORY.md/SOUL.md/USER.md - Large “runbooks” embedded directly in SKILL.md instead of
references/
- Repeated summaries that never get trimmed
- Summaries that accrete historical detail instead of staying restart-critical
Negative examples (don’t run this skill)
- “Delete old sessions / prune logs / apply fixes now” → this skill is audit-only.
- “Change my OpenClaw config automatically” → must ask first.
- “Investigate a specific bug in app code” → use repo-specific debugging instead.
Workflow (audit → plan)
Step 0 — Determine scope
Find:
- Workspace dir: where your OpenClaw workspace / project files live
- State dir: where OpenClaw stores runtime state (sessions, memory, etc.)
The state dir is often:
- macOS/Linux:
~/.openclaw - Windows:
%USERPROFILE%\.openclaw
…but it can differ per installation. The audit script supports overrides via --state-dir or OPENCLAW_STATE_DIR.
If you want a quick sanity check:
# POSIX (macOS/Linux)
echo "WORKDIR=$PWD"; echo "HOME=$HOME"; ls -ld ~/.openclaw
# PowerShell (Windows)
Write-Host "WORKDIR=$PWD"; Write-Host "USERPROFILE=$env:USERPROFILE"; Get-Item "$env:USERPROFILE\.openclaw"
Step 1 — Run the audit script
This script prints a short summary and can write a full JSON report.
# Run the audit script shipped with this skill.
# From the skill folder, run:
python3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json
# If your Python executable is not `python3` (common on Windows):
# py -3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json
# Optional overrides:
# --workspace (defaults to current directory)
# --state-dir (defaults to ~/.openclaw or OPENCLAW_STATE_DIR)
python3 scripts/context_cleanup_audit.py --workspace . --state-dir <PATH_TO_OPENCLAW_STATE> --out context-cleanup-audit.json
Interpretation cheatsheet:
- Huge
toolResultentries (exec/read/web_fetch): transcript bloat - Many
System:/Cron:lines: automation bloat - Large bootstrap docs (AGENTS/MEMORY/SOUL/USER): reinjected rules bloat
Step 2 — Produce a fix plan (lowest-risk first)
Create a short plan with:
- Top offenders (largest transcript entries)
- Noisiest recurring jobs (cron/heartbeat)
- Quick wins (reversible)
Use these standard levers:
Lever A — Make no-op automation truly silent
Goal: maintenance loops should output exactly NO_REPLY unless there is an anomaly.
Pattern: update prompts so the last line forces:
Finally output ONLY: NO_REPLY
Lever B — Keep notifications, avoid transcript injection
If you want alerts but want the interactive session lean:
- Send out-of-band (Telegram/Slack/etc.)
- Then output
NO_REPLY
See: references/out-of-band-delivery.md
Lever C — Keep injected bootstrap files small
- Keep only restart-critical rules in
MEMORY.md - Move bulky notes into
references/*.mdormemory/*.md
Step 3 — Verify
After you apply any changes:
- Confirm the next cron/heartbeat runs are silent on success.
- Watch context growth rate (it should flatten).
Sample report skeleton (what “good output” looks like)
Use this structure when you report the audit (even if you do not write JSON):
# Context Clean Up — Audit Report (No Changes)
## Executive Summary
- Symptoms observed:
- Primary bloat drivers:
- Recommended first action:
## Top Offenders
1) <offender> — <why it matters> — <quick fix>
2) <offender> — <why it matters> — <quick fix>
## Automation Noise (Cron/Heartbeat)
- Findings:
- Proposed changes (audit-only):
- Risk/rollback notes:
## Bootstrap Size
- Files contributing most:
- Recommendation:
## Plan (3–8 steps)
1) ...
2) ...
## Rollback Plan
- How to revert each step:
## Verification
- What to check after changes:
References
references/out-of-band-delivery.mdreferences/cron-noise-checklist.md
04 同仓库更多 Skills
zvukogram
Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.
zohomail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-recruit
Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows. Use this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-people
Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave. Use this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-mail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-inventory
Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments. Use this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.