@x12i/memorix-docs 1.0.2 → 1.1.1

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 +7580 -45
  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 +4 -3
@@ -0,0 +1,163 @@
1
+ # Intelligence propose → human install
2
+
3
+ > **Use case id:** `intelligence-propose-install`
4
+ > **Goal:** Profile and propose metadata, then install only via deliberate human action.
5
+ > **Audiences:** developers
6
+ > **Tags:** intelligence, metadata
7
+
8
+ ## Reading path
9
+
10
+ 1. **Structural Intelligence** (developers) → chapters: `2-deterministic-profile-first`, `3-propose-from-evidence`, `4-human-install-the-only-write-path`, `15-anti-patterns`
11
+ 1. **Metadata, Agents, Abstracts & Mappings** (developers) → chapters: `9-install-and-publish-never-auto`
12
+
13
+ ## From: Structural Intelligence — 2. Deterministic profile first
14
+
15
+ Profiling is **structural and deterministic**. Feed it sample records (fixtures or bounded reads) and get evidence — not vibes.
16
+
17
+ What a profile typically reports:
18
+
19
+ | Signal | Why it matters |
20
+ |---|---|
21
+ | Paths & value types | Candidate field maps / content shapes |
22
+ | Null vs missing | Optional vs required / mapping quirks |
23
+ | Uniqueness | Identifier / key candidates |
24
+ | Cardinality | One-vs-many content / relationship hints |
25
+ | Overlap across samples | Abstract union / shared shape candidates |
26
+
27
+ Air-gapped rule: heuristics must work with **no model credentials**. If AI is unavailable, profiling and proposal scaffolding still run; AI-only enrichment is skipped or marked insufficient.
28
+
29
+ ### HTTP — profile
30
+
31
+ ```http
32
+ POST /api/intelligence/profile
33
+ x-memorix-org-id: g12ops…
34
+ x-memorix-agent-ids: ops
35
+ content-type: application/json
36
+ ```
37
+
38
+ Body (conceptual): scoped sample set + label (e.g. `employees`, `work-items`). Response: structural profile artifact — **not** an install.
39
+
40
+ Acceptance orgs: fresh `g12ops*` only — never live customer orgs as profiling playgrounds that might leak into install habits.
41
+
42
+ ---
43
+
44
+ ## From: Structural Intelligence — 3. Propose from evidence
45
+
46
+ A proposal is a **draft metadata pack fragment** (or diff) tied to profile evidence. Outcomes you must handle:
47
+
48
+ | Outcome | Meaning | Next step |
49
+ |---|---|---|
50
+ | Evidence-backed suggestion | Enough structure to propose types/maps/… | Human review |
51
+ | Insufficient evidence | Samples too thin / conflicting | Gather more fixtures; do not install |
52
+ | Rejected by validation | Draft fails metadata/format rules | Fix samples or proposal rules; do not install |
53
+
54
+ ```ts
55
+ const proposal = createProposal(profile, {
56
+ scope: { orgId: "g12ops…", agentIds: ["ops"] },
57
+ basePackId: "ops", // compare against approved ops when relevant
58
+ });
59
+ ```
60
+
61
+ ### HTTP — proposals & helpers
62
+
63
+ | Route | Role |
64
+ |---|---|
65
+ | `POST /api/intelligence/suggest/people` | Focused people/abstract-oriented suggestions |
66
+ | `POST /api/intelligence/proposals` | Create / list proposal artifacts |
67
+ | `POST /api/intelligence/compare` | Diff draft vs approved pack |
68
+ | `POST /api/intelligence/export-draft` | Export a draft for review / offline inspect |
69
+
70
+ None of these routes install metadata. If a host “Apply” button skips `/api/metadata/install` with `confirm: true` (or Studio’s explicit install), it is a product bug.
71
+
72
+ ---
73
+
74
+ ## From: Structural Intelligence — 4. Human install (the only write path)
75
+
76
+ After review:
77
+
78
+ ```bash
79
+ ORG=g12opsintel01
80
+ H=(-H "x-memorix-org-id: $ORG" -H "x-memorix-agent-ids: ops")
81
+
82
+ # Review proposal in Studio Design or via compare/export
83
+ curl -s "${H[@]}" -X POST "$SERVICE/api/intelligence/compare" \
84
+ -H "content-type: application/json" \
85
+ -d '{"proposalId":"…","againstPackId":"ops"}'
86
+
87
+ # Explicit install — separate family
88
+ curl -s "${H[@]}" -X POST "$SERVICE/api/metadata/install" \
89
+ -H "content-type: application/json" \
90
+ -d '{"packId":"ops","confirm":true}'
91
+ ```
92
+
93
+ Rules:
94
+
95
+ 1. **Never** auto-install on proposal create.
96
+ 2. **Never** treat AI confidence as permission to publish.
97
+ 3. Prefer installing into a fresh `g12ops*` first; promote only after acceptance.
98
+ 4. Reject thin proposals — insufficient evidence is a successful, honest outcome.
99
+
100
+ Studio path: Design → intelligence proposal → review evidence → **Install / publish** deliberately (builders twin).
101
+
102
+ ---
103
+
104
+ ## From: Structural Intelligence — 15. Anti-patterns
105
+
106
+ | Anti-pattern | Why it fails | Do this instead |
107
+ |---|---|---|
108
+ | Auto-install on propose | Silent production metadata drift | Explicit install with confirm |
109
+ | Treat AI confidence as epistemic truth | Wrong gate | Evidence + human review |
110
+ | Intelligence writes snapshots / links | Wrong package boundary | Pipelines / relationship engine |
111
+ | Require live AI for CI | Blocks air-gapped gates | Deterministic fixtures |
112
+ | Profile on live customer org “for fun” | Risk + habit | Fresh `g12ops*` |
113
+ | Hide insufficient-evidence | Forces bad installs | Surface as first-class outcome |
114
+ | Merge propose + install in one host API | Skips review | Two calls, two UX steps |
115
+ | Invent abstract collections from suggestions | Violates virtual abstracts | Bindings only after install |
116
+ | Use proposal text as record payload | Wrong layer | Metadata vs data plane |
117
+
118
+ ---
119
+
120
+ ## From: Metadata, Agents, Abstracts & Mappings — 9. Install and publish — never auto
121
+
122
+ Hard product behavior: **Intelligence may propose metadata. Install/publish is always an explicit human or API step.**
123
+
124
+ ![Explicit metadata installation](../screenshots/19-explicit-metadata-installation.png)
125
+
126
+ ### Why never auto-install
127
+
128
+ - Metadata changes change what engines will run next.
129
+ - Accidental install on a shared org is a production incident.
130
+ - Proposals can be wrong, incomplete, or unsafe — review is the product.
131
+
132
+ ### Routes
133
+
134
+ | Route | Meaning |
135
+ |---|---|
136
+ | `POST /api/metadata/validate` | Check a pack without making it live |
137
+ | `POST /api/metadata/install` | Install into the org metadata DB for the scoped agents |
138
+ | `POST /api/metadata/publish` | Publish / promote a validated set per product policy |
139
+ | `GET /api/metadata/packs` | List known packs |
140
+
141
+ `@x12i/memorix-metadata-runtime` is the in-process helper behind those routes. Host apps that only talk HTTP never need to import it.
142
+
143
+ ### Ops acceptance flow
144
+
145
+ 1. Start fresh `g12ops*` + `agentIds: ["ops"]`.
146
+ 2. Validate the ops pack (or the subset you are changing).
147
+ 3. Install explicitly.
148
+ 4. Fetch `/api/metadata/effective` and confirm `People`, `work-items`, relationship definitions, sources.
149
+ 5. Only then run Memory / pipelines / relationship verify.
150
+
151
+ If an intelligence proposal looks wrong, **reject it**. Do not install “to see what happens” on a shared org.
152
+
153
+ 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.
154
+
155
+ ---
156
+
157
+ ## Also see
158
+
159
+ - **Data Access Patterns** (`04-data-access-patterns`) — Decision matrix — best / acceptable / forbidden access methods for real client tasks.
160
+
161
+ ---
162
+
163
+ _Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._
@@ -0,0 +1,396 @@
1
+ # Build KnowX claims with human review
2
+
3
+ > **Use case id:** `knowx-claims-review`
4
+ > **Goal:** Model NODE/EDGE claims with provenance and run the fixture path without live AI.
5
+ > **Audiences:** developers
6
+ > **Tags:** knowx, provenance
7
+
8
+ ## Reading path
9
+
10
+ 1. **Building KnowX** (developers) → chapters: `1-core-architecture`, `2-mandatory-provenance-and-sourcespan`, `5-modeling-edge-assertions-claims`, `6-human-review-via-siblings`, `10-full-runnable-fixture-no-live-ai`
11
+
12
+ ## From: Building KnowX — 1. Core architecture
13
+
14
+ Three rules:
15
+
16
+ 1. **Business subjects wear KnowX as a facet.**
17
+ An employee, work item, or procedure becomes graph-visible by adding `contentType: "knowx"` on the **same** `recordId`.
18
+
19
+ 2. **Claims are first-class subjects.**
20
+ An assertion between subjects gets its **own** `recordId` and object type (e.g. `assertions`) that also uses `contentType: "knowx"` with `data.kind: "EDGE"`.
21
+
22
+ 3. **Traversal is lightweight.**
23
+ Heavy KnowX JSON is for audit. Fast graph UI reads materialized four-field relationship links — never copied payloads.
24
+
25
+ ```text
26
+ Business subject (recordId)
27
+ ├─ snapshots / raw / workflow / … ← ordinary Memorix content
28
+ └─ knowx ← NODE facet (epistemic + provenance)
29
+
30
+ Assertion subject (its own recordId)
31
+ ├─ knowx ← EDGE kind + domain refs + evidence
32
+ ├─ workflow ← human review assignment (sibling)
33
+ └─ confirmations ← accept/reject decisions (sibling)
34
+
35
+ Accepted EDGE knowx
36
+ └─ materialize → 4-field RelationshipLink (navigation only)
37
+ ```
38
+
39
+ Same `recordId` ⇒ composition. Different `recordId` values ⇒ relationships. KnowX does not invent a parallel identity system.
40
+
41
+ ### One KnowXEntity (not Node/Edge types)
42
+
43
+ | Layer | Name | Stored? |
44
+ |---|---|---|
45
+ | Content type | `knowx` | Yes |
46
+ | Payload discriminator | `data.kind`: `NODE` \| `EDGE` | Inside `.data` |
47
+ | Abstract projection | `KnowXEntity` | Virtual only |
48
+ | Forbidden | `KnowXNode` / `KnowXEdge` types or collections | — |
49
+
50
+ `KnowXEntity` bindings union concrete object types that may carry `knowx` (`employees`, `work-items`, `assertions`, …). Callers read the abstract; writers always target concrete object types.
51
+
52
+ ---
53
+
54
+ ## From: Building KnowX — 2. Mandatory provenance and SourceSpan
55
+
56
+ Every KnowX `.data` includes:
57
+
58
+ ```ts
59
+ type SourceSpan =
60
+ | { jsonPath: string }
61
+ | { lineStart: number; lineEnd: number }
62
+ | { byteStart: number; byteEnd: number };
63
+
64
+ type KnowxProvenance = {
65
+ sourceClass: "measured" | "inferred" | "asserted" | "imported";
66
+ sources: Array<{
67
+ docId: string;
68
+ docType: string;
69
+ docHash: string; // sha-256 hex of exact source bytes/JSON
70
+ span: SourceSpan;
71
+ retrievedAt: string; // ISO-8601
72
+ }>;
73
+ extraction: {
74
+ method: string; // e.g. "deterministic_fixture", "api_fetch"
75
+ extractorId: string;
76
+ confidence: number; // 0..1 extraction confidence — NOT epistemic state
77
+ };
78
+ };
79
+ ```
80
+
81
+ Rules:
82
+
83
+ - `docHash` hashes the **exact** source document bytes (or canonical JSON) that Memory landed — never a mutated copy.
84
+ - `span` points at the region that justified this claim.
85
+ - Missing provenance ⇒ reject the write in product validation / pipeline `validate` step.
86
+
87
+ ---
88
+
89
+ ## From: Building KnowX — 5. Modeling EDGE assertions (claims)
90
+
91
+ An edge such as *employee-10 is assigned to wi-100* is not an employee and not a work item. It is a claim with its own `recordId`.
92
+
93
+ Dedicated object type: `assertions` (category typically `knowledge` or `entity` per pack — pick one and keep it stable).
94
+
95
+ ```json
96
+ {
97
+ "format": "memorix-record/2",
98
+ "recordId": "ASSERTION-99",
99
+ "revision": 1,
100
+ "objectType": "assertions",
101
+ "contentType": "knowx",
102
+ "dataCategory": "knowledge",
103
+ "concept": {
104
+ "title": "employee-10 assigned to wi-100",
105
+ "identifiers": {
106
+ "primary": {
107
+ "kind": "assertionId",
108
+ "value": "ASSERTION-99",
109
+ "issuer": "knowx-pipeline"
110
+ }
111
+ }
112
+ },
113
+ "data": {
114
+ "kind": "EDGE",
115
+ "label": "assigned-to",
116
+ "refs": {
117
+ "from": "employee-10",
118
+ "to": "wi-100",
119
+ "relationshipDefinitionId": "assigned-to",
120
+ "role": "assignee"
121
+ },
122
+ "provenance": {
123
+ "sourceClass": "inferred",
124
+ "sources": [
125
+ {
126
+ "docId": "fixture:activity-log-001",
127
+ "docType": "system_event",
128
+ "docHash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2",
129
+ "span": { "lineStart": 12, "lineEnd": 12 },
130
+ "retrievedAt": "2026-07-22T10:00:00.000Z"
131
+ }
132
+ ],
133
+ "extraction": {
134
+ "method": "deterministic_fixture",
135
+ "extractorId": "knowx-ops-fixture-v1",
136
+ "confidence": 0.85
137
+ }
138
+ },
139
+ "epistemic": {
140
+ "state": "hypothesis",
141
+ "confirmation": "pending",
142
+ "confidenceScore": 0.85,
143
+ "lastTransition": {
144
+ "from": "gap",
145
+ "to": "hypothesis",
146
+ "reason": "fixture extraction",
147
+ "triggeredBy": "pipeline",
148
+ "at": "2026-07-22T10:05:00.000Z"
149
+ }
150
+ }
151
+ },
152
+ "_system": {
153
+ "state": "active",
154
+ "createdAt": "2026-07-22T10:05:00.000Z",
155
+ "modifiedAt": "2026-07-22T10:05:00.000Z"
156
+ }
157
+ }
158
+ ```
159
+
160
+ ### `refs` as domain semantics
161
+
162
+ | Ref key | Role |
163
+ |---|---|
164
+ | `from` / `to` | Endpoint subjects of the claim |
165
+ | `relationshipDefinitionId` | Which Memorix relationship definition this claim intends to materialize |
166
+ | `role` / custom keys | Domain-specific claim structure |
167
+
168
+ These refs describe **what the claim means**. Graph navigation still requires materialization (section 7). Do not walk `refs` as a substitute for `/api/relationships/query`.
169
+
170
+ ### Reification
171
+
172
+ Because `ASSERTION-99` is a subject, another EDGE can set `refs.from: "ASSERTION-99"`. Claims about claims stay ordinary Memorix subjects.
173
+
174
+ ---
175
+
176
+ ## From: Building KnowX — 6. Human review via siblings
177
+
178
+ Do not stuff review UI state into provenance. Use composition siblings on the assertion `recordId`.
179
+
180
+ ### Workflow sibling
181
+
182
+ ```json
183
+ {
184
+ "format": "memorix-record/2",
185
+ "recordId": "ASSERTION-99",
186
+ "revision": 1,
187
+ "objectType": "assertions",
188
+ "contentType": "workflow",
189
+ "dataCategory": "knowledge",
190
+ "concept": {
191
+ "title": "Review workflow for ASSERTION-99",
192
+ "identifiers": {
193
+ "primary": { "kind": "assertionId", "value": "ASSERTION-99", "issuer": "knowx-pipeline" }
194
+ }
195
+ },
196
+ "data": {
197
+ "state": "pending-review",
198
+ "assignedTo": ["ops-reviewers"]
199
+ }
200
+ }
201
+ ```
202
+
203
+ Use `PUT /api/workflow` with `objectType=assertions` and exact `expectedRevision` (book `09`).
204
+
205
+ ### Confirmations sibling
206
+
207
+ ```json
208
+ {
209
+ "format": "memorix-record/2",
210
+ "recordId": "ASSERTION-99",
211
+ "revision": 1,
212
+ "objectType": "assertions",
213
+ "contentType": "confirmations",
214
+ "dataCategory": "knowledge",
215
+ "concept": {
216
+ "title": "Confirmation for ASSERTION-99",
217
+ "identifiers": {
218
+ "primary": { "kind": "assertionId", "value": "ASSERTION-99", "issuer": "knowx-pipeline" }
219
+ }
220
+ },
221
+ "data": {
222
+ "confirmationType": "human-review",
223
+ "decision": "accept",
224
+ "confirmedBy": "ops-user-1",
225
+ "note": "Matches work-item assignee in snapshots"
226
+ }
227
+ }
228
+ ```
229
+
230
+ After accept, pipeline issues a **revision-safe** patch on `assertions-knowx`: `epistemic.state: "fact"`, `confirmation: "human"`.
231
+
232
+ ---
233
+
234
+ ## From: Building KnowX — 10. Full runnable fixture (no live AI)
235
+
236
+ This fixture is enough to accept KnowX **extraction + draft shapes** on an isolated org without model credentials. It is implemented in `@x12i/memorix-ops-pack` and covered by package tests (`knowx-fixture.test.ts`, `index.test.ts`).
237
+
238
+ ### 10.1 What is shipped vs documented
239
+
240
+ | Slice | Status |
241
+ |---|---|
242
+ | Metadata: `knowx` CT, `assertions` OT, `KnowXEntity` abstract + bindings | **Shipped** in ops-pack |
243
+ | `fixtures/knowx-activity-log.jsonl` | **Shipped** |
244
+ | `extractKnowxFromActivityLog` / service id `knowx-ops-fixture-v1` | **Shipped** + unit tested |
245
+ | Pack pipeline `knowx-ops-e2e` (`analyze` → `write-record`) | **Shipped** (pack authoring) |
246
+ | Live AI extractor | **Not shipped** — do not require for acceptance |
247
+ | Studio NODE/EDGE screenshots | May still be placeholders — see shot list |
248
+ | Human accept → relationship materialize | Product policy (same ports as other content); run after drafts are written |
249
+
250
+ ### 10.2 Scope
251
+
252
+ ```text
253
+ orgId: g12opsknowx1 # example; generate via isolation helpers
254
+ agentIds: ["ops"]
255
+ ```
256
+
257
+ ### 10.3 Source document (land as raw)
258
+
259
+ Path: `memorix-ops-pack/fixtures/knowx-activity-log.jsonl` (exact bytes hashed → `docHash`):
260
+
261
+ ```text
262
+ {"line":12,"actorId":"employee-10","workItemId":"wi-100","verb":"assigned"}
263
+ ```
264
+
265
+ ```ts
266
+ import { readFileSync } from "node:fs";
267
+ import {
268
+ extractKnowxFromActivityLog,
269
+ sha256Hex,
270
+ } from "@x12i/memorix-ops-pack";
271
+
272
+ const bytes = readFileSync("…/fixtures/knowx-activity-log.jsonl");
273
+ const { docHash, drafts } = extractKnowxFromActivityLog(bytes);
274
+ // docHash === sha256Hex(bytes)
275
+ ```
276
+
277
+ ### 10.4 Deterministic extractor service
278
+
279
+ Pack `services[]` + runtime bridge:
280
+
281
+ ```json
282
+ {
283
+ "id": "knowx-ops-fixture-v1",
284
+ "capabilities": ["analyze"],
285
+ "invocation": { "kind": "worker", "operation": "knowx-extract-fixture" }
286
+ }
287
+ ```
288
+
289
+ ```json
290
+ {
291
+ "serviceId": "knowx-ops-fixture-v1",
292
+ "kind": "worker",
293
+ "capabilities": ["analyze"]
294
+ }
295
+ ```
296
+
297
+ Behavior (implemented):
298
+
299
+ 1. Read exact source bytes.
300
+ 2. Parse the fixture line (`line`, `actorId`, `workItemId`, `verb`).
301
+ 3. Emit NODE drafts for `employee-10` / `wi-100`.
302
+ 4. Emit EDGE draft `ASSERTION-99` with mandatory provenance (`span.lineStart/lineEnd`, `docHash`, extraction confidence `0.85`).
303
+ 5. Never call an external model.
304
+
305
+ Wire the function into an `analyze` `PortHandler` (or call it from a worker that uses `@x12i/core-service`). Pipeline `write-record` persists drafts — the extractor itself does not open Mongo.
306
+
307
+ ### 10.5 Pipeline definition
308
+
309
+ Pack authoring (`knowx-ops-e2e`):
310
+
311
+ ```json
312
+ {
313
+ "id": "knowx-ops-e2e",
314
+ "steps": [
315
+ { "id": "extract", "kind": "analyze", "serviceId": "knowx-ops-fixture-v1" },
316
+ { "id": "write-knowx", "kind": "write-record", "contentType": "knowx" }
317
+ ]
318
+ }
319
+ ```
320
+
321
+ Runtime v2 shape (after bind/compile):
322
+
323
+ ```json
324
+ {
325
+ "pipelineId": "knowx-ops-e2e",
326
+ "version": "1",
327
+ "services": [
328
+ { "serviceId": "knowx-ops-fixture-v1", "kind": "worker", "capabilities": ["analyze"] }
329
+ ],
330
+ "steps": [
331
+ {
332
+ "stepId": "extract",
333
+ "stepKind": "analyze",
334
+ "serviceId": "knowx-ops-fixture-v1",
335
+ "outputKey": "knowxDrafts"
336
+ },
337
+ {
338
+ "stepId": "write-knowx",
339
+ "stepKind": "write-record",
340
+ "dependsOn": ["extract"],
341
+ "portConfig": { "contentType": "knowx" },
342
+ "outputKey": "knowxWrites"
343
+ }
344
+ ]
345
+ }
346
+ ```
347
+
348
+ Optional Memory pull / `persist-raw` steps can land the JSONL first; the fixture extractor only needs the exact bytes (file or raw DataRef).
349
+
350
+ ### 10.6 Acceptance checklist (runnable)
351
+
352
+ ```bash
353
+ # From memorix-ops-pack:
354
+ npm test
355
+ # covers: metadata KnowXEntity/assertions/knowx, fixture extract, docHash, epistemic ≠ extraction confidence
356
+ ```
357
+
358
+ HTTP smoke after install (when service + live ports are up):
359
+
360
+ ```bash
361
+ # Install ops-pack into fresh g12ops* + agentIds=["ops"]
362
+ # Start pipeline knowx-ops-e2e (or write drafts via data API from extractKnowxFromActivityLog output)
363
+
364
+ curl -sS "${HDR[@]}" \
365
+ "$SERVICE/api/data/content?objectType=work-items&contentType=knowx&id=wi-100"
366
+
367
+ curl -sS "${HDR[@]}" \
368
+ "$SERVICE/api/data/content?objectType=assertions&contentType=knowx&id=ASSERTION-99"
369
+
370
+ curl -sS "${HDR[@]}" \
371
+ "$SERVICE/api/data/abstract?abstractType=KnowXEntity&id=ASSERTION-99"
372
+ ```
373
+
374
+ Verify:
375
+
376
+ - [ ] `epistemic.state` and `provenance.extraction.confidence` both present and distinct
377
+ - [ ] `docHash` matches `sha256` of exact fixture bytes
378
+ - [ ] `KnowXEntity` read works; writing to `KnowXEntity` as objectType fails
379
+ - [ ] EDGE starts as `hypothesis` until human confirmations + revision-safe patch to `fact`
380
+ - [ ] After accept, materialize four-field links (relationship engine) — do not copy knowx JSON onto neighbors
381
+ - [ ] `format === "memorix-record/2"` on all KnowX rows
382
+ - [ ] No `associated*` keys on any content root
383
+ - [ ] Re-run extract does not invent duplicate EDGE ids (`ASSERTION-99` stable)
384
+ - [ ] No live AI credentials required
385
+ - [ ] Org matches `g12ops*`; agents `["ops"]`
386
+
387
+ ---
388
+
389
+ ## Also see
390
+
391
+ - **Relationships & Memory** (`06-relationships-and-memory`) — Exact Memory ingest and relationship engine links — never associated* payloads on records.
392
+ - **Building Pipelines** (`08-pipelines`) — Pipeline definition, step kinds, AI fail-closed, operations, and the complete ops tutorial.
393
+
394
+ ---
395
+
396
+ _Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._