# Themis Domain

> **Themis** - Governance, Democracy, and Compliance Infrastructure

Library-only domain providing a comprehensive governance technology platform
spanning decentralized autonomous organizations, voting mechanisms, deliberative
democracy, constitutional frameworks, judicial systems, crisis governance,
policy analysis, and cross-domain integrations. Named after the Greek titan of
divine law and order.

---

## Overview

The Themis domain models the full spectrum of governance, from traditional
governmental structures and indigenous governance systems to cutting-edge DAO
infrastructure and AI-assisted deliberation. It provides 32 libraries organized
around a core data model with event sourcing and graph-based relationship
tracking, supporting everything from quadratic voting engines to agent-based
governance simulations.

Music Shield integration documentation:

- [Universal Shield Developer Integration Guide](./universal-shield-developer-integration-guide.md) -
  integrate any domain or media type with the Phase 75 Universal Originality
  Shield.
- [Universal Shield Reviewer Guide](./universal-shield-reviewer-guide.md) -
  review flagged, high-risk, and compound Universal Shield outputs across all
  media types.
- [Universal Shield Regulatory Compliance Guide](./universal-shield-regulatory-compliance-guide.md) -
  map Universal Shield evidence, reports, and audit trails to EU, U.S., UK,
  C2PA, biometric, and digital replica compliance workflows.
- [Universal Shield Reference Database Administration Guide](./universal-shield-reference-database-administration-guide.md) -
  operate all-media reference ingestion, eligibility, maintenance, monitoring,
  scaling, backup, and legal-hold workflows.
- [Music Shield Developer Guide](./music-shield-developer-guide.md) - integrate
  `@themis/shield-client` into generation and publishing pipelines.
- [Music Shield Reference Database Administration Guide](./database.md) -
  operate the reference works database, ingestion jobs, deduplication,
  protectability annotations, backup, recovery, and scaling.
- [Music Shield Human Reviewer Guide](./music-shield-human-reviewer-guide.md) -
  review queue workflow, A/B comparison, decision recording, escalation,
  training, and genre-specific guidance.
- [Music Shield Legal Team Guide](./music-shield-legal-team-guide.md) -
  interpret risk assessments, jurisdiction reports, provenance exports, audit
  trails, and case law citations.

---

## Architecture

```
                        @themis/integrations
               (cross-domain bridges to Veritas, Aje, etc.)
                                |
    +--------+--------+---------+---------+--------+--------+
    |        |        |         |         |        |        |
 @themis/ @themis/ @themis/  @themis/  @themis/ @themis/ @themis/
  dao     voting  deliber-  arbitra-  crisis  analytics  ai
          |       ation     tion      |        |         |
          +--------+---------+---------+--------+---------+
                                |
                           @themis/core
               (data models, events, graph, migrations)
```

All libraries export a module identifier constant (e.g., `themiscoreModule`) and
re-export their implementations. The `@themis/core` library provides the
foundational data models, database schema, event bus, and graph structures that
other libraries build upon.

---

## Libraries (32)

### Core Governance

#### `@themis/core` - Foundation Data Models

Core governance data models providing the foundational types and persistence
layer for the entire Themis domain. Includes database schema definitions, an
event sourcing system for governance actions, a graph structure for modeling
relationships between entities, and comprehensive type definitions for
proposals, votes, organizations, and participants.

**Key exports:** `database`, `events`, `graph`, `types`

#### `@themis/dao` - DAO Infrastructure

Decentralized Autonomous Organization lifecycle management:

- **dao-constitution-designer** - Visual/programmatic DAO constitution design
- **dao-cross-chain-governance-coordinator** - Multi-chain DAO governance
  synchronization
- **dao-delegation-strategy-engine** - Automated delegation strategy
  optimization
- **dao-governance-template-library** - Pre-built governance templates
- **dao-legal-wrapper-advisor** - Legal entity wrapper guidance (LLC,
  Foundation, Association)
- **dao-proposal-lifecycle-manager** - End-to-end proposal management from draft
  to execution
- **dao-proposal-quality-gates** - Automated proposal quality scoring and
  validation
- **dao-subdao-architecture-manager** - Hierarchical sub-DAO structure
  management

#### `@themis/voting` - Voting Mechanisms

Comprehensive voting system implementations:

- **universal-ballot-system** - Multi-format ballot creation and tallying
- **delegation-engine** - Liquid democracy delegation with transitive and
  topic-scoped delegation
