| name | vibe-code-audit |
| description | Catalogue-first repo audit for vibe-coded systems. Use when Codex must run llmcc and agentroot, discover semantic duplication and architecture drift, and produce evidence-based refactor bundles with high-confidence findings. Supports progressive disclosure via references/core and stack-specific references/packs. |
| allowed-tools | ["Bash(*run_index.sh*)","Bash(*build_derived_artifacts.sh*)","Bash(*build_read_plan.sh*)","Bash(*run_agentroot_embed.sh*)","Bash(*render_system_map.sh*)","Bash(*render_report_pdf.sh*)","Bash(llmcc *)","Bash(agentroot *)","Bash(rg *)","Bash(sed -n *)","Bash(cat *)","Read(vibe-code-audit/**)","Read"] |
Vibe Code Audit
Run a deterministic, read-only audit optimized for messy, organically grown codebases where the same intent is implemented multiple ways.
Progressive Disclosure
Read only what is needed:
- For normal runs, execute scripts first; avoid opening references before script execution.
- Do not read
references/packs/*.md in default flow.
- Load
references/core/process.md only when script fallback or troubleshooting is required.
- Load
references/core/*.md based on the active phase.
- Load
references/packs/*.md only when stack-specific behavior is ambiguous.
- If running in Claude Code, load
references/claude/subagents-and-model-routing.md only when setting up subagents/models.
Stack pack selection:
Cargo.toml -> references/packs/rust-backend.md
package.json + tsconfig.json + next.config.* -> references/packs/react-next.md
package.json + express usage -> references/packs/node-express.md
Gemfile + Rails markers -> references/packs/rails.md
If no pack matches, continue with core language-agnostic rules.
Inputs
repo_path (default .)
- Optional
output_dir (if omitted, run_index.sh auto-creates <repo_path>/vibe-code-audit/<UTC-timestamp>/)
- Optional focus areas:
duplication, risk, architecture, maintainability
- Optional budget mode:
fast, standard, deep (default standard)
skill_dir (path to this installed skill directory; resolve from runtime context)
Budget behavior:
fast: prioritize top-central hotspots and strongest evidence.
standard: full V1 flow.
deep: broaden duplication and boundary analysis coverage.
Output Location
Resolve output path at the beginning of the run:
- Ask user where to write audit artifacts only if they care to customize location.
- If no explicit output is provided, let
run_index.sh choose the default path.
- Do not run standalone timestamp shell commands to construct output paths.
- Write index artifacts to
<output_dir>/audit_index/.
- Write final report to
<output_dir>/audit_report.md.
- Only create/overwrite files under
<output_dir>.
Guardrails
- Stay read-only against source files.
- Avoid destructive commands.
- Avoid lint/style-only findings.
- Avoid speculative findings.
- Do not run full test suites unless user asks.
Context Budget Rules
Prevent context-window failures during large-repo audits:
- Do not read entire large source files by default.
- Start with file discovery (
rg --files) and targeted search (rg <pattern>).
- Read only relevant slices around evidence (
sed -n start,endp), not whole files.
- If a file exceeds ~800 lines, read only targeted sections unless user explicitly asks for full-file review.
- Avoid parallel bulk file reads across the whole repo.
- Prefer artifact-driven analysis (
manifest, catalog, hotspots, dup_clusters) over exhaustive raw-file ingestion.
- Do not open raw
audit_index/llmcc/**/*.dot files in normal flow; use derived/hotspots.json and catalog artifacts instead.
- Never
Read binary or generated graph/image files (*.dot, *.png, *.jpg, *.jpeg, *.gif, *.pdf).
- If a required
Read fails, retry that file sequentially; do not batch sibling Read calls until the missing-path issue is fixed.
Claude Execution Mode
When running this skill via Claude Code:
- Use subagents to keep main-thread context small.
- Route by task complexity:
haiku for exploration and evidence lookup
sonnet for indexing orchestration, pattern mining, and synthesis
opus only for ambiguous high-severity adjudication
- Use bounded objectives per subagent; avoid long multi-purpose prompts.
- Follow
references/claude/subagents-and-model-routing.md.
Allowed Tools
Use only the following tool classes for this skill unless the user explicitly expands scope:
Bash(<skill_dir>/scripts/run_index.sh ...) for deterministic preflight + indexing.
Bash(<skill_dir>/scripts/build_derived_artifacts.sh ...) for deterministic catalog/hotspots/dup_clusters bootstrap.
Bash(<skill_dir>/scripts/build_read_plan.sh ...) for bounded evidence slice planning.
Bash(<skill_dir>/scripts/run_agentroot_embed.sh ...) only for embedding troubleshooting or manual embed reruns.
Bash(<skill_dir>/scripts/render_report_pdf.sh ...) for optional report PDF generation.
Bash(<skill_dir>/scripts/render_system_map.sh ...) for optional system map rendering.
Bash(llmcc ...) for structural graph generation and PageRank hotspot extraction.
Bash(agentroot ...) for hybrid indexing, lexical query, and semantic search.
Read(vibe-code-audit/**) for reading skill instructions, references, and templates.
Read(<target-repo-files>) for read-only audit evidence collection.
Do not run unrelated command families during the audit flow.
Required Tools
Dependencies:
Optional PDF dependencies:
pandoc
- one PDF engine (
tectonic, typst, xelatex, pdflatex, wkhtmltopdf, or weasyprint)
Validation policy:
- In normal flow,
run_index.sh performs dependency validation.
- Do not run standalone version checks before calling
run_index.sh.
- Run direct version checks only in manual fallback or troubleshooting mode.
Tool Invocation Policy
Use deterministic command execution for indexing:
- Resolve
skill_dir first.
- Execute a single Bash action:
<skill_dir>/scripts/run_index.sh --repo <repo_path> --mode <budget_mode>
- In Claude Code, use a larger command timeout for indexing (
>=900000 ms recommended) or run in background and poll task output.
- If custom output is needed, pass
--output <output_dir> to the same command.
run_index.sh auto-runs read-plan generation unless --skip-read-plan is used.
run_index.sh auto-runs derived artifact bootstrap (catalog.json, hotspots.json, dup_clusters.md).
- Do not run separate preflight commands (
llmcc --version, agentroot --version) outside scripts in normal flow.
- Use direct
llmcc/agentroot commands only if script execution is unavailable.
- Do not run exploratory
llmcc --help or agentroot --help during normal audit flow.
- Use
--help only as fallback when an expected command fails with an unknown command/flag error.
- Run all index commands from the resolved
repo_path.
- Verify expected artifact files/directories after each indexing stage.
- Read
<output_dir>/audit_index/manifest.json before analysis and enforce:
agentroot_document_count > 0
retrieval_query_ok == 1 or retrieval_vsearch_ok == 1 or retrieval_mode == "bm25-only"
- If
retrieval_mode is bm25-only, continue in degraded mode (do not abort), but rely more on direct file evidence and explicit rg corroboration.
run_index.sh auto-embed is enabled by default; let it drive embedding via run_agentroot_embed.sh and avoid manual ad-hoc embed orchestration in normal flow. Use VIBE_CODE_AUDIT_AGENTROOT_AUTO_EMBED=0 only when intentionally disabling embed attempts.
- For embed troubleshooting, read manifest fields:
agentroot_embed_attempted
agentroot_embed_ok
agentroot_embed_backend
agentroot_embed_utf8_panic
- Never use
grep -P / grep -oP; use rg or portable grep -E/grep -oE.
- Avoid
Read on large generated artifacts (*.dot, huge logs, image files) unless recovery mode requires it.
run_index.sh already includes CLI-compatibility fallbacks; if it fails, rerun once and inspect its stderr instead of manually re-implementing indexing with many ad-hoc commands.
- Do not compute hotspot LOC with overlapping glob patterns (for example
src/*.rs + src/**/*.rs) because it double-counts files.
- After writing
<output_dir>/audit_report.md, run:
<skill_dir>/scripts/render_report_pdf.sh --report <output_dir>/audit_report.md --map-mode crate
render_report_pdf.sh attempts render_system_map.sh automatically first (non-fatal).
- Treat system map and PDF export as optional:
- if script output contains
SYSTEM_MAP_PATH=..., reference the generated image
- if script output contains
SYSTEM_MAP_SKIPPED=1, continue without failing the audit
- For PDF:
- if script output contains
PDF_PATH=..., reference the generated PDF
- if script output contains
PDF_SKIPPED=1, continue without failing the audit
- if script output contains
PDF_NOTE=rendered_without_system_map, mention PDF fallback behavior
Required Outputs
Must produce:
<output_dir>/audit_index/manifest.json
<output_dir>/audit_index/llmcc/ artifacts
<output_dir>/audit_index/agentroot/ artifacts
<output_dir>/audit_index/agentroot/status.json (or equivalent status artifact)
<output_dir>/audit_index/derived/catalog.json
<output_dir>/audit_index/derived/hotspots.json
<output_dir>/audit_index/derived/dup_clusters.md
<output_dir>/audit_index/derived/read_plan.tsv
<output_dir>/audit_index/derived/read_plan.md
<output_dir>/audit_report.md
Optional output:
<output_dir>/audit_report.pdf (only when PDF tooling is available)
<output_dir>/system_map.png (only when Graphviz and a dot source are available)
Execution Contract
Execute phases from references/core/process.md in order:
- Phase 0: Scope and stack detection
- Phase 1: Discovery and catalog-first indexing
- Phase 2: Pattern mining for inconsistent implementations
- Phase 3: Semantic duplication clustering
- Phase 4: Architecture and boundaries audit
- Phase 5: Risk audit
- Phase 6: Maintainability and DX audit
- Phase 7: Prioritization and refactor bundle synthesis
- Phase 8: Optional system map rendering and PDF export
Use supporting references as needed:
references/core/inventory.md
references/core/pattern-mining.md
references/core/duplication.md
references/core/architecture.md
references/core/risk.md
references/core/maintainability.md
references/core/prioritization.md
references/core/agent-roles.md
references/core/output-schema.md
references/core/context-budget.md
references/claude/subagents-and-model-routing.md
Findings Rules
- Cap findings to top
10.
- Cap bundles to
3 to 8.
- Every finding must include evidence file paths.
- Every finding must include severity, confidence, effort, and blast radius.
- Apply severity-aware confidence thresholds:
S0/S1: keep only if confidence >= 0.70
S2/S3: keep only if confidence >= 0.85
- Treat inconsistency as a risk multiplier.
- If
manifest.retrieval_mode == "bm25-only", lower confidence for semantic-duplication claims unless corroborated by direct code evidence.
Report Contract
Write <output_dir>/audit_report.md using this exact section order:
- Executive Summary
- System Map
- Hotspots Overview
- Pattern Inconsistencies
- Duplication Clusters
- Risk Findings
- Refactor Bundles
- Roadmap
If ./REPORT_TEMPLATE.md exists in this skill directory, align headings and table layout to it.
Roadmap must include two lanes:
- Quick Wins (1-3 days)
- Deep Work (1-6 weeks)
Definition of Done
Complete only when:
- Required artifacts exist and are populated.
- Retrieval validation succeeded (
agentroot_document_count > 0 and at least one retrieval check succeeded).
- Findings are confidence-filtered and evidence-backed.
- Refactor bundles are actionable and sequenced.
- Report emphasizes consolidation leverage over issue count.