|
| 1 | +# Cyphal specification — notes for AI agents |
| 2 | + |
| 3 | +Read `README.md` first; it contains the authoritative editing rules, label conventions, |
| 4 | +source-formatting style, and build instructions. This file captures the project-specific |
| 5 | +context that is easy to miss on a cold read. |
| 6 | + |
| 7 | +## Key external sources of truth |
| 8 | + |
| 9 | +These live outside this repository but are the authoritative references for anything |
| 10 | +the spec says about the session layer: |
| 11 | + |
| 12 | +- <https://github.com/OpenCyphal-Garage/cy> -- the C reference implementation, design notes, formal models and proofs. |
| 13 | +- <https://github.com/OpenCyphal/libcanard> -- the Cyphal/CAN transport layer C reference implementation. |
| 14 | +- <https://github.com/OpenCyphal/libudpard> -- the Cyphal/UDP transport layer C reference implementation. |
| 15 | + |
| 16 | +When working on the specification, ensure that these repositories are cloned in the outer directory (`../`); |
| 17 | +if not, clone them and check out the main branch. |
| 18 | + |
| 19 | +Numerical constants (moduli, tag widths, header sizes, etc.) and test vectors in the spec are generated from these |
| 20 | +sources and must reproduce bit-for-bit. |
| 21 | +When adding or revising a test vector, regenerate it from the reference C implementation. |
| 22 | + |
| 23 | +## Repository layout |
| 24 | + |
| 25 | +``` |
| 26 | +./ |
| 27 | +├── README.md # authoritative editing guide |
| 28 | +├── CLAUDE.md # this file |
| 29 | +├── compile.sh # builds the PDF |
| 30 | +├── clean.sh # removes build artifacts |
| 31 | +└── specification/ |
| 32 | + ├── Cyphal_Specification.tex # root document; \input's every chapter |
| 33 | + ├── cyphaldoc.cls # custom document class; defines remark, CyphalSimpleTable, etc. |
| 34 | + ├── introduction/introduction.tex |
| 35 | + ├── session/ # main focus of v1.1; composed of several chapter-local files |
| 36 | + ├── transport/ |
| 37 | + └── appendices/ # proofs, TLA+, formal models, references, ... |
| 38 | +``` |
| 39 | + |
| 40 | +A chapter directory contains one main `.tex` file that `\input`s its subordinate files. |
| 41 | + |
| 42 | +## Building |
| 43 | + |
| 44 | +```sh |
| 45 | +./compile.sh |
| 46 | +``` |
| 47 | + |
| 48 | +Ensure it builds cleanly and the PDF looks sensible before declaring the work done. |
| 49 | + |
| 50 | +## Style rules that are easy to forget |
| 51 | + |
| 52 | +Most of the house style lives in `README.md`. A few points warrant extra emphasis: |
| 53 | + |
| 54 | +- **Be brief.** v1.0 was too verbose. The spec must be tight: push rationale into `remark` boxes, |
| 55 | + avoid restating transport-layer definitions, and cross-reference rather than repeat. |
| 56 | +- **No API description.** Describe observable wire behavior and state transitions only. |
| 57 | + Words like "future" are allowed as conceptual handles when describing asynchronous |
| 58 | + state transitions, but they are not API promises. |
| 59 | +- **Lowercase shall / should / may.** The document uses lowercase RFC 2119 keywords in prose. |
| 60 | +- **ASCII only inside `minted` bodies.** The `minted` listings use `inputenc` under `pdflatex`, |
| 61 | + which rejects Unicode characters like `∪`, `≤`, `→`. |
| 62 | + Use ASCII substitutes (`union`, `<=`, `->`) or TeX math in surrounding prose instead. |
| 63 | + |
| 64 | +Heavy rationale, the CRDT proof, the TLA$^+$ listing, the rapidhash reference |
| 65 | +implementation, the eviction solver, and the gossip analytical models all live under |
| 66 | +`specification/appendices/` and are referenced from the main body. |
0 commit comments