@x12i/memorix-docs 1.0.1 → 1.1.0

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.
Files changed (236) hide show
  1. package/dist/generated/bundle.d.ts +4849 -3
  2. package/dist/generated/bundle.d.ts.map +1 -1
  3. package/dist/generated/bundle.js +7582 -47
  4. package/dist/generated/bundle.js.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +6 -4
  8. package/dist/index.js.map +1 -1
  9. package/files/INDEX.md +84 -0
  10. package/files/SEARCH.json +3087 -0
  11. package/files/agent-manifest.json +1785 -0
  12. package/files/apis/memorix-records/overview.md +22 -0
  13. package/files/concepts/abstracts-bindings.md +27 -0
  14. package/files/concepts/agents-inheritance.md +28 -0
  15. package/files/concepts/analysis-objects.md +26 -0
  16. package/files/concepts/composition.md +27 -0
  17. package/files/concepts/decisions-content.md +27 -0
  18. package/files/concepts/effective-metadata.md +27 -0
  19. package/files/concepts/explicit-metadata-installation.md +26 -0
  20. package/files/concepts/intelligence-proposals.md +27 -0
  21. package/files/concepts/mappings-transforms.md +26 -0
  22. package/files/concepts/object-content-category.md +26 -0
  23. package/files/concepts/org-agent-scope.md +27 -0
  24. package/files/concepts/people-union.md +27 -0
  25. package/files/concepts/raw-records.md +26 -0
  26. package/files/concepts/record-revisions.md +26 -0
  27. package/files/concepts/relationship-definitions.md +26 -0
  28. package/files/concepts/relationship-references.md +27 -0
  29. package/files/concepts/resolved-unresolved.md +27 -0
  30. package/files/concepts/sources-and-memory.md +26 -0
  31. package/files/concepts/traversal.md +27 -0
  32. package/files/diagrams/agent-inheritance.md +34 -0
  33. package/files/diagrams/intelligence-journey.md +38 -0
  34. package/files/diagrams/memorix-central-journey.md +51 -0
  35. package/files/diagrams/metadata-lifecycle.md +40 -0
  36. package/files/diagrams/people-union-diagram.md +36 -0
  37. package/files/diagrams/record-content-model.md +43 -0
  38. package/files/diagrams/relationship-traversal.md +40 -0
  39. package/files/diagrams/revision-safe-write.md +39 -0
  40. package/files/examples/analysis-decision-records.md +11 -0
  41. package/files/examples/memorix-record-envelope.md +11 -0
  42. package/files/examples/metadata-pack-install.md +11 -0
  43. package/files/examples/people-abstract-query.md +11 -0
  44. package/files/examples/raw-vs-composed.md +11 -0
  45. package/files/examples/relationship-def-and-ref.md +11 -0
  46. package/files/examples/revision-conflict-response.md +11 -0
  47. package/files/examples/revision-safe-write.md +11 -0
  48. package/files/examples/traversal-resolved-unresolved.md +11 -0
  49. package/files/glossary/abstract.md +9 -0
  50. package/files/glossary/agent.md +9 -0
  51. package/files/glossary/analysis.md +9 -0
  52. package/files/glossary/binding.md +9 -0
  53. package/files/glossary/composition.md +9 -0
  54. package/files/glossary/content-type.md +9 -0
  55. package/files/glossary/data-category.md +9 -0
  56. package/files/glossary/decision.md +9 -0
  57. package/files/glossary/effective-metadata.md +9 -0
  58. package/files/glossary/intelligence-proposal.md +9 -0
  59. package/files/glossary/mapping.md +9 -0
  60. package/files/glossary/memory.md +9 -0
  61. package/files/glossary/object-type.md +9 -0
  62. package/files/glossary/relationship-definition.md +9 -0
  63. package/files/glossary/relationship-reference.md +9 -0
  64. package/files/glossary/revision.md +9 -0
  65. package/files/glossary/scope.md +9 -0
  66. package/files/glossary/source.md +9 -0
  67. package/files/glossary/traversal.md +9 -0
  68. package/files/guides/apply-scope.md +40 -0
  69. package/files/guides/choose-access-method.md +24 -0
  70. package/files/guides/compose-subject-ui.md +24 -0
  71. package/files/guides/define-traverse-relationship.md +26 -0
  72. package/files/guides/diagnose-unresolved.md +24 -0
  73. package/files/guides/evidence-to-decision.md +25 -0
  74. package/files/guides/first-revision-safe-write.md +30 -0
  75. package/files/guides/inspect-effective-metadata.md +30 -0
  76. package/files/guides/query-people-abstract.md +25 -0
  77. package/files/guides/reload-retry-conflict.md +32 -0
  78. package/files/guides/validate-install-pack.md +32 -0
  79. package/files/indexes/books.json +95 -0
  80. package/files/indexes/books.md +17 -0
  81. package/files/indexes/concepts.json +119 -0
  82. package/files/indexes/concepts.md +21 -0
  83. package/files/indexes/diagrams.json +53 -0
  84. package/files/indexes/diagrams.md +10 -0
  85. package/files/indexes/guides.json +71 -0
  86. package/files/indexes/guides.md +13 -0
  87. package/files/indexes/scenarios.json +41 -0
  88. package/files/indexes/scenarios.md +8 -0
  89. package/files/indexes/tutorials.json +47 -0
  90. package/files/indexes/tutorials.md +9 -0
  91. package/files/indexes/use-cases.json +239 -0
  92. package/files/indexes/use-cases.md +41 -0
  93. package/files/knowledge.json +2940 -0
  94. package/files/packs/concept/abstracts-bindings/PACK.md +11 -0
  95. package/files/packs/concept/abstracts-bindings/pack.json +13 -0
  96. package/files/packs/concept/agents-inheritance/PACK.md +11 -0
  97. package/files/packs/concept/agents-inheritance/pack.json +13 -0
  98. package/files/packs/concept/analysis-objects/PACK.md +11 -0
  99. package/files/packs/concept/analysis-objects/pack.json +14 -0
  100. package/files/packs/concept/composition/PACK.md +11 -0
  101. package/files/packs/concept/composition/pack.json +13 -0
  102. package/files/packs/concept/decisions-content/PACK.md +11 -0
  103. package/files/packs/concept/decisions-content/pack.json +13 -0
  104. package/files/packs/concept/effective-metadata/PACK.md +11 -0
  105. package/files/packs/concept/effective-metadata/pack.json +13 -0
  106. package/files/packs/concept/explicit-metadata-installation/PACK.md +11 -0
  107. package/files/packs/concept/explicit-metadata-installation/pack.json +14 -0
  108. package/files/packs/concept/intelligence-proposals/PACK.md +11 -0
  109. package/files/packs/concept/intelligence-proposals/pack.json +13 -0
  110. package/files/packs/concept/mappings-transforms/PACK.md +11 -0
  111. package/files/packs/concept/mappings-transforms/pack.json +13 -0
  112. package/files/packs/concept/object-content-category/PACK.md +11 -0
  113. package/files/packs/concept/object-content-category/pack.json +14 -0
  114. package/files/packs/concept/org-agent-scope/PACK.md +11 -0
  115. package/files/packs/concept/org-agent-scope/pack.json +14 -0
  116. package/files/packs/concept/people-union/PACK.md +11 -0
  117. package/files/packs/concept/people-union/pack.json +13 -0
  118. package/files/packs/concept/raw-records/PACK.md +11 -0
  119. package/files/packs/concept/raw-records/pack.json +14 -0
  120. package/files/packs/concept/record-revisions/PACK.md +11 -0
  121. package/files/packs/concept/record-revisions/pack.json +13 -0
  122. package/files/packs/concept/relationship-definitions/PACK.md +11 -0
  123. package/files/packs/concept/relationship-definitions/pack.json +14 -0
  124. package/files/packs/concept/relationship-references/PACK.md +11 -0
  125. package/files/packs/concept/relationship-references/pack.json +13 -0
  126. package/files/packs/concept/resolved-unresolved/PACK.md +11 -0
  127. package/files/packs/concept/resolved-unresolved/pack.json +13 -0
  128. package/files/packs/concept/sources-and-memory/PACK.md +11 -0
  129. package/files/packs/concept/sources-and-memory/pack.json +13 -0
  130. package/files/packs/concept/traversal/PACK.md +11 -0
  131. package/files/packs/concept/traversal/pack.json +13 -0
  132. package/files/packs/guide/apply-scope/PACK.md +11 -0
  133. package/files/packs/guide/apply-scope/pack.json +13 -0
  134. package/files/packs/guide/choose-access-method/PACK.md +11 -0
  135. package/files/packs/guide/choose-access-method/pack.json +15 -0
  136. package/files/packs/guide/compose-subject-ui/PACK.md +11 -0
  137. package/files/packs/guide/compose-subject-ui/pack.json +13 -0
  138. package/files/packs/guide/define-traverse-relationship/PACK.md +11 -0
  139. package/files/packs/guide/define-traverse-relationship/pack.json +14 -0
  140. package/files/packs/guide/diagnose-unresolved/PACK.md +11 -0
  141. package/files/packs/guide/diagnose-unresolved/pack.json +13 -0
  142. package/files/packs/guide/evidence-to-decision/PACK.md +11 -0
  143. package/files/packs/guide/evidence-to-decision/pack.json +14 -0
  144. package/files/packs/guide/first-revision-safe-write/PACK.md +11 -0
  145. package/files/packs/guide/first-revision-safe-write/pack.json +13 -0
  146. package/files/packs/guide/inspect-effective-metadata/PACK.md +11 -0
  147. package/files/packs/guide/inspect-effective-metadata/pack.json +13 -0
  148. package/files/packs/guide/query-people-abstract/PACK.md +11 -0
  149. package/files/packs/guide/query-people-abstract/pack.json +13 -0
  150. package/files/packs/guide/reload-retry-conflict/PACK.md +11 -0
  151. package/files/packs/guide/reload-retry-conflict/pack.json +13 -0
  152. package/files/packs/guide/validate-install-pack/PACK.md +11 -0
  153. package/files/packs/guide/validate-install-pack/pack.json +13 -0
  154. package/files/packs/scenario/choose-subject-view/PACK.md +11 -0
  155. package/files/packs/scenario/choose-subject-view/pack.json +11 -0
  156. package/files/packs/scenario/pack-valid-not-installed/PACK.md +11 -0
  157. package/files/packs/scenario/pack-valid-not-installed/pack.json +11 -0
  158. package/files/packs/scenario/scope-mismatch/PACK.md +11 -0
  159. package/files/packs/scenario/scope-mismatch/pack.json +11 -0
  160. package/files/packs/scenario/stale-revision-conflict/PACK.md +11 -0
  161. package/files/packs/scenario/stale-revision-conflict/pack.json +11 -0
  162. package/files/packs/scenario/traversal-direction/PACK.md +11 -0
  163. package/files/packs/scenario/traversal-direction/pack.json +11 -0
  164. package/files/packs/scenario/unresolved-relationship/PACK.md +11 -0
  165. package/files/packs/scenario/unresolved-relationship/pack.json +11 -0
  166. package/files/packs/tutorial/analysis-decision-lab/PACK.md +11 -0
  167. package/files/packs/tutorial/analysis-decision-lab/pack.json +14 -0
  168. package/files/packs/tutorial/compare-views/PACK.md +11 -0
  169. package/files/packs/tutorial/compare-views/pack.json +14 -0
  170. package/files/packs/tutorial/conflict-lab/PACK.md +11 -0
  171. package/files/packs/tutorial/conflict-lab/pack.json +13 -0
  172. package/files/packs/tutorial/first-revision-safe-record/PACK.md +11 -0
  173. package/files/packs/tutorial/first-revision-safe-record/pack.json +13 -0
  174. package/files/packs/tutorial/install-pack-lab/PACK.md +11 -0
  175. package/files/packs/tutorial/install-pack-lab/pack.json +13 -0
  176. package/files/packs/tutorial/relationships-lab/PACK.md +11 -0
  177. package/files/packs/tutorial/relationships-lab/pack.json +13 -0
  178. package/files/packs/tutorial/start-with-sample-data/PACK.md +11 -0
  179. package/files/packs/tutorial/start-with-sample-data/pack.json +13 -0
  180. package/files/sample-data/memorix-synthetic-basic.md +13 -0
  181. package/files/scenarios/choose-subject-view.md +36 -0
  182. package/files/scenarios/pack-valid-not-installed.md +33 -0
  183. package/files/scenarios/scope-mismatch.md +44 -0
  184. package/files/scenarios/stale-revision-conflict.md +38 -0
  185. package/files/scenarios/traversal-direction.md +30 -0
  186. package/files/scenarios/unresolved-relationship.md +31 -0
  187. package/files/tutorials/analysis-decision-lab.md +18 -0
  188. package/files/tutorials/compare-views.md +22 -0
  189. package/files/tutorials/conflict-lab.md +18 -0
  190. package/files/tutorials/first-revision-safe-record.md +18 -0
  191. package/files/tutorials/install-pack-lab.md +22 -0
  192. package/files/tutorials/relationships-lab.md +18 -0
  193. package/files/tutorials/start-with-sample-data.md +18 -0
  194. package/files/ui/clients/memorix-studio.md +9 -0
  195. package/files/use-cases/abstract-people-list.md +237 -0
  196. package/files/use-cases/ai-pipeline-fail-closed.md +117 -0
  197. package/files/use-cases/author-pipeline-e2e.md +339 -0
  198. package/files/use-cases/build-callable-service.md +347 -0
  199. package/files/use-cases/builder-acceptance-ops.md +112 -0
  200. package/files/use-cases/choose-access-method.md +111 -0
  201. package/files/use-cases/client-first-read-write.md +374 -0
  202. package/files/use-cases/compose-for-ui.md +97 -0
  203. package/files/use-cases/custom-kind-descriptors.md +137 -0
  204. package/files/use-cases/data-journey-evidence.md +115 -0
  205. package/files/use-cases/discriminated-content-writes.md +152 -0
  206. package/files/use-cases/embed-studio-host.md +165 -0
  207. package/files/use-cases/four-field-links.md +246 -0
  208. package/files/use-cases/http-process-compliance.md +225 -0
  209. package/files/use-cases/install-metadata-pack.md +180 -0
  210. package/files/use-cases/intelligence-propose-install.md +163 -0
  211. package/files/use-cases/knowx-claims-review.md +396 -0
  212. package/files/use-cases/learn-record-envelope.md +233 -0
  213. package/files/use-cases/lists-cursors-pagination.md +196 -0
  214. package/files/use-cases/local-acceptance-g12ops.md +160 -0
  215. package/files/use-cases/memory-hourly-ingest.md +276 -0
  216. package/files/use-cases/metadata-before-write.md +145 -0
  217. package/files/use-cases/migrate-associated-star.md +159 -0
  218. package/files/use-cases/openapi-typed-client.md +78 -0
  219. package/files/use-cases/ops-pack-fixtures.md +168 -0
  220. package/files/use-cases/orient-platform.md +172 -0
  221. package/files/use-cases/pipeline-retry-evidence.md +121 -0
  222. package/files/use-cases/relationship-rebuild-verify.md +128 -0
  223. package/files/use-cases/revision-stale-conflicts.md +194 -0
  224. package/files/use-cases/start-from-zero.md +171 -0
  225. package/files/use-cases/studio-design-types.md +122 -0
  226. package/files/use-cases/studio-explore-subject.md +89 -0
  227. package/files/use-cases/studio-operate-pipelines.md +100 -0
  228. package/files/use-cases/studio-review-intelligence.md +74 -0
  229. package/files/use-cases/studio-scope-isolation.md +67 -0
  230. package/files/use-cases/studio-stale-conflict-ui.md +54 -0
  231. package/files/use-cases/troubleshoot-http-matrix.md +164 -0
  232. package/files/use-cases/trusted-in-process-embed.md +94 -0
  233. package/files/use-cases/workflow-sibling-api.md +212 -0
  234. package/files/visuals/revision-conflict.md +19 -0
  235. package/files/visuals/scope-apply.md +19 -0
  236. package/package.json +5 -4