- **token-weighted-voting** - ERC-20/ERC-721 token-weighted voting
- **quadratic-voting** - Quadratic voting with credit management
- **ranked-choice-voting** - Instant-runoff ranked choice tallying
- **approval-voting** - Approval voting with threshold configuration
- **condorcet-voting** - Condorcet method with cycle resolution
- **conviction-voting-engine** - Conviction voting with time-weighted signals
- **holographic-consensus** - Holographic consensus for scalable governance
- **optimistic-governance** - Optimistic approval with challenge periods
- **vote-escrow-governance** - Vote-escrowed token governance (ve-model)
- **multi-sig-voting** - Multi-signature voting for committee decisions

#### `@themis/reputation` - Reputation Systems

Participant reputation and delegate scoring:

- **delegate-scoring-system** - Multi-dimensional delegate performance scoring
- **eigentrust-reputation-engine** - EigenTrust-based distributed reputation
  calculation
- **participation-analytics-engine** - Participation rate and quality analytics
- **reputation-portability-engine** - Cross-platform reputation portability

#### `@themis/decisions` - Decision Frameworks

Structured decision-making tools:

- **mcda-engine** - Multi-Criteria Decision Analysis with weighted scoring
- **prediction-market-engine** - Internal prediction markets for decision
  forecasting
- **futarchy-execution-engine** - Futarchy implementation (governance by
  prediction markets)
- **decision-quality-tracker** - Decision outcome tracking and calibration

#### `@themis/deliberation` - Deliberative Democracy

Discussion and deliberation infrastructure:

- **discussion-platform** - Structured discussion with threading and moderation
- **argument-mapping-engine** - Argument map visualization with
  pro/con/qualifier relationships
- **opinion-clustering-engine** - Opinion clustering for consensus
  identification (Polis-style)
- **citizen-assembly-engine** - Sortition-based citizen assembly management
- **tech-enhanced-deliberation** - Technology-enhanced deliberation with
  real-time translation
- **participatory-process-designer** - Custom participatory process design
- **ai-deliberation-assistant** - AI-powered deliberation facilitation and
  summarization

#### `@themis/constitutions` - Constitutional Frameworks

Organizational constitution management:

- **charter-authoring** - Visual charter and constitution authoring
- **ai-drafting** - AI-assisted constitutional drafting
- **clause-library** - Reusable governance clause library
- **version-control** - Constitutional version control with amendment tracking
- **amendment-lifecycle** - Amendment proposal, debate, and ratification
- **computational-law-compiler** - Compile governance rules to executable code
- **governance-rule-simulator** - Simulate governance rule interactions
- **smart-contract-generation** - Generate smart contracts from constitutional
  clauses
- **jurisdictional-compliance** - Check constitutions against jurisdictional
  requirements

### Identity and Accountability

#### `@themis/identity` - Governance Identity

Identity verification for governance participation:

- **decentralized-identity-integration** - DID-based identity for governance
- **eligibility-engine** - Voter eligibility determination with configurable
  rules
- **governance-credential-issuer** - Issue verifiable credentials for governance
  roles
- **sybil-resistance-engine** - Sybil attack prevention using proof of
  personhood

#### `@themis/accountability` - Accountability Mechanisms

Governance integrity and accountability:

- **governance-integrity-monitor** - Real-time governance integrity monitoring
- **governance-promise-accountability** - Track elected/appointed official
  promises against actions
- **governance-quality-index** - Composite governance quality scoring
- **secure-whistleblower-protection-system** - Anonymous whistleblower
  submission with cryptographic protection
- **veritas-governance-accountability-bridge** - Cross-domain bridge to Veritas
  for journalism accountability

#### `@themis/transparency` - Audit Trails

Transparency and open data:

- **campaign-finance-transparency** - Campaign finance disclosure and tracking
- **governance-open-data-portal** - Open data API for governance records
- **immutable-governance-audit-trail** - Blockchain-anchored immutable audit
  logs
- **lobbying-transparency-system** - Lobbying activity disclosure
- **public-records-management** - Public records lifecycle management

#### `@themis/privacy` - Privacy in Governance

Privacy-preserving governance mechanisms:

- **confidential-governance-channels** - Encrypted channels for sensitive
  governance discussions
- **maci-anti-collusion-infrastructure** - MACI (Minimal Anti-Collusion
  Infrastructure) for bribery-resistant voting
