---
description: "The base, collection, type-rule, and schema sources of deterministic findings, their dereferencing limits, and the run-scoped execution model"
type: types/note.md
tags: [type-system, document-system]
---

# The validation contract

`commonplace-validate` enforces one contract on a note, with clauses from four places. Every finding is labelled with the source that produced it, because a reader who knows only the type spec would otherwise get failures from rules that spec never mentions:

```
PASS:
- [base] link health: all local relative links resolve
- [schema] type schema: note requirements satisfied
FAIL:
- [type: tag-readme] weight gate: head exceeds hard limit
```

In one sentence: **a type declares what the document must contain; the framework checks that what it points at is really there.**

The explicit `landings`, `redirects`, and `lifecycle` targets are outside this
note pipeline. `landings` and `redirects` emit `[repository]` findings.
`landings` checks that every top-level collection has a `README.md` and that no
sibling `index.md` shadows it. `redirects` compares `properdocs.yml` with the
live `docs_dir`: targets resolve, keys do not shadow pages, and the map is flat.
`lifecycle` inspects the support surfaces under `kb/work/` and `kb/tasks/`. It
fails a non-empty top-level workshop with no framing file and warns about an
unregistered non-empty workshop, a backlog checklist whose tasks are all
complete, or a recurring task whose declared non-glob output does not exist.
The warnings raise reconciliation decisions; they do not authorize registration,
movement, creation, or deletion. Keeping these checks explicit prevents
validation of one note or collection from failing on unrelated repository state
while still making each broader invariant deterministic.

The command presents these findings through two views. The default compact view
prints counts plus every warning, failure, and material notice. `--full` retains
the per-artifact PASS/WARN/FAIL/INFO transcript for deliberate inspection.
For one ordinary target, `--json` emits the versioned `commonplace.validation.v1` envelope with stable
diagnostic rule IDs, subjects, reasons, the path and detected type of every
analysed artifact, and the detailed drill-down command. A caller that requires
one particular typed artifact checks both `summary.files_analysed` and the
corresponding `analysed_artifacts[].type`; `text_files` counts standalone frontmatter-free targets, excluding members
grouped under directory artifacts. It is not the total number of targets.
Presentation does not change severities or exit behavior: warnings exit zero;
failures exit nonzero.

With two or more explicit `.md` paths, the command validates each distinct file once in first-seen order. It does not expand note names or run collection checks. All inputs must resolve to Markdown files before validation begins. Batch JSON uses `commonplace.validation.batch.v1`: `targets` records the supplied arguments instead of a scalar `target`, and `analysed_artifacts` lists the files actually checked.

## Explicit collection and date scopes

Validating a whole collection warns once for each visible directory without a `README.md`, including the collection root. A README gives authors a file to link to in both the shipped library and the published site. File, subdirectory, and date-filtered checks do not issue this warning.

Collection names and paths use generic target resolution, without a privileged
Notes or Theory collection. `today` and `recent` require
`--collection NAME_OR_PATH`. They enumerate that collection's validation
surface, apply the local-date modification-time filter to each target file or
artifact directory, and retain the collection's structure checks and ignored
subtree notices. They do not scan other collections or bypass validation-ignore
markers. A directory artifact's target timestamp is the directory's mtime,
not an aggregation of its members' mtimes.

A `.commonplace-validation-ignore` marker excludes its subtree from
collection-scoped validation and, with the shipped ProperDocs hook, from the
published site in every collection. Site exclusion includes assets and
generated pages; it does not delete the files or prevent explicit validation
of an individual artifact. Keep the interpreting report outside a marked
capture subtree. Links to excluded evidence need a repository URL rather than
a local site-page link.

The site can project checkout-relative links without changing Markdown bytes.
`extra.repository_files_url` in `properdocs.yml` supplies the public repository
base. Existing targets inside the checkout but outside the published pages
(including marked evidence) link there; missing targets retain normal site
warnings. The configured base must correspond to the checkout being published.

