Constraint Alignment System — a pure, multi-domain constraint health engine.
CAS maps any observable system into a unified four-dimensional state:
| Dimension | Variable | Meaning |
|---|---|---|
| Hard admissibility | A_hard | Binary gate — constraint is either installed or it is not |
| Structure | H | Coherence of the governing framework |
| Circulation | Csigma | Flow of resources and information through the system |
| Transfer | T | Ability to execute across system boundaries |
| Pressure | P | Combined external + internal load (weighted merge) |
From those five values CAS derives a failure signature, a priority classification, and a composite value score V.
| Domain | Entry point |
|---|---|
| Horse racing | map_racing_to_cas() |
| FSI (bug/constraint) | map_fsi_to_cas() |
| Reseller margin | map_reseller_to_cas() |
| AEGIS (AI governance) | map_aegis_to_cas() |
Each domain mapper normalizes its raw inputs into the [0, 1] CAS space and returns a DomainProjectionResult with a full observation trace.
from cas_engine import map_racing_to_cas, evaluate_cas_priority, derive_V_from_CAS
result = map_racing_to_cas({
"speed_figure": 105,
"route_confidence": 0.80,
"entropy": 0.25,
"jockey_edge": 0.60,
"trainer_form": 0.70,
"pace_fit": 0.75,
"class_drop": 0.55,
"field_size": 9,
"surface_match": True,
"distance_match": True,
})
print(evaluate_cas_priority(result.cas_state))
print(derive_V_from_CAS(result.cas_state))| Function | Purpose |
|---|---|
compute_failure_signature() |
Returns sigma values for all five dimensions |
classify_failure_mode() |
Dominant failure mode string |
distinguish_Csigma_vs_T() |
Separates circulation failure from transfer failure |
split_Ahard_vs_Asoft() |
Hard constraint vs soft constraint gap |
simulate_parameter_shift() |
What-if: shift one input and measure V change |
run_batch_evaluation() |
Compare CAS win-rate vs baseline across a case set |
validate_cas_invariants() |
Confirm all state values are in [0, 1] |
python test_cas_engine.py17 tests covering: state construction, failure signature, monotonicity, domain mappings, validation, batch evaluation, parameter shift, and invariant checking.
- Zero external dependencies (pure stdlib)
- All weights are in
CASCalibrationConfig— transparent, adjustable, not baked in CASObservationTracerecords every mapping step for auditability- Frozen dataclasses throughout — state is immutable
CAS measures constraint alignment. It does not predict outcomes or prescribe actions. All thresholds and targets are provided by the analyst, not embedded in the engine.
Engineering tool. Not a guarantee of any outcome.