Skip to content

Commit 090d0d7

Browse files
formatting
1 parent 61c9b83 commit 090d0d7

3 files changed

Lines changed: 91 additions & 8 deletions

File tree

CLAUDE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ For example, one could refer to a figure contained inside the chapter "Chapter"
7474
The above rules are crucial to follow to keep cross-references usable.
7575
Without strict conventions in place, they quickly become unmanageable.
7676

77+
To caption a `CyphalSimpleTable`, put the label inside the caption argument, NOT inside the table body:
78+
79+
```tex
80+
\begin{CyphalSimpleTable}[wide]{Caption of the table\label{table:chapter_my_table}}{|l l X|}
81+
Column A & Column B & Column C \\
82+
...
83+
\end{CyphalSimpleTable}
84+
```
85+
7786
### Source formatting
7887

7988
- One level of nesting shall be indented with 4 spaces. Tabs shall not be used anywhere in the source.

specification/transport/can/can.tex

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ \subsection{CAN ID field}
185185
\caption{CAN ID bit layout}\label{fig:transport_can_id_structure}
186186
\end{figure}
187187

188-
\begin{CyphalSimpleTable}[wide]{CAN ID bit fields for 16-bit v1.1 message transfers}{|l l l X|}
189-
\label{table:transport_can_id_fields_message_transfer_v11}
188+
\begin{CyphalSimpleTable}[wide]{%
189+
CAN ID bit fields for 16-bit v1.1 message transfers%
190+
\label{table:transport_can_id_fields_message_transfer_v11}%
191+
}{|l l l X|}
190192
Field & Width & Valid values & Description \\
191193

192194
Transfer priority & 3 & $[0, 7]$ (any) & Section~\ref{sec:transport_transfer_priority}. \\
@@ -204,8 +206,10 @@ \subsection{CAN ID field}
204206
Source node-ID & 7 & $[0, 127]$ (any) & Node-ID of the origin. \\
205207
\end{CyphalSimpleTable}
206208

207-
\begin{CyphalSimpleTable}[wide]{CAN ID bit fields for 13-bit v1.0 message transfers}{|l l l X|}
208-
\label{table:transport_can_id_fields_message_transfer_v10}
209+
\begin{CyphalSimpleTable}[wide]{%
210+
CAN ID bit fields for 13-bit v1.0 message transfers%
211+
\label{table:transport_can_id_fields_message_transfer_v10}%
212+
}{|l l l X|}
209213
Field & Width & Valid values & Description \\
210214

211215
Transfer priority & 3 & $[0, 7]$ (any) & Section~\ref{sec:transport_transfer_priority}. \\
@@ -230,8 +234,10 @@ \subsection{CAN ID field}
230234
section~\ref{sec:transport_can_source_node_pseudo_id}. \\
231235
\end{CyphalSimpleTable}
232236

233-
\begin{CyphalSimpleTable}[wide]{CAN ID bit fields for service transfers}{|l l l X|}
234-
\label{table:transport_can_id_fields_service_transfer}
237+
\begin{CyphalSimpleTable}[wide]{%
238+
CAN ID bit fields for service transfers%
239+
\label{table:transport_can_id_fields_service_transfer}%
240+
}{|l l l X|}
235241
Field & Width & Valid values & Description \\
236242

237243
Transfer priority & 3 & $[0, 7]$ (any) & Section~\ref{sec:transport_transfer_priority}. \\
@@ -289,8 +295,10 @@ \subsubsection{Session header reconstruction}\label{sec:transport_can_v10_header
289295
default values for a best-effort message. The resulting message shall be otherwise indistinguishable from
290296
an equivalent message originated by a v1.1 node on the same pinned topic.
291297

292-
\begin{CyphalSimpleTable}{Session header field values for reconstructed 13-bit message transfers}{|l X|}
293-
\label{table:transport_can_v10_header_reconstruction}
298+
\begin{CyphalSimpleTable}{%
299+
Session header field values for reconstructed 13-bit message transfers%
300+
\label{table:transport_can_v10_header_reconstruction}%
301+
}{|l X|}
294302
Field & Value \\
295303

296304
Header type & Message, best-effort. \\

0 commit comments

Comments
 (0)