Overview
Prismatic Quality Intelligence is a self-evolving, self-healing quality management system with deep Three-Layer Neural Learning (3NL) integration. Operating as the platform's immune system for code health, it autonomously monitors, predicts, evolves, and remediates quality violations across the entire Prismatic Platform's 90-application umbrella. The module enforces the platform's target of a perfect 100/100 quality score -- a standard that has been achieved and maintained through disciplined automation, genetic algorithm evolution of quality rules, and multi-level self-healing capabilities.
Quality Intelligence operates at the intersection of static analysis, pattern recognition, and autonomous evolution. Every commit, every compilation, and every test run feeds data into the quality scoring engine, which computes a composite score from 13 independent domain assessments. When quality dips below configured thresholds, the Quality Floor Guardian triggers automatic remediation cycles. When quality holds steady, the evolution scanner proactively identifies improvement opportunities that would further strengthen the codebase. The system has eliminated over 905 Quality Debt Points (QDP) through automated CASCADE patterns including Type Mismatch, Dead Code, Empty Check, Timer Replacement, and Nuclear Cache remediation.
The system embodies the platform's NO MERCY doctrine: zero tolerance for incomplete implementations, untested code, or deferred quality debt. Every Quality Debt Point is tracked individually and targeted for elimination through automated healing cycles, with the genetic algorithm continuously evolving rule fitness to improve detection accuracy over generations.
Architecture
The system follows a layered architecture combining 3NL intelligence with evolutionary computing and automated healing pipelines.
+------------------------------------------------------------------+
| QUALITY INTELLIGENCE SYSTEM |
+------------------------------------------------------------------+
| +----------------------------------------------------------+ |
| | 3NL INTELLIGENCE CORE | |
| | +------------+ +-----------+ +---------------+ | |
| | | L1: LOGIC | | L2: NEURAL| | L3: LINGUISTIC| | |
| | | Prolog KB | | Pattern | | NLP Analysis | | |
| | | Inference | | Recogn. | | Commit Msgs | | |
| | +-----+------+ +-----+-----+ +-------+-------+ | |
| | +---------------+-----------------+ | |
| | v | |
| | +-------------------+ | |
| | | FUSION ENGINE | | |
| | | Weighted/Consensus/Attention/Cascade | |
| | +-------------------+ | |
| +----------------------------------------------------------+ |
| |
| +----------------+ +----------------+ +------------------+ |
| | SELF-EVOLUTION | | SELF-HEALING | | GITLAB SYNC | |
| | Genetic Algos | | Auto-fix | | Issue Creation | |
| | Rule Mutation | | Rollback | | MR Integration | |
| | Fitness Eval | | Security Patch | | Quality Dash | |
| +----------------+ +----------------+ +------------------+ |
+------------------------------------------------------------------+
The architecture comprises four major subsystems: the 3NL Intelligence Core provides multi-layer quality analysis fusing logic, neural, and linguistic signals; the Evolution Engine uses genetic algorithms to optimize quality rule populations; the Healing Engine performs multi-level automated remediation with rollback; and the GitLab Sync module maintains real-time integration with issue tracking and merge request workflows.
Key Modules
| Module | Purpose | Lines |
|---|---|---|
PrismaticQualityIntelligence | Main orchestrator GenServer coordinating all subsystems | Core |
PrismaticQualityIntelligence.Application | OTP Application with supervision tree | Boot |
PrismaticQualityIntelligence.ThreeNLCore | 3NL Intelligence Core with fusion engine | Analysis |
PrismaticQualityIntelligence.L1Logic | Prolog-based rule inference and constraint checking | L1 |
PrismaticQualityIntelligence.L2Neural | Pattern recognition and anomaly detection | L2 |
PrismaticQualityIntelligence.L3Linguistic | NLP analysis of commit messages and PRs | L3 |
PrismaticQualityIntelligence.EvolutionEngine | Genetic algorithm engine for quality rule optimization | Evolution |
PrismaticQualityIntelligence.HealingEngine | Multi-level self-healing with rollback capability | Healing |
PrismaticQualityIntelligence.GitLabSync | Real-time GitLab issue and MR synchronization | Integration |
PrismaticQualityIntelligence.PredictiveAnalyzer | Quality degradation prediction before it occurs | Prediction |
PrismaticQualityIntelligence.PatternRecognizer | Anti-pattern detection across the codebase | Detection |
PrismaticQualityIntelligence.TrendAnalyzer | Quality trend analysis across sessions and generations | Trends |
PrismaticQualityIntelligence.IssueManager | Automated GitLab issue lifecycle management | Issues |
PrismaticQualityIntelligence.MRMonitor | Merge request quality gate enforcement | MR Gates |
Configuration
config :prismatic_quality_intelligence,
# Evolution settings
evolution_interval: :timer.hours(1),
population_size: 100,
mutation_rate: 0.15,
crossover_rate: 0.70,
elite_size: 10,
# Healing settings
healing_interval: :timer.minutes(15),
max_fixes_per_cycle: 50,
rollback_enabled: true,
# GitLab settings
gitlab_sync_interval: :timer.minutes(5),
auto_create_issues: true,
auto_close_issues: true,
# 3NL settings
fusion_strategy: :weighted,
l1_weight: 0.30,
l2_weight: 0.40,
l3_weight: 0.30
Environment variables: GITLAB_TOKEN, GITLAB_PROJECT_ID, GITLAB_BASE_URL.
API Reference
# Run 3NL quality analysis across files, commits, and metrics
{:ok, analysis} = PrismaticQualityIntelligence.analyze(%{
files: ["lib/my_app.ex"],
commits: [%{sha: "abc123", message: "Fix bug"}],
metrics: %{quality_score: 95, violation_count: 0}
})
# Check platform-wide quality score across 13 domains
{:ok, score} = PrismaticQualityIntelligence.score()
# => %{total: 100, domains: %{dialyzer: 100, credo: 100, compilation: 100, ...}}
# Run evolution cycle with configurable generations
{:ok, result} = PrismaticQualityIntelligence.evolve(generations: 10)
# => %{improvement: 2.3, generation: 42}
# Multi-level self-healing (reactive, predictive, preventive, autonomous)
{:ok, result} = PrismaticQualityIntelligence.heal([], level: :autonomous)
# Predict quality degradation before it manifests
{:ok, prediction} = PrismaticQualityIntelligence.predict_degradation(%{
recent_commits: 15, avg_change_size: 120
})
# Synchronize quality state with GitLab
{:ok, result} = PrismaticQualityIntelligence.sync_gitlab()
# Per-application quality breakdown
{:ok, apps} = PrismaticQualityIntelligence.per_app_scores()
# => [%{app: :prismatic_kernel, score: 100}, ...]Testing
The application uses ExCoveralls for test coverage with comprehensive testing across all subsystems.
# Run all tests
mix test apps/prismatic_quality_intelligence/test
# Run with coverage reporting
mix test apps/prismatic_quality_intelligence/test --cover
# Run quality checks (format + credo + dialyzer)
cd apps/prismatic_quality_intelligence && mix quality
# CI-mode quality pipeline
cd apps/prismatic_quality_intelligence && mix quality.ci| Test Category | Coverage | What It Verifies |
|---|---|---|
| 3NL Analysis | L1/L2/L3 layers | Fusion strategy correctness, layer independence |
| Evolution Engine | Genetic operators | Selection, crossover, mutation, elite preservation |
| Healing Engine | All 4 levels | Fix application, rollback correctness, safety |
| GitLab Sync | API integration | Issue creation, MR comments, label management |
| Predictive Analyzer | Trend detection | Degradation prediction accuracy |
Integration Points
- Prismatic Safety -- Quality floor enforcement; Guardian triggers healing when score drops below 95%
- Prismatic 3NL -- Provides the 3NL framework for multi-layer NLP and logic processing
- Prismatic Core -- Core platform utilities and shared infrastructure
- Prismatic Tooling -- Mix tasks (
mix quality.gates,mix autoheal.cycle) powered by Quality Intelligence - Prismatic Telemetry -- Quality metrics emitted as telemetry events for monitoring
- Prismatic Claude -- Session lifecycle hooks trigger quality checks automatically at session boundaries
NABLA Compliance
Quality Intelligence operates under full NABLA Infinity epistemic compliance. Every quality score maintains provenance traceability -- scores are derived from specific tool outputs (Dialyzer, Credo, compilation) with timestamps and version metadata. The Signal Plurality axiom is satisfied because quality assessment draws from 13 independent analysis domains, preventing single-source bias. Contradiction Preservation is maintained when domain scores conflict (e.g., high Credo score but low Dialyzer score) by preserving both signals rather than averaging them away. The Unknown Valid axiom is respected by the predictive analyzer, which explicitly reports uncertainty ranges rather than manufacturing false confidence about future quality trajectories.
Performance
| Operation | Expected Duration | Impact |
|---|---|---|
| Full 13-domain quality scan | 50-300ms | Blocking pre-commit |
| 3NL analysis (single file) | 10-50ms | Per-commit analysis |
| Evolution cycle (10 generations) | 1-5s | Background evolution |
| Healing cycle (reactive) | 5-30s | Automated remediation |
| GitLab sync | 100-500ms | Non-blocking background |
| Predictive analysis | 20-100ms | Trend computation |
Quality scoring is optimized for pre-commit gate integration with sub-300ms execution. Evolution and healing cycles run as background processes managed by the OTP supervision tree, with configurable intervals to prevent resource contention during peak development activity.
Related Resources
- Prismatic Credo -- Custom Credo checks specific to platform conventions
- Prismatic Testing -- Test infrastructure feeding coverage data to quality scoring
- Prismatic Traits -- Conceptual parallel: trait-based profiling applied to code quality
- Prismatic Transcendence -- Quality metrics serve as fitness inputs for consciousness evolution
Connect & Contribute
Created by Tomáš Korcak (korczis) | Open Source under GHL