# Themis — Systems Deep Dive

> The `libs/themis/` area: ~71 Nx libraries that split into two systems under
> one name — a **digital-governance platform** (DAOs, voting, constitutions,
> deliberation, treasuries) and the **Themis Originality Shield**, an AI-content
> copyright / originality-detection stack across every media family.

## What this area is

Themis (Greek titaness of divine law and order) is the monorepo's
**governance-and-legitimacy** domain, and the `libs/themis/` directory holds it
as many small, single-responsibility Nx libraries rather than one package. Every
project is published under the `@themis/*` scope and is a `layer` library of
TypeScript engines — there is no Rust or native code here. The area cleaves into
two distinct subsystems that happen to share the Themis name because both are
about _legitimacy of outcomes_: one governs **how groups decide**, the other
governs **whether generated content is original enough to publish**.

**Subsystem 1 — the governance platform.** A large family of libraries that
model collective decision-making. `@themis/core` is the shared substrate (graph
schema, event hash-chain, document storage, and the governance type vocabulary).
On top of it sit voting systems (`@themis/voting`, `@themis/frameworks`),
deliberation and decision tooling (`@themis/deliberation`, `@themis/decisions`,
`@themis/knowledge`), on-chain/DAO machinery (`@themis/dao`,
`@themis/constitutions`, `@themis/privacy`, `@themis/identity`,
`@themis/reputation`), treasury and funding (`@themis/treasury`,
`@themis/funding`), dispute/justice (`@themis/arbitration`, `@themis/justice`,
`@themis/accountability`, `@themis/dispute-resolution`, `@themis/transparency`,
`@themis/crisis`), and a wide band of **sector governance** packages that apply
the primitives to civic, corporate, nonprofit, digital, environmental,
international, and other real-world domains. `@themis/ai` and
`@themis/analytics` add AI assistants and metrics over the whole platform, and
`@themis/integrations` wires Themis to sibling Oshun domains.

**Subsystem 2 — the Originality Shield.** A copyright-risk pipeline that scans
AI-generated content for substantial similarity to protected works before it is
published. `@themis/originality-shields` is the shared evaluator core; per-media
shields (`@themis/music-shield`, `@themis/visual-shield`, `@themis/text-shield`,
`@themis/video-shield`, `@themis/3d-shield`, `@themis/character-shield`,
`@themis/motion-shield`, `@themis/fashion-shield`, `@themis/design-shield`,
`@themis/environment-shield`) run modality-specific detectors. Underneath the
music shield sits a layer of **analysis primitives**
(`@themis/harmonic-analysis`, `@themis/melodic-analysis`,
`@themis/rhythmic-analysis`, `@themis/spectral-analysis`,
`@themis/structural-analysis`, `@themis/vocal-analysis`,
`@themis/lyric-analysis`, `@themis/audio-fingerprint`), plus cross-cutting
services for risk scoring, remediation, human review, provenance, reference
databases, model-governance compliance, content watermarking / C2PA provenance
(`@themis/watermarking`), analytics, and the public API/SDK
(`@themis/shield-api`, `@themis/shield-client`). A newer **cross-media /
universal** generation maps each single-media capability onto every media family
at once — `@themis/universal-risk-scoring`, `@themis/universal-reference-db`,
`@themis/universal-provenance`, `@themis/universal-remediation`,
`@themis/universal-review`, `@themis/universal-analytics`, and
`@themis/cross-media-governance`.

These two subsystems are mostly independent dependency graphs that share the
`@themis/` namespace and the same legitimacy framing; a handful of seams (the
`dispute-resolution`→Concordia router, the `integrations` bridges) connect
Themis outward to the rest of Oshun.

## How it fits the wider system

The **governance** libraries are consumed by Themis services and by sibling
domains that need decision machinery (the `@themis/integrations` package names
explicit bridges to AJE, Iris, Kuan-Yin, Lakshmi, Maat, Maya, Metis, Sophia, and
Veritas). The **Shield** is consumed by content-producing domains that must gate
publication on copyright risk — `@themis/shield-api` exposes adapters named for
Calliope, Euterpe, and Isis, and `@themis/visual-shield` carries Calliope/Isis
integration modules — and by V2 UGC flows (decals, logos, championship media).
`@themis/dispute-resolution` routes governance and moderation disputes into the
Concordia mediation domain (Phase 179.7.2), and `@themis/academic-integrity`
provides the adjudication mechanics behind Metis academic-integrity verdicts.
Walk the "used by" edges on any node below to see its exact consumers. The
boundary invariant is the usual one: these are `@themis/*` libraries of pure
logic; transport, persistence wiring, and UI live in the consuming services and
apps.

## Entity reference

### @themis/core

The governance substrate (`libs/themis/core/src`): a barrel re-exporting four
subsystems — `database/` (document storage + migrations), `events/` (a Kafka
service plus an `audit-anchor` / `hash-chain` tamper-evident event log),
`graph/` (governance graph schema, queries, service), and `types/` (the shared
vocabulary: `proposal-vote`, `member-role`, `organization`, `framework`,
`deliberation`, `dispute-resolution`, `treasury-fiscal`, `governance-metrics`).
Every other governance library builds on these types.

