cgd-validator
Validator for Clarity-Gated Document (.cgd) files — documents verified and annotated for safe LLM ingestion.
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-versionverified-dateverified-byhitl-status
## Clarity Gate Verificationsection
Warnings
- HITL status not "CONFIRMED"
- Projections ("will be") without
*(projected)*marker - Vague quantifiers without annotation
Related
- Clarity Gate - Pre-ingestion verification for RAG systems
- Source of Truth Creator - Create .sot files
- sot-validator - Validate .sot files
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
Metadata
Release files for cgd-validator 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cgd_validator-0.1.1.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cgd_validator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / cgd_validator-0.1.1.tar.gz
| Download URL | cgd_validator-0.1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78634837da2b9c980b25ca02a29e06f0954910671a75e8a23de0564bfa295bbe
|
|
BLAKE2b-256 checksum How to use checksums |
b7318897f6fcb7ca46835c3679729b7b30abaa08139d2a3845421ce5455a2e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / cgd_validator-0.1.1-py3-none-any.whl
| Download URL | cgd_validator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2996a04adbbd6a2fd2f8364533211da9a9c58cb087f9cb4ecdaa9f2af17f14aa
|
|
BLAKE2b-256 checksum How to use checksums |
2dfaa58d566905e488dd4556ed6594526398ebd14b9b560ceca22e2ea1c7c2ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|