Skip to content
Back to skills

Audit

ASecurity

Audit Claude Code instruction/memory files (CLAUDE.md, root AGENTS.md, CLAUDE.local.md, .claude/rules/, auto-memory) against official-docs checks; actions: audit (default), fix, update, report. Use when: 'audit CLAUDE.md', 'audit AGENTS.md', 'memory health', or pruning rules. Not for config/hooks: /harness-config:audit.

  • 34 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 2, 2026
ai-agentsgoshellbashgitdocumentation

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add melodic-software/claude-code-plugins --skill audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/melodic-software-audit-7b2a44d9/badge)](https://www.skillsdirectory.com/skills/melodic-software-audit-7b2a44d9)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: "Audit Claude Code instruction/memory files (CLAUDE.md, root AGENTS.md, CLAUDE.local.md, .claude/rules/, auto-memory) against official-docs checks; actions: audit (default), fix, update, report. Use when: 'audit CLAUDE.md', 'audit AGENTS.md', 'memory health', or pruning rules. Not for config/hooks: /harness-config:audit."
argument-hint: "[audit|fix|update|report] [--repo <repo> ...]"
user-invocable: true
disable-model-invocation: false
shell: bash
metadata:
  workflow-stage: anytime
  summary: Audit CLAUDE.md, a root AGENTS.md, rules, and auto-memory against the official-docs checklist
---

# Memory Health

**Arguments.** `[audit|fix|update|report] [--repo <repo> ...]`. Default: audit, on this project

## Pre-computed context

The deterministic spine, one invocation, header then findings. The root-file line count has
`@` imports expanded, since imported files load at launch; the token figure is bytes / 4 over the
whole always-loaded set and is an estimate, not a measurement.

!`bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/audit-spine.sh" 2>/dev/null || echo "Deterministic spine: unavailable (audit-spine.sh failed to run; run the per-check scripts by hand)"`

Deterministic health check for the Claude Code instruction/memory layer. Audits files you write that
shape Claude's behavior, not the entire context window (MCP tools, agents, and skills are covered by
the `audit` and `audit-automation-gaps` skills in the `harness-config` plugin).

## Scope

