config-audit

Audit ~/.config/{ai,claude,codex}/ and the deployed tool home (~/.claude or ~/.codex) for 3-tier structure compliance: layout, prefix convention, AGENTS.manifest sync, deploy-model integrity, generate

SKILL.md

GitHub

Audit ~/.config/{ai,claude,codex}/ structure for compliance with the 3-tier layout rules.

Arguments: $ARGUMENTS — empty runs the structural checks below; content [path] runs only the content-consistency pass at the end of this file, over the whole tree or the given path.

Checks (tool-agnostic)

1. Tier violation

  • A file in claude/ whose body has NO Claude-specific dependency (no custom slash commands — /<name> naming a skill does not count, no Agent(subagent_type=...), no EnterPlanMode/EnterWorktree, no ~/.claude/-only paths, no Claude hooks/extensions, no settings.json permissions) → suggest moving to ai/.
  • A file in codex/ whose body has NO Codex-specific dependency (no sandbox modes, no codex exec, no ~/.agents/skills/, no config.toml [mcp_servers.*]-only refs) → suggest moving to ai/.
  • A file in ai/ whose body uses tool-only tokens or systems → split the tool-specific portion into the tool's directory. Exception: naming both tools side by side, where the file depends on neither — ai/README.md's deploy tables, PERSONAL.md giving each tool its own phrasing of one instruction, a memory note recording that a hook exists on one tool and not the other, /<name> written as shorthand for a shared skill. The test: delete one tool from the file. If the advice still stands for the tool that remains, the mention is descriptive and belongs in ai/; if it collapses, it is a dependency and belongs in that tool's directory.
  • A file in ai/ containing a literal ~/.claude/ or ~/.codex/ path (instead of the {{TOOL_HOME}} token) → FAIL (a literal tool path silently breaks the other tool). Exceptions: ai/README.md, ai/skills/config-audit/SKILL.md, and ai/memory/feedback_ai_config_structure.md — these describe the deploy model itself and must name both tools' literal targets — plus the deploy tooling (ai/scripts/, ai/lib/, ai/AGENTS.manifest), which exists to write or check both tools' targets and cannot use a per-tool token. The rule targets operational paths (command/ls/script targets), not prose that documents deploy structure.

2. Prefix violation

  • File or skill directory directly under claude/{rules,memory,skills}/ without claude- prefix → FAIL (move with rename).
  • File or skill directory directly under codex/{rules,memory,skills}/ without codex- prefix → FAIL.
  • Any file under ai/ with claude- or codex- prefix → FAIL (prefix is for tool-specific tiers only).
  • For tool-specific skills, the directory name is the ownership boundary and MUST keep the native prefix. The SKILL.md frontmatter name: is the user-facing invocation/display name and MAY omit the native prefix when the shorter name is clear and unique in that tool's deployed skill scope.
  • Duplicate SKILL.md frontmatter name: values within one deployed skill scope → FAIL (Claude scope: ai/skills, ai/skills/private, claude/skills; Codex scope: ai/skills, ai/skills/private, codex/skills).

