计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
audit-agent-speed【效率与协作】Measure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans. Use when "Claude is slow" or "CPU is pinned". App speed → audit-performance.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Degree of freedom: MIXED — measurement commands [LOW freedom — run exactly]; which fixes to recommend [HIGH freedom].
Audit-and-fix exception. Report first, then fix. Apply local, reversible fixes right away. Ask before anything that needs admin rights, touches committed config, deletes data, or changes a user preference (effort, model).
Most of an agent's turn is model time on the provider's servers, and no local tuning changes that. This skill wins back the local part: hooks, tools, builds, git, terminal rendering, and a CPU that other processes keep pinned.
| Skill | Owns |
|---|---|
| audit-agent-speed (this) | The agent host: Claude Code/Cursor config, hooks, status line, worktrees, OS scanners |
audit-performance | The product's runtime speed (Core Web Vitals, bundles, queries) |
workflow-environment-ready | Proving tools and verify commands work before a long run |
iterate-agent-harness | Turning an agent failure into a guard with a regression test |
Observe: total CPU 100% with 3 sessions. Per-process sampling:
ccusage×5 at 49%,wmiprvse8%,MsMpEng3%. Interpret: the status line runsccusage statuslineevery 10 s per session; each run re-reads ~10 GB of transcripts, and slow runs pile up. Classify: fix now. Remove the widget (back up the config first). Verify: noccusagespawned in 2 min; total 53–72% → later ~30% as agent jobs finished (report the workload change separately from the fix).
Windows (includes protected processes such as Defender):
$c = Get-Counter '\Process(*)\% Processor Time' -SampleInterval 5 -MaxSamples 1 -ErrorAction SilentlyContinue
$cores = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
$c.CounterSamples | Where-Object { $_.InstanceName -notin '_total','idle' -and $_.Status -eq 0 } |
Group-Object { $_.InstanceName -replace '#\d+#x27;,'' } |
ForEach-Object { [pscustomobject]@{ Name=$_.Name; Count=$_.Count; Cpu=[math]::Round((($_.Group | Measure-Object CookedValue -Sum).Sum)/$cores,1) } } |
Sort-Object Cpu -Descending | Select-Object -First 15
macOS / Linux: ps -eo pcpu,comm --sort=-pcpu | head -20 (macOS: ps -Ao pcpu,comm -r | head -20).
Take 3–4 samples over ~30 s. Avoid heavy Get-CimInstance Win32_Process
loops while measuring; they inflate wmiprvse themselves.
statusLine.refreshInterval adds timed runs on top; leave it unset
unless a widget needs a clock.ccusage statusline,
transcript-parsing HUDs) scale with transcript volume × sessions. Prefer
widgets that only read the JSON Claude Code passes on stdin (cost,
context window, rate limits). Keep ccusage as an on-demand CLI.gitCacheTtlSeconds ≥ 30).Inventory every hook in ~/.claude/settings.json and each repo's
.claude/settings.json, then time each one (echo '{}' | <command>).
PreToolUse with matcher *, PostToolUse on
Edit|Write) spawn a process per call. Narrow with matcher or the if
field (permission-rule syntax) so non-matching calls never spawn.lint-staged at
commit and rewrites files under the agent (forcing re-reads). Remove it when
pre-commit already runs eslint --fix.asyncRewake: true: background, skip-if-unchanged, wakes the agent only on a
new error set. Copy it to <repo>/.claude/hooks/ and pass the repo's
typecheck script name.async, asyncRewake, if)"pluginConfigs": { "agents-md@builtin": { "options": { "instructionFiles": "claude-md-and-agents-md" } } }
(ignored in project settings). Source: https://code.claude.com/docs/en/memory@imports load at launch and don't
save context. Run /doctor prompt-audit to find bloat..worktrees/)
make every Grep/Glob walk each copy and return duplicate hits. Add them to
.git/info/exclude (local, no commit) or .gitignore. Check:
git check-ignore -v .worktrees/x and compare rg --files | wc -l before and after.medium. A global
xhigh slows every routine turn. Suggest high (or the default) with
/effort xhigh for hard tasks. On Opus 5.5, changing effort keeps the prompt cache.Explore with model: haiku overrides it for fast, cheap searches./fast): up to 2.5× faster output at a higher per-token price,
billed from usage credits on subscriptions; enable at session start.Agents create worktrees faster than anyone removes them. Inventory with
git worktree list --porcelain per repo and classify:
HEAD and
logs/HEAD mtimes in the worktree's git dir, not index: git status
rewrites the index and makes every worktree look fresh.[gone] on the remote (squash merges).Report the counts and list; remove SAFE ones only on approval, with
git worktree remove (never --force).
node.exe, git.exe) skip scanning of
everything those processes write, so flag them as risk, not as a speed fix.
Source: https://learn.microsoft.com/en-us/windows/dev-drive/PreventIndexingCertainPaths policy key was observed to be ignored on
Windows 11 Home; verify any exclusion with a probe file.AWCC.SCSubAgent, ~8% CPU) scale with agent
process churn. Attribute wmiprvse load by enabling the
Microsoft-Windows-WMI-Activity/Trace channel for ~20 s (admin) and
grouping ClientProcessId. Killing the sub-agent doesn't stick if a
service respawns it; the fix is uninstalling the utility, which is the owner's call.Before reporting, fail the run if any of these are true:
| # | Finding | Measured | Fix | Status (fixed / ask / leave) |
Then a before/after CPU table, the list of changed files with backups, and what's left for the owner (admin prompts, committed config, preferences).