- **private-delegation-engine** - Private delegation with zero-knowledge proofs
- **verifiable-offchain-governance** - Verifiable off-chain governance with
  on-chain settlement
- **zk-anonymous-voting** - Zero-knowledge anonymous voting system

### Legal and Compliance

#### `@themis/traditional` - Traditional Law Systems

Historical and living governance traditions:

- **living-indigenous-governance-models** - Indigenous governance systems
  (Haudenosaunee, Ubuntu, Maori)
- **customary-law-integration-framework** - Customary law integration with
  modern governance
- **religious-governance-models** - Religious governance frameworks
- **state-religion-governance-models** - Church-state governance models
- **non-western-governance-operating-systems** - Non-Western governance
  paradigms

#### `@themis/digital` - Digital Governance

Platform and technology governance:

- **platform-governance-models** - Social platform content governance models
- **algorithmic-governance-framework** - Algorithmic decision accountability
- **ai-governance-systems** - AI system governance and oversight
- **autonomous-systems-governance** - Autonomous vehicle/drone governance
- **internet-governance-engine** - Internet governance (ICANN, IETF model)
- **open-source-governance-models** - Open source project governance (Apache,
  Linux Foundation)
- **technology-standards-governance** - Technical standards body governance
- **data-governance-frameworks** - Data governance and sovereignty frameworks

#### `@themis/international` - International Governance

International relations and global governance:

- **international-organizations-governance-engine** - UN, EU, AU governance
  modeling
- **treaty-governance-lifecycle** - Treaty negotiation, ratification, and
  compliance tracking
- **diplomatic-governance-models** - Diplomatic protocol and governance
- **sovereignty-models** - Sovereignty frameworks and shared governance models
- **trade-governance-systems** - WTO and trade governance modeling
- **international-financial-governance** - IMF, World Bank governance structures
- **global-commons-governance** - Ocean, space, and atmospheric commons
  governance
- **international-collective-action-engine** - Collective action problem
  modeling

#### `@themis/justice` - Justice Systems

Judicial and legal system governance:

- **judicial-system-architecture-engine** - Court system modeling and judicial
  appointment
- **legal-traditions-comparison-engine** - Common law vs. civil law comparison
- **criminal-justice-governance-models** - Criminal justice policy modeling
- **judicial-independence-framework** - Judicial independence safeguards
- **transitional-justice-governance-engine** - Post-conflict transitional
  justice
- **reparations-governance-framework** - Reparations policy design
- **access-to-justice-governance** - Legal aid and access to justice programs

#### `@themis/arbitration` - Dispute Resolution

Decentralized arbitration and mediation:

- **decentralized-arbitration-court** - Kleros-style decentralized arbitration
- **dispute-management-system** - Dispute lifecycle tracking
- **multi-tier-escalation-engine** - Escalation from mediation to arbitration to
  litigation
- **restorative-justice-framework** - Restorative justice process management
- **structured-mediation-protocol** - Structured mediation with AI facilitation

### Organizational Governance

#### `@themis/corporate` - Corporate Governance

Enterprise governance tools:

- **committee-governance-manager** - Board committee management
- **digital-board-management-platform** - Digital board meeting platform
- **esg-governance-compliance-engine** - ESG compliance tracking and reporting
- **esg-governance-integration-engine** - ESG integration into corporate
  strategy
- **fiduciary-duty-monitoring-engine** - Fiduciary duty compliance monitoring
- **proxy-voting-infrastructure** - Shareholder proxy voting system
- **shareholder-engagement-manager** - Shareholder communication management

#### `@themis/nonprofit` - Nonprofit Governance

Nonprofit and cooperative governance:

- **benefit-corporation-governance-manager** - B-Corp governance
- **cooperative-governance-manager** - Worker/consumer cooperative governance
- **fiscal-sponsorship-governance-manager** - Fiscal sponsorship governance
- **grant-governance-manager** - Grant-making governance
- **mondragon-federation-governance-manager** - Mondragon-style cooperative
  federation governance
- **nonprofit-board-governance-manager** - Nonprofit board management

#### `@themis/community` - Community Governance

Community organization governance:

- **association-governance-manager** - Professional association governance
- **community-organization-toolkit-manager** - Community organizing tools
- **housing-association-governance-manager** - HOA and housing co-op governance
- **labor-union-governance-manager** - Union governance and elections
- **sports-club-governance-manager** - Sports club governance and membership
  voting

#### `@themis/civic` - Civic Participation

Civic engagement and e-government:

