# `legal@1`: legal records, contracts and deadlines

Version **1.1.0** · published 2026-12-02 · MIT · boards: compliance-calendar, contract-obligations, entity-management, vendor-renewals · [changelog](../CHANGELOG.md)

A local record of dates and terms supplied by the user: when an agreement renews, when a notice or filing is due, and which role is responsible. These records help the user organize and review their own inputs. They are not legal advice.

## Tables and their grain

| Table | One row represents |
|---|---|
| `entities` | A registered entity and its reported status |
| `entity_roles` | A role for one entity and term, with no person identified |
| `contracts` | An agreement and its reported current term |
| `obligations` | An occurrence of a filing, notice, renewal, payment, review or other supplied deadline |
| `contract_prices` | One stated price per agreement and effective date |
| `import_issues` (1.1) | A row or calendar entry an importer could not read or left out, shown in the board's data review |

Contract Obligations and Vendor Renewals read agreements and the related deadline rows. Vendor Renewals also reads effective-dated prices and may read card transactions separately through finance@2. Entity Management reads registered entities, their roles, and filings. Compliance Calendar reads deadlines from SQL rows regardless of whether the source was a CSV or an iCalendar export. A standalone deadline may have both links empty. A supplied link must identify a row in its register, and an obligation linked to both a contract and an entity must agree with the contract's entity when known.

## Connector conventions

- **Dates.** Store source-local `YYYY-MM-DD` dates. The connector resolves timed calendar entries using the source's timezone when available. Keep distinct occurrences as distinct rows. An unknown deadline is an import issue: a row in `import_issues` (1.1), never a guessed date. A term end and a notice length are context. Store a notice or renewal date only when the source supplies or the user confirms it. No jurisdictional calendars or deadline arithmetic are part of the standard.
- **Statuses.** Normalize source values to the versioned vocabularies. Keep absent statuses as `unknown`. A completed, waived or cancelled row may omit its resolution date when the source omits it. A completion date after the due date remains valid. Whether an open occurrence is overdue depends on `meta.as_of`.
- **Money.** A price is a finite, non-negative amount in major units per stated billing interval, with row currency. Preserve future quoted prices and their effective dates if supplied. Compare like currency and interval. Card activity stays in finance@2. Exchange rates and automatic payment matching are outside this contract.
- **Identity and provenance.** Use source-scoped IDs, with source occurrence IDs for recurring calendar events. When a source has no ID, hash the natural key and use a stable occurrence counter for true duplicates. Exclude `imported_at` from `meta.data_hash`. Keep one authoritative source per record. Review possible duplicates before linking exports.
- **Privacy.** Keep local references, vendor labels and registered details on the user's computer. Use roles for people. Drop attendees, email addresses, officer names, document bodies and calendar descriptions from structured imports. Samples are fictional.

