Cathedral Audit
by @hydroculator
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...
clawhub install cathedral-auditπ About This Skill
name: cathedral-audit description: 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.
Cathedral Audit
A structured process for measuring and closing spec-code drift in the Cathedral C# codebase.
When to Run
Process Overview
1. Forward Audit (specs β code)
2. Reverse Audit (code β specs)
3. Consolidation & Prioritization
4. Execution
5. Verification
Step 1: Forward Audit (Specs β Code)
For each spec in kitty-specs/, compare what the spec says against what the code does.
Output per spec: One of:
Deliverable: kitty-specs/000-project-context/spec-audit-YYYY-MM-DD.md
Use 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.
Step 2: Reverse Audit (Code β Specs)
Scan all .cs files in src/Cathedral.Core/ and src/Cathedral.TestHarness/. For each file/subsystem, determine:
Output sections: 1. Executive Summary β counts with delta from previous audit 2. Unspecced Code β files/subsystems with no spec coverage 3. Architectural Divergences β code takes a fundamentally different path than spec 4. Code Exceeding Spec β code has features the spec doesn't document 5. Dead/Orphaned Code β files with no callers or references 6. Bugs Discovered β runtime, data, or logic bugs found during review 7. Comparison with Previous Audit β what improved, what remains
Deliverable: kitty-specs/000-project-context/reverse-audit-YYYY-MM-DD.md
Use parallel CC agents (group files by directory/subsystem) for speed if memory allows. Run sequentially on memory-constrained hosts.
Step 3: Consolidation & Prioritization
Merge findings from both audits into a prioritized action plan:
| Priority | Category | Criteria | |----------|----------|----------| | P0 | Bug fixes | Runtime impact β broken endpoints, data corruption, crashes | | P1 | Dead code removal | Safe deletes that reduce confusion and LOC | | P2 | Data quality fixes | Dropped data, wrong defaults, double-logging | | P3 | Spec coverage | Write new specs for unspecced code (no code changes) | | P4 | Spec accuracy | Update existing specs to document code-exceeding-spec features | | P5 | Mechanical refactors | Renames, wiring, entity-scoping completion | | P6 | Architectural gaps | V2 features where code diverges from spec by design (defer) |
Rules:
Deliverable: Recommendations section in the reverse audit report.
Step 4: Execution
Execute fixes by priority tier (P0 first, P6 last or deferred).
Per priority tier:
1. Log intent to memory/YYYY-MM-DD.md β tier name, CC session name, what's being attempted
2. Write a task briefing for CC (see references/cc-task-template.md)
3. Launch CC session: cat /tmp/task.md | claude -p --allowedTools 'Edit,Write,Read,Bash'
4. Set up monitoring cron (every 5 min)
5. When CC completes: log results to daily memory β files changed, what was done, any issues
6. Verify build before committing β dotnet build must pass
7. If CC gets killed (OOM): check git diff --stat, verify build manually, fix any issues, log the incident
8. Commit with descriptive message referencing the priority tier
9. Log commit hash to daily memory
Hard rules:
dotnet build passes before committing. No exceptions. CC may get OOM-killed mid-build-check.Logging template for daily memory:
## [Priority Tier Name]
CC session: [name] (launched ~HH:MM CST)
Task: [brief description]
Status: [RUNNING | β
COMPLETE | β FAILED | β οΈ KILLED]
Files changed: [count]
Key actions: [what was done]
Issues: [any problems encountered]
Committed as [hash]
Step 5: Verification
After all tiers are complete, optionally run a quick re-audit to measure improvement:
Deliverable: Updated audit files with comparison section.
Logging
Every audit produces a complete trail in memory/YYYY-MM-DD.md:
This 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.
Baseline Tracking
Always compare against the previous audit. Store audits as:
kitty-specs/000-project-context/
spec-audit-YYYY-MM-DD.md (forward)
reverse-audit-YYYY-MM-DD.md (reverse)
The executive summary table with deltas is the key metric:
| Category | Previous | Current | Delta |
|----------|----------|---------|-------|
| Unspecced Code | 38 | 24 | -14 |
| Divergences | 12 | 7 | -5 |
| Dead Code | 14 | 8 | -6 |
| Bugs | 0 | 8 | +8 |
| Conformant | ~60 | ~120 | +60 |
CC Task Briefing Template
See references/cc-task-template.md for the standard format for CC task briefings.