Attributed external quotations have a separate link boundary. The renderer
uses an explicit commit-pinned GitHub source file, the accepted analysis's
frozen Git source plus its attributed file, or a name-paired, checksum-bound
ingest capture's source URL. A web source URL identifies the original page,
not an immutable remote copy. If no reliable source-file base is available,
quoted relative links render as their label and literal original path, not
Commonplace navigation. Ordinary unattributed blockquotes and authored links
keep normal link diagnostics. Rendering does not verify external destinations
or alter retained quotations.

## Directory artifacts

A [directory artifact](./definitions/directory-artifact.md) is a directory
whose `ARTIFACT.yaml` names a directory type; it is one additional
validation unit. Visible direct Markdown children are the candidate
members; descendants remain independent traversal targets.

A type spec's `layout` declares the members; the definition states its
keys. The validator checks from the layout: membership, with
`membership: closed` making a file that matches no role a finding and
`membership: open` admitting it; each member's expected type;
requiredness, always and by the discriminating field's value; and
`identity`, that the listed fields equal the source member's, or the run's
values when the source is `run` and validation runs inside an analysis run.
`verifies` is checked only for naming roles. Its meaning belongs to the
analysis workflow: code (`apply_verdict`) applies the verifying role's verdict to the
subjects it was handed, refusing or accepting each, and that application
settles the relation for the verified version
([ADR 114](./adr/114-directory-types-declare-what-a-role-verifies.md),
kept by [ADR 118](./adr/118-analyses-run-as-a-workflow-over-headless-harnesses.md)).
Type rules registered for the
directory type compute what needs a grammar, such as record citations
within each role's `cites` scope.

The shared schema receives `{manifest, members}` and constrains the manifest.
The manifest can contain only `type` when no metadata is required. Optional
`members` entries map filenames to `{sha256: <digest>}`. Each entry asserts
that its file exists; each supplied digest must match exact bytes. Whether
every member must be pinned is the type's rule. Metadata cannot authorize a
member the layout forbids.

Explicit directory validation runs artifact checks alongside ordinary file checks,
even with a malformed manifest. Layout and type-rule checks run over the
members present even when the schema or a member fails, so an incomplete
working instance reports its absent required members and checks the relations
its members reach. Every such finding names its role, or no role when it
concerns the whole artifact. `ValidationRun.artifact_findings(directory)`
returns them for a caller that filters by role; content overrides can place a
candidate's bytes at its role's path without writing it. A collection sweep
groups direct members under their directory and counts the directory once.
In JSON, `analysed_artifacts` uses the directory path and full type-spec path;
member diagnostics use the member's path. The existing `files_analysed` field
counts these validation units. Explicit member-file validation checks only
that file. A workflow calls `ValidationRun.validate(directory)` to check the
artifact without starting traversal; repeated requests reuse results and active
cycles fail.

The analysis set's boundary is a member and declares its sources. Each
member's references resolve against the members its role cites, including
supersessions in the reconciliation, and the set rule checks the overview's
index of them and that its repeated boundary sections equal the boundary's. Every member's
quote-anchored citations resolve against the boundary's frozen `source`: a Git
commit in the recorded checkout, or a capture file pinned by its digest. As
with ingest snapshots, pinned bytes absent from this machine leave a member's
quotations unverified, reported as information; the analysis workflow, which
holds the source, refuses them. The profile cites only
the three analyst reports; it contributes no declarations, annotations or
source quotations, so an isolated profile cannot validate its references.

See [ADR 095](./adr/095-directory-artifacts-add-shared-set-validation.md)
[ADR 111](./adr/111-directory-types-declare-their-layout.md) and
[ADR 112](./adr/112-one-quote-resolver-for-grounding-and-analysis-evidence.md)
for the boundary and alternatives, and the
[analysis set type](../agentic-system-analyses/types/agentic-system-analysis-set.md) for the
first production contract.

## Scope: this is the deterministic half only

A type is verified by **three** mechanisms, and only the first two are the validator's:

| | Mechanism | When | Judges meaning? |
|---|---|---|---|
| 1 | `schema` — declarative JSON Schema | validate time | no |
| 2 | `type_rule` — imperative code the type registers | validate time | no |
| 3 | **type-conformance review gate** — the type spec's *body text* is the criterion, read by an LLM ([ADR 038](./adr/038-type-conformance-reviews-use-the-type-spec-as-the-gate.md)) | review time | yes |