### @themis/frameworks

A catalog of governance-framework engines (`libs/themis/frameworks/src`), one
file per model: `direct-democracy`, `representative-democracy`,
`liquid-democracy`, `bicameral-governance`, `consensus-governance`, `holacracy`,
`sociocracy-3`, `conviction-voting`, `futarchy`, plus a
`hybrid-framework-composer` that combines them. ~7.7K lines of real
model-specific logic (≈11K with specs).

### @themis/voting

The voting-systems library (`libs/themis/voting/src`): twelve tally/engine
modules including `ranked-choice-voting`, `condorcet-voting`, `approval-voting`,
`quadratic-voting`, `token-weighted-voting`, `conviction-voting-engine`,
`holographic-consensus`, `multi-sig-voting`, `vote-escrow-governance`,
`optimistic-governance`, `delegation-engine`, and a `universal-ballot-system`.
Each implements its named electoral method rather than a generic counter.

### @themis/decisions

Decision-science engines (`libs/themis/decisions/src`): an `mcda-engine`
(multi-criteria decision analysis), `prediction-market-engine`,
`futarchy-execution-engine`, and a `decision-quality-tracker`. Supplies the
quantitative decision tooling that voting and deliberation feed into.

### @themis/deliberation

Pre-vote deliberation tooling (`libs/themis/deliberation/src`): an
`argument-mapping-engine`, `opinion-clustering-engine`,
`citizen-assembly-engine`, `participatory-process-designer`,
`discussion-platform`, an `ai-deliberation-assistant`, and
`tech-enhanced-deliberation`. Models how groups reason before they vote.

### @themis/knowledge

The governance knowledge base (`libs/themis/knowledge/src`, ~27K lines, the
largest single library): taxonomies and comparison engines such as
`political-systems-taxonomy`, `electoral-systems-knowledge-base`,
`governance-theory-engine`, `governance-pattern-library`,
`governance-case-study-library`, `historical-governance-timeline`,
`political-philosophy-knowledge-base`, `party-systems-and-competition-models`,
and several comparison/transition-analysis engines. The reference library the
rest of the platform reasons against.

### @themis/identity

Voter-identity and eligibility primitives (`libs/themis/identity/src`):
`decentralized-identity-integration`, an `eligibility-engine`,
`governance-credential-issuer`, and a `sybil-resistance-engine`. Establishes
_who_ may participate before a vote is counted.

### @themis/reputation

Reputation and delegate-trust engines (`libs/themis/reputation/src`): an
`eigentrust-reputation-engine`, `delegate-scoring-system`,
`participation-analytics-engine`, and `reputation-portability-engine`. Provides
the trust weights that liquid/delegated voting relies on.

### @themis/privacy

Privacy-preserving governance (`libs/themis/privacy/src`):
`zk-anonymous-voting`, `maci-anti-collusion-infrastructure`,
`private-delegation-engine`, `confidential-governance-channels`,
`verifiable-offchain-governance`, and a `v2-data-subject-rights` module.
Implements the cryptographic-privacy and data-rights side of voting.

### @themis/simulation

Governance simulation/stress-testing (`libs/themis/simulation/src`): a
`governance-agent-based-simulation-framework`,
`constitutional-design-simulation-engine`,
`governance-resilience-stress-testing-engine`, and a library of
`governance-prebuilt-simulation-scenarios`. Lets a design be tested before it is
adopted.

### @themis/dao

On-chain DAO machinery (`libs/themis/dao/src`, ~13K lines): a
`dao-proposal-lifecycle-manager`, `dao-proposal-quality-gates`,
`dao-constitution-designer`, `dao-delegation-strategy-engine`,
`dao-subdao-architecture-manager`, `dao-cross-chain-governance-coordinator`,
`dao-legal-wrapper-advisor`, and a `dao-governance-template-library`. The
crypto-native counterpart to `@themis/frameworks`.

### @themis/constitutions

Constitution authoring and computational law (`libs/themis/constitutions/src`,
~11K lines): `charter-authoring`, `clause-library`, `amendment-lifecycle`,
`version-control`, `jurisdictional-compliance`, an `ai-drafting` module, a
`computational-law-compiler`, `smart-contract-generation`, and a
`governance-rule-simulator`. Turns governance rules into versioned,
machine-checkable artifacts.

### @themis/policy

Policy analysis and computational law (`libs/themis/policy/src`): a
`policy-analysis-engine`, `policy-simulation-engine`,
`regulatory-monitoring-system`, and a `computational-law-engine`. The
policy-lifecycle complement to `@themis/constitutions`.

### @themis/treasury

Treasury governance (`libs/themis/treasury/src`): a
`participatory-budget-governance-engine`, `spending-controls-engine`,
`treasury-diversification-governance-engine`, and a
`fiscal-transparency-dashboard`. Governs how a collective's funds are allocated
and controlled.

### @themis/funding

