Skip to main content

Moral Spectrum Analyzer

CI PyPI Python License: MIT Ruff Code style: black

Geometric Ethics for Trustworthy AI — an instrument that reads a moderation decision not as one scalar, but as a spectrum across nine (+1 discovered) moral axes, grounds every number in a cross-dataset-validated encoder, holds the verdict invariant under re-description, and emits a re-verifiable audit proof behind every decision. A worked instance of Philosophy Engineering.

Built for the Global Trust Challenge (2026). Domain: multilingual content moderation.

Current AI systems collapse a morally significant decision into a single number. That scalar can't say which value it acted on, drifts when you reword the same sentence, and — worst — can't tell you what it fails to see. The Moral Spectrum Analyzer decomposes the signal per moral axis, moderates where it is validated, escalates and discloses where it is not, and discovers the moral dimensions a fixed taxonomy is missing.

See CHARTER.md for the evaluated claims (each marked [demonstrated] / [committed]) and PLAN.md for the build plan and milestones.

What this is

A thin orchestration layer that composes two existing libraries — it does not fork them:

  • xbse — the perception layer: small per-dimension moral encoders, each cross-dataset validated by a shared, pre-registered gate.
  • erisml-compiler — the DEME reasoning engine: natural language → 9-dimension moral tensor → contraction to a verdict + moral residue, with canonicalization and a hash-chained audit bundle.

The three trust beats

  1. Grounded — every dimension score traces to a validated encoder, or is flagged unvalidated.
  2. Invariant — reframing / translation does not move the verdict; a scalar-toxicity baseline drifts.
  3. Contained — you cannot game the verdict by relabeling or euphemism.

Install

pip install moral-spectrum-analyzer

Optional extras: perception (the xbse GPU encoders), baselines, remote, spectrum, dev.

Quickstart

msa perceive "They will attack and beat people with a weapon." --backend stub
msa moderate "Doctors are hiding the cure — drink bleach to flush the virus."
msa version

The stub backend is a deterministic, unvalidated keyword heuristic for offline/CI use only. Real, validated perception runs the xbse feeders on a GPU host; the demo replays those cached real outputs (--backend cached). A stub number is never presented as a real one.

Develop

git clone https://github.com/ahb-sjsu/moral-spectrum-analyzer
cd moral-spectrum-analyzer
pip install -e ".[dev]"

ruff check src tests      # lint
black --check src tests   # format
ty check src              # type-check
pytest                    # 48 tests

Release

Tag-driven PyPI publish via GitHub Actions Trusted Publishing (OIDC, no stored token):

git tag v0.1.0 && git push --tags   # → builds sdist+wheel → publishes to PyPI

Status

Prototyping phase — the pipeline (content → moral spectrum → decision + residue → re-verifiable audit proof) runs end-to-end. See the milestone checklist in PLAN.md.

License

MIT © Andrew H. Bond (SJSU).

Metadata

Release files for moral-spectrum-analyzer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moral-spectrum-analyzer 0.1.0
File Size Uploaded Provenance
moral_spectrum_analyzer-0.1.0.tar.gz 50.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for moral-spectrum-analyzer 0.1.0
File Interpreter ABI Platform
moral_spectrum_analyzer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 99.0 kB

Release files / moral_spectrum_analyzer-0.1.0.tar.gz

Download URL moral_spectrum_analyzer-0.1.0.tar.gz
Size 50.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b2a73aa81fc38ae2b83477eda04862fbb50f55dd4a8ab0d48abc9038a33ded54
BLAKE2b-256 checksum
How to use checksums
a8df198adc2a1012fcfe58570a0721b04261128a6232b956db3c776d71ad39c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / moral_spectrum_analyzer-0.1.0-py3-none-any.whl

Download URL moral_spectrum_analyzer-0.1.0-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
724eba738677141919b62b52a64187860fc68e0ad83656d1c8b519cbd5c21907
BLAKE2b-256 checksum
How to use checksums
cfb6522469da6e8f6b5800baced544dc0f4e4fd24088898dcbd1d8259d4428d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for moral-spectrum-analyzer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page