This page documents 1 and 2. The third is not a lesser mechanism: **a type spec's natural-language instructions are an executable criterion, not documentation.** Everything a schema cannot express still binds — it binds at review time. That is why [`type-spec.md`](../types/type-spec.md) tells authors *not* to restate schema rules in body text: the schema already enforces them, so a restatement only spends reviewer judgment re-confirming what is already guaranteed, instead of on the properties only a reviewer can check.

## The four sources of a validator finding

| Source | Owner | Mechanism | Can dereference? |
|---|---|---|---|
| `base` | framework | imperative, applies to every typed note; repository-boundary, write-brief pairing, and collection-contract naming rules also cover bare text | yes — link health, archive boundary, tag heads, verbatim quotes |
| `collection` | the collection | imperative, checks `unquoted-source-limit` where the nearest `COLLECTION.md` sets it (typed and bare text) | yes — resolves tracked-source links and verbatim quotes |
| `type: <name>` | the type | imperative rules registered for that type | yes — type specs resolve their declared schemas |
| `schema` | the type | declarative JSON Schema over the parsed document | **no** |

**A type is not verified by its schema alone.** For example, `type-spec.schema.yaml` can constrain the `schema:` field's shape, but an imperative rule must follow a non-null path and load the declared schema. So *who owns a rule* and *whether it dereferences* are independent axes, which is why the table has no empty cells and why "schema versus everything else" is the wrong mental model.

Type-spec documents are ordinary validation artifacts. Collection validation includes local type specs, and `commonplace-validate types` runs the same base, type-rule, and schema pipeline over every type spec under the project's `kb/`, skipping subtrees under a validation-ignore marker. In this checkout that includes the library's global types; in an installed project the read-only library is not validated. There is no separate type-system validation pass.

Imperative rules select types by type identity, not by the type spec's `name` field. A type's identity is its `type:` value as written, its spec's path under a KB root such as `types/tag-readme.md` or `articles/types/article.md`, so a same-named collection-local type remains distinct. [ADR 048](./adr/048-imperative-type-rules-dispatch-by-canonical-path.md) introduced this keying. Reports still use the shorter `type: <name>` label because a display label is not an identity key.

## What the schema can and cannot express

The schema is **not** limited to frontmatter. `ParsedDocument.to_validation_object()` hands it `frontmatter`, `body`, `headings`, `links`, and `body_dates`, so a type can require a `## Reasoning` heading or constrain body content declaratively, and several do.

What a schema cannot do is **dereference** — it has no way to say *follow this path and look inside the artifact it names*. JSON Schema validates one instance document; the referent is another file. This is an inherited limit of the substrate, not a gap worth closing, and it is the whole reason a second, imperative check mechanism exists at all.

So the dividing line is not frontmatter/body. It is **inside the supplied schema instance** (declarable) versus **outside that instance** (must be loaded and checked). Directory schemas can compare the member data their loader supplies; they cannot perform filesystem reads themselves. A referential check needs locatable inputs outside the supplied instance and those inputs must be available at check time: distinct conditions 2 and 3 of [checking retained results trades cost against reliance risk](../theory/checking-retained-results-trades-cost-against-reliance-risk.md). Those conditions make checking possible; they do not make it obligatory. The base contract below selects which checks Commonplace runs and their severities.

## The base contract

Every note **with frontmatter** is checked for the following, whatever its type. A type spec does not declare these and cannot opt out of them.

