New GAP finding CA-GAP-028: authored subagents exist and not one of them names `model:` or `effort:`, so every delegated task runs on the main conversation's model (`model` defaults to `inherit`). Cites BP-MODEL-001/002, landed in C1. `whats-active` and `manifest` now carry `model`/`effort` per agent. Shipped as a conditional LEVER rather than a 25th dimension, and the choice was made by measurement: as a t3 dimension the agent-less marketplace-medium fixture would count it vacuously-present, moving the denominators 41->42 and utilization 44->45 — which flips `segment` "Developing"->"Competent" in the frozen v5.0.0 posture baseline, a field strip-retired-gap.mjs does not mask. A lever never enters those denominators. The general rule is now an invariant in CLAUDE.md. One check across both axes, not one per axis: it fires only when neither is used anywhere, so a deliberate everything-on-one-model policy stays silent. Cost is recall, chosen for precision. Found by dogfooding, fixed red-first: `model: inherit` is the documented default spelled out, so it must not count as routing — otherwise a config opts out of the opportunity without changing anything real. Two pre-existing defects surfaced and closed on the way: - The humanizer guard asserted TRANSLATIONS.GAP.static EQUALS the dimension titles, which forbade humanizing any lever — all three existing levers fell through to the generic "feature opportunity" default, wrong for a budget lever. Guard now requires coverage of every emittable title, seen red against those three before the entries were written. - Two hand-written copies of the lever list (finding-codes guard, humanizer guard) merged into one exported LEVERS registry carrying code AND title. - suppression-validation pinned CA-GAP-028 as an unoccupied number; C4 claimed it. Fixed structurally with a derived first-free id, not by picking a new literal — same class as #60's "bump this again". Suite 1596/0. Frozen v5.0.0 snapshots untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq3nye21RVYk4pZLeT8pGz
192 lines
7.7 KiB
Markdown
192 lines
7.7 KiB
Markdown
---
|
|
name: config-audit:whats-active
|
|
description: Show which plugins, skills, MCP servers, hooks, and CLAUDE.md files are active for a repo — with token estimates
|
|
argument-hint: "[path] [--json] [--verbose] [--suggest-disables]"
|
|
allowed-tools: Read, Glob, Bash
|
|
model: sonnet
|
|
---
|
|
|
|
# Config-Audit: What's Active
|
|
|
|
Show a complete, read-only inventory of everything Claude Code loads for a given repo — plugins, skills, MCP servers, hooks, CLAUDE.md cascade — with source attribution and rough token estimates. Helps identify candidates for disabling without guessing.
|
|
|
|
## UX Rules (MANDATORY — from `.claude/rules/ux-rules.md`)
|
|
|
|
1. **Never show raw JSON or stderr output.** Always use `--output-file` + `2>/dev/null`.
|
|
2. **Narrate before acting.** Tell the user what you're about to do.
|
|
3. **Read, don't dump.** Read the JSON file and render formatted tables.
|
|
4. **End with context-sensitive next steps.**
|
|
|
|
## Implementation
|
|
|
|
### Step 1: Parse `$ARGUMENTS`
|
|
|
|
Split `$ARGUMENTS` into a path and flags. Path is the first non-flag argument. Default to `.` (current working directory). Recognized flags:
|
|
|
|
- `--json` — emit raw JSON instead of rendered tables (power-user mode)
|
|
- `--raw` — pass-through to the scanner; accepted for CLI surface consistency. `whats-active` is an inventory-only output (no findings prose), so `--raw` is a no-op here, but the flag is still threaded through for uniform behaviour across the toolchain.
|
|
- `--verbose` — include per-file byte/line detail
|
|
- `--suggest-disables` — append deterministic disable-candidates + LLM-judgment pass
|
|
|
|
### Step 2: Run the CLI silently
|
|
|
|
Tell the user: **"Reading active configuration for `<path>`..."**
|
|
|
|
```bash
|
|
RAW_FLAG=""
|
|
if echo "$ARGUMENTS" | grep -q -- "--raw"; then RAW_FLAG="--raw"; fi
|
|
# Set each to the flag itself when the user asked for it, otherwise leave empty.
|
|
# A placeholder in square brackets does not start with a dash, so the scanner's
|
|
# arg loop would take it as the TARGET PATH instead of a flag.
|
|
VERBOSE_FLAG="" # --verbose
|
|
SUGGEST_FLAG="" # --suggest-disables
|
|
node ${CLAUDE_PLUGIN_ROOT}/scanners/whats-active.mjs "<path>" --output-file /tmp/config-audit-whats-active.json $VERBOSE_FLAG $SUGGEST_FLAG $RAW_FLAG >/dev/null 2>/dev/null; echo $?
|
|
```
|
|
|
|
**Exit code handling:**
|
|
- `0` → continue
|
|
- `3` → tell user: "Couldn't read configuration. Check that the path exists and is a directory." Stop.
|
|
|
|
### Step 3: If `--json` was requested, cat the file and stop
|
|
|
|
```bash
|
|
cat /tmp/config-audit-whats-active.json
|
|
```
|
|
|
|
Do NOT render tables in JSON mode.
|
|
|
|
### Step 4: Read JSON and render
|
|
|
|
Use the Read tool on `/tmp/config-audit-whats-active.json`. Extract:
|
|
|
|
- `meta.repoPath`, `meta.durationMs`, `meta.gitRoot`, `meta.projectKey`
|
|
- `totals.estimatedTokens.grandTotal` (and subtotals)
|
|
- `claudeMd.files[]` — render cascade table
|
|
- `plugins[]` — render plugin table
|
|
- `skills[]` — render skills table
|
|
- `mcpServers[]` — render MCP table (disabled shown italic)
|
|
- `hooks[]` — render hooks table
|
|
|
|
Render as markdown:
|
|
|
|
```markdown
|
|
**Active configuration for `<repoPath>`** — ~{grandTotal} tokens loaded at startup
|
|
|
|
{if gitRoot != repoPath: "Git root: `<gitRoot>`"}
|
|
{if projectKey: "`.claude.json` project slice: `<projectKey>`"}
|
|
|
|
### CLAUDE.md cascade ({claudeMd.files.length} files, ~{claudeMd.estimatedTokens} tokens)
|
|
|
|
| Scope | Path | Bytes | Lines |
|
|
|-------|------|-------|-------|
|
|
| {scope} | `<path>` | {bytes} | {lines} |
|
|
| ... | ... | ... | ... |
|
|
|
|
### Plugins ({plugins.length}, ~{plugins subtotal} tokens)
|
|
|
|
| Plugin | Version | Commands | Agents | Skills | Hooks | Rules | Tokens |
|
|
|--------|---------|----------|--------|--------|-------|-------|--------|
|
|
| {name} | {version} | {commands} | {agents} | {skills} | {hooks} | {rules} | ~{estimatedTokens} |
|
|
|
|
### Skills ({skills.length}, ~{skills subtotal} tokens)
|
|
|
|
| Skill | Source | Tokens |
|
|
|-------|--------|--------|
|
|
| {name} | {source}{if pluginName: ` (${pluginName})`} | ~{estimatedTokens} |
|
|
|
|
### Agents ({agents.length}, ~{agents subtotal} tokens)
|
|
|
|
| Agent | Source | Model | Effort | Tokens |
|
|
|-------|--------|-------|--------|--------|
|
|
| {name} | {source}{if pluginName: ` (${pluginName})`} | {model or "inherit"} | {effort or "session default"} | ~{estimatedTokens} |
|
|
|
|
Skip this section entirely when `agents` is empty. `model: null` is rendered as
|
|
*inherit* and `effort: null` as *session default* — both are the documented
|
|
defaults, so a blank cell would read as missing data rather than as the choice
|
|
it is. If no agent pins either column, say so in one sentence: every delegated
|
|
task then costs what the session costs.
|
|
|
|
| Server | Source | Status | Command |
|
|
|--------|--------|--------|---------|
|
|
| {name} | {source} | {enabled ? "enabled" : "*disabled*"} | `{command}` |
|
|
|
|
### Hooks ({hooks.length}, ~{hooks subtotal} tokens)
|
|
|
|
| Event | Matcher | Source |
|
|
|-------|---------|--------|
|
|
| {event} | {matcher or "-"} | {source} |
|
|
|
|
### Settings cascade
|
|
|
|
| Scope | Path | Keys |
|
|
|-------|------|------|
|
|
| user | `<path>` | {keyCount} |
|
|
| project | `<path>` | {keyCount} |
|
|
| local | `<path>` | {keyCount or "(missing)"} |
|
|
|
|
### Totals
|
|
|
|
| Category | Items | Estimated tokens |
|
|
|----------|-------|------------------|
|
|
| CLAUDE.md | {claudeMdFiles} | ~{claudeMd} |
|
|
| Plugins | {plugins} | ~{plugins} |
|
|
| Skills | {skills} | ~{skills} |
|
|
| MCP servers | {mcpServers} | ~{mcpServers} |
|
|
| Hooks | {hooks} | ~{hooks} |
|
|
| **Grand total** | — | **~{grandTotal}** |
|
|
|
|
_Estimates assume ~4 chars/token (Claude ballpark). Real token count varies ±15%._
|
|
```
|
|
|
|
### Step 5: If `--verbose`, add per-file detail
|
|
|
|
For each CLAUDE.md file, skill, and plugin, include a nested "Details" list with bytes, lines, and full path.
|
|
|
|
### Step 6: If `--suggest-disables`, show candidates
|
|
|
|
First show deterministic signals from `suggestDisables.candidates[]`:
|
|
|
|
```markdown
|
|
### Disable candidates (deterministic)
|
|
|
|
| Kind | Name | Reason | Confidence |
|
|
|------|------|--------|------------|
|
|
| {kind} | {name} | {reason} | {confidence} |
|
|
```
|
|
|
|
Then run LLM judgment — check `git log --oneline -20` and project manifests (package.json/Cargo.toml/etc.) to propose up to **3** additional candidates. For each candidate, you MUST:
|
|
1. Name the specific redundancy
|
|
2. Name the signal the user should check to confirm
|
|
|
|
Do NOT suggest items you can't name concrete redundancy for. If you can't find 3 strong candidates, return fewer or zero.
|
|
|
|
### Step 7: Cleanup and next steps
|
|
|
|
```bash
|
|
rm -f /tmp/config-audit-whats-active.json
|
|
```
|
|
|
|
```markdown
|
|
### What's next
|
|
|
|
- **`/config-audit posture`** — check configuration health (A-F grades per area)
|
|
- **`/config-audit feature-gap`** — context-aware recommendations for features you aren't using
|
|
- **Disable a plugin:** edit `~/.claude/settings.json` → `enabledPlugins` (remove the entry)
|
|
- **Disable an MCP server:** edit `~/.claude.json` → `projects.<path>.disabledMcpjsonServers`
|
|
- **Re-run with flags:** `/config-audit whats-active --verbose` (details) or `--suggest-disables` (pruning help)
|
|
```
|
|
|
|
## Scope and limits
|
|
|
|
- **Read-only.** This command never writes to configuration files — no mkdir, no edits, no deletes.
|
|
- **Single repo.** Scans one repo path per invocation. Cross-repo rollups are out of scope.
|
|
- **Ballpark token counts.** Estimates are deterministic but not calibrated against Claude's tokenizer. Use them to compare categories, not to predict exact billing.
|
|
- **No runtime queries.** We inspect config files only — we do not connect to MCP servers or invoke hooks.
|
|
|
|
## Error handling
|
|
|
|
| Condition | Action |
|
|
|-----------|--------|
|
|
| Exit code 3 | Tell user path is invalid, suggest checking path exists |
|
|
| JSON parse fails (shouldn't happen — CLI writes valid JSON) | Tell user to re-run, mention this as a bug to report |
|
|
| No plugins, no CLAUDE.md, no hooks found | Still render with zeroes; suggest `/config-audit feature-gap` for setup help |
|