Setup

From melodic-software/claude-code-plugins · View interactive version

Setup is an AI agent skill from the GitHub repository melodic-software/claude-code-plugins. Verify the disk-hygiene plugin's runtime prerequisites and platform posture for this machine. Use when: 'set up disk-hygiene', 'configure disk-hygiene', 'is disk-hygiene working', a clean run reported a missing prerequisite, or before a first audit on a new machine. Actions: check (read-only verific

How to use this skill

Skill file

Purpose

Thin check-centric setup per the uniform setup contract (docs/plugin-philosophy.md

"Setup is explicit and repeatable" in the marketplace repository): check inspects and

reports, apply resolves. Targets and modes arrive as /disk-hygiene:clean arguments. The

tunables are two userConfig options, the disk_hygiene_enabled toggle and policy_file,

plus the standing policy layers. apply writes only when it moves an old policy file (step 7),

and only after a yes; the old file is then removed only through /disk-hygiene:clean's gated

apply.

Action routing: no argument or check runs the check; apply runs the check first, then

points at each remediation. Neither prompts, except for the yes apply asks before step 7

moves a file and the clean skill's own confirmation before it removes the old one.

`check` (read-only)

The clean skill and its bundled scripts (${CLAUDE_PLUGIN_ROOT}/skills/clean/) are the

single source of truth for what the plugin requires per platform.

Read it first. Probe what it actually does, don't recite this file. Then run each probe via

Bash and report a PASS/FAIL/INFO table with one remediation line per FAIL. Do not modify anything.

Read engine files (hygiene.py and the other scripts under skills/clean/scripts/) with the

Read or Grep tool, or with the one plain reader command step 2 names, run alone with its

absolute path. Never name an engine file inside a compound shell line: no cd, variable

assignment, $ expansion, ; or && chain around it. The plugin's own guard denies such a

line as "not one plain literal invocation"; it lets a line through only when every command in

it is a reader it lists (destructive_guard.py _bash_reads_only).

The toggle is an audit-only kill switch, not a short-circuit: the guard registers

unconditionally and still scans with the toggle off, so most prerequisite absences keep their

FAIL semantics regardless of the toggle. Only the execution-tier tools the audit lane never