Public-goods funding mechanisms (`libs/themis/funding/src`): a
`quadratic-funding-engine`, `augmented-bonding-curve-engine`,
`retroactive-public-goods-funding`, `continuous-governance-funding-streams`, and
a `hypercert-impact-certificate-system`. Implements the named crypto-economic
funding designs.

### @themis/arbitration

Dispute-handling engines (`libs/themis/arbitration/src`): a
`decentralized-arbitration-court`, `multi-tier-escalation-engine`,
`structured-mediation-protocol`, `restorative-justice-framework`, and a
`dispute-management-system`. The in-platform conflict-resolution machinery.

### @themis/justice

Justice-system modelling (`libs/themis/justice/src`): a
`judicial-system-architecture-engine`, `judicial-independence-framework`,
`criminal-justice-governance-models`, `access-to-justice-governance`,
`legal-traditions-comparison-engine`, `transitional-justice-governance-engine`,
and a `reparations-governance-framework`. Models legal institutions and
traditions rather than running a court.

### @themis/dispute-resolution

A thin **routing adapter** (`libs/themis/dispute-resolution/src`, ~786 lines)
that sends governance / DAO / moderation disputes into the Concordia mediation
domain (Phase 179.7.2). Exports `routeThemisDispute` / `shouldRouteToConcordia`
plus DSA "statement of reasons" builders (`buildThemisDsaStatementOfReasons`),
moderation-appeal and tournament-result dispute flows. Honest about its scope:
it routes and formats, it does not adjudicate.

### @themis/accountability

Accountability monitors (`libs/themis/accountability/src`): a
`governance-integrity-monitor`, `governance-promise-accountability` tracker,
`governance-quality-index`, a `secure-whistleblower-protection-system`, and a
`veritas-governance-accountability-bridge`. (Note: this dir contains
untracked/leftover build artifacts on disk — `.js.map`/`.d.ts.map` — alongside
source, not committed to git.)

### @themis/transparency

Transparency infrastructure (`libs/themis/transparency/src`): an
`immutable-governance-audit-trail`, `governance-open-data-portal`,
`public-records-management`, `campaign-finance-transparency`, and a
`lobbying-transparency-system`. The public-visibility layer over governance
records.

### @themis/crisis

Emergency-governance and resilience (`libs/themis/crisis/src`, ~12K lines): a
`continuity-of-government-engine`, `emergency-powers-governance-framework`,
`democratic-resilience-framework`, `leadership-succession-governance`,
`state-building-post-conflict-governance`,
`pandemic-public-health-crisis-governance`, and a
`governance-failure-analysis-engine`. Covers state recovery and emergency
decision-making.

### @themis/civic

Civic / e-government governance (`libs/themis/civic/src`): a
`digital-democracy-platform`, `e-government-governance-layer`,
`election-management-system`, `participatory-budgeting-platform`, and a
`legislative-monitoring-system`. Applies the primitives to public-sector
governance.

### @themis/community

Community-organization governance (`libs/themis/community/src`, ~11K lines):
managers for `association`, `housing-association`, `labor-union`, and
`sports-club` governance plus a `community-organization-toolkit-manager`.
Member-organization governance patterns.

### @themis/corporate

Corporate governance (`libs/themis/corporate/src`): a
`digital-board-management-platform`, `committee-governance-manager`,
`proxy-voting-infrastructure`, `shareholder-engagement-manager`,
`fiduciary-duty-monitoring-engine`, and ESG compliance/integration engines.
Board-and-shareholder governance.

### @themis/nonprofit

Nonprofit and cooperative governance (`libs/themis/nonprofit/src`): managers for
`nonprofit-board`, `cooperative`, `benefit-corporation`, `grant`,
`fiscal-sponsorship`, and `mondragon-federation` governance. Mission-driven
organization patterns.

### @themis/digital

Digital / platform / technology governance (`libs/themis/digital/src`, ~19K
lines): `ai-governance-systems`, `algorithmic-governance-framework`,
`autonomous-systems-governance`, `data-governance-frameworks`,
`platform-governance-models`, `internet-governance-engine`,
`open-source-governance-models`, and `technology-standards-governance`. Governs
technology itself.

### @themis/environmental

Environmental / commons governance (`libs/themis/environmental/src`, ~13K
lines): `climate-governance-frameworks`, `natural-resource-governance`,
`environmental-impact-governance`, `digital-commons-governance`,
`intergenerational-governance-mechanisms`, and an
`operational-commons-governance-engine`. Long-horizon and shared-resource
governance.

### @themis/international

International-relations governance (`libs/themis/international/src`, ~12K
lines): `diplomatic-governance-models`, `treaty-governance-lifecycle`,
`trade-governance-systems`, `international-financial-governance`,
`global-commons-governance`, `sovereignty-models`,
`international-organizations-governance-engine`, and an
`international-collective-action-engine`. Cross-border governance.

### @themis/sectors

Sector-specific governance (`libs/themis/sectors/src`, ~23K lines, the broadest
applied library): `financial-monetary-governance`, `health-system-governance`,
`urban-municipal-governance`, `property-land-governance`,
`media-governance-frameworks`, `military-security-governance`,
`civil-society-advocacy-governance`, `representation-inclusion-governance`, and
`behavioral-governance-design`. One engine per industry vertical.

