Skip to main content

Validator for Clarity-Gated Document (.cgd) files - verified documents for safe LLM ingestion

Project description

cgd-validator

Validator for Clarity-Gated Document (.cgd) files — documents verified and annotated for safe LLM ingestion.

PyPI version License: CC BY 4.0

What is a .cgd file?

A Clarity-Gated Document (.cgd) file is a markdown document that has passed epistemic verification and contains inline annotations ensuring safe interpretation by LLMs.

Part of the Clarity Gate ecosystem for epistemic quality verification.

Installation

pip install cgd-validator

CLI Usage

# Validate a single file
cgd-validator document.cgd

# Validate multiple files
cgd-validator docs/*.cgd

# Output as JSON
cgd-validator document.cgd --json

# Quiet mode (errors only)
cgd-validator document.cgd -q

Python API

from cgd_validator import validate, is_valid, detect, validate_file

# Full validation with errors and warnings
result = validate(file_content)
print(result.valid)       # bool
print(result.errors)      # list of ValidationError
print(result.warnings)    # list of ValidationError
print(result.frontmatter) # parsed YAML frontmatter dict

# Quick check
if is_valid(file_content):
    print('Document passes validation')

# Detect if content is .cgd format
if detect(file_content):
    print('This appears to be a .cgd file')

# Validate from file path
result = validate_file('document.cgd')

Validation Rules

Required Elements

  • YAML frontmatter with:
    • clarity-gate-version
    • verified-date
    • verified-by
    • hitl-status
  • ## Clarity Gate Verification section

Warnings

  • HITL status not "CONFIRMED"
  • Projections ("will be") without *(projected)* marker
  • Vague quantifiers without annotation

Related

File Format Specification

See the SOT and CGD File Format Specification.

License

CC BY 4.0 — Use freely with attribution.

Author

Francesco Marinoni Moretto
GitHub: @frmoretto

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgd_validator-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cgd_validator-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file cgd_validator-0.1.0.tar.gz.

File metadata

  • Download URL: cgd_validator-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for cgd_validator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 24eddf5575747118d778050276f9f7edc0b0a3e27032e38aa0aaaf5949998242
MD5 0728fb99f2131ce66177e0caf76b6da6
BLAKE2b-256 ea5c8a980cb26947a543d8a2ef57d2866eee5acd2014ce1a0f202c5ca5aa68ac

See more details on using hashes here.

File details

Details for the file cgd_validator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cgd_validator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for cgd_validator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f242ce9f1163cdd8941a1e8a7b2ae70bc26ef1267eb8576cc91d992dccc8ada
MD5 e1391ac0332b40290fe89d9232900fb7
BLAKE2b-256 6443756a7f68610f80d7fde59744c5a91c2ed409c19d3374473084a25fc43b10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page