- **digital-democracy-platform** - Digital democracy platform for civic
  participation
- **e-government-governance-layer** - E-government integration layer
- **election-management-system** - Election management and result tabulation
- **legislative-monitoring-system** - Legislative bill tracking and voting
  analysis
- **participatory-budgeting-platform** - Participatory budgeting with proposal
  and voting cycles

#### `@themis/sectors` - Sector-Specific Governance

Domain-specific governance systems:

- **military-security-governance** - Military and national security governance
- **health-system-governance** - Healthcare system governance
- **financial-monetary-governance** - Central bank and financial regulatory
  governance
- **urban-municipal-governance** - Municipal and city governance
- **media-governance-frameworks** - Media regulation and press freedom
  governance
- **property-land-governance** - Land rights and property governance
- **behavioral-governance-design** - Behavioral nudge design for governance
- **representation-inclusion-governance** - Representation and inclusion policy
- **civil-society-advocacy-governance** - Civil society and advocacy governance

### Financial Governance

#### `@themis/treasury` - Treasury Management

Organizational treasury governance:

- **participatory-budget-governance-engine** - Participatory budgeting with
  allocation and voting
- **spending-controls-engine** - Multi-signature spending approval and limits
- **treasury-diversification-governance-engine** - Treasury asset
  diversification strategy governance
- **fiscal-transparency-dashboard** - Real-time fiscal transparency reporting

#### `@themis/funding` - Funding Mechanisms

Public goods and organizational funding:

- **quadratic-funding-engine** - Gitcoin-style quadratic funding rounds
- **retroactive-public-goods-funding** - Retroactive public goods funding
  (Optimism RetroPGF model)
- **hypercert-impact-certificate-system** - Hypercert impact certificate
  issuance and trading
- **augmented-bonding-curve-engine** - Augmented bonding curves for continuous
  funding
- **continuous-governance-funding-streams** - Streaming governance fund
  distribution

### Specialized

#### `@themis/environmental` - Environmental Governance

Climate and environmental governance:

- **climate-governance-frameworks** - Climate policy governance modeling
- **digital-commons-governance** - Digital commons (open data, open source)
  governance
- **environmental-impact-governance** - Environmental impact assessment
  governance
- **intergenerational-governance-mechanisms** - Intergenerational equity in
  governance
- **natural-resource-governance** - Natural resource extraction governance
- **operational-commons-governance-engine** - Elinor Ostrom-inspired commons
  governance

#### `@themis/crisis` - Crisis Governance

Emergency and crisis governance:

- **emergency-powers-governance-framework** - Emergency powers activation with
  sunset clauses
- **pandemic-public-health-crisis-governance** - Public health crisis governance
- **continuity-of-government-engine** - Government continuity planning
- **leadership-succession-governance** - Leadership succession protocols
- **governance-failure-analysis-engine** - Post-mortem governance failure
  analysis
- **state-building-post-conflict-governance** - Post-conflict state building
- **democratic-resilience-framework** - Democratic resilience stress testing

#### `@themis/policy` - Policy Frameworks

Policy analysis and simulation:

- **computational-law-engine** - Executable policy specification language
- **policy-analysis-engine** - Policy impact analysis with cost-benefit modeling
- **policy-simulation-engine** - Agent-based policy simulation
- **regulatory-monitoring-system** - Regulatory change monitoring and alerting

#### `@themis/analytics` - Governance Analytics

Governance intelligence and reporting:

- **voter-behavior-analytics-engine** - Voter behavior pattern analysis
- **proposal-outcome-analytics-engine** - Proposal success rate and factor
  analysis
- **governance-health-monitor** - Real-time governance health scoring
- **power-distribution-analysis-engine** - Power concentration and distribution
  analysis
- **governance-intelligence-reports-engine** - Automated governance intelligence
  reports

#### `@themis/knowledge` - Governance Knowledge Base

Political science and governance knowledge repository with 15 engines covering:

- **political-systems-taxonomy** - Political system classification
- **governmental-structure-models** - Government structure models (presidential,
  parliamentary)
- **electoral-systems-knowledge-base** - Electoral system encyclopedia (FPTP,
  PR, mixed)
- **party-systems-and-competition-models** - Party system theory
- **political-philosophy-knowledge-base** - Political philosophy reference
  (Rawls, Nozick, Habermas)
