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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cgd_validator-0.1.1.tar.gz.
File metadata
- Download URL: cgd_validator-0.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78634837da2b9c980b25ca02a29e06f0954910671a75e8a23de0564bfa295bbe
|
|
| MD5 |
853b3bf8fda8a4f905795affe5c0e78e
|
|
| BLAKE2b-256 |
b7318897f6fcb7ca46835c3679729b7b30abaa08139d2a3845421ce5455a2e8f
|
File details
Details for the file cgd_validator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cgd_validator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2996a04adbbd6a2fd2f8364533211da9a9c58cb087f9cb4ecdaa9f2af17f14aa
|
|
| MD5 |
d573b112f09b03952fa9e16a87abab60
|
|
| BLAKE2b-256 |
2dfaa58d566905e488dd4556ed6594526398ebd14b9b560ceca22e2ea1c7c2ad
|