{"skill":{"slug":"cathedral-audit","displayName":"Cathedral Audit","summary":"Run a full spec-code audit on the Cathedral codebase. Use after build waves, major refactors, or when spec-code drift is suspected. Produces forward audit (s...","description":"---\nname: cathedral-audit\ndescription: Run a full spec-code audit on the Cathedral codebase. Use after build waves, major refactors, or when spec-code drift is suspected. Produces forward audit (specs→code), reverse audit (code→specs), bug report, and prioritized fix plan. Drives execution of fixes through CC sessions.\n---\n\n# Cathedral Audit\n\nA structured process for measuring and closing spec-code drift in the Cathedral C# codebase.\n\n## When to Run\n\n- After a build wave (multiple features/refactors landed)\n- Before starting a new major feature (establish baseline)\n- When spec-code drift is suspected\n- Periodically as a health check (not on a calendar — trigger on events)\n\n## Process Overview\n\n```\n1. Forward Audit (specs → code)\n2. Reverse Audit (code → specs)\n3. Consolidation & Prioritization\n4. Execution\n5. Verification\n```\n\n## Step 1: Forward Audit (Specs → Code)\n\nFor each spec in `kitty-specs/`, compare what the spec says against what the code does.\n\n**Output per spec:** One of:\n- ✅ **Conformant** — code matches spec\n- ⚠️ **Divergent** — code exists but differs from spec\n- ❌ **Missing** — spec describes something not built\n\n**Deliverable:** `kitty-specs/000-project-context/spec-audit-YYYY-MM-DD.md`\n\nUse parallel CC agents (one per spec batch) for speed if memory allows. **On memory-constrained hosts (e.g., WSL2), run sequentially — two concurrent CC sessions will OOM.** Provide each agent read-only access.\n\n## Step 2: Reverse Audit (Code → Specs)\n\nScan all `.cs` files in `src/Cathedral.Core/` and `src/Cathedral.TestHarness/`. For each file/subsystem, determine:\n\n- Is it covered by a spec?\n- Does it match what the spec says?\n- Is it dead/orphaned code?\n\n**Output sections:**\n1. **Executive Summary** — counts with delta from previous audit\n2. **Unspecced Code** — files/subsystems with no spec coverage\n3. **Architectural Divergences** — code takes a fundamentally different path than spec\n4. **Code Exceeding Spec** — code has features the spec doesn't document\n5. **Dead/Orphaned Code** — files with no callers or references\n6. **Bugs Discovered** — runtime, data, or logic bugs found during review\n7. **Comparison with Previous Audit** — what improved, what remains\n\n**Deliverable:** `kitty-specs/000-project-context/reverse-audit-YYYY-MM-DD.md`\n\nUse parallel CC agents (group files by directory/subsystem) for speed if memory allows. **Run sequentially on memory-constrained hosts.**\n\n## Step 3: Consolidation & Prioritization\n\nMerge findings from both audits into a prioritized action plan:\n\n| Priority | Category | Criteria |\n|----------|----------|----------|\n| **P0** | Bug fixes | Runtime impact — broken endpoints, data corruption, crashes |\n| **P1** | Dead code removal | Safe deletes that reduce confusion and LOC |\n| **P2** | Data quality fixes | Dropped data, wrong defaults, double-logging |\n| **P3** | Spec coverage | Write new specs for unspecced code (no code changes) |\n| **P4** | Spec accuracy | Update existing specs to document code-exceeding-spec features |\n| **P5** | Mechanical refactors | Renames, wiring, entity-scoping completion |\n| **P6** | Architectural gaps | V2 features where code diverges from spec by design (defer) |\n\n**Rules:**\n- Bugs always get their own section with severity ratings\n- \"Code exceeding spec\" = spec update, not code change\n- Architectural divergences that are intentionally deferred (V2 work) go to P6 and are documented but not actioned\n- Each priority level should be achievable in a single CC session\n\n**Deliverable:** Recommendations section in the reverse audit report.\n\n## Step 4: Execution\n\nExecute fixes by priority tier (P0 first, P6 last or deferred).\n\n**Per priority tier:**\n1. **Log intent** to `memory/YYYY-MM-DD.md` — tier name, CC session name, what's being attempted\n2. Write a task briefing for CC (see `references/cc-task-template.md`)\n3. Launch CC session: `cat /tmp/task.md | claude -p --allowedTools 'Edit,Write,Read,Bash'`\n4. Set up monitoring cron (every 5 min)\n5. When CC completes: **log results** to daily memory — files changed, what was done, any issues\n6. **Verify build before committing** — `dotnet build` must pass\n7. If CC gets killed (OOM): check `git diff --stat`, verify build manually, fix any issues, log the incident\n8. Commit with descriptive message referencing the priority tier\n9. **Log commit hash** to daily memory\n\n**Hard rules:**\n- ⚠️ **ALWAYS verify `dotnet build` passes before committing.** No exceptions. CC may get OOM-killed mid-build-check.\n- ⚠️ **ALWAYS log to daily memory file at every step.** Log intent before launch, results after completion, commit hash after commit. If the session dies, the log survives for recovery.\n- One commit per priority tier (or logical grouping)\n\n**Logging template for daily memory:**\n```markdown\n## [Priority Tier Name]\n- CC session: [name] (launched ~HH:MM CST)\n- Task: [brief description]\n- Status: [RUNNING | ✅ COMPLETE | ❌ FAILED | ⚠️ KILLED]\n- Files changed: [count]\n- Key actions: [what was done]\n- Issues: [any problems encountered]\n- Committed as [hash]\n```\n\n## Step 5: Verification\n\nAfter all tiers are complete, optionally run a quick re-audit to measure improvement:\n\n- Compare counts: unspecced, divergent, dead code, bugs\n- Verify delta matches expectations\n- Document remaining gaps and whether they're P6/deferred or newly discovered\n\n**Deliverable:** Updated audit files with comparison section.\n\n## Logging\n\nEvery audit produces a complete trail in `memory/YYYY-MM-DD.md`:\n\n- **Audit launch** — which audits are being run, baseline reference\n- **Audit results** — summary counts, key findings\n- **Each priority tier** — intent, CC session, results, issues, commit hash\n- **Final summary** — total commits, total lines changed, what's resolved vs deferred\n\nThis is non-negotiable. The Feb 17-18 amnesia incident proved that unlogged work is lost work. Log-then-act: write what you're about to do BEFORE doing it, then update with results.\n\n## Baseline Tracking\n\nAlways compare against the previous audit. Store audits as:\n```\nkitty-specs/000-project-context/\n  spec-audit-YYYY-MM-DD.md      (forward)\n  reverse-audit-YYYY-MM-DD.md   (reverse)\n```\n\nThe executive summary table with deltas is the key metric:\n\n```markdown\n| Category | Previous | Current | Delta |\n|----------|----------|---------|-------|\n| Unspecced Code | 38 | 24 | -14 |\n| Divergences | 12 | 7 | -5 |\n| Dead Code | 14 | 8 | -6 |\n| Bugs | 0 | 8 | +8 |\n| Conformant | ~60 | ~120 | +60 |\n```\n\n## CC Task Briefing Template\n\nSee `references/cc-task-template.md` for the standard format for CC task briefings.\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":617,"installsAllTime":1,"installsCurrent":1,"stars":0,"versions":1},"createdAt":1773482740741,"updatedAt":1778999466541},"latestVersion":{"version":"1.0.0","createdAt":1773482740741,"changelog":"- Initial release of cathedral-audit skill for auditing spec-code drift in the Cathedral C# codebase.\n- Provides structured steps: forward audit (specs→code), reverse audit (code→specs), consolidation & prioritization, execution, and verification.\n- Includes detailed priority guidelines and logging requirements for all steps.\n- Ensures actionable deliverables and prioritization of findings for efficient codebase health improvement.\n- Emphasizes thorough audit trails and comparisons with previous audits for progress tracking.","license":"MIT-0"},"metadata":null,"owner":{"handle":"hydroculator","userId":"s172zbmv8x3wdbgj3rx7yxkme58859pc","displayName":"hydroculator","image":"https://avatars.githubusercontent.com/u/59405571?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089884950}}