Architecture drift detection, silent failure scanning, hallucination prevention, and feature completeness auditing. Activates at phase boundaries, before merges, or on explicit audit requests.
Architecture drift detection, silent failure scanning, hallucination prevention, and feature completeness auditing. Activates at phase boundaries, before merges, or on explicit audit requests.
System Supervisor - Architectural Integrity Scanner
Detects specification drift, silent failures, hallucinated assertions, and incomplete features. Provides a post-execution audit layer that complements the Execution Guardian's pre-execution gates.
Description
Scans the codebase for architectural integrity issues that accumulate over time. Compares implementation against specifications, detects dead code and silent failures, validates technical assertions, and measures feature completeness across all layers. Distinct from the Execution Guardian (pre-execution safety) and the Council of Logic (code quality).
When to Apply
Positive Triggers
Before merge to main: Final integrity check before code reaches production branch
After Genesis Orchestrator execution phase: Post-section or post-phase audit
Silent failures are code constructs that fail without alerting. They accumulate technical debt invisibly.
What to Scan For
Silent Failure Type
Detection Pattern
Severity
Dead imports
import X where X is never used in the file
LOW
Empty catch blocks
except: or catch {} with no logging or re-raise
HIGH
Unused API endpoints
Route defined but no frontend calls reference it
MEDIUM
Orphaned DB columns
Column in model but never read/written by any query
MEDIUM
Unchecked return values
Async function called without await or return value discarded
HIGH
Unreachable code paths
Code after unconditional return, raise, or break
LOW
Stale environment variables
.env.example references variable not used in code
LOW
Unhandled promise rejections
.then() without .catch() or missing error boundary
HIGH
Type assertion bypasses
as any, # type: ignore without justification comment
MEDIUM
Commented-out code blocks
More than 5 consecutive commented lines of code
LOW
Silent Failure Report Format
## Silent Failure Scan — {date}
| # | Type | Location | Line | Severity | Recommendation |
|---|------|----------|------|----------|---------------|
| 1 | Empty catch | apps/backend/src/api/main.py | 47 | HIGH | Add logging or re-raise |
| 2 | Dead import | apps/web/lib/api/client.ts | 3 | LOW | Remove unused import |
| 3 | Unchecked await | apps/backend/src/agents/base.py | 92 | HIGH | Add await or handle return |
### Summary- HIGH: {n} (fix immediately)
- MEDIUM: {n} (fix before merge)
- LOW: {n} (fix when convenient)
Hallucination Prevention
The Problem
AI coding agents can make assertions about code behaviour that are not verified. These assertions become "technical hallucinations" — statements treated as fact that may be incorrect.
Assertion Classification
When the agent makes a technical assertion (e.g., "this function handles errors correctly", "this endpoint returns 404"), classify it:
Classification
Meaning
Action
CONFIRMED
Verified by test, code inspection, or documentation
No action needed
INFERRED
Logically follows from confirmed facts but not directly verified
Acceptable with note
ASSUMED
Plausible but not verified
Trigger verification pass
FABRICATED
No evidence supports the assertion
Block and correct immediately
Verification Protocol
When an assertion is classified as ASSUMED:
Locate the source: Find the code or spec that should confirm the assertion
Run targeted test: Execute relevant test if available
Reclassify: Move to CONFIRMED or FABRICATED based on evidence
Report: Document the verification result
Hallucination Report Format
## Assertion Verification — {date}
| # | Assertion | Classification | Evidence | Action |
|---|-----------|---------------|----------|--------|
| 1 | "Auth middleware validates JWT expiry" | CONFIRMED | test_auth.py:test_expired_token passes | None |
| 2 | "Rate limiter returns 429 after 100 req/min" | ASSUMED | No rate limiter test exists | Write test |
| 3 | "Contractor API returns paginated results" | FABRICATED | API returns full list, no pagination | Correct claim |
Scope Boundary
This hallucination check applies to technical code assertions only. For content-level claims (marketing copy, user-facing text), defer to content review processes.
Feature Completeness Matrix
How It Works
For each declared feature, verify implementation across all required layers:
## Feature Completeness — {date}
| Feature | UI | API | Model | Validation | Tests | Docs | Errors | Score |
|---------|----|----|-------|-----------|-------|------|--------|-------|
| Auth (login/logout) | Y | Y | Y | Y | Y | Y | Y | 100% |
| Contractor profiles | Y | Y | Y | P | N | N | P | 57% |
| Document management | Y | Y | Y | Y | P | Y | Y | 86% |
| Analytics dashboard | N | P | N | N | N | N | N | 14% |
**Legend**: Y = Complete, P = Partial, N = Missing
### Thresholds- 100%: Release-ready
- 80-99%: Acceptable for merge (document gaps)
- 50-79%: Requires completion plan before merge
- <50%: Not ready — must complete core layers first
See references/completeness-matrix.md for detailed layer-by-layer checklists and path patterns.
Strategic Intelligence (Lightweight)
Portable, project-scoped signals only. No investor readiness, competitive analysis, or business metrics — those are non-portable and outside this skill's scope.