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.mdai/skills/config-audit/SKILL.md
GitHubAudit ~/.config/{ai,claude,codex}/ structure for compliance with the 3-tier layout rules.
Checks (tool-agnostic)
1. Tier violation
- A file in
claude/whose body has NO Claude-specific dependency (no slash commands, noAgent(subagent_type=...), noEnterPlanMode/EnterWorktree, no~/.claude/-only paths, no Claude hooks/extensions, no settings.json permissions) → suggest moving toai/. - A file in
codex/whose body has NO Codex-specific dependency (no sandbox modes, nocodex exec, no~/.agents/skills/, noconfig.toml [mcp_servers.*]-only refs) → suggest moving toai/. - 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.mdgiving each tool its own phrasing of one instruction, a memory note recording that a hook exists on one tool and not the other. The test: delete one tool from the file. If the advice still stands for the tool that remains, the mention is descriptive and belongs inai/; 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, andai/memory/feedback_ai_config_structure.md— these describe the deploy model itself and must name both tools' literal targets. 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}/withoutclaude-prefix → FAIL (move with rename). - File or skill directory directly under
codex/{rules,memory,skills}/withoutcodex-prefix → FAIL. - Any file under
ai/withclaude-orcodex-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.mdfrontmattername: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.mdfrontmattername: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/(excludingai/skills/,ai/scripts/,ai/lib/,ai/.gitignore,ai/AGENTS.manifestitself,ai/README.md) NOT listed inai/AGENTS.manifest→ WARN (Codex will not see this file). Same asai/scripts/sync-back.sh --strictwould catch. - A line in
ai/AGENTS.manifestwhose target file does not exist → FAIL. feedback_ai_config_structure.mdnot 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_]+}}inai/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/skillsis 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.mdmissing theAUTO-GENERATEDheader → FAIL (file was hand-edited or bootstrap is broken).~/.codex/AGENTS.mdmissing theAUTO-GENERATEDheader → FAIL.~/.codex/AGENTS.mdmissing<!-- codex/DEVGUARD.md -->whencodex/DEVGUARD.mdexists → FAIL (Codex-only addendum is not deployed).- Bytes of
~/.codex/AGENTS.mdexceedingproject_doc_max_bytes(read fromcodex/config.toml.template) → FAIL.
Checks (tool-specific, run only when current tool matches)
Claude
~/.claude/settings.jsonhook entries reference scripts that exist underclaude/hooks/→ if a referenced script is missing, FAIL (dangling hook reference).~/.claude/MEMORY.mdindex entries reference files that exist under~/.claude/memory/(or itsprivate/subdir) → FAIL on missing entry target, WARN on file-without-entry.- Plain files under
~/.claude/memory/that are not generated, not symlinks toai/memory/orclaude/memory/, and not indexed by~/.claude/MEMORY.md→ WARN (runtime-only memory drift). ~/.claude/skills/<name>symlinks resolve to a real directory underai/skills/orclaude/skills/, or under the vendor root (${AI_VENDOR_DIR:-~/.local/share/ai-vendor}) for askillentry inai/scripts/vendor.manifestor the private manifest → FAIL on broken symlink. A real directory a vendored tool's own installer put there (rea'sreverse-engineer-anything) is not a finding.~/.claude/modsis a symlink toclaude/mods/, and every path in~/.claude/settings.jsonenv.CLAUDE_CODE_PLUGIN_DIRSis 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.tomlparses as valid TOML → FAIL on parse error.[mcp_servers.<name>]blocks havecommand(stdio) orurl(HTTP) → WARN if neither.project_doc_max_bytesis set ≥ current AGENTS.md size → FAIL otherwise.codex/config.toml.templateUserPromptSubmithooks missingcodex/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 toensure-session, or preserve the 30-second bound → FAIL. Adefault/PPID binding key or anensure-currentprompt 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, malformedok, or unexpected status), or emits it for a validated draft/activeokbinding → FAIL. ~/.agents/.codex/state/current.txtexists 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/*.mdfrontmatter hasstatus: draftorstatus: active→ WARN (old Codex plan namespace may conflict with shared plan/state expectations). ~/.agents/skills/<name>symlinks resolve underai/skills/orcodex/skills/, or under the vendor root for a vendoredskillentry (same rule as Claude) → FAIL on broken.
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.