New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Configuration audit plugin that diagnoses broken registry, settings, hooks, and MCP servers in Claude Code.

version
1.24.9
GitHub stars
60
View on GitHub

What it does

  • Adds /health:check, /health:skill-audit, and the plugin-registry and settings-configuration reference skills for environment diagnosis
  • Covers orphaned projectPath entries, stale enabledPlugins keys, stack fit, agentic flags, and ~/.claude.json bloat in one pass
  • Runs config-drift.py and probe-delta.py to flag broken pointer stubs, duplicate rules, and stale review dates across the rules corpus
  • Designed for developers whose Claude Code install misbehaves and the broken layer is unknown

Diagnose and fix Claude Code configuration issues - plugin registry, settings, hooks, MCP servers

Add marketplace

/plugin marketplace add laurigates/claude-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install health-plugin@laurigates-claude-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

health-agentic-audit

The user-facing entry point is /health:check --scope=agentic, with --fix to apply changes; this skill is model-invoked only (user-invocable: false).

Scan all plugin skills, commands, and agents for CLI commands that would flood an agent's context: commands documented without compact, fail-fast, or machine-readable flags. Also reports skills whose reviewed date is stale.

Standards reference: .claude/rules/agentic-optimization.md, .claude/rules/skill-quality.md, and .claude/rules/context-engineering.md § Supersedes. The "Agentic Optimizations" table is optional under those rules: keep it only where the commands are the payload (CLI-wrapper skills). This audit never asks for one elsewhere and never inserts one.

When to Use This Skill

Use this skill when...Use another approach when...
Finding bare CLI commands in skill docsPlugin relevance to the project stack (/health:check --scope=stack)
Finding skills whose reviewed date is staleComprehensive environment check (use /health:check)
Quality-checking skill documentation in batchPlugin registry issues (/health:check --scope=registry)
Skill overlap or split pressure (use /health:skill-audit)

Context

  • Plugin root: !pwd
  • Skill files: !find . -path ./.claude/worktrees -prune -o \( -name 'SKILL.md' -o -name 'skill.md' \) -print
  • Agent files: !find . -path ./.claude/worktrees -prune -o -path '*/agents/*.md' -not -name 'README.md' -print

Parameters

ParameterDescription
--fixApply the single replacement flag that REFERENCE.md names for a bare CLI command, after confirmation, and update modified on each edited file. Never inserts tables or placeholder rows
--verboseShow all scanned files and detailed pattern matching results

Execution

Execute this agentic output audit:

Step 1: Discover all plugin content files

Use the Context file lists (worktrees are pruned; each agent worktree is a full repo clone). Classify each file by type (skill, command, agent) for the report.

Step 2: Scan for bare CLI commands missing compact flags

This is the audit's primary finding. Read the execution and context sections of every file and match the commands against the Bare CLI Command Patterns table in REFERENCE.md. A command is a finding when it lacks the compact, fail-fast, or machine-readable flag its row names.

Match only commands the reader is told to run: fenced shell blocks and !`…` context commands. Prose that quotes a command as an anti-pattern is not a finding. Context commands that read a whole file (cat <file>) go in the Context Section Issues list.

Step 3: Note CLI-wrapper skills without an Agentic Optimizations table (INFO)

A missing table is at most an INFO note, and only for a CLI-wrapper skill: one whose commands are the payload, meaning at least half of its fenced shell commands start with the same tool and that tool is named in the skill's name or description. Every other skill without a table passes this step silently. INFO notes never count towards the issue total and --fix never acts on them.

Step 4: Check reviewed dates for staleness

For each skill, read the reviewed field from the YAML frontmatter, using the extraction pattern in REFERENCE.md. reviewed records when the content was last verified against current docs; modified records the last edit and says nothing about review.

  1. Flag reviewed older than 90 days as a stale review
  2. Flag a missing reviewed field as never reviewed
  3. Leave modified out of this check

Step 5: Generate the audit report

