ckasketch-calibration-v1 / manifest.schema.yaml
marcjon's picture
Initial publication: v1 calibration corpus (text track)
854c1b8 verified
Raw
History Blame Contribute Delete
7.79 kB
# JSON Schema for individual entries in ckasketch/calibration/v1/text/manifest.yaml
#
# Each entry describes one item in the calibration corpus with full provenance,
# attribution, and licensing metadata. The build script validates every entry
# against this schema before writing manifest.yaml; CI verifies the published
# manifest against this schema on every commit.
#
# Lives at: ckasketch/calibration/v1/text/manifest.schema.yaml
# Used by: ckasketch/calibration/build/validate_manifest.py
#
# This schema is written in YAML-formatted JSON Schema (draft 2020-12).
$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "https://github.com/marctjones/llmfp/blob/main/ckasketch/calibration/v1/text/manifest.schema.yaml"
title: "CKASketch v1 Text Calibration Corpus — Item Manifest Entry"
description: |
One entry per item in the v1 text calibration corpus. The manifest is the
authoritative record of provenance, licensing, and attribution. Every item
carries full provenance regardless of whether attribution is legally required
(universal-attribution policy).
type: object
required:
- id
- domain
- language
- source
- authorship
- license
- sha256
- char_length
additionalProperties: false
properties:
id:
type: string
pattern: "^text_[0-9]{4}$"
description: "Stable corpus-internal id, e.g. text_0001."
domain:
type: string
enum:
- prose # general English/multilingual prose
- code_python
- code_other # JS / Rust / Java / C++ / Go
- math # math problems, proofs, reasoning chains
- dialogue # chat-style multi-turn or single-turn instruct
- multilingual_prose # non-English prose
- scientific # paper abstracts, scholarly text
- structured # JSON / YAML / schema examples / tables-as-text
language:
type: string
description: "BCP 47 / ISO 639-1 code, e.g. 'en', 'zh', 'ja', 'ar'. 'mul' for code/structured items mixing languages."
pattern: "^[a-z]{2,3}(-[A-Z]{2})?$|^mul$"
source:
type: object
required:
- name
- url
- accessed_date
additionalProperties: false
properties:
name:
type: string
enum:
- wikipedia
- gutenberg
- the_stack_v2
- gsm8k
- math_dataset
- openassistant
- pubmed_oa
- arxiv
- schema_org
- github_permissive
description: "Canonical source identifier; one of the supported fetchers. (proofwiki dropped per DESIGN.md §9: ai-train=no Content-Signal + no sanctioned bulk channel.)"
url:
type: string
format: uri
description: "Stable canonical URL of the source item."
revision_id:
type: [string, integer]
description: "Source-specific immutable revision id (Wikipedia oldid, git commit sha, arXiv version, etc.)"
permalink:
type: string
format: uri
description: "Permanent link to the exact revision used (preferred over plain url for reproducibility)."
archive_url:
type: string
format: uri
description: "Wayback Machine / Internet Archive URL for stability if canonical source disappears."
accessed_date:
type: string
format: date
description: "ISO 8601 date the item was fetched, YYYY-MM-DD."
authorship:
type: object
required:
- creator
additionalProperties: false
properties:
creator:
type: string
description: "Author / contributor identifier as required by the license. 'Wikipedia contributors' is canonical for Wikipedia."
creator_url:
type: string
format: uri
description: "URL identifying the creator (e.g., Wikipedia article history page, GitHub user/org page)."
copyright_notice:
type: string
description: "Copyright header preserved from the source (required for permissive code, optional otherwise)."
license:
type: object
required:
- spdx
- url
- tier
additionalProperties: false
properties:
spdx:
type: string
description: "SPDX identifier. Must be in the accepted set (no NC, no ND, no GPL/AGPL/LGPL)."
enum:
- CC0-1.0
- CC-BY-3.0
- CC-BY-4.0
- CC-BY-SA-3.0
- CC-BY-SA-4.0
- Apache-2.0
- MIT
- BSD-2-Clause
- BSD-3-Clause
- ISC
- PD # Public Domain (US PD, pre-1928, gov works)
- PDM-1.0 # Public Domain Mark
- Unlicense
url:
type: string
format: uri
description: "URL of the license text."
tier:
type: string
enum: [A, B, C, D, E]
description: |
Licensing tier per DESIGN.md §8:
A — Public Domain
B — CC0 / equivalent
C — CC-BY (attribution-only)
D — Permissive code (Apache/MIT/BSD/ISC)
E — CC-BY-SA (share-alike, accepted under aggregate framing)
attribution_required:
type: boolean
description: "True if the license legally requires attribution. Universal policy: capture it anyway."
sharealike:
type: boolean
description: "True if the license has a share-alike obligation (CC-BY-SA only). Attaches to individual item, not corpus or sketches."
attribution_text:
type: string
minLength: 1
description: |
Pre-formatted attribution text suitable for inclusion in NOTICES.md.
Required for all items (universal-attribution policy), even PD/CC0.
Format follows the source's recommended attribution template.
modifications:
type: string
minLength: 1
description: |
Human-readable description of any transformations applied during extraction
(truncation, whitespace normalization, language detection, deduplication).
Required by CC-BY family licenses; provided universally.
sha256:
type: string
pattern: "^[a-f0-9]{64}$"
description: "SHA-256 hex digest of the extracted text content (after extraction + modifications)."
char_length:
type: integer
minimum: 1
maximum: 8192
description: "Length of the extracted text in characters. Soft target: 768."
text:
type: string
minLength: 1
description: |
OPTIONAL in the manifest — the actual text lives in corpus.jsonl, not the
manifest. Manifest entries are pure metadata. If present here, it must
match the corpus.jsonl entry byte-for-byte.
# -----------------------------------------------------------------------------
# Validation cross-checks (enforced by validate_manifest.py beyond JSON Schema)
#
# 1. (id, sha256) must be unique within the manifest.
# 2. license.spdx must agree with license.tier:
# - PD/PDM-1.0/Unlicense → tier A
# - CC0-1.0 → tier B
# - CC-BY-* → tier C
# - Apache-2.0/MIT/BSD-*/ISC → tier D
# - CC-BY-SA-* → tier E
# 3. license.sharealike must be true iff spdx ∈ {CC-BY-SA-3.0, CC-BY-SA-4.0}.
# 4. license.attribution_required must be true unless spdx ∈ {CC0-1.0, PD, PDM-1.0, Unlicense}.
# 5. authorship.copyright_notice required iff license.tier == D.
# 6. source.permalink or source.revision_id required for {wikipedia, the_stack_v2, github_permissive}.
# 7. source.archive_url recommended for tier-A/B/C web sources (verify with wayback).
# 8. domain must be consistent with source.name (e.g., source=gsm8k → domain=math).
# 9. char_length must equal len(corpus.jsonl[id].text).
# 10. corpus.jsonl[id].text hashed with SHA-256 must equal manifest sha256.