3. AGENTS.manifest drift

  • A file in ai/ (excluding ai/skills/, ai/scripts/, ai/lib/, ai/memory/private/, ai/.gitignore, ai/AGENTS.manifest itself, ai/README.md) NOT listed in ai/AGENTS.manifest → WARN (Codex will not see this file). Codex discovers local ai/memory/private/*.md automatically; those filenames must stay out of the tracked manifest.
  • A line in ai/AGENTS.manifest whose target file does not exist → FAIL.
  • feedback_ai_config_structure.md not the first memory entry in the manifest memory section → FAIL (Codex must see token rules before any token-using file).

4. Undefined tokens

  • Any {{[A-Z_]+}} in ai/ source files whose name is NOT in the defined token set ({{TOOL_HOME}}, {{TOOL_NAME}}, {{TOOL_NAME_LC}}, {{INSTRUCTIONS_FILE}}, {{CONFIG_FILE}}, {{PLAN_DIR}}, {{STATE_DIR}}) → FAIL. Either add to the token set + bootstrap expand functions, or replace with literal value.
  • {{PLAN_DIR}} must resolve to .agents/plans, {{STATE_DIR}} to .agents/state. .agents/skills is for Codex skill discovery only; .agents/plans, .agents/state, and .agents/tasks/ (per-task backlog/closed/links/memory) must stay sibling entries (never inside .agents/skills).

5. Generated-file integrity

  • ~/.claude/MEMORY.md missing the AUTO-GENERATED header → FAIL (file was hand-edited or bootstrap is broken).
  • ~/.codex/AGENTS.md missing the AUTO-GENERATED header → FAIL.
  • ~/.codex/AGENTS.md missing <!-- codex/DEVGUARD.md --> when codex/DEVGUARD.md exists → FAIL (Codex-only addendum is not deployed).
  • Bytes of ~/.codex/AGENTS.md exceeding project_doc_max_bytes (read from codex/config.toml.template) → FAIL.

Checks (tool-specific, run only when current tool matches)

Claude

  • ~/.claude/settings.json hook entries reference scripts that exist under claude/hooks/ → if a referenced script is missing, FAIL (dangling hook reference).
  • ~/.claude/MEMORY.md index entries reference files that exist under ~/.claude/memory/ (or its private/ subdir) → FAIL on missing entry target, WARN on file-without-entry.
  • Plain files under ~/.claude/memory/ that are not generated, not symlinks to ai/memory/ or claude/memory/, and not indexed by ~/.claude/MEMORY.md → WARN (runtime-only memory drift).
  • ~/.claude/skills/<name> symlinks resolve to a real directory under ai/skills/ or claude/skills/, or under the vendor root (${AI_VENDOR_DIR:-~/.local/share/ai-vendor}) for a skill entry in ai/scripts/vendor.manifest or the private manifest → FAIL on broken symlink. A real directory a vendored tool's own installer put there (rea's reverse-engineer-anything) is not a finding.
  • ~/.claude/mods is a symlink to claude/mods/, and every path in ~/.claude/settings.json env.CLAUDE_CODE_PLUGIN_DIRS is a folder under it holding .claude-plugin/plugin.json → FAIL on a missing or non-symlinked target (a mod that does not load fails silently).

Codex

  • ~/.codex/config.toml parses as valid TOML → FAIL on parse error.
  • [mcp_servers.<name>] blocks have command (stdio) or url (HTTP) → WARN if neither.
  • project_doc_max_bytes is set ≥ current AGENTS.md size → FAIL otherwise.
  • codex/config.toml.template UserPromptSubmit hooks missing codex/hooks/inject-context.sh, or its timeout is not exactly 30 seconds → FAIL (session binding must resolve within the prompt turn).
  • Either inject-context adapter does not parse the exact session_id, pass its strict tool namespace to ensure-session, or preserve the 30-second bound → FAIL. A default/PPID binding key or an ensure-current prompt path is also a FAIL.
  • An unbound main adapter payload contains any plan id/title/path/branch/base/recovery field, or does not state that main current is launcher-only → FAIL.
  • Either inject-context adapter omits the exact canonical continuation guard from every branch without a validated draft/active session binding (normal unbound/empty, legacy_unmapped, internal_error, malformed ok, or unexpected status), or emits it for a validated draft/active ok binding → FAIL.
  • ~/.agents/.codex/state/current.txt exists and is non-empty → WARN (legacy tool-specific state pointer; current shared state is repo-local .agents/state/current.txt).
  • Any legacy ~/.agents/.codex/plans/*.md frontmatter has status: draft or status: active → WARN (old Codex plan namespace may conflict with shared plan/state expectations).
  • ~/.agents/skills/<name> symlinks resolve under ai/skills/ or codex/skills/, or under the vendor root for a vendored skill entry (same rule as Claude) → FAIL on broken.

Content consistency (only with the content argument)

The structural checks pass while a document states something false. This pass reads what the tracked files under ai/, claude/ and codex/ claim and checks each claim against the thing that decides it. It is judgment work and costs far more than the checks above, so it never runs by default.

A claim worth checking is one that can be wrong:

  • a command, subcommand, flag, file, path, hook event or exit code that is said to exist;
  • a step number, section name or output format in another skill or agent;
  • what a skill hands to another skill, agent or script, and what that side expects back;
  • a guarantee: "enforced", "atomic", "always", "never", "only", "refuses";
  • a count, range or list presented as current ("C1 through C15", "three sections").

Procedure:

  1. Take the file list from git ls-files. Group it by the code it describes (root documents with rules, memory, scripts and hooks; the pm skills with their modules; the workflow skills with the agents they dispatch; the rest), and give each group to a separate read-only reviewer when the tool can run several, otherwise go group by group.
  2. For every claim, open the code or the other document that decides it. Where the claim is about behaviour and the tool is cheap to run, run it — a tool's --help is a claim too, not evidence.
  3. For every handoff, read both ends: the caller's arguments and expectations against the callee's inputs and output format.
  4. Re-open each finding yourself before reporting it. A reviewer's report is a lead; drop a finding when both statements can hold at once, and say which ones were dropped and why.

Report each finding with the claim's file:line, the evidence (file:line or the command and its output), and which side is wrong — or decision needed when either the document or the code could be the intended one. Separate what you confirmed from what a reviewer reported and you did not re-open. Leave out style, omissions, and a dated measurement that is not presented as current. End with N confirmed, M unverified, K dropped.

Output

Report each FAIL/WARN with:

  • File path (and line number when applicable)
  • Rule violated
  • Suggested fix (one line)

Group by Check 1–5 then tool-specific. End with a one-line summary: N FAIL, M WARN, K PASS.

Rules

  • Read-only — never modify files. Surface findings only.
  • A check that does not apply (no relevant files exist) → report — (n/a), not PASS.
  • For Check 3, do not auto-update the manifest; that is the user's call.