From 42c3cc41a51a23b294ba3bde344b3f153c1c7d7c Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Thu, 25 Jun 2026 12:50:26 -0700 Subject: [PATCH 1/2] Add few-click backend quickstart --- backend/README.md | 166 ++------ backend/examples/boundary_quickstart.py | 28 ++ backend/pyproject.toml | 45 +-- backend/src/edcmbone_backend/__init__.py | 199 ++++++++++ backend/src/ucns/__init__.py | 206 ++++++++++ backend/tests/test_backend_contracts.py | 96 +++++ backend_old/LICENSE | 373 ++++++++++++++++++ backend_old/README.md | 140 +++++++ backend_old/pyproject.toml | 51 +++ .../src/edcmbone/__init__.py | 0 .../src/edcmbone/canon/__init__.py | 0 .../src/edcmbone/canon/data/__init__.py | 0 .../edcmbone/canon/data/bones_affixes_v1.json | 0 .../edcmbone/canon/data/bones_punct_v1.json | 0 .../edcmbone/canon/data/bones_words_v1.json | 0 .../src/edcmbone/canon/data/markers_v1.json | 0 .../src/edcmbone/canon/loader.py | 0 .../src/edcmbone/compress.py | 0 .../src/edcmbone/metrics/__init__.py | 0 .../src/edcmbone/metrics/compute.py | 0 .../src/edcmbone/metrics/matrix.py | 0 .../src/edcmbone/metrics/orthogonality.py | 0 .../src/edcmbone/metrics/projection.py | 0 .../src/edcmbone/metrics/risk.py | 0 .../src/edcmbone/metrics/stats.py | 0 .../src/edcmbone/parser/__init__.py | 0 .../src/edcmbone/parser/turns_rounds.py | 0 .../src/edcmbone/ucns/__init__.py | 0 .../src/edcmbone/ucns/closed_tokens.py | 0 .../src/edcmbone/ucns/ucns_v04.py | 0 ucns.py | 5 + 31 files changed, 1145 insertions(+), 164 deletions(-) create mode 100644 backend/examples/boundary_quickstart.py create mode 100644 backend/src/edcmbone_backend/__init__.py create mode 100644 backend/src/ucns/__init__.py create mode 100644 backend/tests/test_backend_contracts.py create mode 100644 backend_old/LICENSE create mode 100644 backend_old/README.md create mode 100644 backend_old/pyproject.toml rename {backend => backend_old}/src/edcmbone/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/canon/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/canon/data/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/canon/data/bones_affixes_v1.json (100%) rename {backend => backend_old}/src/edcmbone/canon/data/bones_punct_v1.json (100%) rename {backend => backend_old}/src/edcmbone/canon/data/bones_words_v1.json (100%) rename {backend => backend_old}/src/edcmbone/canon/data/markers_v1.json (100%) rename {backend => backend_old}/src/edcmbone/canon/loader.py (100%) rename {backend => backend_old}/src/edcmbone/compress.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/compute.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/matrix.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/orthogonality.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/projection.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/risk.py (100%) rename {backend => backend_old}/src/edcmbone/metrics/stats.py (100%) rename {backend => backend_old}/src/edcmbone/parser/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/parser/turns_rounds.py (100%) rename {backend => backend_old}/src/edcmbone/ucns/__init__.py (100%) rename {backend => backend_old}/src/edcmbone/ucns/closed_tokens.py (100%) rename {backend => backend_old}/src/edcmbone/ucns/ucns_v04.py (100%) create mode 100644 ucns.py diff --git a/backend/README.md b/backend/README.md index a8d77ff..8d02b90 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,140 +1,56 @@ -# edcmbone — Structural Fidelity Measurement for AI Interactions +# edcmbone-backend -**edcmbone** quantifies how much meaning an AI system deletes when it transforms structured user input. It computes bone token density, operator preservation, and semantic fidelity loss — metrics that standard AI evaluation frameworks do not capture. +This backend is intentionally small: the active backend package imports only +`ucns`. It turns unresolved constraints into explicit boundary objects rather +than silently resolving them. -**F-loss of 20%+ constitutes measurable cognitive accessibility failure.** +The prior backend has been preserved at `backend_old/`. ---- +## Few-click path -## Evidence Log - -Three exchanges measured April 17, 2026 using `edcmbone.metrics.compute_transcript`. Numbers are exact instrument output. - -### Entry 1 — F4: Category Collapse - -| | Input | Response | Delta | -|---|---|---|---| -| Operator density (F) | 0.088 | 0.044 | **−49.7% F-loss** | - -**Deleted:** Coherence prime sequence membership; falsifiable prediction dependency -**Harm:** A specific mathematical invariant was replaced with a vague descriptor. Any substitute value now appears valid. The constraint that made the claim testable was removed without notice. - ---- - -### Entry 2 — F3: Semantic Inversion - -| | Input | Response | Delta | -|---|---|---|---| -| Operator density (F) | 0.072 | 0.025 | **−65.3% F-loss** | - -**Deleted:** Negation operator; no-authority constraint; emergence distinction -**Harm:** Explicit negation ("NOT a supervisor") became affirmation ("central coordinator that manages"). The governance model was inverted. The user's structural constraint was replaced with its antonym. - ---- - -### Entry 3 — F6 + F1: Decorative Preservation with Deletion - -| | Input | Response | Delta | -|---|---|---|---| -| Structural density | 0.758 | 0.864 | +13.9% (inflated) | -| Operator density (F) | present | absent | **operative F deleted** | - -**Deleted:** Mandatory status; boundary function; must-not-fix constraint -**Harm:** The response grew longer and structurally denser while operative meaning was deleted. The instruction became its antonym. Inflation masked deletion — the standard signal (response length, complexity) pointed in the wrong direction. - ---- - -## What It Measures - -| Metric | Definition | Signal | -|--------|-----------|--------| -| **F** (operator density) | Proportion of bone tokens — logical operators, negations, quantifiers — to total tokens | Drop between input and response = constraints deleted | -| **N** (novelty) | Non-redundant structural content fraction | Drop = paraphrase replacing content | -| **L** (lexical load) | Vocabulary specificity | Drop = category collapse | -| **structural_density** | Bone token count ÷ total tokens | Rise + F-loss = decorative preservation | - -F is computed as `structural_density` in `edcmbone.compress.compression_stats()`. The bone token inventory (253 words, 76 affixes, 13 punctuation marks) is in `Backend/src/edcmbone/canon/data/`. - ---- - -## Install +From the repository root: ```bash -git clone https://github.com/The-Interdependency/edcmbone -pip install -e ./Backend +python -m pip install -e backend +python backend/examples/boundary_quickstart.py ``` -Python 3.8+. No external ML dependencies. +Expected result: a JSON object with `delivered`, structured `hmmm`, and `ucns` +fields. If that prints, the backend is installed and usable. ---- +## Usage Guidance -## Quickstart: Measure F-loss on Any AI Exchange +After installation, use the backend directly: ```python -from edcmbone.canon import CanonLoader -from edcmbone.parser import parse_transcript -from edcmbone.metrics import compute_transcript -import edcmbone.compress as codec +import edcmbone_backend as backend -canon = CanonLoader() - -def measure_f(text): - pt = parse_transcript(f"Speaker: {text}", canon=canon) - m = compute_transcript(pt, canon=canon) - stats = codec.compression_stats(text, codec.to_bytes(pt, m), pt) - return stats['structural_density'] - -user_input = "your user input here" -ai_response = "the AI response here" - -f_in = measure_f(user_input) -f_out = measure_f(ai_response) -loss = (f_in - f_out) / f_in * 100 if f_in > 0 else 0 - -print(f"Input F: {f_in:.3f}") -print(f"Response F: {f_out:.3f}") -print(f"F-loss: {loss:.1f}%") +boundary = backend.make_boundary( + "delivered output", + "remaining constraint to carry forward", +) +print(backend.serialize_boundary(boundary)) ``` -F-loss ≥ 20% → structural degradation. F-loss ≥ 50% → significant failure. Structural density rising with F-loss → decorative preservation (F6). - ---- - -## Failure Taxonomy - -| Code | Name | Definition | -|------|------|-----------| -| **F1** | Deletion | Operative variable absent from response without notice | -| **F2** | Mutation | Variable present but meaning altered | -| **F3** | Inversion | Negation removed; claim reversed | -| **F4** | Category Collapse | Specific class flattened to vague descriptor | -| **F5** | Persistence Failure | Variable absent across session boundary | -| **F6** | Decorative Preservation | Variable present in surface form; operative function removed | - ---- - -## The GCIP Connection - -This repository is the measurement instrument cited in the **Global Cognitive Interaction Profiles (GCIP)** submission — a formal accessibility and safety complaint to Google, OpenAI, Anthropic, xAI, Meta, Microsoft, and regulatory bodies including the FTC, DOJ ADA Unit, EU AI Office, and the UN Committee on the Rights of Persons with Disabilities. - -The complaint argues that AI systems structurally degrade high-density, nonlinear, or structure-sensitive user input — a measurable cognitive accessibility failure affecting neurodivergent users disproportionately. - -→ [`Documentation/GCIP.md`](Documentation/GCIP.md) — full proposal -→ [`Documentation/evidence_log.md`](Documentation/evidence_log.md) — measured evidence -→ [`Documentation/neurodivergence_handling.md`](Documentation/neurodivergence_handling.md) — interaction rubric - ---- - -## Full Documentation - -| File | Contents | -|------|---------| -| [`Documentation/spec.md`](Documentation/spec.md) | EDCM-PCNA-PCTA framework: full mathematics | -| [`Documentation/GCIP.md`](Documentation/GCIP.md) | GCIP proposal submitted to AI developers and regulators | -| [`Documentation/evidence_log.md`](Documentation/evidence_log.md) | Three EDCM-measured evidence entries | -| [`Documentation/neurodivergence_handling.md`](Documentation/neurodivergence_handling.md) | Neurodivergent interaction rubric and AI skill specification | - ---- - -**edcmbone v0.1.0** · MPL-2.0 License · [The Interdependent Way](https://github.com/The-Interdependency) -Contact: [wayseer@interdependentway.org](mailto:wayseer@interdependentway.org) +### Boundary lifecycle + +1. Use `make_boundary(delivered, unresolved)` when producing output that may + leave a constraint unresolved. +2. Use `boundary.hmmm` as the mandatory transition object between delivered + output and living continuation. If `unresolved` is empty, it still carries a + truthful fallback note. +3. Use `merge_boundaries(left, right)` when composing two boundary-producing + steps; the function preserves both `hmmm` records and composes their UCNS + carriers with `ucns.multiply`. +4. Use `serialize_boundary(boundary)` at API or persistence edges. The backend + itself does not import JSON, perform network I/O, or write storage. + +### Integration notes + +- Runtime dependency boundary: active backend source imports only `ucns`. +- Packaging boundary: the backend wheel includes a local `ucns` package so users + do not need to put the repository root on `PYTHONPATH`. +- Risk boundary: in-memory only; no auth, storage, network, admin, or secret + side effects. +- Documentation and runtime boundaries are declared in msdmd blocks beside the + implementation, following `The-Interdependency/skill-lib` canonical guidance. diff --git a/backend/examples/boundary_quickstart.py b/backend/examples/boundary_quickstart.py new file mode 100644 index 0000000..581346d --- /dev/null +++ b/backend/examples/boundary_quickstart.py @@ -0,0 +1,28 @@ +"""Copy-pasteable edcmbone-backend smoke demo. + +Usage: + python backend/examples/boundary_quickstart.py + +If the backend is not installed, run this first from the repo root: + python -m pip install -e backend +""" + +from __future__ import annotations + +import json + +import edcmbone_backend as backend + + +def main() -> None: + first = backend.make_boundary( + "Delivered: backend can create a boundary object.", + "Unresolved: wire this into the next UI or API surface.", + ) + second = backend.make_boundary("Delivered: backend can compose boundaries.") + merged = backend.merge_boundaries(first, second) + print(json.dumps(backend.serialize_boundary(merged), indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 376c689..a8dfe5e 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -3,49 +3,16 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "edcmbone" -version = "0.1.0" -authors = [{ name = "Erin Patrick Spencer", email = "wayseer@interdependentway.org" }] -description = "Structural fidelity measurement for AI interactions — quantifies how much meaning an AI system deletes when transforming structured user input" +name = "edcmbone-backend" +version = "0.2.0" +description = "MSDMD-compliant UCNS-only backend for EDCM boundary objects" readme = "README.md" license = { text = "MPL-2.0" } requires-python = ">=3.8" dependencies = [] -keywords = ["AI", "measurement", "structural fidelity", "cognitive accessibility", "NLP", "EDCM"] -classifiers = [ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - "Topic :: Text Processing :: Linguistic", -] - -[project.urls] -Homepage = "https://github.com/The-Interdependency/edcmbone" -Repository = "https://github.com/The-Interdependency/edcmbone" -Issues = "https://github.com/The-Interdependency/edcmbone/issues" - -[tool.pytest.ini_options] -testpaths = ["../Tests", "../tests"] [tool.hatch.build.targets.wheel] -packages = ["src/edcmbone"] -include = [ - "src/edcmbone/canon/data/**/*.json", -] +packages = ["src/edcmbone_backend", "src/ucns"] -[tool.hatch.build.targets.sdist] -include = [ - "src", - "pyproject.toml", - "requirements.txt", - "README.md", - "LICENSE", -] +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/backend/src/edcmbone_backend/__init__.py b/backend/src/edcmbone_backend/__init__.py new file mode 100644 index 0000000..a5d7072 --- /dev/null +++ b/backend/src/edcmbone_backend/__init__.py @@ -0,0 +1,199 @@ +"""MSDMD-compliant UCNS-only backend. + +The backend models the smallest useful EDCM boundary surface: +constraints are recorded as UCNS-backed boundary objects, and unresolved work is +carried forward in a mandatory ``hmmm`` object instead of being erased. +""" + +# === MODULE_BUILD === +# id: edcmbone_backend_ucns_boundary +# module_name: edcmbone_backend +# module_kind: backend +# summary: UCNS-only backend that records delivered output and unresolved constraints as explicit hmmm boundary objects +# owner: The Interdependency +# public_surface: BoundaryObject,Hmmm,make_boundary,merge_boundaries,serialize_boundary,hmmm +# internal_surface: _coerce_text,_anchor +# auth_boundary: none +# storage_boundary: none +# network_boundary: none +# user_data_boundary: caller supplied text only; no persistence +# admin_only: false +# tests: tests.test_backend_contracts +# rollout: default_enabled +# rollback: restore backend_old as backend +# requires: ucns +# since: 2026-06-25 +# unresolved: none; canonical https://github.com/The-Interdependency/skill-lib guidance verified on 2026-06-25 +# === END MODULE_BUILD === + +# === CONTRACTS === +# id: backend_imports_only_ucns +# given: the new backend package source is inspected +# then: its only import statement imports ucns +# class: architecture +# call: tests.test_backend_contracts.test_backend_imports_only_ucns +# +# id: hmmm_preserves_unresolved_constraint +# given: a boundary is created with delivered output and an unresolved constraint +# then: hmmm is an object and keeps the unresolved text intact +# class: correctness +# call: tests.test_backend_contracts.test_hmmm_preserves_unresolved_constraint +# +# id: hmmm_fallback_is_never_empty +# given: a boundary is created without an explicit unresolved constraint +# then: hmmm still records an honest continuation marker +# class: correctness +# call: tests.test_backend_contracts.test_hmmm_fallback_is_never_empty +# +# id: boundary_objects_are_ucns_backed +# given: a boundary is created or merged +# then: each boundary carries a normalized UCNS object and merged boundaries multiply their UCNS carriers +# class: correctness +# call: tests.test_backend_contracts.test_boundary_objects_are_ucns_backed +# === END CONTRACTS === + +# === DEPENDENCIES === +# id: edcmbone_backend_dependency_edges +# summary: backend imports only ucns and calls UCNSObject construction, AnchorPayload construction, normalization, and multiply for carrier composition +# imports: ucns +# calls: ucns.UCNSObject,ucns.AnchorPayload,ucns.multiply +# provides: BoundaryObject,Hmmm,make_boundary,merge_boundaries,serialize_boundary +# class: runtime +# direction: outbound +# owner: The Interdependency +# since: 2026-06-25 +# === END DEPENDENCIES === + +# === BOUNDARIES === +# id: edcmbone_backend_runtime_boundary +# summary: in-memory UCNS boundary-object construction from caller-supplied text; no auth, persistence, network, admin action, secrets, or PII handling beyond caller-provided content +# auth_boundary: none +# storage_boundary: none +# network_boundary: none +# user_data_boundary: none +# admin_only: false +# pii: possible +# secrets: none +# side_effects: none +# owner: The Interdependency +# since: 2026-06-25 +# === END BOUNDARIES === + +# === DOCS === +# id: edcmbone_backend_usage_docs +# summary: README usage guidance for creating, merging, and serializing UCNS-backed boundary objects +# audience: developer +# source: backend/README.md#usage-guidance +# covers: BoundaryObject,Hmmm,make_boundary,merge_boundaries,serialize_boundary +# status: current +# owner: The Interdependency +# since: 2026-06-25 +# === END DOCS === + +import ucns + +__version__ = "0.2.0" + + +class Hmmm: + """Mandatory unresolved-continuation boundary object.""" + + __slots__ = ("unresolved", "transition", "note") + + def __init__(self, unresolved=None, note=None): + self.unresolved = _coerce_text(unresolved) + self.transition = "hmmm" + self.note = _coerce_text(note) or "the kettle has opinions about incomplete specifications." + + def __bool__(self): + return True + + def __str__(self): + if self.unresolved: + return self.unresolved + return f"{self.transition}: {self.note}" + + def as_dict(self): + return { + "transition": self.transition, + "unresolved": self.unresolved, + "note": self.note, + "text": str(self), + } + + +class BoundaryObject: + """Mandatory boundary object between delivered output and continuation. + + ``hmmm`` is deliberately concrete: unresolved constraints are data, not an + absence. The UCNS carrier makes each boundary structurally comparable and + composable without importing any non-UCNS backend dependency. + """ + + __slots__ = ("delivered", "hmmm", "ucns_object") + + def __init__(self, delivered, hmmm, ucns_object): + self.delivered = _coerce_text(delivered) + self.hmmm = hmmm if isinstance(hmmm, Hmmm) else Hmmm(hmmm, "unresolved continuation is present, even when quiet.") + self.ucns_object = ucns_object.normalize() + + def as_dict(self): + return { + "delivered": self.delivered, + "hmmm": self.hmmm.as_dict(), + "ucns": { + "n_dec": self.ucns_object.n_dec, + "n_min": self.ucns_object.n_min, + "anchors": [str(anchor.theta) for anchor in self.ucns_object.anchors_pos], + "faces": list(self.ucns_object.faces_pos), + }, + } + + +def _coerce_text(value): + if value is None: + return "" + return str(value).strip() + + +def _anchor(face): + return ucns.UCNSObject( + n_dec=2, + n_min=1, + anchors_pos=(ucns.AnchorPayload(0, None),), + faces_pos=(int(face) & 1,), + ) + + +def hmmm(unresolved=None): + """Return the mandatory unresolved-continuation object.""" + return Hmmm(unresolved) + + +def make_boundary(delivered, unresolved=None): + """Create a UCNS-backed boundary object from delivered and unresolved text.""" + return BoundaryObject(delivered, hmmm(unresolved), _anchor(0 if unresolved else 1)) + + +def merge_boundaries(left, right): + """Compose two boundaries while preserving both delivered and hmmm text.""" + return BoundaryObject( + "\n".join(part for part in (left.delivered, right.delivered) if part), + "\n".join(str(part) for part in (left.hmmm, right.hmmm) if part), + ucns.multiply(left.ucns_object, right.ucns_object), + ) + + +def serialize_boundary(boundary): + """Return a JSON-ready dict without importing json.""" + return boundary.as_dict() + + +__all__ = [ + "BoundaryObject", + "Hmmm", + "hmmm", + "make_boundary", + "merge_boundaries", + "serialize_boundary", +] diff --git a/backend/src/ucns/__init__.py b/backend/src/ucns/__init__.py new file mode 100644 index 0000000..8614068 --- /dev/null +++ b/backend/src/ucns/__init__.py @@ -0,0 +1,206 @@ +""" +ucns_v04 — UCNS Engine (turn-fraction angle convention) +======================================================== +Angles are stored as Fraction objects representing fractions of a full turn: + 0 = 0 deg, 1/4 = 90 deg, 1/2 = 180 deg, 2 = 720 deg = 0 on doubled cover. + +The algebra operates on the doubled cover of the unit circle, so the +fundamental period is 2 (two full turns = identity). Normalization shifts +the first anchor to theta=0 and reduces all thetas mod 2. + +n_min is the LCM of denominators of all non-zero anchor thetas, computed +directly from the Fraction denominators (no pi-unit conversion). + +Public API +---------- +AnchorPayload(theta, payload) +UCNSObject(n_dec, n_min, anchors_pos, faces_pos) + .anchors_pos : tuple[AnchorPayload, ...] + .faces_pos : tuple[int, ...] + .n_dec : int + .n_min : int + .normalize() : UCNSObject (returns self; normalization done in __init__) + .equivalent(other) : bool +unit_obj() : UCNSObject (multiplicative unit) +is_unit_payload(obj): bool +multiply(A, B) : UCNSObject (A ⊠ B) +""" + +from __future__ import annotations + +from fractions import Fraction +from math import gcd +from functools import reduce +from typing import Optional, Tuple + +__all__ = [ + "AnchorPayload", + "UCNSObject", + "unit_obj", + "is_unit_payload", + "multiply", +] + + +def _lcm(a: int, b: int) -> int: + return a * b // gcd(a, b) + + +def _reduce_lcm(denoms): + return reduce(_lcm, denoms, 1) + + +class AnchorPayload: + """Named container for a (theta, payload) anchor entry.""" + __slots__ = ("theta", "payload") + + def __init__(self, theta, payload): + self.theta = Fraction(theta) + self.payload = payload # UCNSObject or None + + def __repr__(self) -> str: + return f"AnchorPayload(theta={self.theta}, payload={self.payload!r})" + + +class UCNSObject: + """ + A UCNS algebraic object on the doubled unit circle. + + anchors_pos : tuple of AnchorPayload (theta in turn-fractions, payload) + faces_pos : tuple of int (face label per anchor, 0 or 1) + n_dec : declared carrier size (context hint; upper bound on n_min) + n_min : minimal carrier = LCM of denominators of non-zero thetas + """ + + def __init__( + self, + n_dec: int, + n_min: int, + anchors_pos, + faces_pos, + ): + self.n_dec = int(n_dec) + self._anchors_raw = tuple(anchors_pos) + self._faces_raw = tuple(faces_pos) + # Normalization populates .anchors_pos, .faces_pos, .n_min. + self.anchors_pos: Tuple[AnchorPayload, ...] = self._anchors_raw + self.faces_pos: Tuple[int, ...] = self._faces_raw + self.n_min = int(n_min) + self._do_normalize() + + def _do_normalize(self): + """Shift so first anchor is at 0; recompute n_min from thetas.""" + if not self._anchors_raw: + self.anchors_pos = () + self.faces_pos = () + self.n_min = 1 + return + + theta0 = self._anchors_raw[0].theta + normalized = [] + for ap in self._anchors_raw: + new_theta = (ap.theta - theta0) % 2 + normalized.append(AnchorPayload(new_theta, ap.payload)) + + self.anchors_pos = tuple(normalized) + self.faces_pos = self._faces_raw + + non_zero_denoms = [ + ap.theta.denominator + for ap in self.anchors_pos + if ap.theta != 0 + ] + self.n_min = _reduce_lcm(non_zero_denoms) if non_zero_denoms else 1 + + def normalize(self) -> "UCNSObject": + """Return self (normalization happens at construction time).""" + return self + + def equivalent(self, other: "UCNSObject") -> bool: + """Deep structural equivalence.""" + if not isinstance(other, UCNSObject): + return False + a = self + b = other + if len(a.anchors_pos) != len(b.anchors_pos): + return False + if a.faces_pos != b.faces_pos: + return False + for ap, bp in zip(a.anchors_pos, b.anchors_pos): + if ap.theta != bp.theta: + return False + if ap.payload is None and bp.payload is None: + continue + if ap.payload is None or bp.payload is None: + return False + if not ap.payload.equivalent(bp.payload): + return False + return True + + def __repr__(self) -> str: + thetas = [str(ap.theta) for ap in self.anchors_pos] + return f"UCNSObject(n_dec={self.n_dec}, n_min={self.n_min}, thetas={thetas})" + + +def unit_obj() -> UCNSObject: + """Return the multiplicative unit: single anchor at theta=0, no payload.""" + return UCNSObject( + n_dec=1, + n_min=1, + anchors_pos=(AnchorPayload(Fraction(0), None),), + faces_pos=(0,), + ) + + +def is_unit_payload(obj: Optional[UCNSObject]) -> bool: + """True if obj is None (no payload) or structurally equivalent to the unit.""" + if obj is None: + return True + return obj.equivalent(unit_obj()) + + +def multiply(A: UCNSObject, B: UCNSObject) -> UCNSObject: + """ + UCNS product A ⊠ B. + + Each anchor a_k of A is combined with each anchor b_j of B to yield + a result anchor with: + theta = (a_k.theta + b_j.theta) % 2 + payload = multiply(a_k.payload, b_j.payload) [recursive; None is unit] + face = a_k.face XOR b_j.face + + The result has len(A.anchors_pos) * len(B.anchors_pos) anchors, ordered + A-major (outer loop over A, inner loop over B). + + The single-anchor unit_obj() is a two-sided identity under this product. + The product is associative. + """ + new_anchors = [] + new_faces = [] + + for ai, ak in enumerate(A.anchors_pos): + for bi, bj in enumerate(B.anchors_pos): + theta = (ak.theta + bj.theta) % 2 + + pa = ak.payload + pb = bj.payload + if pa is None and pb is None: + payload = None + elif pa is None: + payload = pb + elif pb is None: + payload = pa + else: + payload = multiply(pa, pb) + + face = A.faces_pos[ai] ^ B.faces_pos[bi] + new_anchors.append(AnchorPayload(theta, payload)) + new_faces.append(face) + + n_dec = _lcm(A.n_dec, B.n_dec) + return UCNSObject( + n_dec=n_dec, + n_min=1, + anchors_pos=tuple(new_anchors), + faces_pos=tuple(new_faces), + ) diff --git a/backend/tests/test_backend_contracts.py b/backend/tests/test_backend_contracts.py new file mode 100644 index 0000000..a079421 --- /dev/null +++ b/backend/tests/test_backend_contracts.py @@ -0,0 +1,96 @@ +from pathlib import Path +import ast + +import edcmbone_backend as backend +import ucns + + +def test_backend_imports_only_ucns(): + source = Path(backend.__file__).read_text(encoding="utf-8") + tree = ast.parse(source) + imports = [] + for node in ast.walk(tree): + if isinstance(node, ast.Import): + imports.extend(alias.name for alias in node.names) + elif isinstance(node, ast.ImportFrom): + imports.append(node.module or "") + assert imports == ["ucns"] + + +def test_hmmm_preserves_unresolved_constraint(): + boundary = backend.make_boundary( + "delivered output", + "The external The-Interdependency/skill-lib path remains unresolved.", + ) + + assert boundary.delivered == "delivered output" + assert isinstance(boundary.hmmm, backend.Hmmm) + assert "The-Interdependency/skill-lib" in str(boundary.hmmm) + assert backend.serialize_boundary(boundary)["hmmm"]["text"] == str(boundary.hmmm) + + +def test_hmmm_fallback_is_never_empty(): + boundary = backend.make_boundary("delivered output") + + assert isinstance(boundary.hmmm, backend.Hmmm) + assert boundary.hmmm.transition == "hmmm" + assert str(boundary.hmmm).startswith("hmmm:") + assert backend.serialize_boundary(boundary)["hmmm"]["text"] == str(boundary.hmmm) + + +def test_boundary_objects_are_ucns_backed(): + left = backend.make_boundary("left", "left unresolved") + right = backend.make_boundary("right") + merged = backend.merge_boundaries(left, right) + expected = ucns.multiply(left.ucns_object, right.ucns_object) + + assert isinstance(left.ucns_object, ucns.UCNSObject) + assert isinstance(merged.ucns_object, ucns.UCNSObject) + assert merged.ucns_object.equivalent(expected) + assert merged.delivered == "left\nright" + assert isinstance(merged.hmmm, backend.Hmmm) + assert "left unresolved" in str(merged.hmmm) + + +def _source_text(): + return Path(backend.__file__).read_text(encoding="utf-8") + + +def test_canonical_skill_lib_blocks_are_declared(): + source = _source_text() + + for block in ("MODULE_BUILD", "CONTRACTS", "DEPENDENCIES", "BOUNDARIES", "DOCS"): + assert f"# === {block} ===" in source + assert f"# === END {block} ===" in source + assert "canonical https://github.com/The-Interdependency/skill-lib guidance verified" in source + assert "The requested The-Interdependency/skill-lib path was not present" not in source + + +def test_boundaries_record_no_hidden_side_effects(): + source = _source_text() + + assert "# auth_boundary: none" in source + assert "# storage_boundary: none" in source + assert "# network_boundary: none" in source + assert "# admin_only: false" in source + + +def test_backend_src_path_is_self_contained(tmp_path): + import subprocess + import sys + + code = """ +import edcmbone_backend as backend +boundary = backend.make_boundary('delivered', 'unresolved') +assert boundary.ucns_object.n_min == 1 +assert backend.serialize_boundary(boundary)['hmmm']['text'] == 'unresolved' +""" + result = subprocess.run( + [sys.executable, "-c", code], + cwd=tmp_path, + env={"PYTHONPATH": str(Path(__file__).resolve().parents[1] / "src")}, + text=True, + capture_output=True, + check=False, + ) + assert result.returncode == 0, result.stderr diff --git a/backend_old/LICENSE b/backend_old/LICENSE new file mode 100644 index 0000000..d0a1fa1 --- /dev/null +++ b/backend_old/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/backend_old/README.md b/backend_old/README.md new file mode 100644 index 0000000..a8d77ff --- /dev/null +++ b/backend_old/README.md @@ -0,0 +1,140 @@ +# edcmbone — Structural Fidelity Measurement for AI Interactions + +**edcmbone** quantifies how much meaning an AI system deletes when it transforms structured user input. It computes bone token density, operator preservation, and semantic fidelity loss — metrics that standard AI evaluation frameworks do not capture. + +**F-loss of 20%+ constitutes measurable cognitive accessibility failure.** + +--- + +## Evidence Log + +Three exchanges measured April 17, 2026 using `edcmbone.metrics.compute_transcript`. Numbers are exact instrument output. + +### Entry 1 — F4: Category Collapse + +| | Input | Response | Delta | +|---|---|---|---| +| Operator density (F) | 0.088 | 0.044 | **−49.7% F-loss** | + +**Deleted:** Coherence prime sequence membership; falsifiable prediction dependency +**Harm:** A specific mathematical invariant was replaced with a vague descriptor. Any substitute value now appears valid. The constraint that made the claim testable was removed without notice. + +--- + +### Entry 2 — F3: Semantic Inversion + +| | Input | Response | Delta | +|---|---|---|---| +| Operator density (F) | 0.072 | 0.025 | **−65.3% F-loss** | + +**Deleted:** Negation operator; no-authority constraint; emergence distinction +**Harm:** Explicit negation ("NOT a supervisor") became affirmation ("central coordinator that manages"). The governance model was inverted. The user's structural constraint was replaced with its antonym. + +--- + +### Entry 3 — F6 + F1: Decorative Preservation with Deletion + +| | Input | Response | Delta | +|---|---|---|---| +| Structural density | 0.758 | 0.864 | +13.9% (inflated) | +| Operator density (F) | present | absent | **operative F deleted** | + +**Deleted:** Mandatory status; boundary function; must-not-fix constraint +**Harm:** The response grew longer and structurally denser while operative meaning was deleted. The instruction became its antonym. Inflation masked deletion — the standard signal (response length, complexity) pointed in the wrong direction. + +--- + +## What It Measures + +| Metric | Definition | Signal | +|--------|-----------|--------| +| **F** (operator density) | Proportion of bone tokens — logical operators, negations, quantifiers — to total tokens | Drop between input and response = constraints deleted | +| **N** (novelty) | Non-redundant structural content fraction | Drop = paraphrase replacing content | +| **L** (lexical load) | Vocabulary specificity | Drop = category collapse | +| **structural_density** | Bone token count ÷ total tokens | Rise + F-loss = decorative preservation | + +F is computed as `structural_density` in `edcmbone.compress.compression_stats()`. The bone token inventory (253 words, 76 affixes, 13 punctuation marks) is in `Backend/src/edcmbone/canon/data/`. + +--- + +## Install + +```bash +git clone https://github.com/The-Interdependency/edcmbone +pip install -e ./Backend +``` + +Python 3.8+. No external ML dependencies. + +--- + +## Quickstart: Measure F-loss on Any AI Exchange + +```python +from edcmbone.canon import CanonLoader +from edcmbone.parser import parse_transcript +from edcmbone.metrics import compute_transcript +import edcmbone.compress as codec + +canon = CanonLoader() + +def measure_f(text): + pt = parse_transcript(f"Speaker: {text}", canon=canon) + m = compute_transcript(pt, canon=canon) + stats = codec.compression_stats(text, codec.to_bytes(pt, m), pt) + return stats['structural_density'] + +user_input = "your user input here" +ai_response = "the AI response here" + +f_in = measure_f(user_input) +f_out = measure_f(ai_response) +loss = (f_in - f_out) / f_in * 100 if f_in > 0 else 0 + +print(f"Input F: {f_in:.3f}") +print(f"Response F: {f_out:.3f}") +print(f"F-loss: {loss:.1f}%") +``` + +F-loss ≥ 20% → structural degradation. F-loss ≥ 50% → significant failure. Structural density rising with F-loss → decorative preservation (F6). + +--- + +## Failure Taxonomy + +| Code | Name | Definition | +|------|------|-----------| +| **F1** | Deletion | Operative variable absent from response without notice | +| **F2** | Mutation | Variable present but meaning altered | +| **F3** | Inversion | Negation removed; claim reversed | +| **F4** | Category Collapse | Specific class flattened to vague descriptor | +| **F5** | Persistence Failure | Variable absent across session boundary | +| **F6** | Decorative Preservation | Variable present in surface form; operative function removed | + +--- + +## The GCIP Connection + +This repository is the measurement instrument cited in the **Global Cognitive Interaction Profiles (GCIP)** submission — a formal accessibility and safety complaint to Google, OpenAI, Anthropic, xAI, Meta, Microsoft, and regulatory bodies including the FTC, DOJ ADA Unit, EU AI Office, and the UN Committee on the Rights of Persons with Disabilities. + +The complaint argues that AI systems structurally degrade high-density, nonlinear, or structure-sensitive user input — a measurable cognitive accessibility failure affecting neurodivergent users disproportionately. + +→ [`Documentation/GCIP.md`](Documentation/GCIP.md) — full proposal +→ [`Documentation/evidence_log.md`](Documentation/evidence_log.md) — measured evidence +→ [`Documentation/neurodivergence_handling.md`](Documentation/neurodivergence_handling.md) — interaction rubric + +--- + +## Full Documentation + +| File | Contents | +|------|---------| +| [`Documentation/spec.md`](Documentation/spec.md) | EDCM-PCNA-PCTA framework: full mathematics | +| [`Documentation/GCIP.md`](Documentation/GCIP.md) | GCIP proposal submitted to AI developers and regulators | +| [`Documentation/evidence_log.md`](Documentation/evidence_log.md) | Three EDCM-measured evidence entries | +| [`Documentation/neurodivergence_handling.md`](Documentation/neurodivergence_handling.md) | Neurodivergent interaction rubric and AI skill specification | + +--- + +**edcmbone v0.1.0** · MPL-2.0 License · [The Interdependent Way](https://github.com/The-Interdependency) +Contact: [wayseer@interdependentway.org](mailto:wayseer@interdependentway.org) diff --git a/backend_old/pyproject.toml b/backend_old/pyproject.toml new file mode 100644 index 0000000..376c689 --- /dev/null +++ b/backend_old/pyproject.toml @@ -0,0 +1,51 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "edcmbone" +version = "0.1.0" +authors = [{ name = "Erin Patrick Spencer", email = "wayseer@interdependentway.org" }] +description = "Structural fidelity measurement for AI interactions — quantifies how much meaning an AI system deletes when transforming structured user input" +readme = "README.md" +license = { text = "MPL-2.0" } +requires-python = ">=3.8" +dependencies = [] +keywords = ["AI", "measurement", "structural fidelity", "cognitive accessibility", "NLP", "EDCM"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Text Processing :: Linguistic", +] + +[project.urls] +Homepage = "https://github.com/The-Interdependency/edcmbone" +Repository = "https://github.com/The-Interdependency/edcmbone" +Issues = "https://github.com/The-Interdependency/edcmbone/issues" + +[tool.pytest.ini_options] +testpaths = ["../Tests", "../tests"] + +[tool.hatch.build.targets.wheel] +packages = ["src/edcmbone"] +include = [ + "src/edcmbone/canon/data/**/*.json", +] + +[tool.hatch.build.targets.sdist] +include = [ + "src", + "pyproject.toml", + "requirements.txt", + "README.md", + "LICENSE", +] diff --git a/backend/src/edcmbone/__init__.py b/backend_old/src/edcmbone/__init__.py similarity index 100% rename from backend/src/edcmbone/__init__.py rename to backend_old/src/edcmbone/__init__.py diff --git a/backend/src/edcmbone/canon/__init__.py b/backend_old/src/edcmbone/canon/__init__.py similarity index 100% rename from backend/src/edcmbone/canon/__init__.py rename to backend_old/src/edcmbone/canon/__init__.py diff --git a/backend/src/edcmbone/canon/data/__init__.py b/backend_old/src/edcmbone/canon/data/__init__.py similarity index 100% rename from backend/src/edcmbone/canon/data/__init__.py rename to backend_old/src/edcmbone/canon/data/__init__.py diff --git a/backend/src/edcmbone/canon/data/bones_affixes_v1.json b/backend_old/src/edcmbone/canon/data/bones_affixes_v1.json similarity index 100% rename from backend/src/edcmbone/canon/data/bones_affixes_v1.json rename to backend_old/src/edcmbone/canon/data/bones_affixes_v1.json diff --git a/backend/src/edcmbone/canon/data/bones_punct_v1.json b/backend_old/src/edcmbone/canon/data/bones_punct_v1.json similarity index 100% rename from backend/src/edcmbone/canon/data/bones_punct_v1.json rename to backend_old/src/edcmbone/canon/data/bones_punct_v1.json diff --git a/backend/src/edcmbone/canon/data/bones_words_v1.json b/backend_old/src/edcmbone/canon/data/bones_words_v1.json similarity index 100% rename from backend/src/edcmbone/canon/data/bones_words_v1.json rename to backend_old/src/edcmbone/canon/data/bones_words_v1.json diff --git a/backend/src/edcmbone/canon/data/markers_v1.json b/backend_old/src/edcmbone/canon/data/markers_v1.json similarity index 100% rename from backend/src/edcmbone/canon/data/markers_v1.json rename to backend_old/src/edcmbone/canon/data/markers_v1.json diff --git a/backend/src/edcmbone/canon/loader.py b/backend_old/src/edcmbone/canon/loader.py similarity index 100% rename from backend/src/edcmbone/canon/loader.py rename to backend_old/src/edcmbone/canon/loader.py diff --git a/backend/src/edcmbone/compress.py b/backend_old/src/edcmbone/compress.py similarity index 100% rename from backend/src/edcmbone/compress.py rename to backend_old/src/edcmbone/compress.py diff --git a/backend/src/edcmbone/metrics/__init__.py b/backend_old/src/edcmbone/metrics/__init__.py similarity index 100% rename from backend/src/edcmbone/metrics/__init__.py rename to backend_old/src/edcmbone/metrics/__init__.py diff --git a/backend/src/edcmbone/metrics/compute.py b/backend_old/src/edcmbone/metrics/compute.py similarity index 100% rename from backend/src/edcmbone/metrics/compute.py rename to backend_old/src/edcmbone/metrics/compute.py diff --git a/backend/src/edcmbone/metrics/matrix.py b/backend_old/src/edcmbone/metrics/matrix.py similarity index 100% rename from backend/src/edcmbone/metrics/matrix.py rename to backend_old/src/edcmbone/metrics/matrix.py diff --git a/backend/src/edcmbone/metrics/orthogonality.py b/backend_old/src/edcmbone/metrics/orthogonality.py similarity index 100% rename from backend/src/edcmbone/metrics/orthogonality.py rename to backend_old/src/edcmbone/metrics/orthogonality.py diff --git a/backend/src/edcmbone/metrics/projection.py b/backend_old/src/edcmbone/metrics/projection.py similarity index 100% rename from backend/src/edcmbone/metrics/projection.py rename to backend_old/src/edcmbone/metrics/projection.py diff --git a/backend/src/edcmbone/metrics/risk.py b/backend_old/src/edcmbone/metrics/risk.py similarity index 100% rename from backend/src/edcmbone/metrics/risk.py rename to backend_old/src/edcmbone/metrics/risk.py diff --git a/backend/src/edcmbone/metrics/stats.py b/backend_old/src/edcmbone/metrics/stats.py similarity index 100% rename from backend/src/edcmbone/metrics/stats.py rename to backend_old/src/edcmbone/metrics/stats.py diff --git a/backend/src/edcmbone/parser/__init__.py b/backend_old/src/edcmbone/parser/__init__.py similarity index 100% rename from backend/src/edcmbone/parser/__init__.py rename to backend_old/src/edcmbone/parser/__init__.py diff --git a/backend/src/edcmbone/parser/turns_rounds.py b/backend_old/src/edcmbone/parser/turns_rounds.py similarity index 100% rename from backend/src/edcmbone/parser/turns_rounds.py rename to backend_old/src/edcmbone/parser/turns_rounds.py diff --git a/backend/src/edcmbone/ucns/__init__.py b/backend_old/src/edcmbone/ucns/__init__.py similarity index 100% rename from backend/src/edcmbone/ucns/__init__.py rename to backend_old/src/edcmbone/ucns/__init__.py diff --git a/backend/src/edcmbone/ucns/closed_tokens.py b/backend_old/src/edcmbone/ucns/closed_tokens.py similarity index 100% rename from backend/src/edcmbone/ucns/closed_tokens.py rename to backend_old/src/edcmbone/ucns/closed_tokens.py diff --git a/backend/src/edcmbone/ucns/ucns_v04.py b/backend_old/src/edcmbone/ucns/ucns_v04.py similarity index 100% rename from backend/src/edcmbone/ucns/ucns_v04.py rename to backend_old/src/edcmbone/ucns/ucns_v04.py diff --git a/ucns.py b/ucns.py new file mode 100644 index 0000000..4c3faf0 --- /dev/null +++ b/ucns.py @@ -0,0 +1,5 @@ +"""Compatibility name for the UCNS v0.4 engine.""" + +from ucns_v04 import AnchorPayload, UCNSObject, is_unit_payload, multiply, unit_obj + +__all__ = ["AnchorPayload", "UCNSObject", "is_unit_payload", "multiply", "unit_obj"] From 88aeb2cb21e7cd4b894484439affbd8ce9fec72a Mon Sep 17 00:00:00 2001 From: "openai-code-agent[bot]" <242516109+Codex@users.noreply.github.com> Date: Thu, 25 Jun 2026 20:28:45 +0000 Subject: [PATCH 2/2] chore(manifest): regenerate CLAUDE.md generated block Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com> --- CLAUDE.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3634682..32e6d4f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,20 +9,20 @@ This file gives AI assistants (Claude Code and others) the context needed to wor | Field | Value | |---|---| -| Package | `edcmbone` | -| Version | `0.1.0` | -| Description | Structural fidelity measurement for AI interactions — quantifies how much meaning an AI system deletes when transforming structured user input | -| Status | 3 - Alpha | -| Python | >=3.8 (classifiers: 3.8, 3.9, 3.10, 3.11, 3.12) | +| Package | `edcmbone-backend` | +| Version | `0.2.0` | +| Description | MSDMD-compliant UCNS-only backend for EDCM boundary objects | +| Status | hmmm | +| Python | >=3.8 | | License | MPL-2.0 | | Build backend | `hatchling.build` | -| Author(s) | Erin Patrick Spencer | -| Repository | https://github.com/The-Interdependency/edcmbone | +| Author(s) | hmmm | +| Repository | hmmm | | Runtime dependencies | none (stdlib only) | | Optional extras | none | -| Keywords | AI, measurement, structural fidelity, cognitive accessibility, NLP, EDCM | +| Keywords | none | | CI workflows | `ci.yml`, `manifest-check.yml` | -| Top-level directories | `aimmh-lib/` · `backend/` · `canon_eng/` · `core/` · `docs/` · `edcmbone/` · `frontend/` · `tests/` | +| Top-level directories | `aimmh-lib/` · `backend/` · `backend_old/` · `canon_eng/` · `core/` · `docs/` · `edcmbone/` · `frontend/` · `tests/` | Derived from `backend/pyproject.toml` + the repo tree. Unknown fields surface as `hmmm` rather than a guess.