### @themis/traditional

Non-Western and customary governance (`libs/themis/traditional/src`, ~13K
lines): a `customary-law-integration-framework`,
`living-indigenous-governance-models`,
`non-western-governance-operating-systems`, `religious-governance-models`, and
`state-religion-governance-models`. Models governance traditions outside the
liberal-democratic default.

### @themis/ai

Governance AI assistants (`libs/themis/ai/src`, ~8K lines): a
`constitutional-advisor-agent`, `governance-proposal-analyst-agent`,
`governance-facilitator-agent`, `autonomous-governance-delegate-agent`, and a
`parliamentary-procedure-assistant`. LLM-driven agents that operate over the
governance platform.

### @themis/analytics

Governance analytics engines (`libs/themis/analytics/src`): a
`governance-health-monitor`, `voter-behavior-analytics-engine`,
`proposal-outcome-analytics-engine`, `power-distribution-analysis-engine`, and a
`governance-intelligence-reports-engine`. The metrics/observability layer over
governance activity.

### @themis/integrations

The cross-domain bridge library (`libs/themis/integrations/src`, ~20K lines):
named bidirectional bridges to AJE, Iris, Kuan-Yin, Lakshmi, Maat, Maya, Metis,
Sophia, and Veritas (e.g. `iris-themis-governance-assistant`,
`maat-themis-organizational-governance`, `veritas-themis-intelligence-pipeline`,
`sector-specific-governance-bridges`). This is where the governance platform
connects to the rest of Oshun.

### @themis/originality-shields

The **shared Shield evaluator core** (`libs/themis/originality-shields/src`,
~364 lines). Exports the Zod media-family / upload-kind / decision schemas
(`passed` / `review` / `blocked`), the `ThemisOriginalityShieldVerdict` shape,
and `buildThemisOriginalityShieldVerdict()` — the single function every
per-media shield delegates to with its own config. The common scoring/verdict
contract the media shields are thin specializations of.

### @themis/shield-api

The Shield's HTTP/WebSocket surface (`libs/themis/shield-api/src`, ~20K lines /
~11K non-spec): a `server`/`main`/`worker` trio, `runtime-handlers`,
`runtime-queue`, `runtime-health`, `realtime-websocket`, `webhooks`, `metrics`,
an `openapi` spec, and integration adapters for Calliope, Euterpe, and Isis. The
public contract and integration surface for platform consumers of the Shield.

### @themis/shield-client

A small **TypeScript SDK** (`libs/themis/shield-client/src`, ~691 lines, single
module) wrapping the `@themis/shield-api` operations (`scan`, `quickScan`,
`batchScan`, `getResult`, `remediate`, `lookupReference`, `submitReview`,
`getProvenance`, `getHealth`, `getStats`) behind a typed fetch client. A facade
over the API types, not its own logic.

### @themis/shield-analytics

Shield monitoring and continuous-improvement primitives
(`libs/themis/shield-analytics/src`): a `false-positive-tracker`,
`false-negative-tracker`, `threshold-tuning-engine`, `post-publication-monitor`,
`legal-landscape-monitor`, `model-training-feedback`, and a
`dashboard-data-provider`. Closes the loop on detector accuracy.

### @themis/model-governance

Generative-model compliance controls (`libs/themis/model-governance/src`):
`license-verification`, an `opt-out-registry`, `membership-inference` and
`verbatim-reproduction` (memorization) tests, `canary-testing`, and a
`red-team-framework`. Governs the training-data and memorization side of the
models the Shield protects against.

### @themis/compound-detector

Cross-media compound detection (`libs/themis/compound-detector/src`, ~2K lines):
`media-decomposition`, `cross-correlation`, and `ip-holder-cross-reference` —
correlates separate originality matches (e.g. a character that matches across
image _and_ voice _and_ text) into a single compounded risk signal.

### @themis/music-shield

The AI-music copyright shield (`libs/themis/music-shield/src`): a `pipeline`, a
`decision-engine`, a `validation-corpus`, and the `music-shield` orchestrator.
Composes the music analysis primitives (harmonic/melodic/rhythmic/spectral/
structural/vocal/lyric + audio-fingerprint) into a scan→score→review→publish
gate.

### @themis/visual-shield

The visual-originality shield (`libs/themis/visual-shield/src`, 53 modules, ~19K
lines — the largest shield): perceptual `hashing`, neural `embeddings`,
`face-embeddings`/`face-similarity`, `logos`/`trademark-text`,
`style-attribution`, `deepfake-indicators`, `watermarks`, `memorization`,
`protected-persons`, `character-recognition`/`character-silhouettes`, plus
Calliope and Isis integration modules. Scans V2 UGC decals, logos, and custom
championships.

### @themis/text-shield