| Entity | Location | Load model this audit uses | Audited here |
|--------|----------|--------|-------------|
| Project instructions | `CLAUDE.md` | Every session, full | Yes |
| Project instructions in `AGENTS.md` | `AGENTS.md` and `.claude/AGENTS.md` at the root | Audited only where discovery reports Claude Code reads it; the condition and its record are in [official-guidance.md](reference/official-guidance.md#compaction-by-steering-method) | Yes, as the project instructions (the C-checks) |
| Local overrides | `CLAUDE.local.md` | Every session, full | Yes |
| Rules | `.claude/rules/**/*.md` | Every session (unconditional) or on-demand (path-scoped) | Yes |
| **User instructions** | `${CLAUDE_CONFIG_DIR:-~/.claude}/CLAUDE.md` | Every session, full, in **every** project | Yes |
| **User rules** | `${CLAUDE_CONFIG_DIR:-~/.claude}/rules/**/*.md` | Same as project rules, in every project | Yes |
| Auto-memory | `${CLAUDE_CONFIG_DIR:-~/.claude}/projects/<project>/memory/` | The start of MEMORY.md, up to the M1 gate's firing values | Yes |
| Nested `AGENTS.md` | `**/AGENTS.md` below the root | Reachable unless a `CLAUDE.md`-family file on its path displaces it without importing or symlinking it (N1) | Reachability only (N1); content is not audited |
| Settings, hooks, MCP, agents, skills | Various | Various | No. Use `harness-config`'s `audit` / `audit-automation-gaps` |

The load-model column is this audit's working model, not a restatement of the docs; each check in
[reference/criteria.md](reference/criteria.md) carries the pointer it rests on.

- **Pointer**: for how each file loads, see
  [How CLAUDE.md files load](https://code.claude.com/docs/en/memory#how-claude-md-files-load),
  [Organize rules with `.claude/rules/`](https://code.claude.com/docs/en/memory#organize-rules-with-claude/rules/),
  [When Claude Code reads AGENTS.md](https://code.claude.com/docs/en/memory#when-claude-code-reads-agents-md)
  and auto memory's [How it works](https://code.claude.com/docs/en/memory#how-it-works).

Auto memory's effective enabled/disabled state must be resolved before auditing it, not assumed
from a single scope: [`${CLAUDE_PLUGIN_ROOT}/skills/stateless/context/status.md`](../stateless/context/status.md),
"Resolve the effective state".

The two user-scope rows are in scope because they load in every session regardless of where it starts.
Discovery tags every file with its scope so project-scoped criteria (C9) skip personal files rather
than reporting a repo-scoped finding against one. **C6 Consistency** owns instruction-content
conflicts across that discover-instruction-surfaces population, including **user↔project** pairs.
`harness-config:audit-instructions` I15 owns memory-layer precedence adjudication and every conflict
pair with an anchor outside that population (nested `CLAUDE.md`, auto-memory, settings, hooks,
skills, agents, output styles).

## Scope boundary (route out)

This audit owns instruction-layer **health**: structure, size, placement, and index integrity of
the memory files against the codified checklist. Whether an instruction's *content* is still
needed by the current model is the model-era fit question, owned by the `harness-config` plugin's
`audit-instructions` skill. Prior-model workarounds, over-prescriptive scaffolding, bare
prohibitions without rationale, reasoning-echo directives, think-carefully steers, vague design
steers, settled-answers lines on analysis surfaces, and stale example scaffolding fall there.
Guidance a long-run file *lacks* (when to stop and when to keep going, a finish line, a task file,
the end-of-run report shape) is that plugin's `audit-prompting-postures`. When
that plugin is enabled, route such findings to `/harness-config:audit-instructions` (if enabled) or
`/harness-config:audit-prompting-postures` (if enabled), invoked via the Skill tool, rather than
judging them against this checklist; when it is not enabled, keep each as a criteria-free
observation in this audit's report (never a checklist finding, never silently dropped) so the
operator can weigh it against current official prompting guidance.

## Argument parsing

| Argument | Action |
|----------|--------|
| *(none)* or `audit` | Run the full codified checklist against all instruction/memory files |
| `update` | Research current official docs, refresh criteria and official-guidance reference files |
| `fix` | Apply fixes for audit findings (requires prior audit, asks for approval) |
| `report` | Show last audit results without re-running |

## Target scope

With no target form, the audit covers the project the session runs in, as every section below
describes. The target forms (`--repo`, `--repos-from`, `--owner`, `--fleet`, `--skip`, or the same
request in words) apply to `audit`, `report` and `fix`, and select several repositories, which
resolve, count, fan out and merge as
[`${CLAUDE_PLUGIN_ROOT}/reference/target-scope.md`](../../reference/target-scope.md) "Target
forms", "Resolving repositories", "Fan-out" and "Merging findings" say. `update` refreshes this
plugin's own criteria and takes no target. What differs here:

- **Each repository's pass runs from that clone's root**, since the bundled scripts and the
  state-key helper resolve the project from the working directory. The pre-computed header above
  describes the invoking session's directory, so each pass runs `audit-spine.sh --root <clone>` itself. The pass
  reads the clone's working tree, not `origin/HEAD`: `CLAUDE.local.md` is untracked, auto memory is
  keyed to the clone's path, and a session in that clone loads what is on disk.
- **User-scope files are audited in every repository's pass**, since path-scoped rules and the
  currency checks depend on the project (Step 2 in [context/audit.md](context/audit.md)). The same
  user-scope finding from several passes merges into one row.
- **Cross-repository signal**: the same rule in several repositories' `CLAUDE.md`, `AGENTS.md` or
  `.claude/rules/` files is a candidate to move to user scope or to the standards repository. A
  file `file-provenance.sh` reports as `synced` is not that finding, unless it differs from its
  source (the contract's "Cross-repository signals").
- **State stays per repository**: each pass writes its report under that clone's `<state-key>`,
  and `report` and `fix` read each clone's own. Run the helper below with `--root <clone root>`
  from anywhere else, a fix worktree included, since a worktree has its own key.
- **`fix` runs in the main session, one repository at a time**, because every fix waits for the
  user's approval. Tracked files change in one worktree and one pull request per repository, as
  the contract's "Writes stay per repository" says; confirm each finding still holds on the
  worktree's copy before editing it. `CLAUDE.local.md`, auto memory and user-scope files are not
  tracked, so they change in place. The memory-directory resolution and the closing re-audit run
  from the clone root.

## Determinism contract

The checklist at [reference/criteria.md](reference/criteria.md) is codified, not a subjective rubric.
Its **deterministic spine** (C1 line budget with `@` imports expanded, M1 index size, the
script-backed M2 index integrity, RD1 orphan-rule, and N1 nested-`AGENTS.md` reachability checks,
plus the provenance classification each finding carries) yields byte-identical findings on the same
repo state; its **judgment tier**
(C2-C9, R1-R4, M3-M4) applies fixed criteria with model reading, so findings vary in wording though
not in criteria. Label those "judgment candidate" in the report. Criteria derive from official Claude
Code documentation: [reference/official-guidance.md](reference/official-guidance.md) holds, per
topic, the audit's decision and a pointer to the docs section behind it, never the docs' text.
Refresh both via the `update` action.

## Script paths

The `context/` and `reference/` files write each bundled script as `<skill-dir>/scripts/<name>.sh`,
where `<skill-dir>` is this skill's directory: `${CLAUDE_SKILL_DIR}`. Put that path in place of the
placeholder before running a command. We never put a `${…}` token in those files: we do not rely on
one being substituted in a file read through the Read tool, or on the Bash tool's environment
carrying `CLAUDE_PLUGIN_ROOT`.

- **Pointer**: for where each `${…}` reference resolves, see
  [Where each variable resolves](https://code.claude.com/docs/en/plugins/manifest-reference#where-each-variable-resolves)
  and [Available string substitutions](https://code.claude.com/docs/en/skills#available-string-substitutions).

## Audit mode (default)

Load [context/audit.md](context/audit.md) for the full audit workflow.

## Update mode

Load [context/update.md](context/update.md) for the research-and-refresh workflow.

## Fix mode

Load [context/fix.md](context/fix.md) for the fix-with-approval workflow.

## Derive the report location before writing or reading

Every action that touches the report uses **one** path, resolved here: `audit` writes it, `report`
serves it, `fix` acts on it.

```
${CLAUDE_PLUGIN_DATA}/audit/<state-key>/last-audit.md
```

**Derive `<state-key>` by running this, in the project being audited:**

```bash
bash "${CLAUDE_PLUGIN_ROOT}/lib/state-key.sh"
```

It prints `<repo-identity>/<worktree-discriminator>`, the scheme `harness-config:audit-pass` defines
and `audit-prompting-postures` uses. Run it and use its output as the key. Pass `--explain` when
the report should say which rung produced its key.

**Why the key exists.** We treat `${CLAUDE_PLUGIN_DATA}` as one directory per plugin per machine,
with no project, checkout, worktree, or session segment. A fixed `audit/last-audit.md` is therefore
**one file per machine**.

- **Pointer**: for the plugin data directory, see
  [Environment variables](https://code.claude.com/docs/en/plugins/manifest-reference#environment-variables).

Losing reports is the smaller half; the larger half is the read. `report` mode would serve whatever
that file currently holds and `fix` mode would act on it, so on a machine with two repositories,
project B can be shown project A's
findings and offered edits derived from another repository's memory layer. That is a wrong answer
served, not merely an artifact lost, which is why an append-only history does not close it and the
*path* has to carry project identity.

**Never serve a report you cannot attribute.** If nothing exists at the derived path, say that no
audit has been run **for this project** and suggest running one. Do not fall back to an unkeyed
location.

**A `health/` directory or an unkeyed `audit/last-audit.md` under the plugin data directory is
unattributable.** Either is a machine-global file with no project segment, so nothing records which
repository produced it. It cannot be adopted into a project's key without inventing that
attribution, and inventing it is exactly the defect the key exists to remove. Where such a file is
present, name its path to the user as a leftover they may delete, and run the audit rather than
reading it.

**Audit output is contributor-local by design.** Reports audit a contributor's personal auto-memory
(`~/.claude/projects/<project>/memory/`), which varies per team member, so they persist in the
plugin's own data directory, never in the consuming repo.

**A rolling latest is a separate decision from keying, and this skill keeps one on purpose.**
`last-audit.md` is replaced by the next run *of the same project*; the report is a working artifact,
not a trend series. That is only safe because the key makes "the same project" mean something. See
[`docs/contracts/plugin-data-report-keying/`](https://github.com/melodic-software/claude-code-plugins/blob/main/docs/contracts/plugin-data-report-keying/README.md)
for when a writer owes a per-run history instead.

## Report mode

Read the report at the derived path above and present it. When it is absent, apply the
never-serve-what-you-cannot-attribute rule above rather than reaching for another file.

## Consumer-convention extension seam

This skill ships the doc-derived checklist only. A consuming repo that layers its own
instruction-hygiene conventions (e.g. a team-shared-first codification policy, an always-loaded
context-budget policy, or an exemption from the 200-line CLAUDE.md target for repos that deliberately
run a large rules layer) declares them in its own `CLAUDE.md` / `.claude/rules/`. Read those files
during the audit and apply any additional criteria or documented exemptions they define, reporting
such findings under a `REPO` check-ID so they stay distinct from the doc-derived checks.

## Next

/corrections:codify rules `<file>`, when a finding names a rule a check can enforce.

## Related

- Check if instruction text is still needed by current models: /harness-config:audit-instructions.
- Check for missing posture guidance: /harness-config:audit-prompting-postures.
- Audit settings, hooks, MCP, or plugins: /harness-config:audit.
- Inspect, disable, or purge auto-memory: /harness-memory:stateless.

## Complementary workflows

The `claude-md-management` plugin from Anthropic's `claude-plugins-official` marketplace
complements this health check when it is enabled. Run this audit first to identify issues.
Absent that plugin, the fix mode here stands on its own.

- **Pointer**: for what the plugin's skill and command do, read its
  [README: Usage](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/claude-md-management#usage).

Files in this skill

  • SKILL.md15.6 KB
  • context/gotchas.md2.9 KB
  • context/persist-findings.md18.7 KB
  • evals/evals.json14 KB
  • evals/fixtures/expired-stamp.md755 B
  • evals/fixtures/golden/c01-verbatim-workspace-layout/case.md659 B
  • evals/fixtures/golden/c01-verbatim-workspace-layout/expected.json1.7 KB
  • evals/fixtures/golden/c01-verbatim-workspace-layout/source.md1.1 KB
  • evals/fixtures/golden/c02-verbatim-split-spans/case.md813 B
  • evals/fixtures/golden/c02-verbatim-split-spans/expected.json1.5 KB
  • evals/fixtures/golden/c02-verbatim-split-spans/source.md1003 B
  • evals/fixtures/golden/c03-near-verbatim-light-edit/case.md539 B
  • evals/fixtures/golden/c03-near-verbatim-light-edit/expected.json1.3 KB
  • evals/fixtures/golden/c03-near-verbatim-light-edit/source.md874 B
  • evals/fixtures/golden/c04-near-verbatim-distant-citation/case.md898 B
  • evals/fixtures/golden/c04-near-verbatim-distant-citation/expected.json1.6 KB
  • evals/fixtures/golden/c04-near-verbatim-distant-citation/source.md986 B
  • evals/fixtures/golden/c05-paraphrase-restructured/case.md543 B
  • evals/fixtures/golden/c05-paraphrase-restructured/expected.json1.8 KB
  • evals/fixtures/golden/c05-paraphrase-restructured/source.md764 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.