在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
记忆
haircut
试用The barber for your coding agents' config. Weighs everything every agent on this machine loads (instruction files, memory, MCP servers, hooks, skills, commands, subagents, plugins, leftovers), prices each item in tokens from your own transcripts, and parks the dead weight with a receipt and an undo. Use this skill whenever the user mentions config bloat, a heavy or slow session start, tokens burned before the first word, too many MCP servers, hooks that are slow or fire on every prompt, skills or commands or plugins nobody invokes, cleaning up or auditing CLAUDE.md or AGENTS.md, Codex config, or asks what does my agent actually load, why is my context full before I type, which of these servers can I turn off, or what is this plugin costing me. Use it even when they only say the session feels bloated or startup got slow, and even when they mention /context, /doctor or /skill-doctor.
它能做什么
haircut is five deterministic stages plus this one. The script scans, measures, prices and proposes on its own. Your job is the conversation and the decision. Keep it that way: do not recompute a number the script already produced, and do not invent a verdict the report does not carry.
技能文档
haircut
haircut is five deterministic stages plus this one. The script scans, measures, prices and proposes on its own. Your job is the conversation and the decision. Keep it that way: do not recompute a number the script already produced, and do not invent a verdict the report does not carry.
Match the size of the answer to the size of the question. Someone who asks "how much do I pay before my first word" gets stage 1 and stage 2 and nothing more. Nobody gets walked into a cleanup they did not ask for.
1. Measure
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" --json
Add flags only when the user asked for them:
--days Nchanges the usage window (default 90).--agents claude-code,codexlimits the scan. Valid names: claude-code, codex, opencode, cursor, gemini, copilot, windsurf, continue, claude-desktop, vscode.--probemeasures the cost of MCP tool schemas by connecting to each configured server. It starts those servers the way the agent would, so use it only when the user asks to measure MCP schema cost, and tell them it will start their servers before you run it.
Everything in this stage is read-only. Claude Code transcripts take seconds; Codex rollouts can take a minute on a machine with months of them, so say so before you run it, and run it in the background if the user is waiting on something else.
The command prints a JSON summary and the run folder path in run_dir. Read
REPORT.md from that folder next. Do not read report.json: it carries every
item in full and will swallow your context for nothing. Reach into it only if the
user asks about a specific item the report does not cover.
There is also report.html in the same folder, self-contained, for browsing and
deciding with a mouse. node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" report --open
opens it. Offer it when the list is long or the user prefers to click; the page
exports the same decisions.json this skill writes in stage 4.
2. Tell the user what it found
Three things, in plain words, in this order:
- The before-first-word figure.
headline.claude_code.before_first_wordgivesavg_coldtokens acrosscold_sessionscold starts, worst casemax_cold. This comes from the API's own usage fields in the transcripts, so call it measured, not estimated. If Codex was scanned, addheadline.codex.fixed_per_rollout.totalper rollout and the per-call MCP schema cost, which Codex pays again on every single model call. - The three biggest savings from
top_savings: what each one is, what it costs over the window, why the script flagged it. - The count per verdict from
totals.by_verdict, one short line each. PARK goes in the bag. TRIM stays but gets cut down. FIX is wanted but broken. ROTATE is a credential sitting in plain text. ASK is the user's call. KEEP stays. INERT costs nothing where it sits.
No table longer than ten rows. When a list runs long, name the top few and point
at REPORT.md for the rest. The user can read a file; what they need from you is
the shape of the problem.
3. Walk the ASK and ROTATE items
The report proposes. It never decides. Every item whose verdict is ASK or ROTATE
needs the user's answer before it can go into decisions.json.
Use the AskUserQuestion tool, at most four questions per round. Group items that share a fate into one question (three unused servers from the same vendor, for example) rather than asking eight times. Every option has to say two things: what changes on disk, and what stops working. "Park it" on its own is not something a person can judge.
Options that work:
- "Park it. The server is removed from the user config and its folder moves into the bag. Its tools stop appearing in any session until you restore it."
- "Keep it. Nothing changes, and it keeps costing about 1,200 tokens at every session start."
ROTATE is different: nothing moves and nothing is parked. The user rotates the key themselves. Say which file holds it, never print the value or any fragment of it, and ask whether to leave the item alone until the key is out of that file.
Never answer for the user. An item they skipped stays later, which changes
nothing.
4. Decide, then trim
Write decisions.json into the run folder, next to REPORT.md, with the Write
tool (not a shell heredoc). Start from the proposals and overwrite them with the
user's answers. If the user decided in the browser instead, they paste or save
the page's export into that same file and you continue from here:
{
"run": "",
"items": {
"": { "decision": "park", "note": "unused in 90 days, user confirmed" },
"": { "decision": "keep", "note": "" }
}
}
decision is park, keep or later. Only park moves anything, and later
is the safe default for whatever the user did not answer. Item ids are the id
field from the report; decisions.template.json in the same folder already lists
every candidate, so copy ids from there instead of typing them.
Then show the user the plain list of what will be parked, one line per item, name and what stops working. Wait for an explicit yes. A topic change, silence, or "sounds good" about something else is not a yes.
On yes, dry run first:
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" trim --dry-run
Show the plan it prints. If it differs from what you told the user, stop and reconcile before going further. Then run it for real:
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" trim
5. Receipt and undo
Print the receipt: what moved, what was edited, what was skipped and why. Every
operation is also written to MANIFEST.jsonl inside the bag.
Give the user the exact undo command with the bag id filled in:
node "${CLAUDE_PLUGIN_ROOT}/bin/haircut.mjs" restore --bag --dry-run
The real restore is the same line without --dry-run. The /haircut:restore
skill takes it from there.
Finally, tell them the current session already paid for what was just parked, so
nothing looks different yet. Start a new session and run /haircut again to see
the difference.
Rules
- Nothing is deleted. Parked items move into a dated bag and
restoreputs them back. If the user asks you to delete something, park it and tell them where it went. - Never edit the content of CLAUDE.md, AGENTS.md or MEMORY.md. haircut
measures those files and reports what they cost per session. Rewriting the
prose inside them is the user's job, or
/doctor's. Reporting that a file is large is fine. Trimming it is not. - Team files stay put. A skill, command or rules file inside a shared repo may belong to colleagues. Say so out loud before proposing it, and let the user decide. The scanner marks those ASK for exactly this reason.
- Never print a credential, or a fragment of one, into the conversation. Name the file, name the item, stop there.
- Read-only until the yes. Scan, measure, probe and report change nothing.
trimis the only command that touches anything, and it does not run before the user has approved a list they have actually seen. - Plugins are one unit. A skill, hook or server that ships inside a plugin is not parked on its own. The move is to disable the plugin, and the report says so on those items.
- Report what the script found. If a number is missing, say it is missing. If the script failed, show its error and stop; do not reconstruct the audit by hand.
What this adds
Claude Code already ships three checks, and they are good. /context shows what
the live session is carrying right now. /skill-doctor reports per-skill usage
over the last week. /doctor runs a checkup over recent transcripts and applies
fixes with confirmation. Say so if the user asks. haircut covers what they do
not:
- Every agent on the machine, not just this one. Codex in particular sends full MCP tool schemas with every model call and ships no config doctor of its own.
- Hooks priced in tokens and in latency per fire, from what they actually injected.
- Duplicates and scope shadowing: the same skill installed twice, a project setting quietly overriding a global one.
- A receipt. Every change lands in a manifest, and one command puts it all back.
相关技能
以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。
通过一个命令行工具完成多链加密货币交易、钱包管理与 AI 市场分析。
把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。
按用户明确指令,在得到大脑(Get笔记)中保存、搜索并管理笔记与知识库。
othmanadi 的更多技能
浏览全部技能把多步骤任务写成磁盘上的 markdown 计划文件,即使上下文被 /clear 清空也能从断点继续。
Gives AI coding agents temporal awareness via a hook-backed ledger and decision rules. Activates whenever an agent reasons about recency, retry windows, memory staleness, deploy cooldowns, idle detection, or any "when / how long ago" question. Required for autonomous or long-running agents.
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires langsmith-fetch CLI installed.
A live visual Kanban board and continuity layer for long-running agentic tasks. Nobody wants to read a markdown plan or stare at raw HTML while an agent grinds for an hour, so Plandeck turns the plan into a board that organizes itself. Use it when a task is multi-step, long-running, or needs visual planning. Break the work into cards, declare which card depends on which, and Plandeck computes the critical path, auto-promotes cards to Ready as their dependencies clear, rolls up story-point estimates into an honest percent complete, and names the one next action. Plans, observed transitions, and last-known-good snapshots stay as plain files on disk, so they survive /clear and context resets. After a reset, run plandeck next to recover the single next move and its recent history. If the plan stops parsing, run plandeck doctor before using git. Renders a live board in the browser over SSE. Triggers on plan a project, break down a task, kanban board, task board, visual plan, long-running ag
Build generative UI with OpenUI — any LLM provider, any backend language. Scaffold, integrate, validate.
Connect and operate the Loophole Bridge (Ableton Live MCP server). Use when the user wants to check Live/bridge prerequisites, wire an MCP client to Loophole, or run a Live editing recipe (humanize, build arrangement, batch rename, chord from prompt). Triggers: "is my Ableton bridge working", "set up loophole", "connect Claude to Ableton", "/doctor", "/setup".