docs← Back to article

Markdown for LLMs

Sources: pitfalls

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# Sources: pitfalls

Wrong forms, silent outcomes, `LDC-E` diagnostics, typical mistakes of
formalizers and AI agents, how to detect them. Items marked "confirmed by run"
were reproduced during this research on the installed `law` (semantics
`law.core/0.2`).

## 1. Fragment text retyped

One missing diacritic in a source fragment (plain "e" where the document has
"dotted yo") — and `check` stops:
`LDC-E5201` (text hash), with a pinned publication `LDC-E5202` (no
occurrence). No check normalizes anything: neither NFC nor whitespace
collapsing. Detection: copy bytes from the document, recalculate the hash after
every edit.

## 2. Edition declared `PINNED_*`, but a fragment without a hash

`LDC-E5205`. The duty follows from the edition's claim, not from a
publication's presence: either `content_hash` on every fragment or the honest
`materialization_status ABSTRACT_ONLY`. AI agents often add `PINNED_*`
"for solidity" — that is a refusal.

## 3. Wrong bytes

Re-pinned the document and did not recalculate the publication hash —
`LDC-E5204`; the same code when `local_path` is absolute, contains `..` or is
unreadable. A publication with no `content_hash` at all — `LDC-E1305`. Order
matters: `LDC-E5204` goes first — mismatched bytes void conclusions drawn from
them.

## 4. Removed `local_path` line switches pinning off (silently)

`LDC-E5206`, a warning: `LDC-E5202` and `LDC-E5204` compute
only where bytes resolve locally. Without the path `check` is clean, while the
edition keeps claiming `PINNED_*`. As of 21.09.2026 the corpus records 219 of
3 090 hashed publications this way. Detection: keep `local_path` in every
pinned publication; no warning on `PINNED_*` without a path is a reason to
check, not to rejoice.

## 5. `materialization_status` undeclared

`LDC-E5207`, a warning. The status must be declared, not
derived from a publication's presence: without it the hash duty (item 2)
does not hold, and the coverage report reads the edition as unpinned. An
edition claiming no pinning gets no warning — silence is the norm here.

## 6. Anchor to a nonexistent fragment

`LDC-E5103`, a warning: the node's `anchors` keep the bare name
instead of the StableId, tracing loses the address. The anchor name must be
declared in the package as a `fragment`, `edition`, `publication` or `source`;
a reference to another package is `package::Fragment` or a string. The level is
a warning because 102 conformance scenarios and 24 corpus packages use the form:
a refusal would drop the conformance corpus. The neighbouring form `fragment …
in NO_SUCH_EDITION` is rejected under its own code — `LDC-E5102` (already an
error, not a warning).

## 7. `@source` relation attributes outside `anchors`

`relation = …`, `coverage = …`, `quote = "…"` do not land in the `anchors`
field: it holds only fragment references. An annotation with at least one attribute materializes as an `anchor`
node (`<rule>/anchor/<k>`, document `schemaVersion: law.core.ir/0.4`). Values
outside the closed lists — `LDC-E1373` (nine
relations, four coverages). A quote must be a continuous substring of the
fragment text byte for byte, otherwise `LDC-E5208`; an empty or non-string
quote — the same code. AI agents love inventing "in-spirit" quotes — caught only
by this check.

## 8. Label or `text` without a status

`LDC-E0201` at the status position. The status is mandatory for both `label`
and fragment `text`. A label on a `package` header is allowed by the grammar
but does not lower — `LDC-E1321`.

## 9. Explicit `@id` on `source` / `edition` / `fragment` (confirmed by run)

The annotation does not execute: the StableId stays package-derived
`namespace#Name`. The mismatch gives
warning `LDC-E1372` naming both identifiers. Reproduction during this
research: a `research.sources.anchored_rule` package variant with the line
`@id("urn:research:sources:park-rules-2026")` over `source PARK_RULES` —

```text
warning LDC-E1372: явный `@id("urn:research:sources:park-rules-2026")` на декларации
`source PARK_RULES` НЕ ИСПОЛНЯЕТСЯ ... уберите аннотацию либо дождитесь решения
о смене StableId корпуса
check OK: docs/research/constructs/22-sources/examples/anchored-rule
```

On `rule`, `priority`, norm templates, `assert` and `calendar` the same
annotation executes. The StableId-change cascade (`contentHash`, anchors,
144 corpus places) awaits a separate owner decision — do not fix by hand.

## 10. Form slot outside the dictionary

`vocative` on `ru-KZ` or a repeated slot — `LDC-E8203`, a warning: the form
is kept, the consumer degrades to `text`. The slot dictionary is closed per
language family.

## 11. `id "…";` in source bodies is outside the supported form

`source`, `edition`, `publication`, and `fragment` do not accept an `id`
field: unsupported fields are errors and no partial CLIR is emitted.
E-0027 legalized the field for assertions, not the source model.
`@id` on derived-ID kinds has a separate boundary: E1372 warns only on
divergence; the actual ID remains package-derived (see item 9).