- **Frontmatter parses** — valid delimiters, well-formed YAML.
- **Title length** within `MAX_NOTE_TITLE_LENGTH`; **filename slug length** within `MAX_NOTE_SLUG_LENGTH`. Review results and edit results are exempt from both limits regardless of location. Connect reports and write briefs are exempt from the slug limit. Other structural checks still apply. Git-ignored files are also exempt from both limits, except when validating a pinned artifact for publication. Outside a Git worktree or without Git, only the type exemptions apply.
- **Link health** — every local relative link resolves to an existing target. *Warns.*
- **Tag heads** — every tag on an eligible typed artifact must have a head at `kb/tags/<tag>-README.md`. A missing head fails validation. Checking one artifact does not enumerate other members.
- **Collection contract name** — every `COLLECTION.md` must declare `type: types/collection-contract.md`, and only a `COLLECTION.md` may carry that type. Violations **fail** (including bare-text `COLLECTION.md` files).
- **Write-brief pairing** — a `brief:` value must be the document's own `<stem>.brief.md`, and that sibling must exist with `type: types/write-brief.md`. Every file named `*.brief.md` must carry that type and be declared by its sibling `<stem>.md`, and every write brief must be so named ([ADR 092](./adr/092-write-briefs-are-optional-sidecars-named-by-a-validated-pointer.md)). Violations **fail** (including bare-text `*.brief.md` files).
- **Proposal archive boundary** — no library artifact links to a file under `kb/reference/proposals/archive/`. The archive README is a permitted target and may link to archived files itself; workshop files under `kb/work/` may also link in. Violations **fail**.
- **Verbatim quotes** — every `verbatim`-marked quotation resolves against the source it links ([ADR 046](./adr/046-verbatim-quotes-are-validated-against-their-cited-source.md)). A quote absent from or repeated in its eligible source region **fails**; an unpairable verbatim citation warns, but only in notes that demonstrably use the convention.
- **Ingest snapshot pairing** — when an ignored local snapshot is retained, its name-paired path, source URL, and exact-byte checksum must agree with the tracked ingest. A mismatch warns; when the recorded bytes exist under another filename, the warning locates them without treating that path as mutation authority. For a legacy ingest without a checksum, the source URL may locate a related capture but cannot establish exact-byte identity. Complete cache absence is silent.
- **Source quotes** — every attributed blockquote in a tracked ingest's `## Quotes` section names its exact snapshot path and checksum, and occurs exactly once in that snapshot or within its supplied line range. Absent, ambiguous, or out-of-range extracts **fail**. Missing or mismatched local bytes are reported as unverified, without judging the extract. Analysis sets resolve their quotations with the same mechanism against a different pin (see [directory artifacts](#directory-artifacts)). Notes citing an ingest match only retained blockquote bodies, never attribution text or analytical prose. Both the snapshot check and citations of retained extracts use the ingest's source-kind normalization: repository sources preserve code operators.
- **Ingest contract** — in a tracked ingest, the `## Quotes` block sits immediately before `## Connections Found`; the analysis outside Quotes does not link into `.snapshots/`, cite a `related-systems/` checkout or name a connect report; and frontmatter carries the snapshot's capture fields unchanged without copying its `type`, `description`, `genre` or `tags`. *Warns*; an ingest handoff (`commonplace-validate --handoff`) fails on the same findings.
- **Snapshot links** — no file other than an ingest links into a `.snapshots/` directory. Git ignores snapshots, so such a link resolves only on the machine that holds the file; link the paired `.ingest.md`. A path in a code span is a mention, not a link. *Warns.*