Output the report template from REFERENCE.md:

  1. Bare CLI Commands: file, line, command, and suggested fix
  2. Context Section Issues: context commands using cat or verbose output
  3. Stale Reviews (>90 days): files with an old or missing reviewed date
  4. CLI-Wrapper Skills Without an Agentic Optimizations Table (INFO): Step 3's notes, if any
  5. Summary: counts of skills/commands/agents scanned and issues found (INFO notes listed separately)

If --verbose: also list all scanned files with their status (pass/fail per check).

Step 6: Apply fixes (if --fix)

When --fix is passed:

  1. Collect the Bare CLI Commands findings whose REFERENCE.md row gives a replacement in its --fix applies column and whose command is the last stage of its pipeline (no | after it, so a downstream parser still gets the format it expects). Every other finding stays report-only.
  2. Show the planned edits (file, line, old command, new command) and confirm them with AskUserQuestion before writing.
  3. Apply the confirmed edits and set modified to today's date in each edited file. Leave reviewed unchanged: a flag edit is not a review.
  4. Report which files changed and list the report-only findings for manual follow-up.

--fix changes no other content: no Agentic Optimizations tables, no placeholder rows, no date-only edits on files it did not otherwise change.

See Also

  • /health:check - Full diagnostic scan
  • health-plugin:health-audit - Plugin relevance audit (user path: /health:check --scope=stack)
  • .claude/rules/agentic-optimization.md - Optimization standards
  • .claude/rules/context-engineering.md - Why the Agentic Optimizations table is optional

Readme

health-plugin

Diagnose and fix Claude Code configuration issues including plugin registry, settings, hooks, and MCP servers.

Installation

/plugin install health-plugin@laurigates-claude-plugins

Skills

SkillDescription
/health:checkSingle entry point when the broken layer is unknown. Diagnose (and optionally fix) Claude Code environment, plugin registry, project-stack fit, and skill agentic-optimisation — routed by --scope.
/health:skill-auditSkill-overlap report for the plugin repo: skills that could answer the same request, split-pressure inside a SKILL.md, and merge candidates. Writes four reports to tmp/skill-audit/.
plugin-registryReference skill: Claude Code's plugin registry, install scopes, why a project can load an older plugin version than the rest of the machine, a capability declared in the marketplace but missing from the installed copy, and troubleshooting
settings-configurationReference skill: settings file hierarchy, permission wildcards, and patterns

Internal scopes (routed by /health:check --scope=...)

