Books / Law as Code in Practice: German Housing Benefit (Wohngeld) / Appendix D
Appendix D
Reproducing the Examples

Contents of Law as Code in Practice: German Housing Benefit (Wohngeld)
Every answer in this book was produced by the law command-line tool, either from a case package — a small package that holds fictional files, each with its facts and legal date, and imports the canons whose rules apply — or from the declared scenarios of the Wohngeld canon itself. The rules are never copied into the case.
What you need
- The
lawcommand-line tool, version 0.2.2 or later (npm i -g @arxo/cli), executinglaw.core/0.2.11. The chapters say which version recorded each table: on 12 October 2026,law0.1.12 in a checkout of the Arxo repository. The reproduction kit below was checked the same day with the releasedlaw0.2.2: the same amounts and statuses. - The reproduction kit of this book: two public repositories.
- the canons,
github.com/arxohq/arxo-wohngeld: the three German canons, each with its sources, pinned legal texts and scenarios, and a registry from which the case packages install them; - the examples,
github.com/arxohq/law-as-code-germany-examples: the case packages and the saved answers of Chapter 9.
- the canons,
Getting the kit
r=https://github.com/arxohq
git clone $r/arxo-wohngeld.git
git clone $r/law-as-code-germany-examples.git examples
The case package of the chapters’ commands, <case package>, is examples/familie-weimar. The canon, <canon>, is the folder arxo-wohngeld/packages/de.social.wohngeld: its dependencies are pinned inside it, so there is nothing to install.
law install never picks versions: it restores exactly what law.lock pins and checks every hash. In a checkout of the Arxo repository the same package and canon are corpus/laws/de/wohngeld/examples/familie-weimar and corpus/laws/de/wohngeld.
The case package
All the files of the Vogts and of the excluded woman are in one case package, familie-weimar — the <case package> of the chapters’ commands. It holds four files and six saved questions.
| File | Who and when | Chapters |
|---|---|---|
Familie2025 |
the Vogts on 1 January 2025, the § 21 Nr. 3 assessment recorded as decided | 0–4, 6, 9 |
Familie20241231 |
the same family on 31 December 2024 | 0, 1, 9 |
FamilieOhneWuerdigung |
the Vogts on 1 January 2025 without the authority’s assessment | 3, 6 |
AlleinGrundsicherung |
a woman in Weimar receiving SGB II support with housing costs, on 1 March 2025 | 7 |
The questions are JSON files in queries/:
| Question file | Asks whether |
|---|---|
einkommen-1710.json |
the monthly assessed income is €1,710.00 |
miete-777-80.json |
the rent taken into account is €777.80 |
wohngeld-485.json |
the monthly Wohngeld is €485 |
wohngeld-463.json |
the monthly Wohngeld is €463 |
anspruch-485.json |
a claim to €485 exists |
kein-anspruch-alle-ausgeschlossen.json |
no claim exists because all household members are excluded |
One fact changed
The variations of Chapters 2, 3, 4 and 8 — the Vogts’ case with one fact changed — are five cases of a second case package of the kit, familie-weimar-varianten. Its questions collect the value (collect-y, collect-m, collect-w, collect-n for Y, M, the Wohngeld and the number of members).
| File | Change against Familie2025 |
Answer | Chapters |
|---|---|---|---|
VMiete850 |
rent €850 | M €998.20, €644 | 2, 3, 4 |
VSteuer |
income tax also expected | Y €1,496.25, €542 | 2, 3, 4 |
VWerbung2000 |
work expenses €2,000 | Y €1,658.6666666667 (ten decimal places, rounded half up), €499 | 2, 3 |
VOhneMittelpunkt |
Markus’s life centre not established | 3 members, €351 | 2, 3, 8 |
V20270101 |
legal date 1 January 2027 | MISSING_PARAMETER_VALUE |
8 |
The canon’s scenarios
The other answers are scenarios of the Wohngeld canon — the <canon> of the chapters’ commands:
| Scenario file | What it holds | Chapters |
|---|---|---|
tests/bmwsb-2023.lawtest, tests/bmwsb-2025.lawtest |
the ministry’s worked examples, 9 and 9 tenant examples executed | 5, final exercise |
tests/redaktionen.lawtest |
the change of edition and the edges of the values the model holds | 1, 8 |
tests/tatsachen.lawtest |
missing and conflicting facts | 8 |
tests/ausschluss-und-urteil.lawtest |
exclusions under § 7, the authority’s judgment, the owner-occupier flag | 6, 7, 8 |
Asking a question
Work in the case package directory — from the folder where you cloned the kit:
cd examples/familie-weimar
law install --registry arxo=../../arxo-wohngeld/registry
law ask . --case Familie2025 \
--query-json queries/wohngeld-485.json --out "$(mktemp -d)"
--case names the file, --query-json the question; --out saves the full answer — status, proof and fingerprints — in a directory.
Running the scenarios
In the canon folder, arxo-wohngeld/packages/de.social.wohngeld:
law test . --file tests/bmwsb-2025.lawtest
Each line reports a scenario as passed or failed, and a total. On 12 October 2026 the 2023 suite passed 9 of 9, the 2025 suite 10 of 10, the edition suite 6 of 6, the suite of missing and conflicting facts 7 of 7, and the suite of exclusions and judgments 16 of 16; in arxo-wohngeld, with the released law 0.2.2, all 87 scenarios of the canon passed.
Replaying a saved answer
The kit keeps the two answers of Chapter 9 in familie-weimar/runs/. Replay one in a copy:
d="$(mktemp -d)"
cp -R runs/familie-2025 "$d"
law eval "$d/familie-2025"
shasum -a 256 runs/familie-2025/result.json \
"$d/familie-2025/result.json"
law eval evaluates the saved answer again — without the source files or a rebuild — and must give the same bytes. Compare the program and case fingerprints in the manifest and the fingerprint of result.json in the original and the replay: if they match, the same program gave the same answer to the same case. That shows repeatability, not legal correctness — Chapter 9 explains the difference.
The saved answers and their fingerprints, recorded on 12 October 2026; each replay was byte for byte identical:
| Fingerprint | Value |
|---|---|
| program, both answers | sha256:8a69e9ad8320d428a783c2a2e40bb0de53eb469ff99427bad732eaa21d0b749c |
case Familie2025 (€485) |
sha256:8eb8b74380524355eada4c2c6b4811dc2e7a1fe166ce166dd94283d27ccf3f22 |
case Familie20241231 (€463) |
sha256:cba339409be3cd65a5b4701157e4a8331a7a265b2fa02a6e0a33c0b165e59bbc |
result.json, Familie2025 |
e5ce59dd0f27c666410c9d247fad47b9ed75a939b052e360cb64fb6fe6790eb4 |
result.json, Familie20241231 |
f685d323d60ca09fbadd2be9940e09a7855fa3b0b4e593b0bf90c25d8b3f1735 |
| semantics | law.core/0.2.11 |
If your answer differs
Check, in this order: the version of law; the legal date and the facts of the file; the editions and annex rows the canon pins. A later edition of a text, or a corrected fact, gives a new answer to a new question — not a failed reproduction of the old one.