@@ -0,0 +1,246 @@
1
+ # Link subjects with four-field relationships
2
+
3
+ > **Use case id:** `four-field-links`
4
+ > **Goal:** Define relationships, expand on read, never store associated* on records.
5
+ > **Audiences:** developers
6
+ > **Tags:** relationships, links
7
+
8
+ ## Reading path
9
+
10
+ 1. **Relationships & Memory** (developers) → chapters: `3-relationships-four-field-links-only`, `5-reads-virtual-expansion`, `9-hard-rules-relationships-memory`
11
+ 1. **Runtime Data Client** (developers) → chapters: `8-relationship-reads`, `15-relationship-mutation-boundary`
12
+
13
+ ## From: Relationships & Memory — 3. Relationships — four-field links only
14
+
15
+ **Trusted writer:** `@x12i/memorix-relationships` only.
16
+ **Store:** `@x12i/memorix-relationship-store` (Candidate C, org-scoped per data category).
17
+
18
+ Hard rule **#3**: links remember endpoints and meaning — they never copy target payloads.
19
+
20
+ ### The only stored link shape
21
+
22
+ ```ts
23
+ {
24
+ relationshipId: string; // deterministic
25
+ relationshipDefinitionId: string; // which definition produced this link
26
+ fromRecordId: string;
27
+ toRecordId: string;
28
+ }
29
+ ```
30
+
31
+ Nothing else belongs on the persisted link:
32
+
33
+ - No nested employee snapshots
34
+ - No job context blobs
35
+ - No revision copies of either side
36
+ - No `associated*` root buckets on subject records
37
+
38
+ Job context and revisions live in **operational evidence**, captured via data-plane expansion when the engine needs them — never denormalized onto the link.
39
+
40
+ ### Why four fields
41
+
42
+ Older shapes nested full related records under `associated*`. That duplicated data, mixed navigation with evidence, and made writes unsafe. The new path:
43
+
44
+ ```text
45
+ Same recordId → composition (siblings)
46
+ Different recordIds → relationship (four-field link)
47
+ ```
48
+
49
+ ### Definition (metadata) vs link (data)
50
+
51
+ | Layer | Example |
52
+ |---|---|
53
+ | Relationship **definition** (metadata) | `people-assigned-to-work-items` |
54
+ | Materialized **link** (data) | `{ relationshipId, relationshipDefinitionId, fromRecordId: "…Alex…", toRecordId: "wi-100" }` |
55
+
56
+ Definitions are authored in packs and installed with other metadata. Links are produced by the engine.
57
+
58
+ Studio Design shows definitions:
59
+
60
+ ![Relationship definition](../screenshots/06-relationship-definition.png)
61
+
62
+ ### Ops definitions (subset)
63
+
64
+ From `memorix-ops-pack`:
65
+
66
+ | Id | Meaning |
67
+ |---|---|
68
+ | `people-assigned-to-work-items` | Person assigned to perform a work item |
69
+ | `work-items-use-procedures` | Work item follows reusable procedures |
70
+ | `activity-events-about-work-items` | Activity event reports progress on a work item |
71
+ | `work-items-depend-on-work-items` | Work item depends on another work item |
72
+ | `people-collaborate-with-people` | Two people collaborate (undirected) |
73
+
74
+ Example definition sketch:
75
+
76
+ ```json
77
+ {
78
+ "id": "people-assigned-to-work-items",
79
+ "name": "People assigned to work items",
80
+ "meaning": "A person (employee or contractor) is assigned to perform a work item",
81
+ "directionality": "directed",
82
+ "from": { "abstractType": "People", "property": "assignedWorkItems" },
83
+ "to": { "abstractType": "WorkItems", "property": "assignedPeople" },
84
+ "discoveryRules": [
85
+ {
86
+ "id": "from-source-assignee",
87
+ "kind": "source-field",
88
+ "sourcePath": "assigneeId",
89
+ "notes": "ops-source work-items.assigneeId resolves across employees and contractors"
90
+ }
91
+ ]
92
+ }
93
+ ```
94
+
95
+ Abstract endpoints (`People`, `WorkItems`) compile to concrete binding plans — the engine does not invent Cartesian products.
96
+
97
+ ---
98
+
99
+ ## From: Relationships & Memory — 5. Reads — virtual expansion
100
+
101
+ `@x12i/memorix-data` can expand relationships **virtually** at read time:
102
+
103
+ ```ts
104
+ // Conceptual read options
105
+ {
106
+ relationships: {
107
+ include: true,
108
+ depth: 1,
109
+ expandContentTypes: ["snapshots"], // optional projection of targets
110
+ },
111
+ }
112
+ ```
113
+
114
+ Rules:
115
+
116
+ - Expansion is **calculated** for the response — it does not paste payloads into stored links.
117
+ - Unresolved targets remain visible as unresolved (Studio shows this clearly).
118
+ - Expanding content types is a read convenience; writers still address concrete content separately.
119
+
120
+ ![Link traversal / expansion](../screenshots/07-link-traversal-expansion.png)
121
+
122
+ ![Unresolved relationship](../screenshots/08-unresolved-relationship.png)
123
+
124
+ ### Composition vs relationship on read
125
+
126
+ | Same `recordId` | Different `recordId`s |
127
+ |---|---|
128
+ | Composition / siblings | Relationship expansion |
129
+ | `getContent` / compose APIs | `relationships.include` |
130
+ | Snapshot + workflow + analysis on WI-100 | Alex → WI-100 assignment link |
131
+
132
+ ---
133
+
134
+ ## From: Relationships & Memory — 9. Hard rules (relationships & memory)
135
+
136
+ 1. Acceptance orgs are fresh `g12ops*` with `agentIds: ["ops"]`.
137
+ 2. Permanent narrative is non-cyber **ops**.
138
+ 3. Relationships are **four-field links only** — no `associated*` storage, no copied payloads.
139
+ 4. Abstracts stay virtual — relationship definitions may *reference* abstracts; links still store concrete `recordId`s.
140
+ 5. Mutations go through the data plane / trusted writers — never direct Mongo domain writes.
141
+ 6. Memory secrets via **`credentialRef` only**.
142
+ 7. Memory stops at raw — no promote / analysis / relationship discovery inside Memory.
143
+ 8. No ad-hoc product link PUT/DELETE (**405**).
144
+ 9. Deterministic fixtures only for acceptance — no live AI required.
145
+
146
+ Full list: [HARD-RULES.md](../../HARD-RULES.md).
147
+
148
+ ---
149
+
150
+ ## From: Runtime Data Client — 8. Relationship reads
151
+
152
+ Default content reads contain **no** relationships. Expansion is opt-in.
153
+
154
+ ### Capabilities
155
+
156
+ - Explicit relationship include / `expandRelationships`
157
+ - Forward and inverse traversal as exposed
158
+ - Filter by relationship definition
159
+ - Independent relationship pagination
160
+ - Selected target content types
161
+ - Abstract target projection where supported
162
+ - Depth-one default / hard limits
163
+ - Unresolved targets surfaced (do not invent data)
164
+ - Related-property filter/sort only when bounded
165
+ - Diagnostics when a query would be unbounded
166
+
167
+ ### Virtual wrapper
168
+
169
+ ```json
170
+ {
171
+ "source": {
172
+ "format": "memorix-record/2",
173
+ "recordId": "employee-10",
174
+ "objectType": "employees",
175
+ "contentType": "snapshots"
176
+ },
177
+ "relationships": {
178
+ "items": [
179
+ {
180
+ "definition": "employee-owns-work-item",
181
+ "fromRecordId": "employee-10",
182
+ "toRecordId": "wi-100",
183
+ "targetStatus": "resolved"
184
+ }
185
+ ],
186
+ "pageInfo": {}
187
+ }
188
+ }
189
+ ```
190
+
191
+ Clarify:
192
+
193
+ - Target content is **current at read time**.
194
+ - Target content is **never copied onto the source** as authoritative storage.
195
+ - Updating Alex’s snapshot changes future expansions; the **stored link remains four fields**.
196
+ - Clients **must not** persist the expansion wrapper as the system of record.
197
+
198
+ ### Four-field links only
199
+
200
+ Authoritative storage is the central relationships collection: definition + endpoints (+ allowed link metadata). No root `associated*`, no copied neighbor payloads, no relationship sibling content as product storage.
201
+
202
+ ### Unresolved targets
203
+
204
+ If `wi-100` was removed or never landed, expansion may return `targetStatus: "unresolved"`. Treat that as readable state — decide whether to retry later or show a gap in the UI.
205
+
206
+ ### Ops story
207
+
208
+ Alex owns WI-100. Get Alex’s snapshot with relationship include for `employee-owns-work-item`. You see a four-field link and optionally the current WI-100 target. Patch Alex’s title → link unchanged → next expansion shows the new title on the source and current WI-100 on the target.
209
+
210
+ ---
211
+
212
+ ## From: Runtime Data Client — 15. Relationship mutation boundary
213
+
214
+ Ordinary clients **cannot** manually create arbitrary relationship links.
215
+
216
+ | Allowed | Forbidden |
217
+ |---|---|
218
+ | Trigger authorized discover / verify / rebuild when exposed | Product `PUT`/`DELETE` of individual links (`405` on ad-hoc mutation) |
219
+ | Rebuild **one** relationship definition | Assume metadata publish auto-rebuilds all links |
220
+ | Read / expand four-field links | Copied associated payloads |
221
+ | | Relationship sibling writes as authoritative storage |
222
+ | | Root `associated*` writes |
223
+
224
+ Materialization belongs to `@x12i/memorix-relationships` / pipelines — not to host apps inventing edges.
225
+
226
+ ### Ops story
227
+
228
+ After Alex and WI-100 snapshots exist, a discover/materialize step creates a four-field `employee-owns-work-item` link. Updating Alex’s title does **not** rewrite the link. Rebuilding that definition refreshes links for that definition only. Metadata install alone does not magically rebuild.
229
+
230
+ ```bash
231
+ # Verify / rebuild — not ad-hoc link CRUD
232
+ curl -sS \
233
+ -H "x-memorix-org-id: $ORG" \
234
+ -H "x-memorix-agent-ids: $AGENTS" \
235
+ "$BASE/api/relationships/..."
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Also see
241
+
242
+ - **Format for Dummies** (`01-format-for-dummies`) — Mental model of the record envelope — OT/CT, composition, discriminators, and what is not stored on the record.
243
+
244
+ ---
245
+
246
+ _Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
@@ -0,0 +1,225 @@
1
+ # HTTP process compliance (ports / health / live)
2
+
3
+ > **Use case id:** `http-process-compliance`
4
+ > **Goal:** Wire core-service, ports-manager, and api-live-view for any process that binds HTTP.
5
+ > **Audiences:** developers
6
+ > **Tags:** ports, core-service, http
7
+
8
+ ## Reading path
9
+
10
+ 1. **Building Services** (developers) → chapters: `14-reference`, `6-bind-and-deploy`
11
+ 1. **Platform Overview** (developers) → chapters: `7-local-stack-quick-start`
12
+
13
+ ## From: Building Services — 14. Reference
14
+
15
+ ### Role comparison
16
+
17
+ | Role | Reads external? | Writes external? | Returns draft? | Uses AI? | Direct Memorix mutation? | Idempotency | Persistence owner |
18
+ |---|---|---|---|---|---|---|---|
19
+ | Collect | Yes | No | Raw handoff | No | Via Memory only | Cursor / content hash | Memory + data plane raw |
20
+ | Enrich | Optional | No | Yes | Optional | No — writer step | Key + revision write | Pipeline writer |
21
+ | Resolve | Optional | No | Candidates | Optional | No — relationship engine | Engine keys | Relationship engine |
22
+ | Action | Optional | Yes | Receipt | Optional | Domain write separate | **Mandatory** | External system + ledger |
23
+ | AI job | Via adapter | No | Yes | Yes | No — writer step | Captured input; one write | Pipeline writer |
24
+
25
+ ### Packages
26
+
27
+ | Package | Use |
28
+ |---|---|
29
+ | `@x12i/memorix-metadata` | `services[]` definitions |
30
+ | `@x12i/memorix-pipeline` | Steps that invoke services |
31
+ | `@x12i/memorix-pipeline-runtime` | Run/attempt/artifact ledger |
32
+ | `@x12i/memorix-mapping` | Prefer before inventing a service |
33
+ | `@x12i/memorix-memory` | Collect / raw landing |
34
+ | `@x12i/memorix-data` | Canonical read/write ports |
35
+ | `@x12i/memorix-service` | HTTP `/api/*` |
36
+ | `@x12i/memorix-ops-pack` | Acceptance fixtures |
37
+ | `@x12i/core-service` | HTTP process compliance (ports, `/health`, `/_live`) |
38
+ | `@x12i/ports-manager` | Org port zones (Memorix **5100–5119**) |
39
+ | `@x12i/api-live-view` | Embeddable live request UI |
40
+
41
+ ### HTTP process compliance (local services)
42
+
43
+ **Terminology:** TCP/HTTP **ports** (this section) are not Memorix **canonical data ports** (`PortHandler` / `write-record`). Different layers, same English word.
44
+
45
+ | Audience | Action |
46
+ |---|---|
47
+ | Remote Memorix **client** (calls `/api/*`) | Do **not** install these kits |
48
+ | New HTTP **worker** Memorix (or Studio) will call | **Must** use `@x12i/core-service` |
49
+ | Studio / ops-source / memorix-service | Already compliant |
50
+
51
+ Any x12i/exellix process that **binds an HTTP port** should use `@x12i/core-service` (pulls in `@x12i/ports-manager` + `@x12i/api-live-view`).
52
+
53
+ #### Compliance contract
54
+
55
+ 1. Port from the org zone map (`port-map.json`) — env override OK; avoid/quarantine enforced
56
+ 2. `GET /health` → `{ ok, service, … }`
57
+ 3. `/_live` (+ inbound/worker rings) via api-live-view
58
+ 4. `x-correlation-id` on request/response
59
+ 5. Startup banner: origin · health · live · docs
60
+
61
+ #### Fastify
62
+
63
+ ```ts
64
+ import Fastify from "fastify";
65
+ import { attachCoreFastify } from "@x12i/core-service/fastify";
66
+
67
+ const app = Fastify();
68
+ const core = await attachCoreFastify(app, {
69
+ identity: {
70
+ id: "@x12i/my-enrich-worker",
71
+ title: "Ops enrich worker",
72
+ zoneId: "memorix",
73
+ portKey: "api", // even API default in zone
74
+ portEnv: "MY_WORKER_PORT",
75
+ docsPath: "/openapi.json",
76
+ },
77
+ getHealth: async () => ({ ok: true, service: "@x12i/my-enrich-worker" }),
78
+ });
79
+
80
+ await app.listen({ port: core.port, host: "127.0.0.1" });
81
+ ```
82
+
83
+ #### Node `http`
84
+
85
+ ```ts
86
+ import http from "node:http";
87
+ import { createCoreNodeHttp, listenAndAnnounce } from "@x12i/core-service";
88
+
89
+ const core = createCoreNodeHttp({
90
+ identity: {
91
+ id: "ops-source",
92
+ title: "Ops Source",
93
+ zoneId: "memorix",
94
+ portKey: "opsSource",
95
+ portEnv: "OPS_SOURCE_PORT",
96
+ docsPath: "/openapi.json",
97
+ },
98
+ });
99
+ // tryHandleCore → /health + /_live; then your routes
100
+ ```
101
+
102
+ #### Ports manager (Memorix zone)
103
+
104
+ | Default | Port | Env |
105
+ |---|---|---|
106
+ | `service` / `api` | **5100** | `MEMORIX_SERVICE_PORT` |
107
+ | `studio` / `ui` | **5101** | `MEMORIX_STUDIO_PORT` / `VITE_DEV_PORT` |
108
+ | `opsSource` | **5102** | `OPS_SOURCE_PORT` |
109
+ | `statusHub` | **5103** | `STACK_STATUS_PORT` |
110
+
111
+ Rules: zone **5100–5119** (20 contiguous); **even = API**, **odd = UI**; never bind avoid list (AirPlay **5000/7000**, …); quarantine **5000–5099**. CLI: `npx x12i-ports zone memorix`. Deep reference: package READMEs for `ports-manager`, `core-service`, `api-live-view`.
112
+
113
+ Prefer `core-service` over wiring `api-live-view` alone. Register the worker’s `ServiceRef.endpoint` to the even API origin the registry will POST to.
114
+
115
+ ### Authoring checklist
116
+
117
+ - [ ] Decision guide says “service,” not mapping/Memory/relationship/pipeline alone
118
+ - [ ] Metadata has logical I/O + capabilities; no secrets/URLs as identity
119
+ - [ ] `ServiceRef` registered (`serviceId`); prod fails closed without it
120
+ - [ ] Handler is a `PortHandler` on a real `StepKind` (not invented `invoke-service`)
121
+ - [ ] Side effects and idempotency declared
122
+ - [ ] Drafts vs persistence split clear
123
+ - [ ] HTTP workers use `@x12i/core-service` (`/health`, `/_live`, zone port)
124
+ - [ ] Conformance + ops fixture tests green on `g12ops*`
125
+ - [ ] Evidence scan: no secrets in ledgers/artifacts
126
+
127
+ ### Glossary (service terms)
128
+
129
+ | Term | Meaning |
130
+ |---|---|
131
+ | Service | Named capability with one logical pack definition (`id`) |
132
+ | ServiceRef | Runtime binding (`serviceId` + `kind` + optional endpoint) |
133
+ | Role / capability | Classification on that one model |
134
+ | StepKind / PortHandler | Executable pipeline step surface — dispatch key |
135
+ | Binding | Registry resolve for a `serviceId` (not handler dispatch) |
136
+ | Draft | Proposed content — not yet stored |
137
+ | DataRef | Reference to inline or artifact payload |
138
+ | Credential ref | Pointer to a secret; never the secret |
139
+ | Attempt | One try of a pipeline step that may invoke a service |
140
+ | TCP port / zone | Local bind address from ports-manager — not a data port |
141
+
142
+ ### Next
143
+
144
+ - [Building Pipelines — Developers](../../08-pipelines/developers/BOOK.md)
145
+ - [Relationships & Memory](../../06-relationships-and-memory/developers/BOOK.md)
146
+ - [Intelligence](../../10-intelligence/developers/BOOK.md)
147
+ - Studio-oriented twin → [Builders](../builders/BOOK.md)
148
+
149
+ ## From: Building Services — 6. Bind and deploy
150
+
151
+ ### Registry
152
+
153
+ `createServiceRegistry` merges (later wins):
154
+
155
+ 1. environment defaults (`ServiceRef[]`),
156
+ 2. effective metadata services (via `servicesFromMetadata` — pack `id` bridged to `serviceId`),
157
+ 3. pipeline-local `services[]` on the v2 `PipelineDefinition`.
158
+
159
+ Pipeline steps may set optional `serviceId`. The registry **resolves identity / endpoint / credentialRef** — it does **not** dispatch to a per-serviceId function. Dispatch remains `stepKind` → `PortHandler`.
160
+
161
+ `credentialRef` (or `auth.secretRef`) resolves at runtime. Resolved views expose `hasCredential` — never the secret.
162
+
163
+ ### Production versus development
164
+
165
+ | Production | Development / test |
166
+ |---|---|
167
+ | Required real `PortHandler` for every used `StepKind` | Explicit stub / recorded adapter |
168
+ | Missing `serviceId` binding fails when the step references it | Opt-in only, clearly labeled |
169
+ | Durable ledger + artifact store | May use isolated fixtures |
170
+ | No fake success | Cannot silently become production default |
171
+
172
+ Startup fails closed when: required binding missing, handler is a silent stub, durable stores missing, `credentialRef` unresolvable for a required operation, or contracts incompatible.
173
+
174
+ ---
175
+
176
+ ## From: Platform Overview — 7. Local stack (quick start)
177
+
178
+ From the monorepo after workspace install:
179
+
180
+ ```bash
181
+ node scripts/dev-stack.mjs
182
+ # opens browser tabs: stack status, /_live views, Studio
183
+ # use --no-open to skip browser tabs
184
+ ```
185
+
186
+ | Surface | Default URL |
187
+ |---|---|
188
+ | Studio | http://127.0.0.1:5101/ |
189
+ | Stack status | http://127.0.0.1:5103/ (hub — not Studio; links to each `/_live`) |
190
+ | Service live view | http://127.0.0.1:5100/_live (`@x12i/api-live-view` via `@x12i/core-service`) |
191
+ | Service OpenAPI | http://127.0.0.1:5100/api/openapi.json |
192
+ | Service health | http://127.0.0.1:5100/health |
193
+ | Ops-source live / health | http://127.0.0.1:5102/_live · `/health` |
194
+
195
+ Ports: Memorix zone **5100–5119** (even = API, odd = UI) from [`@x12i/ports-manager`](../../ports-manager/). Avoid **5000/7000** (macOS AirPlay). Quarantine **5000–5099**. How-to for new HTTP workers: [Building Services — HTTP process compliance](../../07-services/developers/BOOK.md#http-process-compliance-local-services). Remote data clients call `/api/*` only — do not install ports kits.
196
+
197
+ ```bash
198
+ curl -sS \
199
+ -H 'x-memorix-org-id: g12ops-demo' \
200
+ -H 'x-memorix-agent-ids: ops' \
201
+ http://127.0.0.1:5100/api/openapi.json
202
+ ```
203
+
204
+ What to install in *your* app:
205
+
206
+ ```bash
207
+ # Default remote host: nothing required for HTTP
208
+ npm install @x12i/memorix-format@^3.0.1 # optional offline validate/migrate
209
+
210
+ # Trusted platform process only:
211
+ npm install @x12i/memorix-data@^3.0.1 @x12i/memorix-metadata-runtime@^3.0.1
212
+
213
+ # New HTTP services in x12i/exellix (bind a port):
214
+ npm install @x12i/core-service
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Also see
220
+
221
+ - **Migration & Troubleshooting** (`13-migration-troubleshooting`) — associated* rejection, stale revisions, HTTP failure matrix, escalate packets.
222
+
223
+ ---
224
+
225
+ _Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
@@ -0,0 +1,180 @@
1
+ # Author and install a metadata pack
2
+
3
+ > **Use case id:** `install-metadata-pack`
4
+ > **Goal:** Shape agents/OT/CT/abstracts and install/publish deliberately — never auto.
5
+ > **Audiences:** developers
6
+ > **Tags:** metadata, install
7
+
8
+ ## Reading path
9
+
10
+ 1. **Metadata, Agents, Abstracts & Mappings** (developers) → chapters: `2-pack-shape-memorix-metadata-1`, `3-agents-and-inheritance`, `9-install-and-publish-never-auto`, `11-hard-rules-for-metadata-authors`
11
+
12
+ ## From: Metadata, Agents, Abstracts & Mappings — 2. Pack shape (`memorix-metadata/1`)
13
+
14
+ A pack is a declarative document (or folder of JSON fragments assembled into one). Conceptual top-level:
15
+
16
+ ```text
17
+ agents[]
18
+ objectTypes[]
19
+ abstractTypes[]
20
+ abstractBindings[] # sometimes named bindings
21
+ relationshipDefinitions[]
22
+ mappings[]
23
+ views[]
24
+ writes[]
25
+ pipelines[]
26
+ sources[] / services[] / schedules[] / …
27
+ kindDeclarations[]
28
+ extensions{} # items keyed by custom kind id
29
+ ```
30
+
31
+ Minimal sketch (ops-flavored):
32
+
33
+ ```json
34
+ {
35
+ "format": "memorix-metadata/1",
36
+ "agentId": "ops",
37
+ "version": "3.0.0-ops-example",
38
+ "agents": [
39
+ {
40
+ "id": "ops",
41
+ "name": "Operations",
42
+ "parentId": null
43
+ }
44
+ ],
45
+ "objectTypes": [
46
+ {
47
+ "id": "employees",
48
+ "name": "Employees",
49
+ "dataCategory": "entity",
50
+ "contentTypes": [
51
+ { "id": "raw" },
52
+ { "id": "snapshots" }
53
+ ]
54
+ }
55
+ ],
56
+ "abstractTypes": [],
57
+ "abstractBindings": [],
58
+ "relationshipDefinitions": [],
59
+ "mappings": [],
60
+ "views": [],
61
+ "writes": [],
62
+ "kindDeclarations": [],
63
+ "extensions": {}
64
+ }
65
+ ```
66
+
67
+ **Why this shape:** one agent owns a vocabulary; object types declare concrete subjects; everything else (abstracts, relationships, pipelines) hangs off that vocabulary. Product words live in **tier 2/4** (instance metadata / packs), never hard-coded into tier-1 engines.
68
+
69
+ ---
70
+
71
+ ## From: Metadata, Agents, Abstracts & Mappings — 3. Agents and inheritance
72
+
73
+ ### What an agent is
74
+
75
+ An agent is a **named metadata scope** — not a chatbot and not a user account. `ops` is the permanent parent agent for the ops journey. Child agents may inherit and override for project-specific packs.
76
+
77
+ Studio shows inheritance clearly:
78
+
79
+ ![Agents inheritance](../screenshots/02-agents-inheritance.png)
80
+
81
+ ### Ordered `agentIds[]` → effective metadata
82
+
83
+ The service resolves **effective metadata** from the ordered `agentIds[]` on the request:
84
+
85
+ ```ts
86
+ // Conceptual
87
+ effective = resolveAgents(metadataStore, ["ops" /* , "project-ops", … */]);
88
+ ```
89
+
90
+ Rules of thumb:
91
+
92
+ 1. **Order matters.** Later agents override earlier ones for the same `(kind, id)`.
93
+ 2. **Inheritance fills gaps.** A child that does not redefine `employees` still sees the parent’s `employees`.
94
+ 3. **Effective ≠ raw.** `GET /api/metadata/raw` shows one agent’s stored items; `GET /api/metadata/effective` shows the resolved set for the whole `agentIds[]` list.
95
+ 4. **Scope is orthogonal to data.** `orgId` selects the data universe; `agentIds[]` selects vocabulary. Same org can be queried with different agent sets.
96
+
97
+ ### Ops parent agent
98
+
99
+ From `memorix-ops-pack`:
100
+
101
+ ```json
102
+ {
103
+ "id": "ops",
104
+ "name": "Operations (generic parent)",
105
+ "description": "Complete generic parent agent for ordinary operational work. Permanent Memorix acceptance pack.",
106
+ "parentAgentId": null
107
+ }
108
+ ```
109
+
110
+ Acceptance drills use:
111
+
112
+ | Field | Value |
113
+ |---|---|
114
+ | `orgId` | Fresh `g12ops*` (never a live customer org) |
115
+ | `agentIds` | `["ops"]` |
116
+
117
+ See [_shared/ops-scenario.md](../../_shared/ops-scenario.md).
118
+
119
+ ---
120
+
121
+ ## From: Metadata, Agents, Abstracts & Mappings — 9. Install and publish — never auto
122
+
123
+ Hard product behavior: **Intelligence may propose metadata. Install/publish is always an explicit human or API step.**
124
+
125
+ ![Explicit metadata installation](../screenshots/19-explicit-metadata-installation.png)
126
+
127
+ ### Why never auto-install
128
+
129
+ - Metadata changes change what engines will run next.
130
+ - Accidental install on a shared org is a production incident.
131
+ - Proposals can be wrong, incomplete, or unsafe — review is the product.
132
+
133
+ ### Routes
134
+
135
+ | Route | Meaning |
136
+ |---|---|
137
+ | `POST /api/metadata/validate` | Check a pack without making it live |
138
+ | `POST /api/metadata/install` | Install into the org metadata DB for the scoped agents |
139
+ | `POST /api/metadata/publish` | Publish / promote a validated set per product policy |
140
+ | `GET /api/metadata/packs` | List known packs |
141
+
142
+ `@x12i/memorix-metadata-runtime` is the in-process helper behind those routes. Host apps that only talk HTTP never need to import it.
143
+
144
+ ### Ops acceptance flow
145
+
146
+ 1. Start fresh `g12ops*` + `agentIds: ["ops"]`.
147
+ 2. Validate the ops pack (or the subset you are changing).
148
+ 3. Install explicitly.
149
+ 4. Fetch `/api/metadata/effective` and confirm `People`, `work-items`, relationship definitions, sources.
150
+ 5. Only then run Memory / pipelines / relationship verify.
151
+
152
+ If an intelligence proposal looks wrong, **reject it**. Do not install “to see what happens” on a shared org.
153
+
154
+ Full propose / profile / artifact flow (how proposals are produced and reviewed): [Structural Intelligence](../../10-intelligence/developers/BOOK.md). This book only owns the **install boundary**: proposals are never live until an explicit install/publish.
155
+
156
+ ---
157
+
158
+ ## From: Metadata, Agents, Abstracts & Mappings — 11. Hard rules for metadata authors
159
+
160
+ 1. Acceptance orgs are fresh `g12ops*` with `agentIds: ["ops"]` — never live customer orgs.
161
+ 2. Permanent narrative is non-cyber **ops** (employees, work-items, procedures).
162
+ 3. Abstracts are virtual only — no abstract collections / abstract `recordId`.
163
+ 4. Object types live in agent metadata, not in format.
164
+ 5. Custom kinds store/resolve only — engines do not execute them.
165
+ 6. Install/publish is explicit — intelligence never auto-installs.
166
+ 7. Mutations of subject data go through the data plane — never direct Mongo domain writes.
167
+ 8. Deterministic fixtures only for acceptance — no live AI required.
168
+
169
+ Full list: [HARD-RULES.md](../../HARD-RULES.md).
170
+
171
+ ---
172
+
173
+ ## Also see
174
+
175
+ - **Agent Packs & Ops** (`11-agent-packs-and-ops`) — Pack layout, harness, g12ops* acceptance, custom kinds, golden V2 validation.
176
+ - **Structural Intelligence** (`10-intelligence`) — Profile data, proposals with evidence, human install boundary.
177
+
178
+ ---
179
+
180
+ _Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._