minutework 0.1.52 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: ontology-authoring
3
+ description: "Promoting a local fact to shared, URN-anchored truth: declaring ontology mappings, URN anchors, and promotion rules, then staging reviewable promotion candidates."
4
+ ---
5
+
6
+ # Ontology Authoring
7
+
8
+ Use this skill when a local app object should become — or resolve to — a
9
+ **shared, Core-owned, URN-anchored** entity that other tenants' runtimes can
10
+ recognize. This is the authoring half of the promotion loop; the
11
+ principles-only companion is `ontology-mapping/SKILL.md`.
12
+
13
+ The review law is the point of this lane:
14
+ **Core is the sole `urn:mw:<kind>:<uuid>` minter; a runtime never mints, and
15
+ every promotion is reviewable.** You stage a candidate locally and the
16
+ bridge-owned sweep submits it; an operator (or the conservative auto-accept)
17
+ decides. Nothing you author activates a shared URN by itself.
18
+
19
+ ## 1. Classify: shared WHO/WHERE/WHAT vs tenant-local
20
+
21
+ Decide, per object, whether it is genuinely shared identity or just tenant
22
+ data:
23
+
24
+ - `entity` — a shared **WHAT/WHO-org** (a company, vendor, carrier, account).
25
+ - `person` — a shared **WHO** (PII-bearing; always operator-reviewed).
26
+ - `location` — a shared **WHERE** (always operator-reviewed).
27
+ - Everything high-variance or tenant-specific stays **runtime-local** — do not
28
+ promote it. Overlay it instead (step 2).
29
+
30
+ Map the object's stable identifiers to namespaced identifier types
31
+ (`EntityIdentifier.id_type` for entities, `PersonIdentifier.id_type` for
32
+ persons). A good shared identifier is namespaced and externally meaningful
33
+ (e.g. a government registry number). FleetRun is illustrative only: a carrier's
34
+ DOT number is an `entity` identifier; the carrier's internal nickname is not.
35
+
36
+ ## 2. Declare mappings, anchors, and overlays (schema DSL)
37
+
38
+ In `schemas/schema.ts` (or `schema.mw`), declare `ontologyMappings`:
39
+
40
+ ```ts
41
+ ontologyMapping("vendor", "entity", {
42
+ anchors: [anchor("entity_ref", "entity")],
43
+ promotionRules: [
44
+ promotionRule("entity_ref", "entity", {
45
+ mode: "candidate_match",
46
+ idType: "registry_id",
47
+ minConfidence: 0.95,
48
+ }),
49
+ ],
50
+ overlays: [overlay("entity_ref", "vendor_terms", ["payment_terms", "rep"])],
51
+ })
52
+ ```
53
+
54
+ - `anchor(field, target_kind)` — the local field that carries the shared URN
55
+ once resolved. Compiles into a `URNAnchor` target.
56
+ - `overlay(target_urn_field, overlay_kind, payload_fields)` — hang
57
+ tenant-specific fields off a shared entity **without** mutating the shared
58
+ baseline. Keep high-variance fields here, not in the shared object.
59
+ - These compile to `ontologyMappingManifests`, which the runtime materializes
60
+ as `LocalOntologyMapping` rows on install — that is what makes this runtime's
61
+ objects of the kind promotion-eligible and what `ontology.resolve_local`
62
+ falls back to.
63
+
64
+ ## 3. Declare promotion rules (`prom_v1`)
65
+
66
+ For a promotable fact, declare a `promotionRule` with:
67
+
68
+ - `mode`: `candidate_match` (resolve to an existing shared entity) or
69
+ `candidate_create` (propose a new one).
70
+ - `id_type`: the namespaced identifier the match keys on.
71
+ - `min_confidence` (optional): the floor for the conservative entity
72
+ auto-accept. **Auto-accept fires only for `entity`, only on an exactly-one
73
+ unique-identifier match at confidence ≥ threshold, and only as an echo of the
74
+ existing URN — no mint, no create, no merge.** Person, location, zero/multi
75
+ matches, and any create/merge always go to operator review.
76
+
77
+ ## 4. Stage a candidate at runtime (staging only)
78
+
79
+ Staging is a runtime act, separate from submission. Cite the exact tools (both
80
+ are outside the default read ring — grant per agent via `enable_agent_tools`):
81
+
82
+ - `ontology.resolve_local` — read, live. Returns the `URNAnchor` for a local
83
+ object (the shared `core_urn`) or the active mapping candidates as fallback.
84
+ - `ontology.propose_candidate` — effectful, **staging only**. Records a PENDING
85
+ `PromotionCandidate`; it does **not** push to Core. The bridge-owned sweep
86
+ (`MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED`) submits, and Core decides.
87
+
88
+ Provenance is mandatory and you never supply a URN:
89
+
90
+ - Put namespaced identifiers in `evidence.identifiers`
91
+ (`[{ id_type, value }]`), the local anchor target in `evidence.anchor`
92
+ (`{ local_object_kind, local_object_id, field_name }`), and the supporting
93
+ signal as plain `evidence` keys.
94
+ - Pass a calibrated `confidence` and an opaque `source_ref` (a
95
+ `runtime:<id>:<kind>:<id>` reference) — never a `urn:mw:` value, and never a
96
+ `core_urn`. Only Core mints URNs.
97
+
98
+ ## Cross-runtime anchoring
99
+
100
+ A runtime learns a shared `core_urn` **only for facts it itself staged**. There
101
+ is no open "does identifier X exist in Core" lookup. When a second runtime has
102
+ the same mapping installed and stages its own candidate for the same fact, the
103
+ sweep re-POSTs it, Core's `(origin_runtime, origin_ref, candidate_kind)` unique
104
+ constraint dedupes against the already-decided request and returns the **same**
105
+ `core_urn`, and that runtime writes its own `URNAnchor`. Same shared truth, no
106
+ new trust surface.
107
+
108
+ ## Cross-references
109
+
110
+ - `runtime_ontology_contract.md` — runtime-local anchors, mappings, candidates.
111
+ - `core_ontology_and_runtime_overlays.md` — Core ownership and overlays.
112
+ - `schema-engine/SKILL.md` — declaring the schema the mappings hang off.
113
+ - `app-pack-authoring/SKILL.md` — packaging the mappings into an installable app.
114
+ - `ontology-mapping/SKILL.md` — the principles companion.
@@ -8,6 +8,10 @@ description: "Local app data needs shared identifiers, shared meaning, or mappin
8
8
  Use ontology mappings when local app data needs shared identifiers or shared
