host-optimize

host-optimize is a command for Claude Code from rjwalters/kicad-tools. It costs 34 tokens per session (5,590 once invoked), scanned B, original, MIT.

A command for checking and preparing a Mac or Linux computer used for heavy software builds and coding-agent work. It examines system settings, background services, and wasted build files, then separates safe fixes from changes needing approval.

In plain words
What is it for?
Auditing Gatekeeper, backup, developer-tool, and build-directory interference; applying safe preparation steps; and reporting consequential or manual system changes.
Why use it?
It helps identify host-level slowdowns and resource contention that cannot be found by checking a project repository alone.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rjwalters/kicad-tools/host-optimize
Clone the repo
git clone --depth 1 https://github.com/rjwalters/kicad-tools

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for host-optimize

README.md
[![agentmods](https://agentmods.dev/badge/commands/rjwalters/kicad-tools/host-optimize.svg)](https://agentmods.dev/commands/rjwalters/kicad-tools/host-optimize)
Your own site
<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/host-optimize"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/host-optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,590 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.05590
Opus 5 $0.00017 $0.02795
Sonnet 5 $0.00007 $0.01118
Haiku 4.5 $0.00003 $0.00559

Measured 4d ago against content hash bbf2496d9c65, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

host-optimize scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

— build-tree bloat, Loom concurrency vs core count, sudo posture, cache infra,

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Recursive force deletemediumDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

`.loom/worktrees/` whose worktree git no longer lists, `rm -rf` it (these are

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.claude/commands/repo/host-optimize.md · 460 lines

How it starts

The opening of the file, as written. The whole thing — 460 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/repo:host-optimize — Prepare a Build Host

Audit the host a machine presents to heavy Loom/agent build workloads, then apply the safe fixes and gate the consequential ones. This is host preparation, not repo hygiene: nothing here is discoverable from inside a repo, and none of it is fixed by [[tidy]] or [[audit]]. It exists because a Mac Studio running six concurrent release-build worktrees melted down — load average 118, VNC unusable, a multi-hour remediation — and every root cause was host configuration: syspolicyd burning 14+ CPU-hours a day re-scanning target/ trees on every Gatekeeper cache miss, a backup agent churning build dirs at 98% CPU, no passwordless sudo, an empty Developer Tools exemption list, and ~10 GB of dead worktree target/ dirs the scanner kept re-walking.

Follows the pack's inventory → categorize by consequence → report → apply shape (the same shape as [[tidy]] and [[branches]]). Audit checks are always report-only and safe. Fixes are split into three consequence tiers: safe / default-on, confirm-first, and documented-but-manual (printed only, never executed).

macOS-first, Linux-aware. The Gatekeeper / SIP / Spotlight / Time Machine material is macOS-only and is gated behind a uname check. The portable subset — build-tree bloat, Loom concurrency vs core count, sudo posture, cache infra, remote access — still runs and reports on Linux.

Usage

/repo:host-optimize            # Audit, apply safe fixes, report; confirm-first items prompt
/repo:host-optimize --ask      # Review every finding and confirm before applying anything
/repo:host-optimize --audit    # Audit and report only — apply nothing (like /repo:audit)

(--apply is accepted as a synonym for the default, for muscle memory. On a non-macOS host the macOS-only checks are skipped with a one-line note and the portable subset runs unchanged.)

Hard constraints (read before implementing)

  1. The two SIP-gated / global items — the ExecPolicy DB trim and spctl --global-disable — are PRINT-ONLY. Never shell out to perform either. The ExecPolicy trim is SIP-gated (Recovery-mode only) and spctl --global-disable disables Gatekeeper machine-wide; both are printed as a recipe for a human to run deliberately. This is a hard constraint, not a nice-to-have — it is the highest-consequence part of the command.
  2. Never write to /etc/sudoers.d/. The sudo-posture check only detects whether a passwordless drop-in exists and delegates to /repo:sudo (issue #49) or prints the manual visudo-validated recipe. It does not itself install a sudoers drop-in.
  3. Everything applied must have appeared in the report first, and re-running after a clean pass must report a no-op (idempotency) rather than re-applying or erroring.

Read the full file on GitHub · 460 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 460 lines · 34 tokens per session scan B bbf2496d9c65

Subscribe to this mod's changes

host-optimize is a command published in the GitHub repository rjwalters/kicad-tools (53 stars, last pushed today), licensed MIT. It adds 34 tokens to every session and 5,590 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.