ScopeCoversInternal skill
registryOrphaned projectPath entries, stale enabledPlugins keys (addresses #14202)health-plugins
stackEnabled plugins vs project tech stackhealth-audit
agenticBare CLI commands missing compact/fail-fast/JSON flags; stale reviewed dateshealth-agentic-audit
runtime~/.claude.json bloat (dead projects/githubRepoPaths, orphaned MCP, legacy per-project history), history.jsonl growth, cleanupPeriodDays validity. Read-onlycheck-runtime.sh
usageNever-fired and dormant skills and plugin agents mined from session telemetry. Read-only, local-leaning (ADR-0018)check-usage.sh
allAll of the above (default)—

These internal skills are auto-discoverable but not user-invocable — use /health:check instead.

Scripts

ScriptDescription
prune-claude-config.pyRemove orphaned projects, cached data, and (opt-in) legacy per-project prompt history from ~/.claude.json
config-drift.pyAudit the rules/skills corpus itself for duplication, broken pointer stubs, review staleness, and always-loaded budget
probe-delta.pyReport only what is NEW since a probe's last run — reads any probe's --format=json on stdin against a recorded baseline
lib/probe.pyThe finding / waiver / delta contract both of the above share. Stdlib only, imported as from lib.probe import …

lib/probe.py — the shared contract

What a probe must agree with other probes about, and nothing else: the Finding shape, fingerprint (identity across runs), Waivers (pair and single-path, content-hash-keyed, self-expiring), Baseline/Delta, and the STATUS=/ISSUE_COUNT= renderers. Thresholds, the corpus walk and the check_* functions deliberately stay in config-drift.py — those are one probe's opinion, and a second probe adopting them would be adopting a bug rather than a contract.

Two properties are load-bearing and easy to break:

  • fingerprint folds a singular path into the path set. config-drift.py no longer emits path — every construction site passes paths=[...] — but probe-delta.py builds Findings from an arbitrary JSON document, so the singular spelling still arrives from outside this repo: a saved report, a baseline recorded before the normalisation, an older installed plugin. Read as "paths only", every such finding collapses to one fingerprint per kind and the second of them is invisible in every delta report forever. Folding both spellings is also what made the normalisation itself baseline-neutral.
  • Baseline records the root it was taken at. Fingerprints are built from absolute paths, so a baseline recorded at one root and compared at another yields a disjoint set — every finding new and every old one resolved. A root or schema mismatch loads as None, so the caller records a fresh baseline and stays silent.

probe-delta.py

config-drift.py --format=json | probe-delta.py --probe config-drift --root <abs> --record

First run records the baseline and says nothing. Later runs report only new findings; an empty or unparseable input is STATUS=ERROR TYPE=analyzer_failed, never a clean sweep.

--expect-baseline is for a scheduled caller that knows it is not on its first run, such as a workflow keeping the baseline in an evictable cache. There a missing or untrusted baseline is a loss: every finding is re-reported beside a TYPE=baseline_lost finding that names the cause (missing file vs. one recorded at another root or schema), FIRST_RUN=false BASELINE_LOST=true, and the baseline is re-recorded. Without the flag the same condition stays a silent first run, which would swallow whatever appeared while the baseline was gone.

config-drift.py

Answers a question the other health checks do not: is the configuration corpus self-consistent? It compares documents against each other and against the skill corpus, rather than validating any one file in isolation.

The corpus is four kinds — .claude/rules/*.md (plus ~/.claude/rules), */skills/*/SKILL.md, *-plugin/agents/*.md, and CLAUDE.md. All four share one document shape, and each check names the kinds it applies to explicitly:

CheckSeverityKindsCatches
broken_pointer_stubERRORruleA "Promoted to a skill: invoke x" rule whose target no longer exists
duplicate_rule_lexicalWARNruleByte-identical or near-identical rules across scopes
duplicate_agent_lexicalWARNagentTwo agent prompts that have converged
duplicate_claude_md_lexicalINFOclaude_mdTwo CLAUDE.md carrying the same guidance
agent_discovery_misfireERRORagent*-plugin/agents directories present but zero agent files — discovery is broken, not the tree clean
semantic_overlap_*WARNrule, skillDifferently-worded rules or skills covering one topic
rule_covered_by_skillINFOruleA resident rule whose content a skill already carries
promotion_candidateINFOrule, claude_mdThe same guidance at two scopes with no declared parent — a candidate for /agent-patterns:meta-promote. Semantic tier only
always_loaded_budgetWARNrule, claude_mdThe every-turn surface creeping past its ceiling
review_stalenessWARNall fourAn artifact's text changed after its declared reviewed: date. The last change is the oldest commit in the unbroken run whose copy of the file is identical to the newest one, following renames, so a pure move (R100) or a mode change does not re-date it
shallow_cloneWARNall fourDocuments review_staleness skipped because their last-change date is a shallow-clone boundary commit (the clone depth, not the history); unshallow the clone to evaluate them
frontmatter_coverageINFOruleRules with no reviewed: date, so staleness cannot be tracked. Stamp each with the date its text last changed (git log --follow), not the date of a bulk move. The stamping commit then becomes the rule's last change, so any date more than 120 days (STALE_DAYS) old trips review_staleness once that commit lands

duplicate_claude_md_lexical is INFO rather than WARN because a CLAUDE.md pair is very often duplication that is correct — a vendored clone and its upstream, or one package copied into two places — and the analyzer cannot tell that from a divergence. Two .claude/rules/ scopes, and two *-plugin/agents/*.md in one marketplace, are both live and both loaded, so duplication there really is drift.

promotion_candidate and the threshold that cannot do the job alone. T_PROMOTE = 0.88 sits below T_SEMANTIC = 0.91 because at 0.91 this root yields zero findings — shipping at the drift threshold would ship the verdict inert. But the score is not what makes it precise: the declared hierarchy (offload-to-deterministic-substrate at two scopes, 0.8994) outscores the genuine candidate (auto-mode ← claude-code-auto-mode, 0.8990) by 0.0004. No cut separates them; structural_pair does. Two further constraints carry more weight than the number — an ancestor test, because scope_rank is depth and would otherwise pair unrelated repos (69 → 22 pairs at ~/repos), and a 500-char floor, because near-empty redirect stubs score 0.88–0.98 against each other (22 → 12).

Known limitation: a hierarchy declared in a third document is invisible — structural_pair reads only the two documents in the pair. The six ForumViriumHelsinki/.github pairs are exactly this shape, declared in that workspace's own CLAUDE.md. Closing it needs a third-document signal with its own calibration. Run the expensive tier with just config-drift-semantic.

Agents are discovered through the same recursive pruned walk as every other kind (*-plugin/agents), not a depth-anchored glob: the SessionStart probe scans the session cwd, and a portfolio root sits one or two levels above where plugins live. AGENT_DIRS= is the denominator that makes AGENTS=0 legible — beside a nonzero AGENT_DIRS it is a misfire, beside AGENT_DIRS=0 it is a clean tree.

The lexical comparison is partitioned by kind — each kind is compared only against itself. A high Jaccard between an agent prompt and a rule is not a duplicate rule, and pooling costs 9x the partitioned run on this corpus. LEXICAL_PAIRS= in the status block reports how many pairs were compared, so the partition is assertable rather than implicit.

A CLAUDE.md holding generator template payload is excluded — it is content for a repo that does not exist yet, not configuration that loads anywhere. Two signals declare a template and are sufficient alone: an unrendered path component ({{cookiecutter.project_slug}}/), or a generator manifest (cargo-generate.toml / cookiecutter.json / copier.y{a,}ml / cruft.json) at a strict ancestor. Two more only suggest it and need each other: a template/templates path component, and either a manifest sitting beside the document or an npm create-* parent. A bare templates/ component is never enough on its own — a Flask or Django app/templates/ is a Jinja directory whose CLAUDE.md is live configuration. The root's own CLAUDE.md is never excluded. CLAUDE_MD_TEMPLATES_EXCLUDED= is emitted even at 0.

Two cost tiers, because a SessionStart probe cannot pay for a model:

config-drift.py --fast --no-embed --format=json    # 0.33s, pure stdlib, no git spawn
config-drift.py --format=report                    # + embeddings, scheduled use

--fast reads cached last-change dates only; the cache is keyed by content hash, never mtime, so it cannot go stale and cannot be invalidated by a checkout that rewrites timestamps.

Waivers. A finding judged not to be a defect is suppressed by a waiver that records the content hash of every file it vouches for, so it expires the moment one of them is edited. Without that, a recurring report re-lists its known-accepted findings until you stop reading it. --waivers defaults to the operator-local ~/.claude/config-drift-waivers.json; this repo's own corpus has a committed, reviewed file at health-plugin/config-drift-waivers.json, which just config-drift-semantic reads. Two entry forms share one file:

FormKeysSuppresses
paira, b, a_hash, b_hash, reasonevery pairwise kind over that pair: the lexical and semantic duplicates, rule_covered_by_skill, promotion_candidate
single-pathkind, path, hash, reasonthat one kind on that one file: review_staleness, broken_pointer_stub

A relative path resolves against --root, which is what makes the committed file mean the same thing on a CI runner; absolute and ~/ paths are unchanged. Seven kinds are aggregates or probe-health signals with no file to hash, and are declared unwaivable in WAIVER_EXEMPT_KINDS with their reasons.

Hashes are never written by hand. --format=waivers prints a draft entry, hash filled in, for every waivable finding the run reports (so against an existing file, exactly the new and revived findings); keep the entries you judge non-defects and write each reason. WAIVERS_ACTIVE / WAIVERS_MATCHED / WAIVERS_SKIPPED read together: MATCHED below ACTIVE means a waived file was edited or removed (in the cheap tier the semantic-pair waivers cannot match by construction), and SKIPPED counts malformed entries, each named on stderr.

Semantic threshold. The embedding pass is calibrated to cosine ≥ 0.91 with same-name and structural pairs excluded. This is not a default worth changing casually: at 0.86 on a real 884-document corpus it emitted 491 findings, of which 290 were same-name pairs the cheap tier already owns. Everything here is one genre of document, so baseline similarity is high.

Scheduled CI audit

.github/workflows/config-drift-audit.yml (Plugin: Config drift audit) runs the semantic tier over this repository's own corpus on Mondays and Thursdays and comments only what is new into one rolling issue labelled config-drift. No Claude model runs; the cost is Actions minutes. The decisions live in scripts/config-drift-audit.sh and are tested by scripts/tests/test-config-drift-audit.sh.

It complements the portfolio run tracked in #2319 rather than replacing it:

CI auditPortfolio run (#2319)
Corpusthis checkout: rules, skills, agents, CLAUDE.md in git~/repos and ~/.claude/rules, the fleet T_PROMOTE was calibrated on
Waiverscommitted health-plugin/config-drift-waivers.jsonoperator-local ~/.claude/config-drift-waivers.json
A finding isfixable by a PR to this repooften in another repo or in home config
  • State. The baseline and both caches share one actions/cache entry, saved under a fresh key each run and restored by prefix; the model has its own. An entry not read for 7 days is evicted, so a weekly schedule would lose the baseline whenever a run started late. That is why the audit runs twice a week.
  • First run vs. lost baseline. The first completed run records silently. After that, a missing baseline is a loss: probe-delta.py --expect-baseline re-reports every finding beside a baseline_lost row instead of re-recording in silence.
  • Exit codes. Analyzer exit 0 and 1 are completed runs, and so is exit 2 under --gate (next item). Any other code, or empty output, posts an error comment, fails the job, and leaves the baseline untouched. A run whose model failed to load is reported but does not roll the baseline forward.
  • Red state. The analyzer runs with --gate, so an error-severity finding (broken_pointer_stub, agent_discovery_misfire, coverage_metric_broken) makes it exit 2. That run still completes: the finding is commented once and recorded like any other. The job then fails on every run for as long as the finding persists, including the first run. Warn and info findings never fail the job; they only reach the rolling issue.
  • Control. Dispatch with plant_control: true to check the delta logic end to end. The run plants two unrelated rules one scope apart, injects a 0.95 similarity through --sim-fixture, and fails unless exactly that pair comes back as one new promotion_candidate.

Use Cases

Plugin Shows "Installed" But Doesn't Work

This is a known issue (#14202) where project-scoped plugins incorrectly appear as globally installed.

# Diagnose the issue
/health:check --scope=registry

# Fix automatically
/health:check --scope=registry --fix

Full Environment Health Check

# Run all diagnostics
/health:check

# With verbose output
/health:check --verbose

Audit Plugin Relevance

Ensure only relevant plugins are enabled for your project:

# See what plugins are relevant to this project
/health:check --scope=stack

# Preview changes without applying
/health:check --scope=stack --fix --dry-run

# Apply recommended changes
/health:check --scope=stack --fix

This analyzes your project's tech stack (package.json, Cargo.toml, Dockerfile, etc.) and recommends:

  • Removing plugins that don't apply (e.g., kubernetes-plugin if no K8s manifests)
  • Adding plugins that match detected technologies (e.g., container-plugin if Dockerfile exists)

Find Unused Skills (Usage Telemetry)

Surface skills you have enabled but rarely or never invoke, mined from local session transcripts (~/.claude/projects/*/*.jsonl):