The fixtures cover a renewal and its notice, a quoted price increase, a late filing, a standalone overdue review, a different-currency agreement, and an open-ended role term. Same-major upgrades preserve existing field names and meanings under the [standard compatibility rules](../../README.md#semver-what-is-breaking).

## Fields

<!-- fields:begin (generated from schema.sql by spec/build.py; edit the DDL comments) -->

### `meta` (required table)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `key` | TEXT | **yes** | e.g. as_of |
| `value` | TEXT | no | text; dates in YYYY-MM-DD |

### `entities` (required table)

One row per entity in the user's register.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `entity_id` | TEXT | **yes** | source-scoped ID |
| `label` | TEXT | **yes** | entity label, e.g. Sample Studio |
| `kind` | TEXT (vocab `entity_kinds`) | **yes** | company \| nonprofit \| partnership \| trust \| other |
| `status` | TEXT (vocab `entity_statuses`) | **yes** | active \| inactive \| dissolved \| unknown |
| `jurisdiction` | TEXT | no | authority's jurisdiction code or label |
| `registration_ref` | TEXT | no | identifier assigned to the entity by the registry |
| `registered_on` | TEXT (date) | no | date recorded by the registry |
| `source` | TEXT | **yes** | connector ID, e.g. entities-yaml |
| `source_ref` | TEXT | **yes** | input file and row or source object ID |
| `imported_at` | TEXT (instant) | **yes** | UTC instant, excluded from meta.data_hash |

### `entity_roles` (required table)

One row per role and term. Store the role only.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `role_id` | TEXT | **yes** | source-scoped role term ID |
| `entity_id` | TEXT | **yes** | registered entity |
| `role` | TEXT | **yes** | role label, e.g. Treasurer |
| `starts_on` | TEXT (date) | no | first local date of this term, if stated |
| `ends_on` | TEXT (date) | no | last local date of this term, if stated |
| `source` | TEXT | **yes** | connector ID |
| `source_ref` | TEXT | **yes** | input file and row or source object ID |
| `imported_at` | TEXT (instant) | **yes** | UTC instant, excluded from meta.data_hash |

### `contracts` (required table)

One row per agreement in the contract register.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `contract_id` | TEXT | **yes** | source-scoped agreement ID |
| `entity_id` | TEXT | no | registered entity when a link is supplied |
| `label` | TEXT | **yes** | short agreement label from the register |
| `counterparty_label` | TEXT | no | organization or vendor label |
| `status` | TEXT (vocab `contract_statuses`) | **yes** | draft \| active \| ended \| cancelled \| unknown |
| `starts_on` | TEXT (date) | no | first local date supplied by the agreement register |
| `term_ends_on` | TEXT (date) | no | stated last local date of the current term |
| `renewal_mode` | TEXT (vocab `renewal_modes`) | **yes** | automatic \| manual \| none \| unknown |
| `notice_days` | INTEGER | no | stated number of days; context for review, not a deadline |
| `source` | TEXT | **yes** | connector ID, e.g. contracts-csv |
| `source_ref` | TEXT | **yes** | input file and row or source object ID |
| `imported_at` | TEXT (instant) | **yes** | UTC instant, excluded from meta.data_hash |

### `obligations` (required table)

One occurrence per deadline, including filings, notices, and renewals.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `obligation_id` | TEXT | **yes** | source-scoped occurrence ID |
| `entity_id` | TEXT | no | registered entity when supplied |
| `contract_id` | TEXT | no | linked agreement when supplied |
| `kind` | TEXT (vocab `obligation_kinds`) | **yes** | filing \| notice \| renewal \| payment \| review \| other |
| `label` | TEXT | **yes** | source label for this occurrence |
| `due_on` | TEXT (date) | **yes** | local due date confirmed by the source |
| `status` | TEXT (vocab `obligation_statuses`) | **yes** | open \| completed \| waived \| cancelled \| unknown |
| `resolved_on` | TEXT (date) | no | local date the occurrence was closed, when supplied |
| `owner_role` | TEXT | no | responsible role, e.g. Finance |
| `authority` | TEXT | no | receiving organization, where supplied |
| `reference` | TEXT | no | filing type or record reference, when supplied |
| `source` | TEXT | **yes** | connector ID, e.g. obligations-ics |
| `source_ref` | TEXT | **yes** | input file and row or source object ID |
| `imported_at` | TEXT (instant) | **yes** | UTC instant, excluded from meta.data_hash |

### `contract_prices` (required table)

One stated contract price per effective date, in its original currency and billing interval.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `contract_id` | TEXT | **yes** | agreement this price belongs to |
| `effective_on` | TEXT (date) | **yes** | first local date of this price |
| `amount` | REAL | **yes** | non-negative charge in major units of currency |
| `currency` | TEXT (currency) | **yes** | ISO 4217, e.g. USD |
| `period` | TEXT (vocab `price_periods`) | **yes** | once \| monthly \| quarterly \| annual |
| `source` | TEXT | **yes** | connector ID |
| `source_ref` | TEXT | **yes** | input file and row or source object ID |
| `imported_at` | TEXT (instant) | **yes** | UTC instant, excluded from meta.data_hash |

### `import_issues`

What an importer could not read or chose to leave out (1.1): an unknown deadline, an unreadable date, a row with no ID. A board's data review shows these rows; nothing is guessed.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `issue_id` | TEXT | **yes** | stable ID: <source>:<file>:<line> or <source>:<kind> |
| `severity` | TEXT (vocab `severities`) | **yes** | info \| warn \| error (vocab severities) |
| `kind` | TEXT | **yes** | skipped_row \| unknown_deadline \| unknown_layout \| duplicate_row |
| `file` | TEXT | no | the source file name (never its contents) |
| `line` | INTEGER | no | 1-based line or calendar entry in that file, when the issue is one row |
| `detail` | TEXT | **yes** | what happened, e.g. the due date is not a date |
| `handling` | TEXT | **yes** | what was done, e.g. left the row out |
| `source` | TEXT | no | connector ID |

### `annotations` (required table)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `annotation_id` | TEXT | **yes** | stable ID |
| `target` | TEXT | **yes** | metric ID or page ID |
| `kind` | TEXT | **yes** | note \| caveat \| flag \| decision \| open_item |
| `body` | TEXT | **yes** | note text with metric placeholders for numbers |
| `author` | TEXT | no | person or assistant |
| `source_ref` | TEXT | no | source reference |
| `created_at` | TEXT | no | ISO 8601 instant |
| `data_hash` | TEXT | no | hash of cited metric values when written |
| `status` | TEXT | no | active \| stale \| retired |

### `metric_registry` (required table)

| Field | Type | Required | Meaning |
|---|---|---|---|
| `metric_id` | TEXT | **yes** | e.g. obligations.open |
| `version` | INTEGER | no | metric version |
| `unit` | TEXT | no | e.g. count |
| `params` | TEXT | no | accepted metric parameters |
| `description` | TEXT | no | metric description |
| `sql` | TEXT | no | expanded SQL |
| `test` | TEXT | no | check that exercises this metric |

<!-- fields:end -->