The text-originality shield (`libs/themis/text-shield/src`, 35 modules, ~10K
lines): `verbatim`, `near-duplicate`, `semantic`, `cross-language`,
`source-attribution`, `common-phrase`, `narrative`/`quest-structure`/
`world-building`/`character-graph` structural matchers, brand detection, a
`composite-scorer`, and `domain-adapters`. Gates UGC names, logos, and
championship text.

### @themis/video-shield

The video-originality shield (`libs/themis/video-shield/src`, ~9K lines):
`frame-extraction`, `scene-boundary-detection`, `frame-visual-analysis`,
`scene-embedding-comparison`, `shot-sequence-matching`,
`montage-pattern-analysis`, `synthetic-video-detection`, `dialogue-comparison`
(`speech-extraction`), `c2pa-provenance`, and an `audio-delegation` to the music
primitives. Gates V2 replay edits and championship media.

### @themis/3d-shield

The 3D-asset shield (`libs/themis/3d-shield/src`, ~6K lines):
`multi-view-rendering`, `neural-embeddings`, `point-cloud-comparison`,
`voxel-occupancy-comparison`, `uv-texture-analysis`, `character-recognition`,
`product-brand-detection`, `architectural-work-detection`, and
`asset-library-deduplication`. Protects AI-generated meshes, environments, and
branded objects.

### @themis/character-shield

The cross-media character shield (`libs/themis/character-shield/src`): a
`character-database`, `visual-character-matching`, `profile-matching`,
`archetype-differentiation`, and `cross-media-compound-detection`. Matches a
character identity across visual, text, voice, and animation modalities.

### @themis/motion-shield

The motion / animation shield (`libs/themis/motion-shield/src`): a
`choreography-database`, `pose-sequence-matching`,
`joint-trajectory-comparison`, `dance-move-classification`,
`performer-style-analysis`, and a `performer-consent-verification` module.
Covers choreography, performer style, and mocap consent.

### @themis/fashion-shield

The fashion / design shield (`libs/themis/fashion-shield/src`):
`textile-pattern-comparison`, `trade-dress-matching`,
`design-patent-comparison`, and `brand-element-detection`. Protects textile
patterns, trade dress, design patents, and brand elements (the recent
`trade-dress-matching` work).

### @themis/design-shield

A **thin facade** (`libs/themis/design-shield/src`, ~49 lines). Exports
`scanThemisDesignShield()`, which simply calls
`buildThemisOriginalityShieldVerdict` from `@themis/originality-shields` with a
`mediaFamily: 'design'` config for V2 UGC decals/logos/custom championships. No
detector logic of its own — it specializes the shared evaluator.

### @themis/environment-shield

The environment / level shield (`libs/themis/environment-shield/src`):
`architectural-detection`, `level-layout-comparison`, and
`environmental-aesthetics-comparison`. Protects game layouts, virtual worlds,
and architectural designs.

### @themis/audio-fingerprint

Copyright audio-fingerprinting primitives (`libs/themis/audio-fingerprint/src`,
~1.5K lines): `perceptual-hash`, `neural-fingerprint`, `content-id`,
`segment-matching`, `stem-matching`, `transform-matching`, and
`identifier-resolution`. Direct-copy detection feeding the music shield.

### @themis/harmonic-analysis

Harmonic-similarity primitives (`libs/themis/harmonic-analysis/src`):
`chord-extraction`, `harmonic-comparison`, and `protectability-scoring`. A music
analysis input to `@themis/music-shield`.

### @themis/melodic-analysis

Melodic-similarity primitives (`libs/themis/melodic-analysis/src`):
`pitch-extraction`, `contour-analysis`, `ngram-matching`, `similarity-metrics`,
and an `invariance` module (transposition/tempo invariance). Music analysis
input to the music shield.

### @themis/rhythmic-analysis

Rhythmic-similarity primitives (`libs/themis/rhythmic-analysis/src`):
`rhythm-extraction` and `rhythm-comparison`. The rhythm-track analysis input to
the music shield.

### @themis/spectral-analysis

Spectral / timbral primitives (`libs/themis/spectral-analysis/src`):
`spectral-extraction`, `timbral-fingerprinting`, and `sample-detection`. Detects
sampled/timbral reuse for the music shield.

### @themis/structural-analysis

Song-structure primitives (`libs/themis/structural-analysis/src`):
`section-segmentation`, `section-comparison`, `arrangement-analysis`,
`energy-contour`, and a `structural-scorer`. Compares overall arrangement for
the music shield.

### @themis/vocal-analysis

Vocal / voiceprint primitives (`libs/themis/vocal-analysis/src`):
`speaker-embedding`, `voice-print-construction`, `vocal-similarity`, a
`voice-database`, and an `anti-impersonation` module. Voice-likeness detection
for the music shield.

### @themis/lyric-analysis

Lyric-similarity primitives (`libs/themis/lyric-analysis/src`): `text-analysis`,
`joint-analysis` (combining lyric + audio signals), and `filtering-thresholds`.
The lyrics analysis input to the music shield.

### @themis/reference-db

