{"skill":{"slug":"context-clean-up","displayName":"context-clean-up","summary":"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...","description":"---\nname: context-clean-up\nslug: context-clean-up\nversion: 1.0.7\nlicense: MIT\ndescription: |\n  Use when: prompt context is bloating (slow replies, rising cost, noisy transcripts) and you want a ranked offender list + reversible plan.\n  Don't use when: you want automatic deletions or unattended config edits.\n  Output: an audit-only report (top offenders + 3-8 lowest-risk fixes + rollback notes). No changes are applied automatically.\ndisable-model-invocation: true\nallowed-tools:\n  - sessions_list\n  - sessions_history\n  - session_status\nmetadata: { \"openclaw\": { \"emoji\": \"🧹\", \"requires\": { \"bins\": [\"python3\"] } } }\n---\n\n# Context Clean Up (audit-only)\n\nThis skill identifies what is bloating prompt context and turns it into a **safe, reversible plan**.\n\n## Contract\n\n- **Audit-only by default.**\n- No automatic deletions.\n- No unattended config edits.\n- No silent cron/session pruning.\n- If you ask for changes, the skill should propose:\n  1. exact change,\n  2. expected impact,\n  3. rollback plan,\n  4. verification steps.\n\n## Safety model\n\n- No `exec` tool usage.\n- No `read` tool usage.\n- If you want file-level analysis, run the bundled script manually and paste the JSON.\n\n## Quick start\n\n- `/context-clean-up` → audit + actionable plan (no changes)\n\nOptional manual report generation:\n\n```text\npython3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json\n```\n\nWindows variant:\n\n```text\npy -3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json\n```\n\n## What to measure (authoritative, not vibes)\n\nWhen available, prefer **fresh-session `/context json` receipts** over subjective claims like “it feels leaner”.\n\nHigh-signal fields:\n- `eligible skills`\n- `skills.promptChars`\n- `projectContextChars`\n- `systemPrompt.chars`\n- `promptTokens`\n\nIf exact receipts are unavailable, fall back to ranked offenders + change scope, but label confidence lower.\n\n## Common offender classes\n\n1. **Tool result dumps**\n   - oversized `exec` output\n   - large `read` output\n   - long `web_fetch` payloads\n\n2. **Automation transcript noise**\n   - cron jobs that say “OK” every run\n   - heartbeat messages that are not alert-only\n\n3. **Bootstrap reinjection bloat**\n   - overgrown `AGENTS.md` / `MEMORY.md` / `SOUL.md` / `USER.md`\n   - long runbooks embedded directly in `SKILL.md`\n\n4. **Ambient specialist surface**\n   - too many always-visible specialist skills that should be on-demand workers/subagents instead\n\n5. **Summary accretion**\n   - repeated summaries that keep historical detail instead of restart-critical facts only\n\n## Recommended trim ladder (lowest-risk first)\n\n### Phase 1 — Noise discipline\n- Make no-op automation truly silent (`NO_REPLY` or nothing on success).\n- Keep alerts out-of-band when possible.\n\n### Phase 2 — Bootstrap slimming\n- Keep always-injected files short.\n- Move long guidance to `references/`, `memory/`, or external notes.\n\n### Phase 3 — Ambient surface reduction\n- Remove low-frequency specialist skills from always-on prompt surface.\n- Prefer worker/subagent invocation for specialist flows.\n\n### Phase 4 — Higher-risk changes\n- Tool-surface or deeper runtime/config narrowing.\n- Only propose with stronger rollback and explicit approval.\n\n## Workflow (audit → plan)\n\n### Step 0 — Determine scope\nYou need:\n- workspace dir\n- state dir (`<OPENCLAW_STATE_DIR>`)\n\nCommon defaults:\n- macOS/Linux: `~/.openclaw`\n- Windows: `%USERPROFILE%\\.openclaw`\n\n### Step 1 — Run the audit script\n\n```text\npython3 scripts/context_cleanup_audit.py --workspace . --state-dir <OPENCLAW_STATE_DIR> --out context-cleanup-audit.json\n```\n\nInterpretation cheatsheet:\n- huge tool outputs → transcript bloat\n- many cron/system lines → automation bloat\n- large bootstrap docs → reinjection bloat\n\n### Step 2 — Produce a fix plan\nInclude:\n- top offenders\n- lowest-risk fixes first\n- expected impact\n- rollback notes\n- verification plan\n\n### Step 3 — Verify\nAfter changes:\n- confirm automation is silent on success\n- check context growth flattens\n- if possible, compare fresh-session `/context json` before/after\n\n## Important caveat\n\nMany OpenClaw runtimes snapshot skills/bootstrap per session.\nSo skill/config slimming often **does not fully apply to the current session**.\nUse a **new session** for authoritative verification.\n\n## References\n\n- `references/out-of-band-delivery.md`\n- `references/cron-noise-checklist.md`\n","topics":["Prompt"],"tags":{"latest":"1.0.7"},"stats":{"comments":0,"downloads":3044,"installsAllTime":114,"installsCurrent":8,"stars":7,"versions":8},"createdAt":1770475109562,"updatedAt":1778486073009},"latestVersion":{"version":"1.0.7","createdAt":1772997174081,"changelog":"Add trim ladder, /context json verification metrics, rollback-first guidance, and new-session caveat.","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"phenomenoner","userId":"s17f9m8t6mza1fag5yvx1y2njn83gdfg","displayName":"phenomenoner","image":"https://avatars.githubusercontent.com/u/80816280?v=4"},"moderation":null}