- **governance-theory-engine** - Governance theory evaluation
- **governance-comparison-engine** - Cross-polity governance comparison
- **governance-metrics-integration** - V-Dem, Freedom House metric integration
- **governance-transition-analysis** - Democratic transition analysis
- **historical-governance-timeline** - Historical governance timeline database
- **governance-case-study-library** - Governance case study repository
- **organizational-governance-comparison-engine** - Organizational governance
  benchmarking
- **governance-pattern-library** - Reusable governance design patterns
- **governance-literacy-curriculum-engine** - Civic education curriculum
- **governance-scenario-explorer** - Interactive governance scenario exploration

#### `@themis/frameworks` - Governance Frameworks

Governance system implementations:

- **direct-democracy** - Direct democracy referendum system
- **representative-democracy** - Representative democracy with elections
- **liquid-democracy** - Liquid democracy with delegation chains
- **sociocracy-3** - Sociocracy 3.0 circle governance
- **holacracy** - Holacratic circle and role governance
- **conviction-voting** - Conviction voting continuous signaling
- **futarchy** - Futarchy governance-by-prediction-markets
- **bicameral-governance** - Two-chamber governance with reconciliation
- **consensus-governance** - Consensus-based governance models
- **hybrid-framework-composer** - Compose hybrid governance frameworks from
  primitives

#### `@themis/simulation` - Governance Simulation

Governance modeling and stress testing:

- **governance-agent-based-simulation-framework** - Agent-based governance
  simulation engine
- **governance-prebuilt-simulation-scenarios** - Pre-built simulation scenarios
  (voter apathy, capture, etc.)
- **governance-resilience-stress-testing-engine** - Stress testing governance
  under adversarial conditions
- **constitutional-design-simulation-engine** - Simulate constitutional design
  trade-offs

#### `@themis/ai` - AI Governance Agents

AI-assisted governance:

- **autonomous-governance-delegate-agent** - Autonomous delegate agent that
  votes according to configured principles
- **governance-proposal-analyst-agent** - AI agent for proposal analysis and
  impact assessment
- **parliamentary-procedure-assistant** - Robert's Rules and parliamentary
  procedure assistant
- **governance-facilitator-agent** - AI meeting and process facilitator
- **constitutional-advisor-agent** - AI constitutional law advisor

#### `@themis/integrations` - Cross-Domain Bridges

Integration bridges to other Oshun domains:

- **veritas-themis-intelligence-pipeline** - Veritas journalism data feeding
  governance analytics
- **themis-veritas-governance-feed** - Governance data feeding Veritas newsroom
- **governance-journalism-collaboration-hub** - Journalist-governance
  collaboration
- **themis-aje-governance-execution-bridge** - Execute governance decisions
  on-chain via Aje
- **aje-themis-governance-data-ingestion** - Ingest on-chain governance data
- **maat-themis-organizational-governance** - Maat organizational management
  integration
- **lakshmi-themis-fiscal-governance** - Lakshmi financial governance bridge
- **kuan-yin-themis-ethical-governance** - Kuan Yin ethical governance advisory
- **iris-themis-governance-assistant** - Iris conversational governance
  assistant
- **sophia-themis-knowledge-governance** - Sophia knowledge base integration
- **metis-themis-civic-education** - Metis civic education integration
- **maya-themis-virtual-governance** - Maya virtual governance environments
- **sector-specific-governance-bridges** - Additional domain-specific governance
  bridges

---

## Technology Stack

| Component  | Technology                                 |
| ---------- | ------------------------------------------ |
| Language   | TypeScript (ESM)                           |
| Runtime    | Node.js                                    |
| Build      | Nx with `@nx/js:tsc`                       |
| Testing    | Vitest                                     |
| Database   | PostgreSQL (via `@themis/core` migrations) |
| Validation | Zod schemas in select libraries            |

---

## Development

```bash
# Test a specific library
pnpm nx test @themis/core

# Build all Themis libraries
pnpm nx run-many --target=build --projects=tag:scope:themis

# Lint a library
pnpm nx lint @themis/voting

# Run all domain tests
pnpm nx run-many --target=test --projects=tag:scope:themis
```

### Configuration

- **Project tags:** `["scope:themis", "layer:domain", "type:lib"]`
- **Build executor:** `@nx/js:tsc`
- **Special features:** Domain-wide `tsconfig.domain.json`, shared ESLint and
  Prettier configs, shared Vitest configuration
- **Database:** `@themis/core` includes PostgreSQL migrations for governance
  data
- All libraries export a module identifier constant for runtime identification