The originality reference database (`libs/themis/reference-db/src`, ~16K lines,
32 files): a Drizzle `schema` plus `migrations` and a deep set of ingestion
pipelines — `musicbrainz-ingestion`, `acoustid-ingestion`, `midi-ingestion`,
`lyric-ingestion`, `audio-feature-ingestion`, `public-domain-ingestion` — with
`deduplication`, `protectability-annotation`, `jurisdiction-mapping`,
`release-monitoring`, and a `seed-pipeline`. The corpus the music shields match
against.

### @themis/universal-reference-db

Cross-media reference-DB infrastructure
(`libs/themis/universal-reference-db/src`, ~4.9K non-spec / ~7.5K total lines):
a `drizzle-schema`, `schema`, and `migrations`, plus the population/ingestion
modules `character-reference-population`, `visual-reference-ingestion`,
`face-reference-population`, `model-3d-reference-ingestion`,
`text-reference-corpus`, `trademark-reference-population`, and a
`unified-reference-query`. The schema-plus-ingestion backbone for the non-music
shields' reference indexes (more foundational than `@themis/reference-db`).

### @themis/remediation

The remediation pipeline (`libs/themis/remediation/src`, ~5K lines): a
`remediation-orchestrator` plus `constrained-regeneration`,
`harmonic-reharmonization`, `melody-variation`, `lyric-reformulation`,
`vocal-modification`, and `prompt-risk-assessment`. Clears originality flags
while preserving creative intent rather than just rejecting content.

### @themis/review-pipeline

The human-review queue (`libs/themis/review-pipeline/src`): a `review-queue`,
`reviewer-assignment`, `comparison-tools`, `decision-recording`, and
`sla-monitoring`. The human-in-the-loop path for borderline (`review`-decision)
originality assessments.

### @themis/risk-scoring

Legal-risk scoring (`libs/themis/risk-scoring/src`, 27 files): jurisdiction
analyzers (`us-copyright-analysis`, `uk-cdpa-analysis`,
`eu-copyright-analysis`), `case-law`/`precedent-citation`,
`moral-rights-assessment`, `compound-similarity`, `confidence-interval`,
`threshold-calibration`, `multi-jurisdiction-aggregation`, and a
`composite-scorer`. Turns raw similarity into a legally-framed risk verdict.

### @themis/universal-risk-scoring

The cross-modality **risk-aggregation kernel**
(`libs/themis/universal-risk-scoring/src`) that weights, combines, and
classifies per-element risk signals across the eight media types it enumerates —
`visual`, `text`, `video`, `model_3d`, `character`, `motion`, `fashion`,
`environment`. Three real domain modules sit under the `index.ts` barrel.
`media-weight-tables.ts` owns the weighting: a 34-value
`UniversalRiskWeightElement` taxonomy (`neural_embedding`, `trademark`,
`memorization`, `verbatim`, `deepfake`, `trade_dress`, `choreography`, …) and
the per-media `UNIVERSAL_RISK_WEIGHT_TABLES` — e.g. `visual` weights
`neural_embedding`/`character` at 0.25 and `trademark` at 0.10, `text` weights
`verbatim` at 0.30 — with `scoreUniversalRiskElements()` returning the
weight-table dot-product of a media type's element scores (rounded to six
places) and `assertUniversalRiskWeightTablesComplete()` guarding table coverage.
`compound-risk-aggregation.ts` owns the verdict: a five-level
`UNIVERSAL_RISK_LEVELS` ladder (`pass` → `advisory` → `flag` → `high_risk` →
`reject`) with `UNIVERSAL_RISK_SCORE_THRESHOLDS`, a
`classifyUniversalRiskScore()` score→level mapper, and
`aggregateUniversalCompoundRisk()` that rolls multiple per-media
`UniversalMediaRiskResult`s into one compound verdict. `jurisdiction-rules.ts`
adds the legal overlay: `UNIVERSAL_JURISDICTION_CODES` (`US`/`EU`/`UK`),
per-jurisdiction `UNIVERSAL_JURISDICTION_RULES` rule sets, and
`assessUniversalJurisdictionRisk()` that re-weights a media result against a
jurisdiction's rules. The `describeThemisUniversalRiskScoring()` descriptor
still reports `scaffoldComplete: true`: this lib owns the weighting,
aggregation, classification, and jurisdiction math and is fed per-element scores
from outside — the detectors that _produce_ those element scores (the work the
per-media Shields do) are not wired in here. It is the generalisation of the
legal-only `@themis/risk-scoring` into an all-media risk-aggregation surface.

### @themis/universal-provenance