invokes (step 4's lsof-class probes) downgrade from FAIL to INFO when the toggle is

disabled, report those informationally and note that re-enabling restores the FAIL semantics.

A missing git keeps its step-3 verdict either way: the audit lane itself calls it, and its absence degrades the VCS-tracked-content evidence the plugin's fail-closed posture depends on.

Every step-1 and step-2 failure likewise stays FAIL with the toggle disabled.

Audit-only mode is enforced by the guard, every guard surface

depends on a Python 3 interpreter resolving (every surface through

hooks/run-python-hook.sh, which tries python3, then python, then py -3), and a

guard that never runs can neither read nor enforce the configured false, so the fail-open

is most dangerous in exactly this

configuration. That covers an exhausted interpreter ladder, every rung absent, a stub, or

indeterminate, a rung whose version probe then fails to launch at all (a corrupt or

zero-length binary outside WindowsApps, a broken shim, a permission error), and an

interpreter that starts but reports a version below the parsed floor. It does not cover a

stubbed python3 alongside a working python or py -3: the launcher skips the stub, every

guard launches, and that is a WARN (see step 2), not a failure to downgrade.

Launching the version probe proves only that something executes, not that it can run

the guard's own source: Python 3.6, for example, rejects the guard's

from __future__ import annotations and exits without a deny, which this plugin treats as the

same fail-open (what such an exit does to the call: Other exit codes). Unproven guard execution

fails closed like every other guard-relevant unknown in this plugin.

  1. Node exec-form launcher registration. All three registrations (both wired hooks in

hooks/hooks.json and the skill-scoped belt in skills/clean/SKILL.md frontmatter) must set

command to node and put hooks/exec-bash.mjs, then hooks/run-python-hook.sh and that

script's arguments, in args. node resolves to node.exe. FAIL if command is bare bash,

sh, or python3, or if the script path is command with no args: on Windows bare bash is

the WSL relay and a .sh path is not a spawnable executable, so the guard cannot start; this

plugin treats a guard that cannot start as enforcing nothing (what a failed launch does to the

call: the pointer below). Also FAIL if

exec-bash.mjs or the launcher is missing.

does to the call, fetch Exec form and shell form

and Block the action when a hook fails

live.

node and bash, probed with the Bash tool, not through the launcher. FAIL if

command -v node finds nothing: every guard and detector row runs node, so none launches and no guard

is enforced. FAIL if no bash resolves in the launcher's own order, which the header comment of

${CLAUDE_PLUGIN_ROOT}/hooks/exec-bash.mjs lists per platform (read it; do not recite it). On

Windows the remediation is either CLAUDE_CODE_GIT_BASH_PATH, a Git for Windows install, or a

bash.exe on PATH outside System32, Sysnative and WindowsApps; elsewhere, a bash on

PATH. Both FAILs stay FAIL with the toggle disabled, like the interpreter ladder. State the

consequence in the remediation: the hook fails to launch, the guard is not enforced, and the call

proceeds; what the user and the model see then is in the Other exit codes record below. A missing node cannot be

reported by the launcher or the Stop detector, which both need node to start. node on

PATH is a prerequisite separate from Claude Code itself.

Install with npm live; for the

failed-launch notice, Other exit codes.

  1. Python floor on PATH. The interpreter used by scanning, validation, the

guard, and cleanup. (The guard registers on two surfaces: a plugin-level engine gate

that acts only on engine-referencing commands, and the skill-frontmatter belt /disk-hygiene:clean

arms (the clean skill's safety model holds how long the plugin counts on it; for how long a skill

hook stays registered, fetch Hooks in skills and agents

live). Both register unconditionally and resolve the kill switch by

reading disk_hygiene_enabled from managed settings first, then the user settings.json.) The required version has one origin: the MIN_PYTHON

constant in ${CLAUDE_PLUGIN_ROOT}/skills/clean/scripts/hygiene.py, parse it from

there with the Grep tool or this one command, alone on its line:

grep -m1 '^MIN_PYTHON' ${CLAUDE_PLUGIN_ROOT}/skills/clean/scripts/hygiene.py. Probe the

interpreter against that value in a separate call; do not

recite a version number from this file or the README. FAIL if absent or older, naming

the parsed floor in the remediation; the plugin never downloads a runtime. Report the

absolute interpreter path (guarded engine calls must use the same absolute interpreter

the guard reports. Bash aliases and functions cannot substitute).

On Windows, confirm the name the guard resolves is real before anything executes it,

including this floor check's own version probe. python3 is the first rung of the ladder

hooks/run-python-hook.sh walks for every guard surface, and on Windows that name can resolve

to an App Execution Alias stub rather than an interpreter, so setup never executes it

unclassified. The stub does not stop any guard by itself: the launcher skips it

and falls through to python, then py -3.

Using Python on Windows: Troubleshooting

live.

**The ladder, not the first

rung, is the verdict.** A host with real Python installed without "Add to PATH" but with the

py launcher has a stubbed python3 and a perfectly working guard; failing it would report a

healthy install as broken and send the operator to reinstall Python. So the alias probe is

diagnostic input. It says what the first rung is, and keeps setup from executing it,

while the verdict comes from resolving the ladder and checking the selected interpreter

against the parsed floor.

Order of operations: (a) locate the resolution without executing it (Get-Command python3

/ command -v python3, locating is inspection; running is not); (b) classify it with the

bundled inspect-only probe, launched via an interpreter that is not the bare name

python3 (py -3, python, or an absolute interpreter path, any interpreter already

proven real):

"<python>" "${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/python3_alias_probe.py"; if no

such interpreter exists or the one you chose emits no JSON verdict, apply the probe's own

portable signal directly in PowerShell. Proven real is not the same as able to run the probe:

a pre-3.7 interpreter rejects its from __future__ import annotations and a legacy python

2.x fails earlier still, each before anything is classified, so a machine whose only

alternate launcher is Python 3.6 reaches the verdict through PowerShell, not by having no

launcher at all. The signal: a zero-length file under a WindowsApps path component is the stub

((Get-Item -Force (Get-Command python3).Source) → Length 0 plus a ReparsePoint

attribute); (c) resolve the ladder in the launcher's own order, skipping any rung the probe

classified as a stub: python3 only when its verdict is ok, then python, then py -3.

The version probe may execute a rung only once that rung is not a stub, that is the whole

point of (b), and it is why the bare name python3 is never executed on a

store-alias-stub verdict. Report the absolute path of the first rung that runs and meets

the floor.

FAIL when the ladder is exhausted or below the floor. No rung resolves, or the one that

does reports a version under the parsed MIN_PYTHON. That is the real fail-open: the guard

cannot run, and it emits neither exit 2 nor a deny. Distinguish the two for the remediation

wording, an interpreter that starts and reports a version below the floor is a floor miss

(name the parsed floor), one that fails to launch at all is an absent-interpreter failure

(the plugin never downloads a runtime). Both keep the FAIL under a disabled toggle: a

below-floor interpreter is not proven able to execute the guard's source, so audit-only mode

is unenforceable there too. indeterminate on every rung is the same case, identity the

probe could not read anywhere on the ladder is uncertainty about whether the guard can launch

at all, and fails closed like every other guard-relevant unknown in this plugin.

**PASS with a WARN when the ladder resolves a supported interpreter but python3 is the

stub.** Every guard launches, so nothing is failing open. State the residual plainly: the

operator's own bare python3 still reaches the stub, and guarded engine calls must use the

absolute interpreter path reported above rather than that name. Offer clearing the stub as an

optional tidy-up, not as a fix for a broken install: clear the stub (the pointer above has the

steps) or put real Python ahead of WindowsApps on PATH. A bare command -v python3 success is not evidence on its own.

  1. Git. command -v git. Conditional per the README: optional for ordinary trees,

required when a target contains or sits inside a Git worktree. Report presence as INFO

with that conditionality stated; absence is only a FAIL for worktree-containing targets.

  1. Platform posture. Detect the current OS family and report its documented lane per

the README, keeping the audit and execution lanes visibly separate: Windows (full

audit: lstat reparse + Win32, never UAC; engine execution unsupported.

preview reports execution-platform-unsupported as a per-candidate blocker, removal is

a manual, per-path Recycle-Bin handoff only after an execution request and explicit

approval), Linux (full audit; execution when

/proc/self/mountinfo is readable, lsof needed only for that optional execution

lane, absent lsof is INFO with the reduced-capability note), macOS (audit/report

only by design; manual Trash handoff only after an execution request and explicit approval. INFO, not a defect).

  1. Execution kill switch. Resolve the effective disk_hygiene_enabled value

deterministically; never present an assumed value as the configured one. Run the bundled

probe with the step-2 interpreter:

"<python>" "${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/kill_switch_probe.py"

and report its effective value together with its source (configured vs default).

When the probe says degraded: true, report that the configured value could not be read

and that default true is being assumed, an assumption, never the configured value. The

body token ${user_config.disk_hygiene_enabled} is at most a cross-check: if it expanded

to a boolean that contradicts the probe, report the discrepancy instead of silently

preferring either channel (the probe sees user settings only; managed settings or a

--settings flag can carry a value the probe cannot see).

  1. Plugin registration. INFO: confirm the plugin is enabled for this project

with claude plugin list rather than parsing settings files; read its output fields in

plugin list.

  1. Old policy files. Run the read-only migration check with the step-2 interpreter, adding

--user-policy "<path>" only when ${user_config.policy_file} reads as a path:

"<python>" "${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/policy_migration.py" check --project-dir "${CLAUDE_PROJECT_DIR}".

WARN for each file it lists: ~/.claude/disk-hygiene.json and

<project>/.claude/disk-hygiene.json are old locations. The clean engine still reads each

one while no new file supplies its layer, and warns on every scan. Name the old file and the

new file it moves to. A row with new_exists: true is not moved again: verify clears the

old file for removal when the new one resolves the same, and otherwise the user merges it by

hand and reruns apply. No row is a PASS.

`apply` (idempotent)

Run check, then for each FAIL point at the resolution. Every prerequisite is a system

tool or an OS capability, so apply installs nothing and writes nothing, it only points:

the engine's MIN_PYTHON; never a plugin download.

or Git for Windows, or on Windows CLAUDE_CODE_GIT_BASH_PATH naming an existing bash.exe.

interactively with /plugin configure disk-hygiene@<marketplace> or by a headless route, as the

marketplace's plugin-reconfiguration convention gives them in

§ The routes

(it owns the verified-version record). Apply the scope and failure-signal caveats in its

§ Caveats every setup skill's short form carries.

Read both sections and print what they give, the fallback route, its behavior on an

already-installed plugin and the scope to pass included, rather than only naming them, and

leave out the verified-version record.

Never uninstall to reconfigure; that section links what an uninstall deletes. This skill never

writes user settings or pluginConfigs. Afterwards rerun check in a fresh session, since a

same-session check can still show the old value, and report the observed effective value,

never an unobserved change.

when a saved value applies, fetch

plugin CLI reference § plugin configure

live.

with its new_resolved path, and whether policy_file gets set) and ask one yes for the set. A

