Definition
The Fitness Score is a composite metric on a 0.0 to 1.0 scale that quantifies the platform's overall evolutionary health. It aggregates quality domain scores, test coverage, architectural compliance, documentation completeness, security posture, and evolutionary readiness into a single authoritative number. The score serves as the primary decision driver for platform evolution: scores above 0.99 indicate apex fitness and require monitoring only; scores between 0.95 and 0.99 trigger increased investigation; scores below 0.95 trigger emergency intervention including commit blocking and escalation to supreme authority.
The Fitness Score concept draws from evolutionary biology's concept of fitness as a measure of an organism's ability to survive and reproduce in its environment. In the platform context, "fitness" measures the system's ability to maintain quality, evolve capabilities, and resist regression. Unlike simple metrics that measure a single dimension (such as test coverage or compilation warnings), the Fitness Score provides a holistic view that accounts for the interplay between quality domains, documentation coverage, agent compliance, and architectural integrity.
The score is not merely informational -- it is an enforcement mechanism. The Quality Floor Guardian monitors the Fitness Score continuously and triggers automatic responses when it drops below configured thresholds. This creates a self-correcting feedback loop where quality degradation is detected and addressed before it can compound into systemic problems. The Fitness Score thus functions as both a measurement instrument and a governance tool, embodying the NO MERCY, NO DOUBTS doctrine's requirement that quality standards are mechanically enforced rather than aspirationally documented.
Interactive Fitness Dashboard
Platform Fitness Score
Threshold Classification
Component Score Breakdown
Generation Progression
Cache Hit Rate: %
WebSockets:
Failed Requests:
Avg Response: ms
Cache Size:
MCP Enabled:
Historical Context
The concept of software fitness metrics has its roots in the software engineering measurement programs of the 1980s and 1990s. Early metrics like McCabe's cyclomatic complexity (1976), Halstead's software science (1977), and the COCOMO cost model (1981) attempted to quantify software quality through single-dimension measurements. These metrics were useful for specific purposes but failed to capture the holistic health of a software system.
The next generation of metrics attempted composite scoring. The SQALE method (Software Quality Assessment based on Lifecycle Expectations, 2010) introduced the concept of technical debt as a monetary value, while SonarQube popularized quality gates -- boolean pass/fail thresholds on metric combinations. These approaches moved beyond single metrics but still treated quality as a compliance checkbox rather than an evolutionary process.
The Prismatic Platform's Fitness Score represents a third generation of quality measurement, drawing inspiration from evolutionary computing's fitness functions and complex adaptive systems theory. Instead of measuring static compliance, the Fitness Score measures the system's capacity for continued evolution -- its ability to absorb changes without degradation, maintain quality under pressure, and improve through self-corrective mechanisms. This dynamic perspective reflects the platform's commitment to autonomous evolution through the SEADF framework.
The evolution from Quality Score (100-point scale, single domain) to Fitness Score (0.0-1.0 scale, multi-domain) occurred during the platform's Generation 14-15 transition, when it became clear that quality alone was insufficient to guide evolutionary decisions. A platform could score 100/100 on quality while having poor documentation, outdated agents, or weak security posture. The Fitness Score was designed to capture this broader picture.
Technical Architecture
The Fitness Score is computed as a weighted average of component scores, each normalized to the 0.0-1.0 range:
| Component | Weight | Current Score | Measurement Method |
|---|---|---|---|
| Quality Score | 30% | 100/100 (1.0) | 13 quality domains, zero violations |
| Test Coverage | 15% | 5,864 test files | File count and coverage percentage |
| Documentation | 10% | 11,308 docs | Doc file count and completeness |
| Agent Compliance | 15% | 530/530 AIAD agents | AIAD standard adherence rate |
| Consciousness Traits | 10% | 11 traits at 0.998 | Trait fitness sub-scores |
| Architectural Compliance | 10% | OTP-first adherence | Pattern compliance checks |
| Security Posture | 10% | Color Team coverage | Security domain assessment |
The composite formula:
fitness = sum(component_score[i] * weight[i]) for i in componentsdefmodule Prismatic.Evolution.FitnessCalculator do
@moduledoc """
Computes the platform's composite fitness score from
individual component assessments. Score ranges from
0.0 (critical) to 1.0 (apex). The calculator implements
weighted aggregation with configurable component weights
and provides classification into fitness categories that
drive automatic platform responses.
"""
@type fitness_classification :: :apex | :healthy | :warning | :critical | :emergency
@type component_scores :: %{
quality_score: float(),
test_coverage: float(),
documentation: float(),
agent_compliance: float(),
consciousness_traits: float(),
architectural_compliance: float(),
security_posture: float()
}
@component_weights %{
quality_score: 0.30,
test_coverage: 0.15,
documentation: 0.10,
agent_compliance: 0.15,
consciousness_traits: 0.10,
architectural_compliance: 0.10,
security_posture: 0.10
}
@spec compute(component_scores()) :: float()
def compute(component_scores) do
@component_weights
|> Enum.reduce(0.0, fn {component, weight}, acc ->
score = Map.get(component_scores, component, 0.0)
acc + score * weight
end)
|> Float.round(4)
end
@spec classify(float()) :: fitness_classification()
def classify(fitness) when fitness >= 0.99, do: :apex
def classify(fitness) when fitness >= 0.95, do: :healthy
def classify(fitness) when fitness >= 0.90, do: :warning
def classify(fitness) when fitness >= 0.80, do: :critical
def classify(_fitness), do: :emergency
@spec compute_quality_component(map()) :: float()
def compute_quality_component(quality_data) do
domains = [
:dialyzer, :credo, :compilation, :datetime_precision,
:guard_functions, :impl_coverage, :memory_safety,
:performance, :regression_prevention, :timing_patterns,
:todo_management, :typespec_coverage, :unsafe_map_access
]
violations = Enum.sum(Enum.map(domains, &Map.get(quality_data, &1, 0)))
max(0.0, 1.0 - violations * 0.01)
end
@spec compute_delta(float(), float()) :: %{delta: float(), direction: atom()}
def compute_delta(current, previous) do
delta = Float.round(current - previous, 4)
direction = cond do
delta > 0.001 -> :improving
delta < -0.001 -> :declining
true -> :stable
end
%{delta: delta, direction: direction}
end
endThreshold Response Matrix
The Fitness Score drives automatic platform responses through a tiered threshold system:
| Range | Classification | Response Level | Actions |
|---|---|---|---|
| 0.99-1.00 | APEX | OPTIMAL | Monitor only, no intervention needed |
| 0.95-0.99 | HEALTHY | WARNING | Alert, investigation triggered, increased monitoring |
| 0.90-0.95 | WARNING | CRITICAL | Auto-evolution trigger, quality gates tightened |
| 0.80-0.90 | CRITICAL | EMERGENCY | Commit blocking, escalation to supreme authority |
| < 0.80 | EMERGENCY | LOCKDOWN | Full platform lockdown, all deployments halted |
Each threshold transition emits telemetry events that drive alerting, logging, and automatic response orchestration:
defmodule Prismatic.Evolution.FitnessMonitor do
@moduledoc """
Continuous fitness monitoring GenServer that polls component
scores at configurable intervals and triggers automatic
responses when thresholds are crossed. Integrates with the
Quality Floor Guardian for enforcement and Quality DNA for
cross-session persistence.
"""
use GenServer
@check_interval :timer.minutes(5)
@impl GenServer
@spec init(map()) :: {:ok, map()}
def init(state) do
schedule_check()
{:ok, state}
end
@impl GenServer
def handle_info(:check_fitness, state) do
components = gather_component_scores()
fitness = Prismatic.Evolution.FitnessCalculator.compute(components)
classification = Prismatic.Evolution.FitnessCalculator.classify(fitness)
:telemetry.execute(
[:prismatic, :evolution, :fitness],
%{score: fitness},
%{classification: classification, components: components}
)
delta = Prismatic.Evolution.FitnessCalculator.compute_delta(
fitness,
Map.get(state, :last_fitness, fitness)
)
handle_classification(classification, fitness, delta)
persist_to_quality_dna(fitness, components, classification)
schedule_check()
{:noreply, %{state |
last_fitness: fitness,
last_classification: classification,
last_check: DateTime.utc_now()
}}
end
defp handle_classification(:apex, _fitness, _delta), do: :ok
defp handle_classification(:healthy, fitness, delta) do
if delta.direction == :declining do
Prismatic.Alerts.send(:fitness_declining, %{score: fitness, delta: delta})
end
end
defp handle_classification(:warning, fitness, _delta) do
Prismatic.AutoEvolve.trigger_scan()
Prismatic.Alerts.send(:fitness_warning, %{score: fitness})
end
defp handle_classification(:critical, fitness, _delta) do
Prismatic.AutoEvolve.trigger_scan()
Prismatic.Alerts.send(:fitness_critical, %{score: fitness})
end
defp handle_classification(:emergency, fitness, _delta) do
PrismaticSafety.QualityFloorGuardian.block_commits()
Prismatic.Alerts.escalate(:supreme, %{score: fitness})
end
defp schedule_check do
Process.send_after(self(), :check_fitness, @check_interval)
end
defp gather_component_scores do
%{
quality_score: Prismatic.Quality.current_score() / 100,
test_coverage: Prismatic.Testing.coverage_ratio(),
documentation: Prismatic.Docs.completeness_ratio(),
agent_compliance: Prismatic.AIAD.compliance_ratio(),
consciousness_traits: Prismatic.Consciousness.trait_fitness(),
architectural_compliance: Prismatic.Architecture.compliance_ratio(),
security_posture: Prismatic.Security.posture_score()
}
end
defp persist_to_quality_dna(fitness, components, classification) do
data = %{
fitness: fitness,
classification: classification,
components: components,
timestamp: DateTime.utc_now() |> DateTime.to_iso8601()
}
path = ".claude/quality-dna/current-state.json"
File.write!(path, Jason.encode!(data, pretty: true))
end
endArchitecture and Data Flow
The Fitness Score system is architecturally distributed across several platform components:
SEADF Integration: The Self-Evolving Autonomous Development Framework is the primary orchestrator of fitness computation. It coordinates data collection from all quality domains, performs the weighted aggregation, and publishes the result to Quality DNA for cross-session persistence.
Quality DNA Persistence: The computed fitness score is persisted in .claude/quality-dna/current-state.json, ensuring continuity across LLM sessions and development cycles. Each session loads the previous fitness score and can compare current state against historical trends.
Quality Floor Guardian: This autonomous monitoring system watches the fitness score and enforces threshold-based responses. It runs as a supervised GenServer that polls component scores at configurable intervals.
Generation Advancement: Fitness score improvements drive generation transitions. When the platform achieves and sustains improved fitness across all components, the SEADF system evaluates whether a generation advancement is warranted.
Quality Domains (13) βββ
Test Files (5,864) βββ€
Documentation (11,308)βββ€ββ SEADF Aggregator ββ> Fitness Score ββ> Quality DNA
Agent Registry (530) βββ€ |
Consciousness (11) βββ€ v
Architecture Check βββ€ Quality Floor Guardian
Security Assessment βββ |
v
Threshold Response
(alert/block/lockdown)Current Platform State
Within the Prismatic Platform, the current fitness score is 0.9995 (apex), achieved at Generation 19 (Ecosystem Expansion). This score reflects the culmination of 19 generations of evolutionary improvement.
Component Breakdown (Current State)
| Component | Score | Details |
|---|---|---|
| Quality Score | 1.000 | 100/100 across all 13 quality domains, zero violations |
| Test Coverage | 0.998 | 5,864 test files covering all business logic |
| Documentation | 0.999 | 11,308 documentation files across all apps |
| Agent Compliance | 1.000 | All 530 AIAD agents compliant with standard |
| Consciousness Traits | 0.998 | 11 traits operational at near-perfect fitness |
| Architectural Compliance | 0.999 | OTP-first patterns enforced across 115 apps |
| Security Posture | 0.998 | 20 Color Team agents across 6 teams active |
Historical Fitness Trajectory
The fitness score has followed an upward trajectory across generations:
| Generation | Fitness | Key Advancement |
|---|---|---|
| Gen 1-5 | 0.60-0.75 | Foundation, basic quality gates |
| Gen 6-10 | 0.80-0.90 | Quality domains, testing framework |
| Gen 11-14 | 0.90-0.95 | NM/ND doctrine, NABLA integration |
| Gen 15-17 | 0.95-0.998 | Color Teams, consciousness traits |
| Gen 18 | 0.999 | Full Autonomy, perfect quality score |
| Gen 19 | 0.9995 | Ecosystem Expansion, 4 OSS packages, 13-layer Trinity Gate |
Enforcement Integration
The fitness score integrates with the platform's enforcement mechanisms:
defmodule Prismatic.Hooks.FitnessGate do
@moduledoc """
Pre-commit hook integration that checks the current fitness
score before allowing commits. Blocks commits when the
platform is in WARNING, CRITICAL, or EMERGENCY state.
"""
@spec check() :: :ok | {:error, String.t()}
def check do
fitness = Prismatic.Evolution.FitnessCalculator.current()
case Prismatic.Evolution.FitnessCalculator.classify(fitness) do
:apex -> :ok
:healthy -> :ok
:warning -> {:error, "Fitness WARNING (#{}): investigate before committing"}
level -> {:error, "Fitness #{} (#{}): commits BLOCKED"}
end
end
endComponent Measurement Details
Each component is measured through specific mechanisms:
Quality Score Component (30%)
The quality score measures compliance across 13 quality domains. Each domain contributes equally, and any violation reduces the score:
| Domain | Measurement | Tool |
|---|---|---|
| Dialyzer | Type violations | mix dialyzer |
| Credo | Static analysis violations | mix credo --strict |
| Compilation | Warning count | mix compile --warnings-as-errors |
| DateTime Precision | Precision violations | Custom check |
| Guard Functions | Improper guard usage | Custom check |
| @impl Coverage | Missing @impl annotations | Custom check |
| Memory Safety | Unsafe patterns | Custom check |
| Performance | Anti-pattern detection | Custom check |
| Regression Prevention | Missing regression tests | Custom check |
| Timing Patterns | Process.sleep usage | Custom check |
| TODO Management | Unresolved TODOs | Custom check |
| Typespec Coverage | Missing @spec | Custom check |
| Unsafe Map Access | map.key without guard | Custom check |
Agent Compliance Component (15%)
Measures AIAD standard adherence across all 530 agents:
defmodule Prismatic.AIAD.ComplianceChecker do
@moduledoc """
Validates AIAD agent compliance with the standard specification.
Checks for required fields, enforcement blocks, and doctrine references.
"""
@spec compliance_ratio() :: float()
def compliance_ratio do
agents = load_all_agents()
compliant = Enum.count(agents, &compliant?/1)
compliant / max(length(agents), 1)
end
@spec compliant?(map()) :: boolean()
defp compliant?(agent) do
has_required_fields?(agent) and
has_enforcement_block?(agent) and
has_doctrine_reference?(agent)
end
endBest Practices
Monitor Trends, Not Snapshots: A single fitness score reading is less informative than the trend over time. A score of 0.98 that was 0.99 yesterday indicates regression, while 0.98 rising from 0.95 indicates improvement. Track deltas between measurements.
Investigate Component Drops: When the composite score drops, identify which component caused the decline. A drop in test coverage has different remediation than a drop in architectural compliance. The component breakdown provides diagnostic precision.
Calibrate Weights Periodically: Component weights should reflect current platform priorities. During a security-focused phase, increasing the security posture weight ensures the fitness score is sensitive to security improvements or regressions.
Automate Response Actions: Each threshold crossing should trigger automatic actions -- not just alerts. The platform's AutoEvolve and AutoHeal mechanisms should activate based on fitness score thresholds, not manual intervention.
Persist Historical Data: Maintain a time series of fitness scores and component breakdowns for retrospective analysis. This data reveals patterns in quality regression and helps predict future issues.
Common Pitfalls
Goodhart's Law: When the fitness score becomes the target rather than a measure, teams may optimize for the score rather than actual quality. Ensure the score's components genuinely reflect platform health.
Component Masking: A high composite score can mask a critical deficiency in a single component. A fitness of 0.96 with a security posture of 0.50 is dangerous even though the composite looks healthy. Always review component-level scores.
Stale Measurements: If component scores are not refreshed frequently, the fitness score may not reflect current reality. Ensure all component measurements are current before making decisions based on the composite score.
Threshold Fatigue: If thresholds trigger too many alerts without actionable consequences, teams learn to ignore them. Set thresholds that require response and ensure response mechanisms are effective.
Linear Weighting Limitations: The weighted average formula treats all components as independent, but in reality they are correlated. A drop in test coverage often precedes a drop in quality score. Consider implementing correlation-aware scoring in future iterations.
Related Concepts
- Generation - Evolution epochs measured and advanced by fitness improvements
- SEADF - Framework computing and managing fitness scores across all domains
- Quality Floor Guardian - Monitoring system enforcing fitness thresholds
- Quality DNA - Cross-session persistence of fitness history and trends
- AutoEvolve - System driving fitness score improvement through optimization
- Consciousness Traits - Traits contributing to fitness at 0.998 sub-score
- Quality Gates - Enforcement pipeline measuring quality component inputs
- CASCADE Pattern - Quality patterns that drove fitness improvements
- NM/ND Doctrine - Governing framework mandating fitness enforcement
- Credo - Static analysis contributing to quality component
- Dialyzer - Type checking contributing to quality component
See Also
- Architecture - Platform architecture overview
- Technologies - Technology stack details
- Agents - AIAD agents contributing to fitness components
Connect & Contribute
Created by Tomas Korcak (korczis) | Open Source under GHL