Metadata-Version: 2.4
Name: G1-Docket-SDK
Version: 1.0.2
Summary: G1 Docket Developer Client SDK — Zero-Trust Data Attestation & AI Gateway Integrations
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: cryptography>=41.0.0
Requires-Dist: jsonschema>=4.20.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: fastapi>=0.109.0
Requires-Dist: uvicorn>=0.27.0
Requires-Dist: sqlalchemy>=2.0.25
Requires-Dist: httpx>=0.26.0
Requires-Dist: pyjwt>=2.8.0
Requires-Dist: openpyxl>=3.1.2
Requires-Dist: psycopg2-binary>=2.9.9
Requires-Dist: pytest>=8.0.0
Requires-Dist: pytest-asyncio>=0.23.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: pyyaml>=6.0.0
Provides-Extra: integrations
Requires-Dist: langchain-core>=0.1.0; extra == "integrations"
Requires-Dist: llama-index-core>=0.10.0; extra == "integrations"
Dynamic: license-file

<p align="center">
  <img src="prevalidator/g1_logo.png" alt="G1 Logo" width="110" />
</p>

# G1 Docket — by G1163RT Security Labs

[![Release](https://img.shields.io/badge/release-v1.0.2-blue.svg)](https://github.com/cgilbert61/G1-Docket/releases/tag/v1.0.2)
[![CI](https://github.com/cgilbert61/G1-Docket/actions/workflows/ci.yml/badge.svg)](https://github.com/cgilbert61/G1-Docket/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-informational.svg)](pyproject.toml)
[![Latency SLA](https://img.shields.io/badge/p99%20hot--path-%E2%89%A4%205.0%20ms%20(zero--db)-success.svg)](docs/benchmarks-sizing.md)
[![RFC-009](https://img.shields.io/badge/RFC--009-Merkle%20Chunk%20Trees-blueviolet.svg)](docs/rfc-009-merkle-chunk-trees.md)
[![GovReady-Q](https://img.shields.io/badge/NIST%20SP%20800--53-12%2F12%20PASS-success.svg)](docs/govready_compliance_assessment_report.md)
[![Federal DevSecOps](https://img.shields.io/badge/Federal%20DevSecOps-100%25%20PASS-success.svg)](docs/federal_devsecops_compliance_report.md)
[![Section 508](https://img.shields.io/badge/Section%20508-WCAG%202.1%20AA%20PASS-success.svg)](reports/axe-accessibility.json)
[![Community Profile](https://img.shields.io/badge/community%20standards-100%25%20green-success.svg)](CONTRIBUTING.md)

**Cryptographic Data Attestation Framework & Zero-DB-Call AI Gateway Prevalidator (`v1.0.2`) — G1163RT Security Labs.**

AI gateways govern requests. Nothing attests the data those requests touch. **G1 Docket** closes that gap with five integrated subsystems and one open cryptographic contract:

1. **The Attestation Engine (`engine/`)** — Discovers data where it lives (files, spreadsheets, databases via Apache Tika, OpenMetadata, and the **3-Stage Microsoft Purview & Multi-Cloud DLP Connector**), classifies it with Microsoft Presidio and embedded sensitivity labels (recording sensitive entity types and counts, never raw values), provides real-time ETL intake webhooks (`/v1/events/etl`) for dbt Cloud and Apache Airflow, and issues a DSSE-signed in-toto v1 attestation record per object.
2. **The Authoritative Registry (`registry/`)** — The authoritative catalog of signed records on PostgreSQL/SQLAlchemy, enforcing tier-based expiry (`Restricted`: 30d, `Confidential`: 90d, `Internal`: 180d, `Public`: 365d), human-review queues for `Restricted` and low-confidence findings, immediate tier elevation, dual-approval tier lowering, and re-classification on content hash drift.
3. **The Signed Snapshot Publisher (`snapshot/`) & Consumer Conformance Suite (`conformance/`)** — Publishes short-TTL, DSSE-signed snapshots with monotonic sequence numbers and active + `expired`/`revoked` tombstones so downstream consumers enforce policy in memory with zero Registry calls in the request path.
4. **The Zero-DB Prevalidator Gateway (`prevalidator/`)** — A sub-millisecond reverse proxy placed in front of any AI gateway speaking standard OpenAI (`/v1/chat/completions`), Anthropic (`/v1/messages`), or Google Gemini (`/v1beta/models/...:generateContent` & `:streamGenerateContent`) formats (including SSE streaming). Evaluates `<pod:object>` blocks, cryptographically signed multi-agent delegation chains (`<pod:delegate>`), and Enterprise OIDC caller tokens via JWKS against the in-memory snapshot to forward, strip, or refuse requests with uniform responses and `< 0.5 ms` p95 overhead.
5. **The Governance Subsystem & WORM Ledger (`governance/`)** — Downstream enterprise compliance and triage stack featuring an immutable cryptographic WORM audit ledger, a 7-target enterprise SIEM forwarder engine with persistent SQLite buffering, a Four-Eyes Dual-Key Human-in-the-Loop (HITL) triage interface minting Ed25519 DSSE emergency admission tickets, and a Section 508 / WCAG 2.1 AA accessible console.
6. **The Developer Client SDK & Forensic Watermarking (`docket/`)** — Standalone Python client SDK (`G1-Docket-SDK`) providing `DocketClient` / `AsyncDocketClient`, CLI utilities (`docket status`, `docket lookup`, `docket wrap`, `docket watermark-embed`, `docket watermark-inspect`, `docket check-mode`), RFC-009 Merkle Chunk Trees with Octopus batch compression, and zero-trust adapters for leading AI frameworks (LangChain, LlamaIndex, CrewAI, AutoGen, LangGraph).

---

## Visual Demonstration & Console Walkthrough

### 1. Data Attestation & Zero-DB AI Gateway Prevalidator (`:18082`)
> Point the Attestation Engine at any cloud bucket, database, or local folder to automatically classify files, mint in-toto v1 DSSE envelopes, and enforce zero-DB-call sub-millisecond AI prevalidation.

<p align="center">
  <img src="docs/assets/G1-Docket-Demo-LIGHT.gif" alt="G1 Docket - Attestation Engine & Prevalidator Gateway" width="100%" />
</p>

---

### 2. Audit Runway & Go-Live Readiness Monitor (Observe Mode)
> Real-time observation of periodic estate traffic without blocking requests. Tracks empirical exit criteria (traffic coverage, denial stability, and triage disposition) to determine when an organization is ready to flip from OBSERVE to ENFORCE mode.

<p align="center">
  <img src="docs/assets/G1-Docket-Audit-Monitor-Demo.gif" alt="G1 Docket - Audit Runway & Go-Live Readiness Monitor" width="100%" />
</p>

---

### 3. Four-Eyes Dual-Key Quarantine & Triage Queue (`:18084`)
> Intercepts unattested data, forged DSSE envelopes, and DLP policy denials at the inference boundary. Two distinct authorized operators (Key 1 Requester & Key 2 Approver) must review diffs and co-sign emergency admission tickets.

<p align="center">
  <img src="docs/assets/G1-Docket-Governance-Triage-Demo.gif" alt="G1 Docket - Quarantine & Triage Queue" width="100%" />
</p>

---

### 4. Cryptographic WORM Audit Ledger & Chain Integrity Verification (`:18084`)
> Write-Once Read-Many Merkle chain with SQLite WAL write triggers, SHA-256 hash chaining, and real-time chain walk verification from genesis to tip.

<p align="center">
  <img src="docs/assets/G1-Docket-WORM-Ledger-Demo.gif" alt="G1 Docket - Cryptographic WORM Audit Ledger" width="100%" />
</p>

---

### 5. Enterprise SIEM Forwarders Hub (`:18084`)
> Real-time downstream security telemetry stream across 7 pre-configured SIEM destinations (Splunk HEC, Elasticsearch, Syslog CEF, OpenTelemetry, Datadog, Microsoft Sentinel, and AWS CloudWatch) with persistent SQLite buffering and retry backoff.

<p align="center">
  <img src="docs/assets/G1-Docket-SIEM-Hub-Demo.gif" alt="G1 Docket - Enterprise SIEM Forwarders Hub" width="100%" />
</p>

---

## Repository Layout

- `schemas/` — JSON Schemas (`attestation-predicate.schema.json`, `snapshot-predicate.schema.json`, `dsse-envelope.schema.json`) and `CHANGELOG.md`
- `engine/` — Discovery and classification pipelines (OpenMetadata connector, Apache Tika extractor, Microsoft Presidio classifier, OpenLineage intake)
- `registry/` — Registry service, lifecycle state machine, human-review queue, hardened FastAPI server, local DSSE/Sigstore signing toolkit, and `pod` CLI
- `snapshot/` — Signed Snapshot Publisher service and API
- `prevalidator/` — OpenAI, Anthropic, and Google Gemini Prevalidator proxy (Enforce & Observe modes)
- `governance/` — Cryptographic WORM audit ledger, multi-target SIEM forwarders, and HITL Dual-Key triage GUI & server
- `conformance/` — Reference consumer simulator and Consumer Conformance Test Suite
- `docket/` — Typed synchronous & asynchronous Python Remote Client SDK (`DocketClient`, `AsyncDocketClient`), CLI aliases (`docket` / `pod doctor`), cryptographic prompt watermarking & forensic steganography (`docket.watermark`), prompt-audit callback handlers (`DocketLangChainCallbackHandler`), ingestion components (`DocketTransformComponent`), turnkey vector database adapters (`DocketVectorIndexer` & `DocketVectorRetriever` for Pinecone, Qdrant, Chroma, Milvus, Weaviate, PGVector, OpenSearch), and RAG framework adapters (`wrap_rag_documents`, `DocketDocumentTransformer`, `DocketLlamaIndexPostprocessor`, `@attested_tool`, `DocketCrewAITool`, `@docket_langgraph_node`, `DocketAutoGenHook`, and dynamic ABAC policy hooks)
- `examples/` — Interactive Quickstart Notebook (`quickstart_interactive.ipynb`), Phase 0 worked example, Golden Synthetic Sample Estate generator, LiteLLM gateway config, reproducible end-to-end demo (`run_demo.py`), Docker stack verification (`verify_docker_stack.py`), live Enterprise Governance & Dual-Key simulation (`simulate_enterprise_governance.py`), RAG agent retrieval pipeline walkthrough (`rag_agent_walkthrough.py`), Vector Database & Semantic Chunk Zero-Trust Admission Demo (`vector_rag_agent_demo.py`), Multi-Agent Orchestration Benchmark (`multi_agent_orchestration_demo.py`), CrewAI Multi-Agent Team demo (`crewai_agent_demo.py`), LangGraph State Workflow demo (`langgraph_agent_demo.py`), Microsoft AutoGen Multi-Agent demo (`autogen_agent_demo.py`), Snowflake Zero-Trust Admission demo (`snowflake_rag_agent_demo.py`), Databricks Unity Catalog AI Agent walkthrough (`databricks_agent_demo.py`), Apache Iceberg Lakehouse walkthrough (`iceberg_agent_demo.py`), Google BigQuery walkthrough (`bigquery_agent_demo.py`), Dynamic In-Flight Field Masking walkthrough (`dynamic_masking_agent_demo.py`), and Federated Multi-Cloud Warehouse Agent walkthrough (`multicloud_warehouse_agent.py`)
- `benchmarks/` — High-Concurrency Latency & Throughput Benchmark (`benchmark_gateway_concurrency.py`) measuring sub-millisecond p50/p99 admission latencies under multi-threaded concurrency, and Cryptographic Merkle Chunk Trees & Octopus Benchmark (`benchmark_chunk_trees.py`) evaluating tree construction throughput, sub-50 µs verification, and multi-chunk retrieval compression
- `docs/` — [Core Architectural Principles](docs/core-architecture.md), [Authentication & Access Control (RBAC)](docs/authentication-and-access-control.md), [Data Sizing & Throughput Benchmarks](docs/benchmarks-sizing.md), [Federal DevSecOps & Compliance Report](docs/federal_devsecops_compliance_report.md), [GovReady-Q NIST SP 800-53 Compliance Report](docs/govready_compliance_assessment_report.md), [System Security Plan (SSP)](docs/g1_docket_system_security_plan.md), [How Long Should the Audit Run?](docs/audit-period-determination.md), [Doesn't Microsoft Purview Do the Same Thing?](docs/purview-comparison.md), [Fortune 500 Enterprise Reference Architecture](docs/enterprise-reference-architecture.md), [Hyperscale Architecture (100M+ Objects)](docs/hyperscale-architecture.md), [RFC-009: Merkle Chunk Trees (MCT)](docs/rfc-009-merkle-chunk-trees.md), [Observability & Telemetry Guide](docs/observability.md), [Governance Subsystem](docs/governance-subsystem.md), [Operator CLI Reference](docs/cli.md), [Python SDK Guide](docs/sdk.md), [Record Format Spec](docs/record-format.md), [Consumer Contract Spec](docs/consumer-contract.md), and [Security Review](docs/security-review.md)
  - `docs/whitepapers/` — Downloadable PDF Whitepapers: [Core Architecture](docs/whitepapers/G1-Docket-Core-Architecture.pdf), [Data Sizing Benchmarks](docs/whitepapers/G1-Docket-Benchmarks.pdf), [Audit Period Determination](docs/whitepapers/G1-Docket-Audit-Period.pdf), and [Docket vs. Purview](docs/whitepapers/G1-Docket-vs-Purview.pdf)
- `deploy/` — [Production Helm Chart](deploy/helm/g1-docket/README.md) and [Kubernetes Manifests & Edge Sidecar Patterns](deploy/k8s/README.md) for production deployment across AWS EKS, Google GKE, Azure AKS, and on-premise clusters with built-in Horizontal Pod Autoscaling (HPA) and Prometheus `/metrics` scraping
- `k8s/` — Production-grade Kubernetes manifests (Namespace, Deployment, HPA, ConfigMap, Secrets, and Zero-Trust NetworkPolicy)
- `terraform/` — AWS Infrastructure-as-Code foundation module provisioning dedicated KMS Customer Managed Keys (CMK), S3 Object Lock in non-erasable `COMPLIANCE` mode (7-year retention), and IAM IRSA service accounts
- `reports/` — [Federal DevSecOps Compliance Audit Report](reports/FEDERAL_DEVSECOPS_COMPLIANCE_REPORT.md), [High-Concurrency Latency Benchmark Report](reports/CONCURRENCY_BENCHMARK.md), [RFC-009 MCT & Octopus Proof Benchmark Report](reports/MCT_OCTOPUS_BENCHMARK.md), [GovReady-Q NIST SP 800-53 Compliance Assessment Report](docs/govready_compliance_assessment_report.md), [SOC 2 & ISO 27001 Cryptographic Compliance Audit](reports/COMPLIANCE_AUDIT_REPORT.md), [Consolidated 22-Phase Verification Scorecard](reports/VERIFICATION_SCORECARD.json), and [Dual-Plane Security Benchmark Report (Docket vs. Combine)](reports/DOCKET_VS_COMBINE_BENCHMARK_REPORT.md) (600-probe empirical benchmark evaluating cryptographic data provenance vs. NLP cognitive safety)
- `scripts/` — Consolidated 22-phase verification suite (`run_all_verifications.py`), Interactive Operator & Auditor Control Menu (`interactive_menu.py`), Environment Mode & Production Readiness Checker (`check_mode.py`), Enterprise SIEM & SOC exporter (`export_siem_events.py`), SOC 2 evidence packager (`export_soc2_evidence.py`), standalone air-gapped auditor verifier (`docket_verify_standalone.py`), forensic token extractor (`forensic_extractor.py`), Prevalidator proxy launcher (`run_prevalidator.py`), interactive demo walkthrough (`demo_walkthrough.py`), and compliance report generator (`generate_compliance_report.py`)
- `.github/` — GitHub Actions CI/CD workflows ([`ci.yml`](.github/workflows/ci.yml)), [Issue Templates](.github/ISSUE_TEMPLATE/) ([Bug Report](.github/ISSUE_TEMPLATE/bug_report.md), [Feature Request](.github/ISSUE_TEMPLATE/feature_request.md)), and [Pull Request Template](.github/pull_request_template.md)
- **Community Standards & Policies** — [Contributing Guidelines](CONTRIBUTING.md), [Code of Conduct](CODE_OF_CONDUCT.md), [Security Policy](SECURITY.md), and [Apache-2.0 License](LICENSE)

---

## Attestation Record Schema (32 Fields)

Every data asset evaluated and attested by G1 Docket produces a DSSE-signed in-toto v1 attestation record. The payload adheres to a comprehensive 32-field governance schema across 6 functional dimensions:

### 1. Object Identity & Storage (5 Fields)
| Field | Description |
| :--- | :--- |
| `locator` | Canonical URI of the object (`file://...`, `s3://...`, `postgresql://...`). |
| `file_name` | Display filename (e.g., `07_purview_labeled_board_strategy.docx`). |
| `file_path` | Full local host or cloud storage relative path. |
| `mime_type` | Detected file content format (e.g., `application/vnd.openxmlformats...`). |
| `file_size_bytes` | Physical file size in bytes. |

### 2. Cryptographic Integrity & Provenance (5 Fields)
| Field | Description |
| :--- | :--- |
| `content_sha256` | Cryptographic SHA-256 digest of the raw content payload. |
| `attestation_id` | Unique UUID of the signed in-toto v1 attestation record. |
| `issued_at` | UTC ISO-8601 timestamp of record issuance. |
| `expires_at` | Expiry timestamp based on tier policy (`30d`, `90d`, `180d`, or `365d`). |
| `signature_key_id` | Key ID of the active Ed25519/ECDSA operator key that signed the DSSE envelope. |

### 3. Classification & AI Gateway Policy (6 Fields)
| Field | Description |
| :--- | :--- |
| `tier` | Classification tier (`Public`, `Internal`, `Confidential`, `Restricted`). |
| `ai_eligibility` | Prevalidator policy action (`allow`, `strip`, `deny`). |
| `minimum_clearance` | Lowest caller clearance key required to access the data. |
| `egress_class` | Network egress boundary allowed (`local_only`, `private_cloud`, `public_api`). |
| `classification_confidence` | Probabilistic confidence score from Presidio / ML classification (`0.0`–`1.0`). |
| `classification_method` | Classification mechanism (`purview_label`, `presidio_dlp`, `regex_heuristic`, `manual_human_review`). |

### 4. DLP, Purview & Sensitivity Findings (6 Fields)
| Field | Description |
| :--- | :--- |
| `sensitive_entity_types` | Array of detected sensitive data types (`PII`, `PHI`, `PCI`, `API_KEY`, etc.). |
| `sensitive_entity_counts` | Map of entity frequencies (records sensitive types and counts only—never raw values). |
| `total_sensitive_matches` | Aggregate count of sensitive findings in the object. |
| `purview_sensitivity_label_name` | Microsoft Purview / MIP label extracted from document XML metadata. |
| `purview_sensitivity_label_id` | Unique GUID of the Microsoft Information Protection label. |
| `purview_watermark_present` | Boolean indicating whether an enterprise protection watermark or visual marking exists. |

### 5. Ownership, Stewardship & Lineage (5 Fields)
| Field | Description |
| :--- | :--- |
| `owner_id` | Accountable business owner or email (`security@company.org`). |
| `owner_department` | Department or cost center responsible for the data asset. |
| `data_custodian` | Technical administrator / system owning storage. |
| `upstream_lineage_sources` | Origin sources or ingestion pipeline IDs (OpenLineage / OpenMetadata). |
| `downstream_consumers` | Known AI models, applications, or pipelines consuming the asset. |

### 6. Lifecycle State Machine & Review (5 Fields)
| Field | Description |
| :--- | :--- |
| `status` | Lifecycle state (`active`, `pending_review`, `expired`, `revoked`). |
| `last_scanned_at` | Timestamp of the most recent crawl/re-evaluation. |
| `last_verified_at` | Timestamp when cryptographic hash matching was last confirmed. |
| `review_queue_id` | Foreign key to the human-review governance queue if flagged for low confidence or Restricted findings. |
| `governance_approvals` | Dual-approval audit log recording approver IDs and rationales (required for declassifications). |

---

## Quickstart (Local Evaluation & Demo)

### 0. Install Dependencies
```bash
pip install -r requirements.txt
```

### Standalone Developer Client SDK (`G1-Docket-SDK`)

> [!IMPORTANT]
> **Client-Side Only**: `G1-Docket-SDK` is a lightweight Python client library for application and AI agent developers. It does **NOT** run the G1 Docket server infrastructure (the reverse proxy gateway, continuous crawler, Presidio DLP detectors, PostgreSQL registry, or SIEM forwarders).
> 
> - **What it does**: Provides `DocketClient` and `AsyncDocketClient` to query attestation records, wrap RAG chunks in canonical `<pod:object>` tags, format prompts with Merkle chunk proofs (RFC-009), embed/inspect invisible cryptographic watermarks, and integrate with AI agent frameworks (LangChain, LlamaIndex, CrewAI, AutoGen, LangGraph).
> - **What you need**: A running G1 Docket Prevalidator gateway (e.g. at `http://localhost:18082` or your enterprise endpoint). To host the server components, deploy via Docker Compose (`docker compose up`) or Kubernetes (`deploy/helm/`).

```bash
# Install directly from the GitHub Release wheel (.whl)
pip install https://github.com/cgilbert61/G1-Docket/releases/download/v1.0.2/g1_docket_sdk-1.0.2-py3-none-any.whl

# Or install directly from GitHub source
pip install "git+https://github.com/cgilbert61/G1-Docket.git"

# Verify client CLI
docket --help

# Test connection and fetch gateway snapshot status
docket status --url http://localhost:18082

# Query signed attestation record by canonical locator
docket lookup "file://estate/fileshare/product_overview_public.md"

# Wrap local file into a canonical <pod:object> tag with SHA-256 digest
docket wrap "file://finance/revenue.xlsx" --file ./revenue.xlsx

# Embed forensic zero-width Unicode steganographic watermark into text or file
docket watermark-embed "Confidential executive briefing" \
  --owner secops@enterprise.org \
  --agent-id agent-007 \
  --tier Confidential \
  --output ./briefing_watermarked.txt

# Inspect and extract forensic provenance from watermarked content
docket watermark-inspect ./briefing_watermarked.txt

# Assess system readiness and fail-closed security configuration
docket check-mode

# Use in your Python AI agent
python -c "import docket; print('G1-Docket-SDK version:', docket.__version__)"
```

### 1. Run the Reproducible End-to-End Demo (Phases 0–3)
```bash
python -m examples.run_demo
```
This executes:
- **Phase 0**: Attests a single synthetic clinical file end-to-end, verifies the DSSE signature, and confirms that tampered files and tampered envelopes fail verification.
- **Phase 1**: Generates the synthetic estate (documents, `.xlsx` spreadsheets, and database tables), crawls both paths, holds low-confidence findings in the review queue, and exercises `raise_tier`, dual-approved `lower_tier`, and `renew`.
- **Phase 2**: Publishes a DSSE-signed snapshot (`pod_snapshot.dsse.json`).
- **Phase 3**: Runs the Prevalidator proxy against OpenAI `/v1/chat/completions` and Anthropic `/v1/messages`, verifying allowed requests, inline Confidential block stripping (`[POD:STRIPPED]`), and uniform 403 refusal on `Restricted` and `Unattested` objects.

### 2. Run the Full Test & Conformance Suite
```bash
pytest -v
```

### 3. Run the Federal DevSecOps & Compliance Pipeline
Execute the full local-first compliance pipeline matching NIST SP 800-53, DISA STIG, EO 14028, and Section 508 / WCAG 2.1 AA:
```bash
make compliance-check
```
Or run individual verification gates:
```bash
make sast            # SonarQube & Semgrep SAST / CWE scanning
make secrets         # Gitleaks repository secret detection
make iac             # Checkov IaC security scanning (Terraform, K8s, Dockerfile)
make sbom            # Syft CycloneDX SBOM generation (sbom.cdx.json)
make container-scan  # Trivy container hardening & CVE vulnerability scan
make dast            # OWASP ZAP baseline dynamic application security scan
make a11y            # Section 508 & WCAG 2.1 AA automated axe-core check
make load-test       # k6 SLA performance & load testing
make govready        # GovReady-Q NIST SP 800-53 automated assessment
```

### 4. Exercise the `pod` CLI
```bash
# Generate or rotate local operator keys
python -m registry.cli keygen

# Attest a file, directory share, or database
python -m registry.cli attest ./examples/out_demo/estate/fileshare --owner security@example.org

# Look up a record by canonical locator
python -m registry.cli lookup "file://estate/fileshare/product_overview_public.md"

# Publish a signed snapshot for the Prevalidator
python -m registry.cli publish-snapshot --output ./pod_snapshot.dsse.json
```

### 5. Interactive Operator & Auditor Control Menu
Launch the interactive terminal console to run any of the enterprise verification demos, benchmarks, or cluster diagnostics with a single keystroke:
```bash
python scripts/interactive_menu.py
```

---

## One-Click Automated Docker Installers

Self-contained automated installers are provided for Windows and Linux/macOS. They verify prerequisites (Docker, WSL mounts if on secondary drives), prepare `.env`, build all images, launch the stack, and poll health endpoints until ready:

- **Windows**:
  ```cmd
  install.bat
  ```
- **Linux / macOS**:
  ```bash
  chmod +x install.sh
  ./install.sh
  ```

---

## Docker Compose Profiles

Three Compose profiles are provided in `docker-compose.yml`:

```bash
# 1. Core profile: Engine, Registry, Snapshot Publisher, Postgres
docker compose --profile core up -d --build

# 2. Demo profile: Everything in core + Prevalidator + Local AI Gateway + automated synthetic estate bootstrap
docker compose --profile demo up -d --build
python -m examples.verify_docker_stack

# 3. Prevalidator profile: The proxy alone, deployed beside an existing AI gateway
docker compose --profile prevalidator up -d --build
```

---

## Troubleshooting & Automated Health Loop

If secondary drives (such as `D:`) unmount after a Windows reboot, or if you need to poll for stack readiness:

### Automated WSL Remount & Health Polling Loop (PowerShell)
```powershell
# 1. Remount Drive D in Docker Desktop WSL if needed
wsl -d docker-desktop -u root -e sh -c "mkdir -p /mnt/host/d /mnt/d; mountpoint -q /mnt/host/d || mount -t drvfs D: /mnt/host/d -o metadata; mountpoint -q /mnt/d || mount --bind /mnt/host/d /mnt/d"

# 2. Poll health endpoints until active
$endpoints = @(
    "http://localhost:18080/docs",
    "http://localhost:18081/docs",
    "http://localhost:18082/healthz",
    "http://localhost:18083/healthz",
    "http://localhost:14000/healthz"
)

Write-Host "Waiting for G1 Docket services to stabilize..." -ForegroundColor Cyan
for ($i = 1; $i -le 40; $i++) {
    $pending = 0
    foreach ($url in $endpoints) {
        try {
            $resp = Invoke-WebRequest -Uri $url -TimeoutSec 2 -UseBasicParsing
            if ($resp.StatusCode -ne 200) { $pending++ }
        } catch {
            $pending++
        }
    }
    if ($pending -eq 0) {
        Write-Host "`n[+] All G1 Docket services are healthy and active!" -ForegroundColor Green
        break
    }
    Write-Host -NoNewline "."
    Start-Sleep -Seconds 2
}
```

---

## Service Architecture & Swagger API Directory

G1 Docket deploys a modular, microservice-based attestation, prevalidation, and compliance stack:

| Port | Service Component | Interactive Swagger / UI | Key Role & Scope |
| :--- | :--- | :--- | :--- |
| **`18080`** | Registry Service | `http://localhost:18080/docs` | Authoritative PostgreSQL catalog of DSSE-signed in-toto attestation records and review queues. |
| **`18081`** | Snapshot Publisher | `http://localhost:18081/docs` | Issues short-TTL, monotonic DSSE snapshot contracts for zero-DB gate evaluation. |
| **`18082`** | Prevalidator Proxy | `http://localhost:18082/` | OpenAI/Anthropic gateway proxy, continuous estate scanner, and unified operator dashboard. |
| **`18083`** | **Attestation Engine Service** | `http://localhost:18083/docs` | Enterprise crawler, Purview/Presidio classifier, and cloud/warehouse connector API. |
| **`18084`** | **HITL Governance & SIEM Hub** | `http://localhost:18084/` & `/docs` | Cryptographic WORM audit ledger, dual-key quarantine triage GUI, and multi-target SIEM dispatcher. |
| **`14000`** | LiteLLM Mock Gateway | `http://localhost:14000/healthz` | Upstream OpenAI/Anthropic model router and mock gateway for testing. |

---

## Operator Authentication & Default Credentials

G1 Docket features a **Unified Session Authentication Engine** with bidirectional Single Sign-On (SSO) across the Prevalidator Gateway (`:18082`) and the Governance Console (`:18084`). Authenticating on either port automatically unlocks both consoles.

Unauthenticated browser traffic is strictly redirected to `/login` when `DOCKET_REQUIRE_AUTH=true` (or in production). Inference and AI agent SDK requests (`/v1/chat/completions`, `/healthz`, `/metrics`) are machine-to-machine exempt and continue authenticating via standard API keys.

### Built-in Institutional Accounts

| Operator ID | Default Password | Role | Description & Scope |
| :--- | :--- | :--- | :--- |
| **`admin`** | `DocketAdmin2026!Secure` | `admin` | Full system administrator. Configures mode, DLP, LLM providers, and estate crawlers. |
| **`operator1`** | `TriageOperator2026!` | `triage_operator` | Triage specialist (Key 1). Runs directory/file attestations and submits quarantine exemption requests. |
| **`approver1`** | `SecurityLead2026!` | `security_approver` | Security officer (Key 2). Approves high-risk tier changes and co-signs emergency admission tickets. |
| **`auditor1`** | `AuditInspector2026!` | `auditor` | Read-only compliance auditor. Inspects scorecards, snapshots, and WORM ledgers. Mutating actions blocked (`403`). |
| **`mfa_operator`** | `MfaOperator2026!` | `security_approver` | 2FA Enforced Officer (Key 2). Requires RFC 6238 6-digit TOTP (seed: `JBSWY3DPEHPK3PXP`). |

### Making the System Your Own
- **Change Passwords**: Override any password by setting `DOCKET_ADMIN_PASSWORD`, `DOCKET_OPERATOR_PASSWORD`, `DOCKET_APPROVER_PASSWORD`, etc. in your `.env` file.
- **Custom Corporate Accounts**: Supply your company's directory accounts via the `DOCKET_AUTH_USERS_JSON` environment variable.
- **Enterprise SSO / OIDC Federation (Method C)**: Connect enterprise IdPs (Microsoft Entra ID / Azure AD, Okta, Google Workspace, Ping Identity) natively via `DOCKET_OIDC_ISSUER` and `DOCKET_OIDC_AUDIENCE` (or reverse-proxy headers `X-Forwarded-Email`, `X-Forwarded-Roles`). Both the Governance Door and the Prevalidator Caller Door verify IdP cryptographic signatures via JWKS (`jwt.PyJWKClient` cached discovery) supporting RS256/ES256 with fail-closed production guards.
- **Full Guide**: See **[docs/authentication-and-access-control.md](docs/authentication-and-access-control.md)** for complete step-by-step instructions.

---

### Attestation Engine Service (`:18083/docs`)

The **Attestation Engine Service** (OpenAPI 3.1, `v1.0.2`) provides programmatic APIs to discover, inspect, and attest assets across local disks, network shares, and enterprise cloud data lakes:

```
default
├── GET  /healthz                     Service health and readiness probe
├── GET  /v1/browse-dir               Browse host drives and directories for estate targeting
├── POST /v1/attest-selected          Trigger cryptographic attestation across selected drive or path
├── GET  /v1/pc-folders               List auto-discovered workstation directories & document stores
├── GET  /v1/datastores               Query registered enterprise data stores (S3, Azure, GCS, Snowflake, BigQuery, Databricks)
├── POST /v1/datastores               Register new enterprise cloud data lake or warehouse connection
└── GET  /v1/datastores/objects       Enumerate discovered objects and partitions within enterprise datastores
```

- **`GET /v1/browse-dir`**: Takes `?path=` query parameter to navigate the host filesystem, reporting directory entries, file counts, and accessibility.
- **`POST /v1/attest-selected`**: Initiates discovery, DLP classification (Presidio + Purview metadata extraction), and cryptographic DSSE envelope issuance over all scannable files in the path.
- **`GET /v1/datastores` & `POST /v1/datastores`**: Configures enterprise cloud data stores with zero-secret credentials (AWS IAM roles, Azure Managed Identity, GCP Workload Identity / ADC, Snowflake key-pair, Databricks OAuth M2M) and runs partition-level attestation.

---

### HITL Governance Subsystem & WORM Ledger (`:18084` & `:18084/docs`)

The **Governance Subsystem** (OpenAPI 3.1, `v4.0.0`) operates the downstream compliance, immutable audit ledger, quarantine triage, and real-time SIEM streaming pipeline:

```
default
├── GET  /                            Unified HITL Triage, WORM Chain Audit & SIEM Operations Dashboard
├── GET  /api/quarantine              List all quarantined objects (un-papered files, forged envelopes, Presidio blocks)
├── GET  /api/quarantine/{id}         Inspect quarantined object metadata, payload snippet, and audit status
├── POST /api/quarantine/{id}/stage-override    Key 1: Requester stages override with operational rationale
├── POST /api/quarantine/{id}/approve-override  Key 2: Distinct Approver signs release with Ed25519 DSSE emergency ticket
├── POST /api/quarantine/{id}/reject            Formal reviewer rejection and permanent block of quarantined item
├── GET  /api/worm/verify             Full Merkle/hash-chain integrity audit from genesis block ("0"*64) to tip
├── GET  /api/worm/events             Query paginated tamper-evident WORM audit records
├── GET  /api/siem/status             Real-time health, buffer queue length, and delivered count across all 7 forwarders
├── POST /api/siem/{dest_id}/test     Synthetic probe injection with automatic fallback to persistent SQLite buffer
├── GET  /api/siem/mock-receivers     Status of embedded local mock receiver cluster (ports 18088, 19200, 15514, etc.)
├── POST /api/siem/mock-receivers/toggle Toggle local mock receivers on/off
├── GET  /api/siem/{dest_id}/config   Fetch destination parameters (URL, API keys, headers, indices, Syslog TLS)
├── POST /api/siem/{dest_id}/config   Live update destination parameters and persist to governance/config.yaml
├── POST /api/intercept               Boundary intercept webhook for Prevalidator and Combine cognitive denials
└── GET  /events/stream               Server-Sent Events (SSE) live security telemetry stream
```

#### Core Capabilities:
1. **Cryptographic WORM Audit Ledger (`worm_ledger.py`)**:
   - Implements dual-store append-only audit persistence: SQLite with triggers that raise an immediate error on any `UPDATE` or `DELETE` attempt, coupled with a canonical JSON Lines log.
   - Hash-chained with SHA-256 Merkle links from genesis block (`previous_hash = "0" * 64`) to tip.
   - `verify_ledger_integrity()` recalculates the entire chain, pinpointing line numbers and byte-level mutations if tampering occurs.
2. **Four-Eyes Dual-Key Triage Workflow (`dual_key.py`)**:
   - Intercepted un-papered data objects, forged DSSE envelope blocks, or Presidio/Combine PII denials are isolated in quarantine.
   - Override requires **two distinct authorized identities**: Requester (Key 1) stages a business justification; Approver (Key 2) validates the diff and signs an Ed25519 DSSE emergency admission ticket.
   - Upon release, the clean payload is automatically replayed through `:18082`, a `HITL_DUAL_KEY_RELEASE` record is locked into the WORM ledger, and audit notifications stream to downstream SIEMs.
3. **Multi-Target Enterprise SIEM Integration Engine (`siem_forwarder.py`)**:
   - Streams security telemetry to 7 pre-configured destinations:
     - **Splunk HEC**: `/services/collector/event`
     - **Elasticsearch / OpenSearch**: `ecs-1.12` compliant index mapping
     - **Syslog CEF Streamer**: RFC 5424 Common Event Format over TCP/TLS
     - **OpenTelemetry / SOAR Webhook**: CloudEvents structured HTTP POST
     - **Datadog Logs API**: `/api/v2/logs`
     - **Microsoft Sentinel / Azure Log Analytics**: Data Collector API
     - **AWS CloudWatch Logs**: PutLogEvents structured JSON format
   - Zero sensitive data leakage: payloads are scrubbed to hashes, rule IDs, and ticket identifiers.
   - Offline resilience: failed socket transmissions automatically persist to a local SQLite buffer queue and retry upon network reconnection.
   - Integrated GUI editor: update live endpoints, API keys, and Syslog TLS parameters on the fly with automatic persistence to `governance/config.yaml`.
4. **Institutional Operator Authentication & RBAC (`auth.py`)**:
   - Institutional login portal (`/login` on port `:18084`) enforcing PBKDF2 password derivation (100,000 iterations with CSPRNG salt) and tamper-resistant HMAC-SHA256 session tokens (`docket_session`).
   - Role-Based Access Control (`admin`, `operator`, `auditor`, `user`) with `@require_role` decorators guarding administrative and quarantine triage endpoints.
   - Automated brute-force lockout (5 consecutive failures -> 15-minute IP/account rate-limit lock) and sliding inactivity expiration.
   - Native RFC 6238 TOTP hardware/authenticator app two-factor authentication.
   - Cryptographic WORM audit chaining: every authentication event (`OPERATOR_AUTH_SUCCESS`, `OPERATOR_AUTH_FAILURE`, `OPERATOR_MFA_SUCCESS`, `OPERATOR_MFA_FAILURE`, `OPERATOR_LOCKOUT`, `OPERATOR_LOGOUT`) is automatically appended to the immutable Merkle chain.
5. **Environment Pre-Flight & Production Readiness Enforcement (`docket.cli`)**:
   - `python -m docket.cli --check-mode` assesses operational readiness before deployment.
   - In `DEMO` mode, enables zero-config local prototyping with in-memory fallbacks and sample keyrings.
   - In `PRODUCTION` mode, strictly fails closed if an authoritative gateway (`POD_UPSTREAM_GATEWAY_URL`), dedicated PostgreSQL database URL, or hardened credentials are missing.

---

## Enterprise AI Agent & RAG Framework Ecosystem

G1 Docket provides turnkey zero-trust admission control adapters for all leading AI agent and RAG frameworks via `docket.integrations`:

| Framework / Source | Adapter Class / Decorator | Primary Role & Guarantee |
| :--- | :--- | :--- |
| **Model Context Protocol (MCP)** | `DocketMCPServer` & `DocketMCPInterceptor` | Standard MCP 2024-11-05 JSON-RPC 2.0 server & zero-trust tool interceptor for Claude Desktop, Cursor, Antigravity |
| **LlamaIndex** | `DocketLlamaIndexPostprocessor` | Intercepts `NodeWithScore` batches, binds SHA-256 hashes, and rejects poisoned nodes or clearance mismatches |
| **Vector DBs** *(Pinecone, Qdrant, LanceDB, Milvus, Chroma, Weaviate, PGVector, OpenSearch)* | `DocketVectorRetriever` / `DocketVectorIndexer` | Formats similarity search chunks into verified `<pod:object>` envelopes with RFC-009 Merkle proofs & Octopus batch compression |
| **LangChain** | `DocketLangChainCallbackHandler` | Pre-dispatch callback auditor catching untagged context, data smuggling, or character threshold breaches |
| **CrewAI** | `DocketCrewAITool` / wrapper | Attests agent tool execution results before inter-agent communication or final delegation |
| **LangGraph** | `@docket_langgraph_node` | Wraps state transitions and messages between graph nodes with cryptographic provenance |
| **AutoGen** | `DocketAutoGenHook` | Inter-agent message hook validating and tagging conversational exchanges between conversable agents |
| **Snowflake Data Warehouse** | `@attested_tool("snowflake://...")` | Binds SQL queries and Snowpark results to verifiable table-level and column-level attestation contracts |
| **Google BigQuery** | `@attested_tool("bigquery://...")` | Validates data residency and departmental isolation on BigQuery enterprise datasets |
| **Multi-Agent Swarms & Delegation Chains** | `<pod:delegate>` / `process_delegates` | Cryptographically signed provenance, clearance narrowing, and tamper-resistant multi-hop agent delegation |

### Cryptographically Signed Multi-Agent Delegation Chains (`<pod:delegate>`)

In multi-agent architectures (e.g. LangGraph, CrewAI, AutoGen), context travels across multiple autonomous hops before reaching a final LLM call. G1 Docket provides cryptographically signed delegation envelopes (`<pod:delegate>`) to protect multi-agent workflows against data poisoning, context smuggling, and clearance escalation:

```xml
<pod:delegate hop="1" signer="agent-researcher-01" parent_tier="Confidential" signature="Base64Ed25519...">
  <pod:object locator="file://research/earnings_q3.pdf" sha256="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855">
    Summarized Q3 earnings report data...
  </pod:object>
</pod:delegate>
```

- **Per-Agent Ed25519 Signatures**: Each delegation hop verifies the signature of the intermediate agent over the canonical inner payload, ensuring provenance cannot be forged.
- **Monotonic Clearance Narrowing**: Intermediate agents may only narrow clearance (e.g., from `Restricted` to `Confidential`), never widen it (`CLEARANCE_ESCALATION_BLOCKED`).
- **Context Tamper Prevention**: Any alteration to inner tags or attributes breaks the delegation chain (`DELEGATION_CHAIN_BROKEN` / `DELEGATION_SIGNATURE_INVALID`).
- **Sub-Millisecond Verification**: Multi-hop verification executes entirely in memory with `< 0.5 ms` added p95 hot-path latency.

---

### Local-First Federal DevSecOps & NIST SP 800-53 Compliance

G1 Docket embeds a comprehensive, local-first federal compliance testing pipeline matching NIST SP 800-53 Rev. 5, DISA STIG, EO 14028 (SBOM), and Section 508 / WCAG 2.1 AA standards:

- **Static Analysis (SAST)**: SonarQube (`sonar-project.properties`) and Semgrep rulesets (`p/owasp-top-ten`, `p/security-audit`) detect CWE vulnerabilities and security regressions.
- **Secrets & Infrastructure-as-Code (IaC)**: Gitleaks detects committed credentials across git history; Checkov scans Terraform, Helm charts, and Dockerfiles against CIS benchmarks.
- **Supply Chain & Container Hardening (SCA)**: Syft generates an Executive Order 14028 CycloneDX SBOM (`reports/sbom.cdx.json`); Trivy scans container images for CVEs and non-root execution.
- **Dynamic Application Security Testing (DAST)**: OWASP ZAP baseline scan targets local running endpoints.
- **Section 508 & WCAG 2.1 AA Accessibility**: Automated axe-core / Playwright test harness (`scripts/test_accessibility.py`) asserts zero accessibility violations across all HITL operator consoles.
- **SLA & Concurrency Load Testing**: Automated k6 performance runner asserts `< 5.0 ms` p99 latency SLA under high concurrent load.
- **GovReady-Q Automated Assessment**: Generates machine-readable NIST SP 800-53 assessments (`reports/govready_assessment_summary.json`) and OSCAL component definitions (`reports/govready_oscal_component.json`).

Run all compliance gates locally in one command:
```bash
make compliance-check
```

---

---

## License & Third-Party Open Source Software

G1 Docket is licensed under the **Apache License 2.0** — see [LICENSE](LICENSE).

### Open Source Dependencies & Licenses

This project relies on and incorporates open-source libraries and standards. We gratefully acknowledge the upstream maintainers:

| Package / Project | Version | Upstream License | Project URL / Source | Primary Role in G1 Docket |
| :--- | :--- | :--- | :--- | :--- |
| **FastAPI** | `>=0.109.0` | **MIT** | [tiangolo/fastapi](https://github/fastapi/fastapi) | Async REST API framework for Registry, Engine, Prevalidator, and Governance servers |
| **Starlette** | `~=1.10.0` | **BSD 3-Clause** | [encode/starlette](https://github.com/encode/starlette) | ASGI web core, routing, Server-Sent Events (SSE), and request processing |
| **Uvicorn** | `>=0.27.0` | **BSD 3-Clause** | [encode/uvicorn](https://github.com/encode/uvicorn) | High-performance lightning-fast ASGI server |
| **Pydantic** | `>=2.5.0` | **MIT** | [pydantic/pydantic](https://github.com/pydantic/pydantic) | Strict data validation, schema enforcement, and JSON serialization |
| **Pydantic Core** | `>=2.14.0` | **MIT** | [pydantic/pydantic-core](https://github.com/pydantic/pydantic-core) | High-speed Rust core for data parsing |
| **Cryptography** | `>=41.0.0` | **Apache-2.0 / BSD** | [pyca/cryptography](https://github.com/pyca/cryptography) | Ed25519 signing, verification, SHA-256 digests, and X.509 certificates |
| **PyJWT** | `>=2.8.0` | **MIT** | [jpadilla/pyjwt](https://github.com/jpadilla/pyjwt) | JSON Web Token (JWT) encode/decode for role-based service authentication |
| **SQLAlchemy** | `>=2.0.25` | **MIT** | [sqlalchemy/sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) | Database abstraction, WAL transactions, and SQLite/PostgreSQL persistence |
| **HTTPX** | `>=0.26.0` | **BSD 3-Clause** | [encode/httpx](https://github.com/encode/httpx) | Asynchronous HTTP client for SIEM forwarder and AI Gateway reverse proxy |
| **HTTPCore** | `~=1.0.9` | **BSD 3-Clause** | [encode/httpcore](https://github.com/encode/httpcore) | Low-level HTTP transport and connection pooling |
| **JSONSchema** | `>=4.20.0` | **MIT** | [python-jsonschema/jsonschema](https://github.com/python-jsonschema/jsonschema) | Draft 2020-12 schema verification for in-toto attestation records |
| **OpenPyXL** | `>=3.1.2` | **MIT** | [openpyxl](https://foss.heptapod.net/openpyxl/openpyxl) | Spreadsheet parsing, cell extraction, and Excel workbook classification |
| **Jinja2** | `>=3.1.0` | **BSD 3-Clause** | [pallets/jinja](https://github.com/pallets/jinja) | Institutional HTML template rendering for HITL Governance dashboard |
| **PyYAML** | `>=6.0.0` | **MIT** | [yaml/pyyaml](https://github.com/yaml/pyyaml) | SIEM configuration serialization and persistent setting storage |
| **AnyIO** | `>=4.0.0` | **MIT** | [agronholm/anyio](https://github.com/agronholm/anyio) | Structured asynchronous concurrency primitives |
| **Pytest** | `>=8.0.0` | **MIT** | [pytest-dev/pytest](https://github.com/pytest-dev/pytest) | Automated unit, regression, and conformance testing framework |
| **Click** | `>=8.0.0` | **BSD 3-Clause** | [pallets/click](https://github.com/pallets/click) | Command-line interface driver for the `pod` CLI |
| **OpenTelemetry API** | `>=1.20.0` | **Apache-2.0** | [open-telemetry/opentelemetry-python](https://github.com/open-telemetry/opentelemetry-python) | Distributed tracing, security audit events, and trace propagation |
| **Microsoft Presidio** | `>=2.2.35` | **MIT** | [microsoft/presidio](https://github.com/microsoft/presidio) | Sensitive entity recognition (PII/PHI/PCI/API keys) in document content |
| **Apache Tika** | `>=2.6.0` | **Apache-2.0** | [apache/tika](https://tika.apache.org/) | Multi-format content detection and document text extraction |
| **in-toto Specification** | `v1.0` | **Apache-2.0** | [in-toto/attestation](https://github.com/in-toto/attestation) | Standardized metadata format for cryptographic software & data supply chain attestation |
| **DSSE Specification** | `v1.0` | **Apache-2.0** | [secure-systems-lab/dsse](https://github.com/secure-systems-lab/dsse) | Dead Simple Signing Envelope for multi-key detached signatures |
| **LiteLLM** | `>=1.0.0` | **MIT** | [BerriAI/litellm](https://github.com/BerriAI/litellm) | Upstream AI gateway and OpenAI/Anthropic protocol translation |
| **SQLite** | `v3` | **Public Domain** | [sqlite.org](https://www.sqlite.org/) | Embedded transactional storage for WORM ledger, quarantine queue, and SIEM buffer |

---

## Production Observability & Prometheus Metrics

G1 Docket exposes standard Prometheus text exposition format (`text/plain; version=0.0.4; charset=utf-8`) for monitoring, alerting, and SLA tracking:

| Subsystem | Port | Endpoint | Metrics Exported |
| :--- | :--- | :--- | :--- |
| **Prevalidator Gateway** | `:18082` | `GET /metrics` | `g1_docket_mode`, `g1_docket_evaluations_total`, `g1_docket_evaluations_by_decision_total{decision="allow\|deny\|strip\|mask"}`, `g1_docket_policy_denials_by_reason_total`, `g1_docket_evaluation_duration_seconds{quantile="0.5\|0.95\|0.99"}`, `g1_docket_active_snapshot_sequence`, `g1_docket_active_snapshot_entries` |
| **HITL Governance & SIEM** | `:18084` | `GET /metrics` | `g1_docket_governance_worm_events_total`, `g1_docket_governance_quarantine_items{status="QUARANTINED\|RELEASED\|REJECTED"}`, `g1_docket_governance_siem_destinations{enabled="true\|false"}` |

### Prometheus Alerting Rules & Helm Integration

Pre-configured Prometheus alert definitions are bundled for Helm and vanilla Kubernetes deployments under [`deploy/k8s/prometheus-alerts.yaml`](deploy/k8s/prometheus-alerts.yaml) and [`deploy/helm/g1-docket/templates/prometheusrule.yaml`](deploy/helm/g1-docket/templates/prometheusrule.yaml):

* **`G1DocketSubMillisecondSLABreached`**: Critical alert when p95 admission latency breaches the $5\text{ ms}$ SLA budget.
* **`G1DocketHashDriftSpike`**: Critical alert when $> 5$ hash drift / tamper events occur within 5 minutes.
* **`G1DocketWORMVerificationFailure`**: Critical alert when Merkle hash-chain verification detects broken ledger integrity.
* **`G1DocketQuarantineBacklog`**: Warning alert when $> 50$ quarantined items await Four-Eyes dual-key triage.

See the complete [Observability & Monitoring Guide](docs/observability.md) for Prometheus scrape configurations, Grafana dashboard JSON models, and ServiceMonitor manifests.

---

## Community & Security Standards

G1 Docket follows enterprise open-source and institutional security standards:

* **[Contributing Guidelines](CONTRIBUTING.md)**: Development environment setup, architectural invariants, latency budgets, and PR submission guidelines.
* **[Code of Conduct](CODE_OF_CONDUCT.md)**: Contributor Covenant v2.1 community engagement pledge and enforcement standards.
* **[Security Policy](SECURITY.md)**: Vulnerability disclosure program, supported versions, coordinated triage process, and reporting via `security@g1163rt.ai`.
* **[Issue Templates](.github/ISSUE_TEMPLATE/)**: Structured issue templates for [Bug Reports](.github/ISSUE_TEMPLATE/bug_report.md) and [Feature Proposals](.github/ISSUE_TEMPLATE/feature_request.md).
* **[Pull Request Template](.github/pull_request_template.md)**: Standardized checklist verifying zero-database hot-paths, sub-millisecond evaluation latency, and cryptographic compliance.


