Skip to main content

Audit a codebase for energy

You do not have to rewrite anything to get value from Lux. The lift and audit paths analyze foreign code as-is.

Audit

lux audit path/to/project

Works across 14 languages: C, JavaScript, TypeScript, Ruby, Python, HTML, CSS/SCSS, PHP, Go, SQL, Dart, Rust, YAML, JSON.

The recommendation engine runs a dozen-plus detectors:

DetectorCatches
Nested-loop complexityO(n²) where O(n) would serve
Allocation in loopper-iteration heap churn
String concat in loopquadratic string building
Linear searchscans where a hash/map would serve
Loop-invariant recomputationwork hoisted out of the loop
Missing early exitfull scans after the answer is found
N+1 queriesper-row database round-trips
Reallocation growthunsized buffers growing one push at a time
Deep field access in hot loopsrepeated pointer-chasing
Clone/slice in loopsneedless copies per iteration

Each finding carries a category, severity, and an estimated savings factor — an estimate from the cost model, labeled as such.

Lift

When you do want a conversion, lift translates foreign code to .lux:

lux lift legacy.js              # analyze + show the lifted Lux
lux lift legacy.js --convert    # write the .lux file

Lifted output is a starting point, not a guarantee — review it like any generated code. The same analysis is exposed to AI clients through lux-mcp, so an agent can audit and lift on your behalf.

Why this is the adoption path

An audit costs nothing and commits you to nothing: the report stands on its own even if you never write a line of Lux. Energy waste you can name is energy waste you can fix — in any language.