haircut for Openclaw

Haircut measures, prices, and safely trims the configuration overhead loaded by every coding agent on a machine.

othmanadi
v0.1.0
Sep 14, 2026
0
247
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install haircut

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install haircut using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is haircut?

haircut is an Openclaw Skills configuration auditing and cleanup tool for coding agents such as Claude Code, Codex, OpenCode, Cursor, Gemini, Copilot, Windsurf, Continue, Claude Desktop, and VS Code. It scans instruction files, memory, MCP servers, hooks, skills, commands, subagents, plugins, duplicates, and leftovers, then prices their token and latency impact using real transcript data where available.

The skill is designed for safe, evidence-based cleanup rather than blind deletion. It reports measured startup costs, proposes verdicts, asks for explicit decisions, moves approved items into a dated recovery bag, creates a receipt, and supports one-command restoration. As an Openclaw Skills workflow, haircut complements built-in checks such as /context, /doctor, and /skill-doctor by auditing every supported agent on the machine.

haircut Use Cases

  • Investigate why a coding-agent session is slow or why context is full before the first prompt.
  • Measure average and worst-case tokens consumed before the first word of a cold Claude Code session.
  • Audit Codex rollout overhead, including MCP schema costs paid on every model call.
  • Find unused MCP servers, skills, commands, hooks, plugins, subagents, or instruction files.
  • Identify duplicate installations and project settings that shadow global configuration.
  • Review the cost and latency of hooks that fire on every prompt.
  • Audit CLAUDE.md, AGENTS.md, and MEMORY.md without modifying their contents.
  • Decide which credential-bearing configuration items need rotation without exposing secrets.
  • Safely park approved configuration with a manifest and restore it if the change causes problems.
  • Use Openclaw Skills to create a measured, reversible configuration-maintenance workflow across multiple agents.

How haircut Works

  1. Measure: Run the read-only scanner to inspect supported agent configuration, transcripts, usage history, and optional MCP schema costs.
  2. Read the report: Review the concise REPORT.md summary rather than loading the full report.json; optionally open the self-contained report.html interface.
  3. Explain findings: Present the before-first-word token figure, the three largest savings opportunities, and counts grouped by verdict.
  4. Resolve decisions: Ask the user about ASK and ROTATE items in small, grouped rounds. Unanswered items remain later and are not changed.
  5. Write decisions: Save approved choices to decisions.json in the run folder, using item IDs from decisions.template.json.
  6. Confirm the plan: Show the exact list of items to be parked, including what will stop working, and wait for explicit approval.
  7. Dry-run trimming: Execute trim --dry-run and reconcile any difference between the proposed plan and the user-approved list.
  8. Apply changes: Run the real trim command only after confirmation. Approved items are moved, not deleted.
  9. Provide recovery: Print the receipt, point to MANIFEST.jsonl, and provide the exact restore command for the generated bag.
  10. Start fresh: Explain that the current session already paid its startup cost; the user should begin a new session and rerun haircut to measure the improvement.

haircut Setup

haircut is invoked through the installed skill or plugin and uses ${CLAUDE_PLUGIN_ROOT} as its runtime root. The provided skill documentation does not specify a separate package-install command; ensure the skill is available to the coding agent before running these commands.

Run a default, read-only audit:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" --json

Optional measurement controls:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" --json --days 30
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" --json --agents claude-code,codex
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" --json --probe

Use --probe only when the user explicitly wants MCP tool-schema costs measured, because it starts configured MCP servers. Codex transcript scans may take a minute on machines with extensive history.

Open the browser-friendly report when the result is large:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" report --open

After the user approves a decisions file, preview and apply the changes:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" trim <path to decisions.json> --dry-run
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" trim <path to decisions.json>

Restore a bag if needed:

node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --bag <bag id> --dry-run
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --bag <bag id>

All scans, measurements, probes, and reports are read-only. Only the approved trim operation changes files. Never use haircut to edit the contents of CLAUDE.md, AGENTS.md, or MEMORY.md, and never print credential values.

haircut Data Schema & Taxonomy

Run outputs

Each audit creates a run folder whose path is returned in the JSON summary as run_dir.

File Purpose
REPORT.md Human-readable findings, measurements, savings, and verdicts; preferred for review.
report.html Self-contained browser interface for reviewing items and exporting decisions.
report.json Complete machine-readable report containing every item; inspect selectively because it can be large.
decisions.template.json Candidate item IDs and proposal structure used to build decisions.
decisions.json User-approved choices and notes for the current run.
MANIFEST.jsonl Operation-by-operation receipt stored inside the recovery bag.

Decision format

{
  "run": "<run id from the summary>",
  "items": {
    "<item id>": { "decision": "park", "note": "unused in 90 days, user confirmed" },
    "<item id>": { "decision": "keep", "note": "" }
  }
}

Supported decisions are park, keep, and later. Only park moves files. later is the safe default for unanswered items.

Verdict taxonomy

  • PARK: Candidate for removal from active configuration and placement in the recovery bag.
  • TRIM: Useful but oversized or excessive and should be reduced rather than removed.
  • FIX: Wanted configuration that is currently broken.
  • ROTATE: Credential appears in plain text and should be rotated by the user.
  • ASK: Requires an explicit user decision, especially for shared team files.
  • KEEP: Remains active.
  • INERT: Has no measurable cost in its current location.

The report can include headline.claude_code.before_first_word.avg_cold, cold_sessions, and max_cold, plus Codex fixed-per-rollout and per-call MCP schema costs. Savings are summarized in top_savings, while verdict counts appear in totals.by_verdict.

haircut Advanced Features

  • Multi-agent scanning across Claude Code, Codex, OpenCode, Cursor, Gemini, Copilot, Windsurf, Continue, Claude Desktop, and VS Code.
  • Transcript-based token pricing using API usage fields instead of hand-built estimates.
  • Optional live MCP probing that measures tool-schema overhead by starting servers as the agent would.
  • Hook analysis covering both injected token cost and latency per execution.
  • Detection of duplicate skills, commands, and configuration plus scope-shadowing behavior.
  • Plugin-aware handling: skills, hooks, and servers shipped inside a plugin are treated as one unit and are not parked independently.
  • Interactive ASK and ROTATE decisions with grouped questions and explicit consequences.
  • Browser-based review through report.html, including export of the same decisions.json used by the CLI.
  • Dry-run enforcement before any real trim operation.
  • Reversible dated recovery bags with MANIFEST.jsonl receipts and restore support.
  • Safety controls that preserve team files, avoid credential disclosure, and keep all changes read-only until approval.
  • A focused Openclaw Skills workflow that scales the response to the user's question, from a quick startup-cost answer to a complete configuration audit.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*