unifold 0.3.6

Writing the documents#

documents.md says which files a unit has. This chapter says how each is written, what a reviewer checks, and the style they share.

Context items and stamps#

docs/explanation/context.md lists the decisions, conventions and terms from above that a reader must know to understand the unit. The repetition is deliberate: it keeps the unit understandable when its folder is read alone. Each item is a ### heading:

### [cloud/0002 Each service owns its data](../../../docs/decisions/0002-each-service-owns-its-data.md)
<!-- unifold:cites sha=3f9a1c2e -->

Says: no service reads or writes the database schema of another.

Here: `ingest` keeps its duplicate index in a schema of its own.

The other explanation files#

Decisions#

Decision records use MADR: one file per decision, docs/decisions/NNNN-short-title.md, with a four-digit number that is unique within the unit, and this front matter:

---
status: proposed      # or: accepted, rejected, deprecated, superseded by NNNN, derived
date: 2026-10-07
decision-makers: [name]   # once the status is accepted
---

References and the glossary#

A reference is docs/references/<topic>.md: facts in the present tense, for example the contract of a capability, a wire format or a convention. Reasons go to decisions, procedures to skills. A reference that would exceed the line limit becomes a folder with an index.md that links to every part. API reference that a tool produces from code is not written by hand. docs/references/glossary.md holds the terms that have one fixed meaning inside the unit, one table row per term, so that each can be cited alone. A term is defined in the lowest unit that covers its uses.

docs/references/constants.md holds the fixed values a unit and the units below it use: a table whose first columns are Name and Value, one row per value, named everywhere else and written out only there. Its front matter MAY set name-pattern, a regular expression for the names; the default matches capitals in at least two words, MAX_PAYLOAD. Where such a table exists, every name of that form in a code span of a hand-written document of the unit or a unit below it is a row of the nearest table or of a table above it.

Contracts#

A contract is the one document of a connection: both sides name it, the consumer's tests are written from it, and the fake that stands in for it in those tests is defined in it. contracts.md explains it and holds the template. Its body:

The checker verifies ## Parts, Kind:, the signature block, the fields and examples of a command or query, the single definition of a type and ## Fake; it does not check the header or the case of a part heading.

Skills#

A skill is a how-to guide for a recurring task in the unit, in the Agent Skills format: docs/skills/<name>/SKILL.md, with a front matter that has name, equal to the folder name, and description. The description says for whom the procedure is, when it is written for an end user.

Tutorials#

A tutorial is docs/tutorials/<name>.md: a lesson that leads one stated reader, for example "a developer who has cloned the repository" or "an owner with a new sensor stick", through numbered steps to one result they can see. It uses one concrete example throughout, says at each step what the reader should now observe, and explains nothing that is not needed to take the next step. What a thing is belongs in a reference; why it is so in an explanation; both are linked, not repeated. A tutorial is tried by a person before others rely on it.

Review checklist#

The checker compares files with each other. Whoever reviews a change, a person or an agent, checks the meaning:

  1. Can the unit be used after reading its README.md and the contracts that its manifest names? Does a section of README.md repeat what a contract says?
  2. Does a file name a sibling, a user or, outside context.md, an ancestor? Write the need or capability it stands for instead.
  3. Does the parent restate what a child provides or how it works inside?
  4. Does ## Why or an explanation file list units or connections? Does a hand-drawn sequence diagram tell a story that a scenario tells?
  5. For each changed connection: does the provider cover what the need expects? unifold capability prints both sides. Do the examples of each part cover its errors and the sides of every precondition?
  6. Is each Says still true to its source, and each Here still true? Does the passage a derived decision cites say what ## Source says claims?
  7. Is a changed value or limit stated elsewhere? Search for the old value.
  8. Did anything set a decision to accepted without a person asking for it?
  9. Does status match reality, and is it the only place that says how far the work is? Does contract point at what really defines the capability? Does the responsibility join unrelated things with "and"?
  10. Does each guarantee and each goal name something a test could observe?
  11. Is every file of its kind: does a reference give reasons, a tutorial define, an explanation instruct? Move the passage to its home.
  12. Can the reader that Plain language names follow each paragraph without opening a link? Is every abbreviation spelled out or in the glossary, and is every decision cited for what it decides?

Plain language#

The documents follow ISO 24495-1, the international standard for plain language: a reader finds what they need, understands it and can use it. The Markdown style below keeps sentences short; these rules keep them complete.

Markdown style#

What the reference tool reports is in rules.md.

This page as plain Markdown, and its source on GitHub.