# Never-fired + dormant (last invoked 30+ days ago) skills and plugin agents
/health:check --scope=usage

# List the offending skill/agent names, custom dormancy window
bash health-plugin/skills/health-check/scripts/check-usage.sh \
  --home-dir "$HOME" --project-dir "$(pwd)" --window-days 60 --verbose

Findings are advisory review candidates (a skill can be correct yet rarely needed), feeding skill-consolidation and description-quality reviews. The audit is read-only and local-leaning: it needs a long-running local install and emits STATUS=SKIP in a fresh/remote checkout where there is no history. See ADR-0018. "Enabled" means enabled in settings and installed for this project: the inventory comes from ~/.claude/plugins/installed_plugins.json and enabledPlugins, at each plugin's active version, so older cached versions and disabled plugins are not counted.

Permission Debugging

When tools are blocked unexpectedly, use the settings-configuration skill to understand:

  • Settings precedence (managed → --settings → project local → shared project → user)
  • Permission rules: the deny → ask → allow order and per-subcommand matching of compound commands
  • Permission modes, including which allow rules auto mode drops

Prune Config File

Clean up your ~/.claude.json by removing orphaned projects and cached data:

# Preview what would be removed
python health-plugin/scripts/prune-claude-config.py --dry-run

# Interactive mode (confirm before changes)
python health-plugin/scripts/prune-claude-config.py --interactive