9
9
  meaning.
10
10
 
11
+ For the concrete authoring procedure (declaring mappings, URN anchors, and
12
+ promotion rules, then staging reviewable promotion candidates), see the sibling
13
+ `ontology-authoring/SKILL.md`.
14
+
11
15
  - Prefer stable shared references and URNs over duplicating shared entities.
12
16
  - Runtime should remain ontology-aware, not ontology-authoritative.
13
17
  - Keep local app schema ownership clear even when mapping into shared ontology
@@ -142,6 +142,12 @@ generated Builder workspace.
142
142
  - `ontology.resolve_local` -- Read-only native tool over
143
143
  URNAnchor/LocalOntologyMapping; not in the default READ_RING, granted per agent via
144
144
  enable_agent_tools.
145
+ - `ontology.propose_candidate` -- Stages a PENDING PromotionCandidate locally
146
+ (idempotent on origin_ref+candidate_kind). The bridge-owned submission sweep then
147
+ carries it cross-plane (PENDING -> SUBMITTED -> resolved with a Core-minted
148
+ core_urn) under MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED; Core stays the sole URN
149
+ minter and its ingress fails closed independently. Effectful; outside the default
150
+ READ_RING, granted per agent via enable_agent_tools.
145
151
  - `command_exec.run_template` -- Operator/platform-dispatch surface; not an
146
152
  agent-callable tool.
147
153
  - `voice.hangup_call` -- VoiceSession finalization is live; the provider-side hangup
@@ -152,12 +158,6 @@ generated Builder workspace.
152
158
  leg as unavailable):
153
159
  - `scheduling.book_appointment` -- Capability is registered but the direct booking
154
160
  executor is MVP-deferred; preflight truthfully reports provider_unavailable.
155
- - `ontology.propose_candidate` -- Staging leg only: records a PENDING
156
- PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The
157
- cross-plane submission to Core (PENDING -> SUBMITTED -> resolved with a minted
158
- core_urn) is a deferred, bridge-owned leg; the promotion service stays
159
- platform-owned. Effectful; outside the default READ_RING, granted per agent via
160
- enable_agent_tools.
161
161
  - `voice.initiate_call` -- Pre-dial stack is live (consent + TCPA preflight, approval
162
162
  parking, VoiceSession lifecycle); the Twilio dial + realtime media worker are
163
163
  platform-owned Phase 4.
@@ -304,9 +304,9 @@
304
304
  "requires_integration": false,
305
305
  "requires_secret": false,
306
306
  "metered": false,
307
- "executor_ready": "partial",
307
+ "executor_ready": "live",
308
308
  "executor_ref": "tool:ontology.propose_candidate",
309
- "executor_notes": "Staging leg only: records a PENDING PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The cross-plane submission to Core (PENDING -> SUBMITTED -> resolved with a minted core_urn) is a deferred, bridge-owned leg; the promotion service stays platform-owned. Effectful; outside the default READ_RING, granted per agent via enable_agent_tools.",
309
+ "executor_notes": "Stages a PENDING PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The bridge-owned submission sweep then carries it cross-plane (PENDING -> SUBMITTED -> resolved with a Core-minted core_urn) under MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED; Core stays the sole URN minter and its ingress fails closed independently. Effectful; outside the default READ_RING, granted per agent via enable_agent_tools.",
310
310
  "agent_exposable": true,
311
311
  "agent_exposure_path": "native_tool",
312
312
  "approval_required": false,
@@ -9,6 +9,9 @@ Use this skill when the request needs tenant-defined data structures.
9
9
 
10
10
  - Define tenant data in `schemas/schema.ts` or `schema.mw`, not ad hoc Django tables.
11
11
  - Prefer declarative schema changes before adding custom code surfaces.
12
+ - To map local objects onto shared, URN-anchored ontology entities, declare
13
+ `ontologyMappings` (with `anchor`, `promotionRule`, and `overlay` helpers) in
14
+ the same schema source; the procedure is in `ontology-authoring/SKILL.md`.
12
15
  - Index only the fields that need query/filter behavior.
13
16
  - Treat runtime-backed content as the authoring source; publish safe snapshots for anonymous public delivery.
14
17
  - Treat `mw.core.site` as already present in the runtime baseline.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minutework",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "MinuteWork CLI for workspace scaffolding, local preview workflows, and hosted preview deploys.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "jiti": "^2.6.1",
26
26
  "zod": "^4.3.6",
27
27
  "@minutework/platform-config": "0.1.3",
28
- "@minutework/schema-compiler": "0.1.12"
28
+ "@minutework/schema-compiler": "0.1.13"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^24.9.1",