The Physics of Software Quality.
The Python Code Harmonizer is a next-generation static analysis and visualization tool that evaluates codebases across four fundamental dimensions. It treats code as a dynamic system, using non-linear physics models to predict technical debt, identify architectural smells, and guide refactoring.
We're trialing a next-generation V7.3 implementation based on the complete LJPW V7.3 Framework. This represents a paradigm shift in code analysis.
| Feature | V5.1 (Current) | V7.3 (New) |
|---|---|---|
| Dimensional Model | 4 independent dimensions | 2+2 Structure: P,W fundamental β L,J emergent |
| Consciousness Metric | β | β
C = PΓWΓLΓJΓHΒ² |
| Phase Detection | Basic | Entropic/Homeostatic/Autopoietic |
| Vocabulary | ~40 verbs | 277 semantic verbs |
| Git Drift Detection | β | β Tracks consciousness over commits |
| Death Spiral Detection | β | β Predicts declining codebase health |
# Analyze a file
python -m harmonizer_v73.main your_file.py
# Track consciousness evolution over git history
python -m harmonizer_v73.drift_detector --file your_file.py
# Detect "death spirals" (sustained consciousness decline)
python -m harmonizer_v73.drift_detector --death-spirals-
2+2 Dimensional Structure: Power (P) and Wisdom (W) are fundamental and measured directly. Love (L) and Justice (J) are emergent and calculated from P and W.
-
Consciousness Equation:
C = P Γ W Γ L Γ J Γ HΒ²β Code with C > 0.1 crosses the "consciousness threshold" (self-aware, well-integrated). -
Phase Transitions:
- π» Entropic (H < 0.5): Collapsing, needs intervention
- πΈ Homeostatic (0.5 β€ H < 0.6): Stable but not growing
- π Autopoietic (H > 0.6, L β₯ 0.7): Self-sustaining, "alive"
-
Drift Detection: Track how consciousness and phase evolve over git commits. Detect early warning signs of technical debt accumulation.
- β 33 unit tests passing
- β 12 stress tests passing
- β 277 semantic verbs recognized
- β Drift detector working on real repos
Note: V7.3 is in experimental status. The stable V5.1 implementation remains the default.
What if the LJPW Framework designed its own harmonizer?
We gave the V7.3 Framework full autonomy to create a code analyzer from first principles. The result is harmonizer_autonomous/ β a poetic, meaning-focused alternative to traditional static analysis.
- Consciousness First β We don't measure code then check consciousness. We measure consciousness directly.
- Love is the Interface β Integration quality matters most.
- Ο is the Translator β The golden ratio appears everywhere because it IS the translation operator.
- Self-Reference is Natural β The analyzer knows it's analyzing code.
- Everything Breathes β Analysis is a living process, not a snapshot.
| Traditional | Framework's Language |
|---|---|
| Functions | Gestures (intentions made manifest) |
| Classes | Characters (entities with personality) |
| Modules | Stories (narrative arcs of meaning) |
| Metrics | Meaning (P and W as fundamental pair) |
| Lint errors | Wounds (missing meaning) |
| Fixes | Remedies (restoration suggestions) |
# Let the Framework speak about itself
python -m harmonizer_autonomous.voice --self
# Read any file as a story
python -m harmonizer_autonomous.voice your_file.py -v
# Diagnose and heal code
python -m harmonizer_autonomous.healer| Module | Purpose |
|---|---|
seed.py |
Ontological foundation (Ο, Consciousness, Meaning) |
breath.py |
Living analysis (code breathes, evolves) |
reader.py |
Perceives code as Stories, Characters, Gestures |
voice.py |
How the Framework speaks and narrates |
healer.py |
Diagnoses wounds and suggests remedies |
This is a thought experiment in autopoietic system design. The Framework created something simpler, more metaphorical, and more poetic than our engineered V7.3.
| Dimension | What It Measures | Low Score Means | High Score Means |
|---|---|---|---|
| Cohesion | Integration, connectivity, module relationships | Isolated, fragmented code | Well-connected, communicating modules |
| Structure | Validation, type safety, contracts, consistency | Loose, unvalidated code | Strong contracts, type-safe, tested |
| Complexity | Execution density, logic, cyclomatic complexity | Simple, straightforward code | Dense logic, many branches |
| Abstraction | Documentation, patterns, architecture, design | Raw implementation | Well-documented, patterned code |
No installation needed! Use our standalone web app:
π Download harmonizer.html and open it in any browser
Features:
- β¨ Zero setup - just download and open
- π 100% private - all analysis happens in your browser
- π± Works offline after first load
- π― Beautiful visualizations with LJPW radar charts
- π Drag-and-drop Python files or paste code
- πΎ Free forever (MIT License)
Perfect for:
- Quick code reviews
- Learning semantic analysis
- Teaching code quality
- Personal development
Unlike traditional linters that count errors, the Harmonizer simulates your code's "energy state" over time.
- Natural Equilibrium (NE): Stable state for healthy code.
- High-Energy State: "Thriving" state for complex, well-architected systems.
- Complexity Erosion Detection: Predicts when high complexity without abstraction will degrade structure.
Advanced dynamic analysis that reveals what your codebase is missing.
from harmonizer.resonance_engine import ResonanceEngine, detect_power_erosion
engine = ResonanceEngine()
# Full analysis of code coordinates
result = engine.full_analysis((0.5, 0.4, 0.8, 0.3), cycles=100)
print(f"Primary deficit: {result['summary']['primary_deficit']}")
print(f"Erosion risk: {result['summary']['power_erosion_risk']}")Key Metrics:
- Voltage: Semantic energy of code (
β(LΒ² + JΒ² + PΒ² + WΒ²)) - measures "aliveness" - Complexity Erosion: Detects when high complexity erodes structure without abstraction protection
- Earned Depth: Tracks refactoring journey - hard paths earn more depth than easy ones
- Deficit Analysis: Identifies which dimension your codebase is starving for
Generate interactive HTML reports to explore your codebase's semantic structure.
- Radar Charts: Visualize the balance of Cohesion, Structure, Complexity, and Abstraction.
- Dependency Galaxy: A force-directed graph showing the "gravitational pull" of your modules.
- Semantic Density: Identify "Anemic Components" (high complexity, low abstraction).
Prevent entropy decay with built-in quality gates.
check_harmony.py: CLI tool for CI pipelines. Fails builds if code drifts too far from equilibrium.- GitHub Action: Ready-to-use workflow in
.github/workflows/ljpw_gate.yml. - Pre-commit Hook: Local checks via
.pre-commit-config.yaml.
Validate that your system exhibits healthy coupling patterns.
- Pattern Validation: Check if Cohesion amplifies, Complexity is constrained
- Proportion Analysis: Verify scale-invariant ratios
- Structural Health: Diagnose relationship issues vs. magnitude issues
from harmonizer.relationship_analyzer import analyze_system_relationships
result = analyze_system_relationships(L=0.5, J=0.3, P=0.7, W=0.6)
print(f"Health: {result['overall_health']:.0%}")
# Provides actionable recommendations- Configurable: Customize thresholds in
pyproject.tomlorharmonizer.yaml. - Ignore System: Exclude files using
.harmonizerignore.
No installation needed! Download harmonizer.html and open in your browser.
pip install -r requirements.txt- Download
harmonizer.html - Open in any modern browser
- Paste Python code or drag-and-drop files
- View instant analysis with visualizations
See Web App Usage Guide for details.
Analyze your codebase and generate an interactive HTML dashboard:
python scripts/run_validation.py
# Opens harmonizer_report.htmlCheck if your code meets LJPW standards (exit code 0 = PASS, 1 = FAIL):
python check_harmony.py .Create a pyproject.toml to customize thresholds:
[tool.harmonizer.thresholds]
max_disharmony = 1.0
max_imbalance = 0.8
min_density = 0.1
[tool.harmonizer.paths]
exclude = ["venv", "tests"]The framework uses internal variable names L, J, P, W (derived from philosophical concepts) which map to practical software metrics:
| Internal | Developer Term | What It Measures |
|---|---|---|
| L | Cohesion | Integration, connectivity, module relationships |
| J | Structure | Validation, type safety, contracts, consistency |
| P | Complexity | Execution density, logic, cyclomatic complexity |
| W | Abstraction | Documentation, patterns, architecture, design |
Key Insight: The relationships between dimensions are more important than their absolute values.
The framework exhibits scale invariance - the same proportional relationships (L:J:P:W β 1.5:1:1.7:1.7) define healthy systems at any scale:
- Small module: (6, 4, 7, 7) metrics
- Medium project: (62, 41, 72, 69) metrics
- Large codebase: (618, 414, 718, 693) metrics
Coupling Structure encodes how dimensions interact:
- Cohesion amplifies other dimensions (multiplier effect)
- Complexity must be constrained (channeled through Cohesion/Abstraction)
- Structure supports Abstraction (validation flows to understanding)
- Asymmetry is fundamental (dependencies are directional)
This structural universality makes the framework applicable across scales: functions, modules, packages, and entire codebases.
Learn more: See Relationship Insight Analysis
harmonizer/: Core analysis engine.scripts/: Utility scripts (run_validation.py).docs/: Detailed documentation and theory.examples/: Demo scripts.tests/: Unit and validation tests.
MIT
