# Context layer

## What is being named

The layer in `@miadi/tracing` (the contract) and `@miadi/tracing-langfuse` (the first provider),
whose shared types live in `@miadi/episodic-memory-schema` (`src/episode-tracing.ts`). Read on
2026-10-13 at commit `e9b74ce8`:

| term in the code | value |
|---|---|
| domains | `ceremony`, `creative`, `eng` (one provider project each, own keys). `creative` was `story` until 2026-10-14 (jgwill/Miadi#769 D-c) |
| resources | `trace`, `prompt`, `session`, `dataset`, `score-config` |
| reference | `miadi-tracing:<domain>/<resource>/<id>[@<version>]`, a prompt's id is its name |
| wheel node | id `tracing:<domain>/<resource>/<id>`, kind `tracing_resource`, provider in `metadata.provider` |
| manifest entry keys (`episode.yaml`, `tracing:`) | `domain`, `resource`, `id`, `name`, `version`, `label`, `session`, `relation`, `backstage`, `added` |
| default relations | trace and session `is-traced-in`, prompt `is-prompted-by`, dataset `is-evaluated-with`, score-config `is-scored-by`, and `generates-with` for a story prompt |
| boundary | only metadata crosses: names, versions, labels, sessions, timestamps, counts, the provider's page. Never a key, a prompt body, or a trace's input or output |

What the owner says the layer does (2026-10-13): we trace, we score traces, we store datasets and
train on them or use them for our narrative, we store prompts and manage their versions.

The Factory's intention (Guillaume, recorded in `/etc/claude-code/CLAUDE.md`): make agent-made
work inspectable and revisitable by connecting the originating question, the session trace, the
interface evidence, explicit criteria, and a person's judgment. jgwill/medicine-wheel#161 turns
those five into links to be mapped to W3C PROV.

## Fields in scope (MECE)

Each lane owns one field family and names the crossings into the others in one line.

| lane | field family | the question it answers |
|---|---|---|
| L1 | provenance, records and process traces: W3C PROV, archival science and diplomatics, process mining, data lineage | what is a trace as a record of what happened |
| L2 | observability and evaluation: distributed tracing, OpenTelemetry GenAI conventions, LLM observability providers, measurement and annotation | what is a trace as telemetry, and what is a score |
| L3 | linguistics, semiotics and textual scholarship: the sign "trace", speech acts, conversation analysis, corpus linguistics, textual and genetic criticism, terminology science | what the words mean, and how to choose them |
| L4 | datasets, corpora and versioned works: dataset documentation, DCAT, IFLA LRM, configuration management, prompts as artifacts | what is a dataset and what is a version |
| L5 | ontology engineering and relational data governance: SKOS, OWL, design patterns, DQV, Web Annotation, CARE, OCAP, Local Contexts, Wilson | how the vocabulary becomes an ontology, and under whose authority |

Out of scope: performance monitoring, logging infrastructure, security audit trails, and contact
tracing except as a caution on connotation.

## Source rules

- Standards (W3C, ISO, IEEE, IETF, IFLA), peer-reviewed papers, official specifications, primary
  authors, Indigenous-authored primary sources for any Indigenous claim.
- Each DOI checked on Crossref, each ISBN on Open Library, each URL by HTTP status, on the day the
  lane ran. A source not checked is marked `verified: false`.
- Claims about a source's content are written from the lane's reading of the fetched page or from
  the lane's knowledge, and the ledger says which.

## Placement

- Packet: `jgwill/Miadi` `foundations/tracing-provider-vocabulary/`, address
  `miadi-foundation:tracing-provider-vocabulary`. It lives here because the packages it grounds are
  in this repo's `packages/`.
- Upstream reader: jgwill/medicine-wheel `src/ontology-core/` (the five links of #161, the session
  node of #159). This packet does not write there.
- Published in `@miadi/foundations` by `node packages/foundations/scripts/release.mjs` after commit.

## Neighbouring packets

- `knowledge-organization-archives-and-provenance/` (2026-05-19, training knowledge only): PROV,
  OAIS, FAIR at the level of the Storyweaver portal. L1 goes deeper on PROV and process mining.
- `self-improving-agent-loops/`: metric validity and Goodhart's law. L2 cites it for scoring.
- `universe-and-perspective-vocabulary/`: the ruling that `ceremony`, `story` (now `creative`) and `eng` are
  perspectives, named `domain` (William, 2026-09-22, D3). This packet keeps `domain` as decided.
- `bounded-contexts-and-integration-contracts/`: the projection pattern. A tracing provider is a
  bounded context read through a contract, which is the same shape.
- `linguistic-relativity-indigenous-epistemology/` (carried): language as frame.