project row through a symlink or resolving outside the project is already refused. Without a yes, write nothing.

With it, in order:

1. "<python>" "${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/policy_migration.py" move --yes --project-dir "${CLAUDE_PROJECT_DIR}",

with the same --user-policy as the check. It writes each new file (the user file

copied as it is, the project file as YAML) and leaves the old files in place. Done when

each row's result reads written or refused: ....

2. When a row has set_option: true, set policy_file to that row's new path through the

headless route in the plugin-reconfiguration convention (above), and print what it reports.

Done when the command reports the value saved; on a refusal, stop before step 3.

3. "<python>" "${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/policy_migration.py" verify --project-dir "${CLAUDE_PROJECT_DIR}" --user-policy "<new user path>".

Read-only: it checks that each new file resolves the same policy as its old file. Done when

every row's result reads verified or refused: ....

4. For each verified row, remove its old file through the clean skill's gated apply lane, never

with rm or this script: run /disk-hygiene:clean --execute --max-depth 1 "<remove.target>"

and plan only remove.path in tier high, citing the verify row (the new file resolves the

same policy) as its evidence. The clean skill's preview and its apply confirmation are this

removal's yes; a declined confirmation keeps the old file. Done when the clean run's report

lists remove.path as removed, or the user declined.

Report each row's result and each removal. A refused or kept row keeps its old file, and the

engine keeps reading it.

Re-running apply after everything passes changes nothing and reports "already configured".

What this skill does not do

is set only through Claude Code's own configure route.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.