Files
notarius/docs/integrations/dnd-npc-occurrence-artifacts.md

91 lines
3.8 KiB
Markdown
Raw Permalink Normal View History

# D&D NPC Occurrence Artifact
2026-07-26 13:43:45 +00:00
This contract defines the durable occurrence list produced by
`dnd/npc-occurrences`. It records discrete, source-grounded occurrences with
2026-07-26 13:43:45 +00:00
NPCs already present in a normalized registry; it does not extend that registry
or summarize the session.
2026-07-26 13:43:45 +00:00
## Identity and compatibility
2026-07-26 13:43:45 +00:00
| Property | Value |
| --- | --- |
| Artifact kind | `dnd/npc-occurrence-list` |
| Schema ID | `notarius.dnd.npc_occurrences` |
| Schema name | `notarius_dnd_npc_occurrences_v1` |
2026-07-26 13:43:45 +00:00
| Schema version | `v1` |
| Media type | `application/json` |
`v1` is a strict JSON object with required `occurrences`; the array may be
empty. Occurrence and source-reference objects reject unknown fields. An
2026-07-26 13:53:38 +00:00
incompatible shape change requires a new schema version.
2026-07-26 13:43:45 +00:00
## Wire shape
Each occurrence has these required fields:
2026-07-26 13:43:45 +00:00
| Field | Contract |
| --- | --- |
| `npc_id` | Exact durable ID from the required NPC registry. |
2026-07-26 13:43:45 +00:00
| `name` | Non-empty canonical display name from the required NPC registry. |
| `kind` | One of the occurrence categories below. |
2026-07-26 13:43:45 +00:00
| `source_refs` | One or more transcript evidence ranges. |
2026-07-26 13:43:45 +00:00
Each source reference has exactly `source_id`, `start_unit_id`, and
`end_unit_id`. It identifies an inclusive range in the current transcript;
unit IDs are positive and the start may not follow the end. Extraction evidence
for an occurrence is confined to its accepted chunk.
```json
{
"occurrences": [
{
"npc_id": "npc:sha256:example",
"name": "Mira Thorn",
"kind": "dialogue",
"source_refs": [
{"source_id": "session-7", "start_unit_id": 12, "end_unit_id": 13}
]
}
]
}
```
## Occurrence categories
| Kind | Meaning |
| --- | --- |
2026-07-26 13:43:45 +00:00
| `mentioned` | The NPC is referred to but is not established as present or communicating. |
| `noncombat_presence` | The NPC is present and relevant without meaningful dialogue or combat participation. |
| `dialogue` | The NPC speaks, responds, or meaningfully participates in a non-combat exchange. |
| `combat_ally` | The NPC actively participates in combat on the party's side. |
| `combat_opponent` | The NPC actively participates in combat against the party. |
2026-07-26 13:43:45 +00:00
| `other` | A clearly evidenced direct occurrence not covered by another category. |
2026-07-26 13:43:45 +00:00
The categories do not represent motives, relationships, state, or events that
the cited transcript does not establish. An `other` entry is not a substitute
for uncertain classification.
2026-07-26 13:43:45 +00:00
## Identity, evidence, and order
The required normalized [NPC registry artifact](dnd-npc-registry-artifacts.md)
supplies names-only contextual grounding to the model. Notarius resolves the
selected name and writes the exact `{npc_id, name}` pair. An unknown or
ambiguous selection rejects the complete model result; normalization does not
repair names by similarity. Registry references are provenance only and never
replace an occurrence's own evidence.
2026-08-06 13:40:42 +00:00
The registry may include an identity established by a factual third-party
mention; that provenance alone does not create a `mentioned` occurrence. Each
occurrence remains a separately cited fact in the current transcript.
Normalization validates the exact pair, orders and
deduplicates exact source references, then orders occurrences by valid source
2026-07-26 13:43:45 +00:00
chronology, NPC comparison identity, display name, kind, and reference sequence.
Only entries with the same NPC ID, canonical name, kind, and complete valid evidence
2026-07-26 13:43:45 +00:00
sequence are collapsed; distinct categories or evidence remain separate.
2026-07-26 13:43:45 +00:00
See the [combat-turn artifact](dnd-combat-turn-artifacts.md) for combat-action
2026-08-03 21:14:52 +00:00
occurrences. The [enemy-event artifact](dnd-enemy-event-artifacts.md) consumes
only `combat_opponent` occurrences as grounding; they never establish an enemy
2026-08-03 21:14:52 +00:00
event or outcome. The [JSON output contract](json-output.md) defines
publication. Pipeline mechanics are described in
[D&D module internals](../internal/dnd.md).