Move PolicyGateError into src/spectra/entities/errors.py (or a new use_cases module). Both infrastructure/main.py and adapters/cli_controller.py should import the single canonical class. This eliminates the duplicate-class hazard and keeps the adapter layer free of infrastructure coupling.
Extract the pipeline stages currently inlined in _run_analysis (INGEST, PREFLIGHT, REPORT, policy gate, receipt attachment) into the use_cases layer so analyze_repository owns all 6 stages. Keep _run_analysis as pure DI wiring + delegation. This restores the Clean Architecture invariant that orchestration lives in use_cases and infrastructure only provides adapters.
Define a WaiverSigner Protocol in use_cases/interfaces.py and inject the YamlWaiverAdapter implementation via a setter (mirroring set_analyzer_factory / set_cache_provider in cli_controller.py). The composition root wires the concrete signer; waiver_cli depends only on the Protocol. This eliminates both the deferred imports and the cryptography coupling.
Import the Protocol types (LLMGateway, AuditPort, MetaPrompterPort, SpecialistPort, CritiquePort) from use_cases/interfaces and type the parameters/returns precisely. Drop the 'type: ignore[arg-type]' once the types align. This restores the dependency-inversion contract the architecture promises.
Each agent module should expose a public prompt_version() function returning its hash contribution. The composition root composes the per-agent versions without touching private attributes. This makes the cache-version contract explicit and refactor-safe.
CritiqueAgent validated findings using extended thinking. 3 of 34 findings were individually confirmed.
Patterns identified by CritiqueAgent that span multiple dimensions
OWASP mapping requires security findings with explicit category references. Run with full code content to populate this section.
AI-assisted screening based on finding text. Not a substitute for professional penetration testing.
AI-estimated composite score. Consult qualified advisors for investment decisions.
Keyword-based mapping to AICPA Common Criteria (CC1–CC9). Not a formal SOC 2 audit.
Keyword-based mapping to PCI DSS 4.0 Requirement 6 (Secure Systems & Software). Not a formal PCI assessment.
Keyword-based mapping to NIST Cybersecurity Framework 2.0 (6 Functions). Not a formal NIST assessment.
Measures finding distribution across files. For contributor-based bus factor analysis, use git blame tools.
Based on $175/hr senior engineer rate and ~5 hours for equivalent manual review. Actual costs vary.