**Bare text opts out of structural checks.** A file with no frontmatter is typed `text` and gets no title, slug, link-health, quote, type, or schema requirements — deliberate, because `text` keeps capture friction at zero and may hold imported material whose relative links are broken by construction. Two exceptions apply. The proposal archive boundary is repository-level: bare library READMEs can otherwise make archived designs load-bearing just as readily as typed notes, and non-library output collections such as `kb/reports/` remain outside that rule. The [unquoted-source limit](#the-unquoted-source-limit) is set by a collection and binds every artifact in it, bare text included.

A `kb/sources` collection sweep also audits the retained local snapshot cache.
It indexes exact ingest `source` URL values independently of checksums so legacy
checksum-less ingests and changed observations remain visibly related. A
derived ingest may also own exact precursor bytes through
`original_snapshot_sha256`; this accounts for a retained translation input
without pretending it is the ingest's primary observation. The sweep warns
about a Markdown snapshot that has no same-stem ingest and no URL or checksum
match, and about redundant alternate copies of an already valid pair. A
checksum-owned alternate that reveals path drift is reported on the affected
ingest instead, so one condition produces one warning.

### Why the two referential checks have different severities

Link health **warns**; a false verbatim quote **fails**. This is the policy selected in ADR 046, not a severity rule deduced from the theory. A dangling link exposes a retrieval problem; a false verbatim claim can conceal one if the reader trusts the asserted fidelity and skips comparison. The decision prioritizes detecting that false assurance. Its prototype audit supports mismatch detection in the audited corpus, but does not establish comparative reader harm or a cost threshold that uniquely warrants these severities.

### Why the base checks are not type-configurable

Letting a type opt out of link health or verbatim-quote resolution would be a knob that can only ever be set wrong: a broken link is broken in every type, and a false `verbatim` claim is false in every type. The checks are already **self-selecting** — a note that makes no verbatim claim produces no candidates — so a type gate would add configuration without adding reach.

## The unquoted-source limit

A collection whose `COLLECTION.md` sets `unquoted-source-limit: <n>` holds every
artifact in it, whatever its type, to that many **unquoted tracked sources**
([ADR 082](./adr/082-grounding-is-bounded-on-the-artifact-by-unquoted-sources.md),
[ADR 122](./adr/122-collections-set-the-unquoted-source-limit.md)). A collection
without the field is not checked; the nearest contract governs. This repository
sets five in `kb/theory/` and `kb/articles/`.

The limit exists so that the artifact's grounding review fits one pass: each
unquoted source is a full read for the reviewer of
[`semantic/grounding-alignment`](../instructions/review-gates/semantic/grounding-alignment.md).
Set it on a collection whose artifacts are grounding-reviewed against tracked
sources, and nowhere else.

What counts:

- A **tracked source** is a link to a `kb/sources/*.ingest.md`. Links to other
  artifacts, notes included, never count.
- A source is **discharged**, and stops counting, when the artifact quotes it
  verbatim: a quoted span marked `verbatim` in the same paragraph as the link,
  whose words occur in that ingest's `## Quotes` section. Retain the needed
  quote with [`cp-skill-ground`](../instructions/cp-skill-ground/SKILL.md);
  never edit the ingest by hand.
- A source linked with `(snapshot required)` anywhere in the artifact always
  counts, quoted or not.

Over the limit, validation **fails** and names the unquoted sources. The remedy
is to quote the supporting passages or split the artifact by claim; a claim
carried jointly by several sources is quoted together, not split. The
collection's contract states any authoring conventions that go with the limit.

## Open

[ADR 050](./adr/050-validation-runs-share-parsed-artifacts-and-collection-indexes.md) gives referential checks a shared execution context: one validation run caches parsed artifacts and collection tag indexes and builds the authored-link graph once. It does not give Markdown elements a shared positioned representation. Link health and verbatim-quote resolution remain separate hand-written passes; they share one notion of code (`note_parser.blank_fenced_code_blocks`), but `ParsedDocument.links` is still a tuple of URLs with no spans, so the quote checker carries its own link regex. A third positioned referential check could still mean a third parser. Tracked in the kb-graph-loader workshop: a `LoadedNote` carrying *positioned* elements is what would retire those private parsers.

---

Relevant Notes:

- [Checking retained results trades cost against reliance risk](../theory/checking-retained-results-trades-cost-against-reliance-risk.md) — rests-on: frames the checking-cost and reliance-risk trade-off; the base contract selects checks and severities locally
- [ADR 046 — Verbatim quotes are validated against their cited source](./adr/046-verbatim-quotes-are-validated-against-their-cited-source.md) — decided-by: the decision that added the second referential check and surfaced the class
- [ADR 024 — Schema severity is per-constraint, fail by default](./adr/024-schema-severity-is-per-constraint-fail-by-default.md) — decided-by: how the `schema` source assigns its own severities
- [Commands](./commands.md) — see-also: the `commonplace-validate` command surface
- [ADR 038 — Type-conformance reviews use the type spec as the gate](./adr/038-type-conformance-reviews-use-the-type-spec-as-the-gate.md) — see-also: the third verification mechanism, where a type spec's natural-language instructions bind as an LLM-judged criterion at review time
- [ADR 050 — Validation runs share parsed artifacts and collection indexes](./adr/050-validation-runs-share-parsed-artifacts-and-collection-indexes.md) — implemented-by: artifact-local and collection-indexed checks share one execution context without a generic dependency engine
