# sexysexy0/public-matters architecture

> Architecture diagram of the GitHub repository sexysexy0/public-matters, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sexysexy0/public-matters
- Repository: https://github.com/sexysexy0/public-matters

## Overview

Public-Matters combines Solidity governance and accountability contracts with operational JavaScript utilities. The clearest sampled runtime flow is a health check recording agent-performance metrics to a local append-only log; separate scripts record governance risks and query an on-chain consciousness ledger through an RPC provider. The README also describes security guardrails and automated health checks, but their implementation wiring is not shown in the excerpts. Contract capabilities are represented as subsystems from the tree, without inferred call relationships.

Main entry points: [`script/export_consciousness.js`](https://github.com/sexysexy0/public-matters/blob/main/script/export_consciousness.js) (Ledger Query), [`scripts/healthCheck.js`](https://github.com/sexysexy0/public-matters/blob/main/scripts/healthCheck.js) (Health Check), [`utils/agentPerformance.js`](https://github.com/sexysexy0/public-matters/blob/main/utils/agentPerformance.js) (Performance Tracking), [`scripts/governanceRiskTracker.js`](https://github.com/sexysexy0/public-matters/blob/main/scripts/governanceRiskTracker.js) (Risk Tracker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Operations"]
  node_healthcheck["Health Check<br/>[healthCheck.js]"]
  node_performance["Performance Tracking"]
  node_performance_log["Performance Log"]
  node_risk_tracker["Risk Tracker"]
  node_risk_log["Risk Log"]
  node_consciousness_export["Ledger Query"]
  node_security_workflows["Security Guardrails<br/>[security.yml]"]
end

subgraph group_governance["Governance Contracts"]
  node_ai_governance["AI Governance"]
  node_decision_audit["Decision Auditing"]
  node_action_gate["Action Guardrails"]
  node_accountability["Accountability"]
  node_transparency[("Transparency")]
end

subgraph group_community["Community Contracts"]
  node_community_dao["Community DAO<br/>[CommunityDAO.sol]"]
  node_resource_stewardship[("Resource Stewardship")]
end

subgraph group_specialized["Specialized Contracts"]
  node_consciousness_ledger[("Consciousness Ledger")]
  node_prediction_markets["Prediction Markets"]
  node_neuroscience["Research Registry"]
  node_energy_resilience["Energy Resilience"]
end

node_operator(("Operator"))
node_rpc["Ethereum RPC"]

node_operator -->|"runs"| node_healthcheck
node_healthcheck -->|"records metrics"| node_performance
node_performance -->|"appends records"| node_performance_log
node_operator -.->|"records risks"| node_risk_tracker
node_risk_tracker -->|"appends records"| node_risk_log
node_operator -.->|"runs query"| node_consciousness_export
node_consciousness_export -->|"queries via"| node_rpc
node_consciousness_export -->|"reads log count"| node_consciousness_ledger

click node_healthcheck "https://github.com/sexysexy0/public-matters/blob/main/scripts/healthCheck.js"
click node_performance "https://github.com/sexysexy0/public-matters/blob/main/utils/agentPerformance.js"
click node_risk_tracker "https://github.com/sexysexy0/public-matters/blob/main/scripts/governanceRiskTracker.js"
click node_consciousness_export "https://github.com/sexysexy0/public-matters/blob/main/script/export_consciousness.js"
click node_consciousness_ledger "https://github.com/sexysexy0/public-matters/blob/main/src/OperatorConsciousnessLedger.sol"
click node_ai_governance "https://github.com/sexysexy0/public-matters/blob/main/src/AIAgentRegistry.sol"
click node_decision_audit "https://github.com/sexysexy0/public-matters/blob/main/src/AIDecisionAudit.sol"
click node_action_gate "https://github.com/sexysexy0/public-matters/blob/main/src/GovernedActionGate.sol"
click node_accountability "https://github.com/sexysexy0/public-matters/blob/main/src/AccountabilityArc.sol"
click node_transparency "https://github.com/sexysexy0/public-matters/blob/main/src/TransparencyLedger.sol"
click node_community_dao "https://github.com/sexysexy0/public-matters/blob/main/contracts/community/CommunityDAO.sol"
click node_resource_stewardship "https://github.com/sexysexy0/public-matters/blob/main/contracts/community/ResourceStewardshipEscrow.sol"
click node_prediction_markets "https://github.com/sexysexy0/public-matters/blob/main/contracts/prediction/FairLiquidityPool.sol"
click node_neuroscience "https://github.com/sexysexy0/public-matters/blob/main/contracts/neuroscience/StudyDesignRegistry.sol"
click node_energy_resilience "https://github.com/sexysexy0/public-matters/blob/main/contracts/EnergyResilience.sol"
click node_security_workflows "https://github.com/sexysexy0/public-matters/blob/main/.github/workflows/security.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_healthcheck,node_performance,node_performance_log,node_risk_tracker,node_risk_log,node_consciousness_export,node_security_workflows toneBlue
class node_ai_governance,node_decision_audit,node_action_gate,node_accountability,node_transparency toneAmber
class node_community_dao,node_resource_stewardship toneMint
class node_consciousness_ledger,node_prediction_markets,node_neuroscience,node_energy_resilience toneRose
class node_operator,node_rpc toneIndigo
```

## Components

### Operations

- [Health Check](https://github.com/sexysexy0/public-matters/blob/main/scripts/healthCheck.js): `scripts/healthCheck.js`
- [Performance Tracking](https://github.com/sexysexy0/public-matters/blob/main/utils/agentPerformance.js): `utils/agentPerformance.js`
- **Performance Log**
- [Risk Tracker](https://github.com/sexysexy0/public-matters/blob/main/scripts/governanceRiskTracker.js): `scripts/governanceRiskTracker.js`
- **Risk Log**
- [Ledger Query](https://github.com/sexysexy0/public-matters/blob/main/script/export_consciousness.js): `script/export_consciousness.js`
- [Security Guardrails](https://github.com/sexysexy0/public-matters/blob/main/.github/workflows/security.yml): `.github/workflows/security.yml`

### Governance Contracts

- [AI Governance](https://github.com/sexysexy0/public-matters/blob/main/src/AIAgentRegistry.sol): `src/AIAgentRegistry.sol`
- [Decision Auditing](https://github.com/sexysexy0/public-matters/blob/main/src/AIDecisionAudit.sol): `src/AIDecisionAudit.sol`
- [Action Guardrails](https://github.com/sexysexy0/public-matters/blob/main/src/GovernedActionGate.sol): `src/GovernedActionGate.sol`
- [Accountability](https://github.com/sexysexy0/public-matters/blob/main/src/AccountabilityArc.sol): `src/AccountabilityArc.sol`
- [Transparency](https://github.com/sexysexy0/public-matters/blob/main/src/TransparencyLedger.sol): `src/TransparencyLedger.sol`

### Community Contracts

- [Community DAO](https://github.com/sexysexy0/public-matters/blob/main/contracts/community/CommunityDAO.sol): `contracts/community/CommunityDAO.sol`
- [Resource Stewardship](https://github.com/sexysexy0/public-matters/blob/main/contracts/community/ResourceStewardshipEscrow.sol): `contracts/community/ResourceStewardshipEscrow.sol`

### Specialized Contracts

- [Consciousness Ledger](https://github.com/sexysexy0/public-matters/blob/main/src/OperatorConsciousnessLedger.sol): `src/OperatorConsciousnessLedger.sol`
- [Prediction Markets](https://github.com/sexysexy0/public-matters/blob/main/contracts/prediction/FairLiquidityPool.sol): `contracts/prediction/FairLiquidityPool.sol`
- [Research Registry](https://github.com/sexysexy0/public-matters/blob/main/contracts/neuroscience/StudyDesignRegistry.sol): `contracts/neuroscience/StudyDesignRegistry.sol`
- [Energy Resilience](https://github.com/sexysexy0/public-matters/blob/main/contracts/EnergyResilience.sol): `contracts/EnergyResilience.sol`

### Other components

- **Operator**
- **Ethereum RPC**

## Connections

- Operator → Health Check: runs (evidence: `scripts/healthCheck.js`)
- Health Check → Performance Tracking: records metrics (evidence: `scripts/healthCheck.js`)
- Performance Tracking → Performance Log: appends records (evidence: `utils/agentPerformance.js`)
- Operator → Risk Tracker: records risks
- Risk Tracker → Risk Log: appends records (evidence: `scripts/governanceRiskTracker.js`)
- Operator → Ledger Query: runs query
- Ledger Query → Ethereum RPC: queries via (evidence: `script/export_consciousness.js`)
- Ledger Query → Consciousness Ledger: reads log count (evidence: `script/export_consciousness.js`)