# Run immediately (creates backup automatically)
python health-plugin/scripts/prune-claude-config.py

# Also drop legacy projects[*].history arrays
python health-plugin/scripts/prune-claude-config.py --drop-legacy-history

The script removes:

  • Orphaned projects: Entries for directories that no longer exist
  • Cached data: cachedChangelog, cachedStatsigGates, cachedDynamicConfigs
  • Legacy prompt history (--drop-legacy-history): per-project history arrays from releases that kept prompt history in ~/.claude.json

Your settings, MCP servers, and tips history are preserved. Close other Claude Code sessions first — they rewrite ~/.claude.json.

Prompt history now lives in ~/.claude/history.jsonl. The cleanupPeriodDays setting (default 30) prunes transcripts and other session data but not history.jsonl. For a project directory that no longer exists, claude purge <path> (v2.1.288+; earlier claude project purge) removes its config entry, transcripts, and history.jsonl lines in one step.

Quick Reference

Plugin Registry Location

~/.claude/plugins/installed_plugins.json

Settings File Locations

ScopePath
User~/.claude/settings.json
Project.claude/settings.json
Local.claude/settings.local.json

Common Issues

SymptomLikely CauseCommand
Plugin not workingWrong projectPath in registry/health:check --scope=registry --fix
A fixed bug still fires in one projectProject-scope install pinned below the user-scope version (scope_lag, from check-plugin-scope-lag.sh)/health:check, then the plugin-registry skill to repair the entry
Irrelevant plugins enabledNo relevance audit done/health:check --scope=stack --fix
Permission deniedMissing allow patternCheck settings-configuration skill
Settings ignoredInvalid JSON/health:check
Large ~/.claude.jsonOrphaned projects/caches, legacy per-project history/health:check --scope=runtime, then claude purge <path> or prune-claude-config.py
Large ~/.claude/history.jsonlNot pruned by cleanupPeriodDaysclaude purge <path> per dead project, or delete the file (loses up-arrow / Ctrl+R recall)

Related

  • Claude Code Issue #14202 - Project-scoped plugin bug
  • configure-plugin - Project infrastructure setup
  • hooks-plugin - Hook configuration and automation

Details

Marketplace
laurigates/claude-plugins
Source
health-plugin
Author
Lauri Gates
Category
Utilities
License
MIT
Keywords
health, diagnostics, troubleshooting, plugins, settings, hooks, mcp, configuration, fix, repair
Listed since
Apr 7, 2026

More from laurigates/claude-plugins

All 52

Similar to health-plugin

More Developer Tools