%cc-core; %cc-record; ]>
Make every cross-session file parseable forever by numbering its fields. The record_skill root declares four things: how a record is declared, how it evolves, how it is read, and how it is checked. The grammar lives in cc-record.dtd: records, record, field with n, name, model and since.
The declaration is an entity in the DOCTYPE of the command or skill that writes the file:
<!ENTITY RECORD.handoff "handoff|whats-next.md|1=original_task:CDATA@1|2=work_completed:CDATA@1|3=work_remaining:CDATA@1">
Each field is number=name:MODEL@since. PCDATA means the reader parses the value (an id, a number, a status from an enumeration). CDATA means the value is carried whole (a description, a command, free text). since is the version the field first appeared in. Numbers are dense from 1.
The evolution rule is append-only. To add a column: append 4=files:CDATA@2 and bump since. To retire a column: keep its number, write it empty, and note it retired in the declaration's commentary; never renumber the ones after it. Because since never decreases as n grows, a single scan of the declaration proves the record was only ever appended to.
The reading rule: split on the declared separator, count the columns, compare with the highest declared n. Fewer columns than declared: refuse and name the missing field. More: read the declared ones, report the surplus count, never guess. A PCDATA field is validated against its enumeration or type before use; a CDATA field is passed through.
The checking rule, for any repository that carries records: the dtd-contract-auditor agent, or a small script, reads every RECORD.* entity in the corpus and asserts dense numbering, monotone since, and that each live file carries exactly as many columns as the highest n. Trip it on purpose once by inserting a field in the middle of a copy and confirm it fails.
Render record_skill as the four sections above, and render any record you write as a record element with one field per declared column in numbered order.
- Every record a command writes has a RECORD.* declaration in that command's DOCTYPE
- Numbers are dense and since never decreases
- Every LAW.RECS.* entity holds