A TS library (`libs/themis/universal-provenance/src/index.ts`, ~1.2K non-spec
lines across three modules, ~1.8K with tests; description "Themis universal
provenance primitives for cross-media generated content.") holding the
cross-media audit-trail backbone for the Originality Shield.
`content-addressed-storage.ts` is the core: SHA-256 content addressing for any
payload (string, bytes, or `canonicalUniversalJson` of structured content), a
`UniversalContentHash` of form `sha256:<hex>`, and an
`InMemoryUniversalContentAddressedStorage` keeping content records plus an
append-only, self-hashing provenance event log (`appendEvent` /
`getEventsByContentHash`, each event carrying its own `eventHash`), with real
`verifyUniversalContentHash` / `verifyUniversalProvenanceEventHash` checks.
`cross-media-project-linkage.ts` links components
(audio/lyrics/image/model_3d/character_profile/…) into one project, records
per-component scans, and rolls up a `UniversalProjectProvenanceView` whose
`requiresCompoundReview` fires when a project spans multiple media at
≥`advisory` risk. `legal-discovery-interface.ts` records generation,
decision-chain and human-review provenance and answers a single-identifier
`query()` with a full discovery response — including a `completeness` audit and
a genuinely valid PDF-1.4 byte source from `renderSimplePdfSource`. Honest
caveats: all three stores are `InMemory*` reference implementations (no DB
persistence) and `describeThemisUniversalProvenance()` still reports
`scaffoldComplete: true`. It is the cross-media generalisation of the legal-only
`@themis/provenance`, paralleling how `@themis/universal-risk-scoring`
generalises `@themis/risk-scoring`.

### @themis/universal-remediation

A TS library (`libs/themis/universal-remediation/src/...`, ~1,590 implementation
lines across six modules; description "Themis universal remediation primitives
for cross-media originality flags") that plans and drives the fix-and-rescan
loop after the Originality Shields flag generated content. Four per-media
engines — `UniversalVisualRemediationEngine`, `UniversalTextRemediationEngine`,
`UniversalVideoRemediationEngine`, `UniversalModel3DRemediationEngine` — each
take a scan summary on the `pass→advisory→flag→high_risk→reject` ladder,
short-circuit to `not_required` when risk is low, otherwise map match types to
deterministic operations (`planTextRemediationOperations` emits
`passage_rewrite`/`character_rename`/`plot_divergence`; visual emits
`palette_shift`/`trademark_inpaint`/`negative_prompt_regeneration`) and rescan
up to `maxRescanAttempts`, returning `cleared` or `still_flagged`.
`UniversalRemediationOrchestrator` dispatches by media type, escalates
`still_flagged`→`human_review` through an injected escalator, and tracks
per-media success-rate stats. It is honestly a scaffold — its descriptor
self-reports `scaffoldComplete: true`. The control flow and operation-planning
are real and deterministic, but no pixels, meshes, or audio are actually edited:
engines emit asset _descriptors_ (a `contentToken` string, negative-constraint
prompt text, `operationsApplied`) and `applyTextRemediation` only inserts
`[rewritten passage…]` placeholders. The detector that re-scores is an injected
`Scanner` seam with nothing wired in, and only four of the nine enumerated media
types have engines. It is the remediation counterpart to
`@themis/universal-risk-scoring`.

### @themis/universal-review

A TS library (`libs/themis/universal-review/src/...`, ~1,293 lines; description
"Themis universal human review primitives for cross-media originality
assessments") providing the human-review layer of the Originality Shield. Three
real modules sit under the `index.ts` barrel. `universal-review-queue.ts` owns
triage: `calculateUniversalReviewPriority()` derives a 1–5 priority from risk
level (`reject`/`high_risk`→1 … `pass`→5), then applies media escalators —
`celebrity_deepfake` on visual/video, `unconsented_face` /
`memorized_training_sample`, `trademark_in_commerce`, compound-media counts —
with per-priority SLA due-dates (4h…7d) and an
`InMemoryUniversalReviewPriorityQueue` that enqueues, locks, requeues timed-out
locks, and completes. `reviewer-pool-management.ts`'s
`UniversalReviewerPoolAssignmentEngine` maps the nine media types to required
expertise (adding `ip_attorney` for P1/high-risk/compound/trademark cases) and
runs a greedy least-loaded set-cover over qualified reviewers, escalating on
`capacity_exhausted`/`no_qualified_reviewer`/`sla_breached`.
`cross-media-review-interface.ts`'s API builds reviewer-UI payloads —
synchronized playback, text-diff, split-screen, 3D overlay, motion timeline —
plus route descriptors, failing loud via `UniversalReviewInterfaceError`. Honest
caveats: `describeThemisUniversalReview()` still reports
`scaffoldComplete: true`; the sole data source is in-memory, the queue is a
BullMQ-shaped interface with an in-memory implementation (no broker wired), and
`diffTokens` is a positional token compare, not a true LCS diff. It pairs with
`@themis/universal-risk-scoring`: that lib scores risk, this one routes flagged
work to qualified humans.

### @themis/universal-analytics

A TS library (`libs/themis/universal-analytics/src/...`, ~1,586 lines;
description "Themis universal analytics primitives for cross-media shield
monitoring") that is the observability and legal-watch layer over the
cross-media shield. Three real modules sit under the `index.ts` barrel, all
keyed on the nine-value `THEMIS_UNIVERSAL_ANALYTICS_MEDIA_TYPES` enum and the
five-level `pass → advisory → flag → high_risk → reject` ladder shared with
`@themis/universal-risk-scoring`. `cross-media-dashboard-data-provider.ts`
records `UniversalAnalyticsScanEvent`s into an in-memory store and computes real
metrics — per-media false-positive/negative rates, cache-hit rate,
average/p95/p99 latency percentiles, risk-level distributions, reference-work
match summaries, and hour/day/week/month time-series buckets — while
`exportPrometheusMetrics()` emits genuine Prometheus exposition text
(`themis_universal_scans_total`, latency gauges, FP/FN rates).
`media-type-risk-comparison.ts` ranks media types, model/domain pairs and
reference works by flag rate, then derives baseline-vs -comparison trends with
multiplier-gated `warning`/`critical` alerts.
`cross-media-legal-landscape-monitor.ts` ingests deduplicated case-decision and
legislative updates against a real hand-curated watchlist (Andersen v. Stability
AI, Getty, NYT v. OpenAI, NO FAKES Act, ELVIS Act) and emits threshold-change
recommendations. Honest caveats: state is in-memory and fed from outside, the
legal monitor's `UniversalLegalLandscapeSourceAdapter` is an injectable seam
with no real feed wired in, and `describeThemisUniversalAnalytics()` still
reports `scaffoldComplete: true`.

### @themis/cross-media-governance

A TS library (`libs/themis/cross-media-governance/src/...`, ~1,790 lines of
`src` across four capability modules plus the barrel; description "Themis
cross-media governance primitives for training data, memorization, red-team, and
opt-out controls"). The `index.ts` barrel enumerates eight media types (`image`,
`text`, `video`, `model_3d`, `music`, `motion`, `voice`, `character`) and four
capabilities, each backed by a real module. `training-data-audit.ts` runs
`ThemisCrossMediaTrainingDataAuditor.audit()`: per-media license, fair-use, and
consent rules (Getty/Shutterstock exclusion, mocap performer consent,
voice-corpus consent, character-rights clearance) that roll up into a
`complianceScore` and a `pass`/`manual_review`/`block` deployment gate.
`memorization-testing.ts` and `red-team-framework.ts` score model output against
reference probes with real `cosineSimilarity`, `ngramOverlap`, and
frame-similarity math and per-media thresholds, classifying memorization and
copyright/likeness vulnerabilities. `unified-opt-out-registry.ts` is an
in-memory `Map` registry with a verify/revoke lifecycle whose
`verifyDeploymentCompliance()` cross-checks datasets against active opt-outs.
Honest caveats: the model that actually generates probe outputs is an injected
seam (`ThemisCrossMediaMemorizationGenerator`/`RedTeamGenerator`), the registry
is in-memory with no persistence or crypto, and
`describeThemisCrossMediaGovernance()` still reports `scaffoldComplete: true`.
It is the originality-shield's model-governance surface — auditing what a
generative model was trained on and whether it regurgitates protected works —
beside `@themis/universal-risk-scoring`.

### @themis/watermarking

A TS library (`libs/themis/watermarking/src`, ~2,600 lines across six modules;
description "Themis content watermarking and authentication primitives for
generated media") implementing the forensic-watermarking + provenance leg of the
Originality Shield. `invisible-image-watermark.ts` is a real DCT mid-band
spread-spectrum coder (8×8 luminance blocks, `mulberry32`-keyed block spreading,
chip-summed correlation detection); `invisible-audio-watermark.ts` embeds
spread-spectrum chips at an RMS-scaled amplitude and detects via per-bit SNR
thresholding (mono + interleaved-multichannel); `invisible-video-watermark.ts`
adds a temporal frame-mean channel plus per-frame fingerprints. Each carries a
length-prefixed `generationId`/timestamp/`modelId` payload guarded by an FNV-1a
checksum and magic word. `c2pa-content-provenance.ts` builds C2PA-style
manifests with `c2pa.actions`, content-hash, and EU AI Act Article 50 disclosure
assertions, signed with HMAC-SHA256 over canonical JSON (a symmetric
platform-key scheme, not full X.509/COSE C2PA).
`watermark-extraction-service.ts` fuses watermark + manifest evidence;
`leak-detection-pipeline.ts` runs connectors → authorization policy →
DMCA-notice/provenance/alert. Honest caveats: the `index.ts` descriptor still
self-reports `scaffoldComplete: true`, and the leak pipeline's platform
connectors (`youtube_content_id`, `social_media_api`, …) are injectable seams —
only a static in-memory connector ships; real platform scanners plug in from
outside.

### @themis/provenance

Provenance and audit-trail primitives (`libs/themis/provenance/src`, ~2.4K
lines): a `generation-recorder`, `scan-recorder`, `decision-audit-trail`,
`content-hash`, `training-data-provenance`, and `provenance-export`. Records the
who/what/when of every generation and scan for downstream audit.

### @themis/academic-integrity

The adjudication mechanics behind Metis academic-integrity verdicts (§8.17)
(`libs/themis/academic-integrity/src`, ~4K lines, organized into subdirs):
`signals/` (the signal taxonomy), `classifier/` (calibrated policy + severity→
action map), `appeals/` (appeals workflow), `bias/` (bias monitor), `verdict/`
(audit persistence), and an `orchestrator/`. Owns how academic-integrity signals
become defensible, appealable verdicts — distinct from the originality Shield.
