@elevasis/sdk 1.20.2 → 1.22.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 (164) hide show
  1. package/dist/cli.cjs +4220 -1583
  2. package/dist/index.d.ts +1035 -481
  3. package/dist/index.js +7381 -4187
  4. package/dist/node/index.d.ts +1 -3
  5. package/dist/node/index.js +40 -49
  6. package/dist/test-utils/index.d.ts +699 -123
  7. package/dist/test-utils/index.js +3826 -630
  8. package/dist/worker/index.js +3616 -442
  9. package/package.json +3 -3
  10. package/reference/_navigation.md +9 -7
  11. package/reference/_reference-manifest.json +1 -1
  12. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  13. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  14. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  15. package/reference/claude-config/registries/graph-skills.json +4 -4
  16. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  17. package/reference/claude-config/rules/active-change-index.md +80 -80
  18. package/reference/claude-config/rules/agent-start-here.md +277 -273
  19. package/reference/claude-config/rules/deployment.md +57 -57
  20. package/reference/claude-config/rules/error-handling.md +56 -56
  21. package/reference/claude-config/rules/execution.md +40 -40
  22. package/reference/claude-config/rules/frontend.md +4 -4
  23. package/reference/claude-config/rules/observability.md +31 -31
  24. package/reference/claude-config/rules/operations.md +29 -17
  25. package/reference/claude-config/rules/organization-model.md +108 -40
  26. package/reference/claude-config/rules/organization-os.md +115 -113
  27. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  28. package/reference/claude-config/rules/platform.md +42 -42
  29. package/reference/claude-config/rules/shared-types.md +49 -46
  30. package/reference/claude-config/rules/task-tracking.md +47 -47
  31. package/reference/claude-config/rules/ui.md +200 -200
  32. package/reference/claude-config/rules/vibe.md +235 -231
  33. package/reference/claude-config/scripts/statusline-command.js +18 -18
  34. package/reference/claude-config/settings.json +34 -34
  35. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  36. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  37. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  38. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  39. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  40. package/reference/claude-config/skills/knowledge/SKILL.md +330 -271
  41. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  42. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -158
  43. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  44. package/reference/claude-config/skills/knowledge/operations/features.md +76 -113
  45. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  46. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  47. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -89
  48. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  49. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  50. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  51. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  52. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  53. package/reference/claude-config/skills/save/SKILL.md +3 -3
  54. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  55. package/reference/claude-config/skills/status/SKILL.md +59 -59
  56. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  57. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  58. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  59. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  60. package/reference/claude-config/skills/tutorial/technical.md +1303 -1306
  61. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  62. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  63. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  64. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  65. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  66. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  67. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  68. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  69. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  70. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  71. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  72. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  73. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  74. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  75. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  76. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  77. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  78. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  79. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  80. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  81. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  82. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  83. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -0
  84. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +42 -0
  85. package/reference/claude-config/sync-notes/README.md +43 -43
  86. package/reference/cli.mdx +808 -668
  87. package/reference/concepts.mdx +146 -146
  88. package/reference/deployment/api.mdx +297 -297
  89. package/reference/deployment/command-center.mdx +209 -209
  90. package/reference/deployment/index.mdx +195 -195
  91. package/reference/deployment/provided-features.mdx +107 -93
  92. package/reference/deployment/ui-execution.mdx +250 -250
  93. package/reference/examples/organization-model.ts +147 -84
  94. package/reference/framework/agent.mdx +156 -156
  95. package/reference/framework/index.mdx +195 -195
  96. package/reference/framework/interaction-guidance.mdx +182 -182
  97. package/reference/framework/memory.mdx +326 -326
  98. package/reference/framework/project-structure.mdx +282 -282
  99. package/reference/framework/tutorial-system.mdx +135 -135
  100. package/reference/getting-started.mdx +142 -142
  101. package/reference/index.mdx +106 -106
  102. package/reference/packages/core/src/README.md +14 -14
  103. package/reference/packages/core/src/business/README.md +2 -2
  104. package/reference/packages/core/src/knowledge/README.md +33 -32
  105. package/reference/packages/core/src/organization-model/README.md +149 -109
  106. package/reference/packages/core/src/test-utils/README.md +37 -37
  107. package/reference/packages/ui/src/api/README.md +18 -18
  108. package/reference/packages/ui/src/app/README.md +24 -24
  109. package/reference/packages/ui/src/auth/README.md +18 -18
  110. package/reference/packages/ui/src/components/README.md +24 -24
  111. package/reference/packages/ui/src/execution/README.md +16 -16
  112. package/reference/packages/ui/src/features/README.md +28 -28
  113. package/reference/packages/ui/src/graph/README.md +16 -16
  114. package/reference/packages/ui/src/hooks/README.md +23 -23
  115. package/reference/packages/ui/src/initialization/README.md +19 -19
  116. package/reference/packages/ui/src/knowledge/README.md +31 -31
  117. package/reference/packages/ui/src/organization/README.md +18 -18
  118. package/reference/packages/ui/src/profile/README.md +19 -19
  119. package/reference/packages/ui/src/provider/README.md +32 -32
  120. package/reference/packages/ui/src/router/README.md +18 -18
  121. package/reference/packages/ui/src/sse/README.md +13 -13
  122. package/reference/packages/ui/src/test-utils/README.md +7 -7
  123. package/reference/packages/ui/src/theme/README.md +23 -23
  124. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  125. package/reference/packages/ui/src/types/README.md +16 -16
  126. package/reference/packages/ui/src/utils/README.md +18 -18
  127. package/reference/packages/ui/src/zustand/README.md +18 -18
  128. package/reference/platform-tools/adapters-integration.mdx +301 -301
  129. package/reference/platform-tools/adapters-platform.mdx +553 -553
  130. package/reference/platform-tools/index.mdx +217 -217
  131. package/reference/platform-tools/type-safety.mdx +82 -82
  132. package/reference/resources/index.mdx +349 -349
  133. package/reference/resources/patterns.mdx +449 -449
  134. package/reference/resources/types.mdx +116 -116
  135. package/reference/roadmap.mdx +165 -165
  136. package/reference/runtime.mdx +173 -173
  137. package/reference/scaffold/core/organization-graph.mdx +110 -89
  138. package/reference/scaffold/core/organization-model.mdx +226 -171
  139. package/reference/scaffold/index.mdx +67 -67
  140. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  141. package/reference/scaffold/operations/scaffold-maintenance.md +10 -10
  142. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  143. package/reference/scaffold/recipes/add-a-feature.md +310 -88
  144. package/reference/scaffold/recipes/add-a-resource.md +137 -117
  145. package/reference/scaffold/recipes/customize-crm-actions.md +439 -439
  146. package/reference/scaffold/recipes/customize-knowledge-browser.md +384 -0
  147. package/reference/scaffold/recipes/customize-organization-model.md +281 -118
  148. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  149. package/reference/scaffold/recipes/extend-crm.md +40 -39
  150. package/reference/scaffold/recipes/extend-lead-gen.md +400 -401
  151. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -114
  152. package/reference/scaffold/recipes/index.md +47 -46
  153. package/reference/scaffold/recipes/query-the-knowledge-graph.md +227 -0
  154. package/reference/scaffold/reference/contracts.md +2389 -2121
  155. package/reference/scaffold/reference/feature-registry.md +9 -20
  156. package/reference/scaffold/reference/glossary.md +76 -76
  157. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  158. package/reference/scaffold/ui/customization.md +243 -243
  159. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  160. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  161. package/reference/scaffold/ui/recipes.md +221 -213
  162. package/reference/spine/spine-primer.md +96 -96
  163. package/reference/templates/index.mdx +47 -47
  164. package/reference/troubleshooting.mdx +223 -223
@@ -1,117 +1,121 @@
1
- ---
2
- title: Gate by Feature or Admin
3
- description: Decision table and recipes for gating routes, sidebar entries, and UI elements by Organization Model feature ID or admin role.
4
- ---
1
+ ---
2
+ title: Gate by System or Admin
3
+ description: Decision table and recipes for gating routes, sidebar entries, and UI elements by Organization Model system ID or admin role.
4
+ ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
7
7
 
8
-
9
- # Gate by Feature or Admin
10
-
11
- Feature visibility starts in `core/config/organization-model.ts`. Routes still enforce access with guards.
12
-
13
- ## Decide the gate
14
-
15
- | Scenario | Gate to use |
16
- | --- | --- |
17
- | Surface can be enabled or disabled per organization/member | `FeatureGuard` with the feature ID |
18
- | Surface is always available to members but restricted to admins | `AdminGuard` plus `requiresAdmin: true` on the feature node |
19
- | Surface is both feature-gated and admin-only | Both guards, plus `requiresAdmin: true` on the feature node |
20
-
21
- ## Feature gate in the org model
22
-
23
- Add or update the feature in `features`.
24
-
25
- ```ts
26
- features: [
27
- {
28
- id: 'analytics',
29
- label: 'Analytics',
30
- enabled: false,
31
- path: '/analytics',
32
- icon: 'custom.analytics',
33
- uiPosition: 'sidebar-primary'
34
- }
35
- ]
36
- ```
37
-
38
- Set `enabled: true` to enable it for all members by default. Dotted IDs such as `analytics.reports` inherit feature state and shell placement from their ancestors unless they declare their own value.
39
-
40
- ## Route-level feature gate
41
-
42
- ```tsx
43
- import { ProtectedRoute } from '@/features/auth'
44
- import { FeatureGuard } from '@/features/auth/guards/FeatureGuard'
45
- import { createFileRoute, Outlet } from '@tanstack/react-router'
46
-
47
- export const Route = createFileRoute('/analytics')({ component: AnalyticsLayout })
48
-
49
- function AnalyticsLayout() {
50
- return (
51
- <ProtectedRoute>
52
- <FeatureGuard featureKey="analytics">
53
- <Outlet />
54
- </FeatureGuard>
55
- </ProtectedRoute>
56
- )
57
- }
58
- ```
59
-
60
- The sidebar is derived from `OrganizationModel.features`; hiding a node there is display behavior only. Keep route guards in place for direct URL access.
61
-
62
- ## Admin-only route
63
-
64
- ```tsx
65
- import { ProtectedRoute } from '@/features/auth'
66
- import { AdminGuard } from '@elevasis/ui/auth'
67
- import { createFileRoute, Outlet } from '@tanstack/react-router'
68
-
69
- export const Route = createFileRoute('/admin')({ component: AdminLayout })
70
-
71
- function AdminLayout() {
72
- return (
73
- <ProtectedRoute>
74
- <AdminGuard>
75
- <Outlet />
76
- </AdminGuard>
77
- </ProtectedRoute>
78
- )
79
- }
80
- ```
81
-
82
- Pair the route guard with the feature node:
83
-
84
- ```ts
85
- {
86
- id: 'admin',
87
- label: 'Admin',
88
- enabled: true,
89
- path: '/admin',
90
- uiPosition: 'sidebar-bottom',
91
- requiresAdmin: true
92
- }
93
- ```
94
-
95
- ## Per-member override
96
-
97
- `MembershipFeatureConfig.features` in `org_memberships.config` overrides enabled state per member.
98
-
99
- ```ts
100
- {
101
- features: { analytics: false }
102
- }
103
- ```
104
-
105
- Settings and admin-only pages should use admin checks, not per-member feature flags.
106
-
107
- ## Verify
108
-
109
- Check the state matrix:
110
-
111
- | Org feature enabled | Member override | Admin | Expected result |
112
- | --- | --- | --- | --- |
113
- | true | absent | any | Route accessible, sidebar visible |
114
- | true | false | any | Route redirects, sidebar hidden |
115
- | false | absent | any | Route redirects, sidebar hidden |
116
- | true | absent | non-admin | Admin route redirects, admin sidebar hidden |
117
- | true | absent | admin | Admin route accessible, admin sidebar visible |
8
+
9
+ # Gate by System or Admin
10
+
11
+ System visibility starts in `core/config/organization-model.ts`. Routes still enforce access with guards.
12
+
13
+ ## Decide the gate
14
+
15
+ | Scenario | Gate to use |
16
+ | --- | --- |
17
+ | Surface can be enabled or disabled per organization/member | `SystemGuard` with the system ID |
18
+ | Surface is always available to members but restricted to admins | `AdminGuard` plus `requiresAdmin: true` on the system node |
19
+ | Surface is both system-gated and admin-only | Both guards, plus `requiresAdmin: true` on the system node |
20
+
21
+ ## System gate in the org model
22
+
23
+ Add or update the system in the id-keyed `systems` map.
24
+
25
+ ```ts
26
+ systems: {
27
+ analytics: {
28
+ id: 'analytics',
29
+ order: 10,
30
+ label: 'Analytics',
31
+ enabled: false,
32
+ path: '/analytics',
33
+ icon: 'custom.analytics',
34
+ uiPosition: 'sidebar-primary'
35
+ }
36
+ }
37
+ ```
38
+
39
+ Set `enabled: true` to enable it for all members by default. Dotted IDs such as `analytics.reports` inherit system state and shell placement from their ancestors unless they declare their own value.
40
+
41
+ ## Route-level system gate
42
+
43
+ ```tsx
44
+ import { ProtectedRoute } from '@/features/auth'
45
+ import { SystemGuard } from '@elevasis/ui/features/auth'
46
+ import { createFileRoute, Outlet } from '@tanstack/react-router'
47
+
48
+ export const Route = createFileRoute('/analytics')({ component: AnalyticsLayout })
49
+
50
+ function AnalyticsLayout() {
51
+ return (
52
+ <ProtectedRoute>
53
+ <SystemGuard systemKey="analytics">
54
+ <Outlet />
55
+ </SystemGuard>
56
+ </ProtectedRoute>
57
+ )
58
+ }
59
+ ```
60
+
61
+ The sidebar is derived from `OrganizationModel.systems`; hiding a node there is display behavior only. Keep route guards in place for direct URL access.
62
+
63
+ ## Admin-only route
64
+
65
+ ```tsx
66
+ import { ProtectedRoute } from '@/features/auth'
67
+ import { AdminGuard } from '@elevasis/ui/auth'
68
+ import { createFileRoute, Outlet } from '@tanstack/react-router'
69
+
70
+ export const Route = createFileRoute('/admin')({ component: AdminLayout })
71
+
72
+ function AdminLayout() {
73
+ return (
74
+ <ProtectedRoute>
75
+ <AdminGuard>
76
+ <Outlet />
77
+ </AdminGuard>
78
+ </ProtectedRoute>
79
+ )
80
+ }
81
+ ```
82
+
83
+ Pair the route guard with the system node:
84
+
85
+ ```ts
86
+ systems: {
87
+ admin: {
88
+ id: 'admin',
89
+ order: 10,
90
+ label: 'Admin',
91
+ enabled: true,
92
+ path: '/admin',
93
+ uiPosition: 'sidebar-bottom',
94
+ requiresAdmin: true
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Per-member override
100
+
101
+ Membership config overrides enabled state per member.
102
+
103
+ ```ts
104
+ {
105
+ systems: { analytics: false }
106
+ }
107
+ ```
108
+
109
+ Settings and admin-only pages should use admin checks, not per-member system flags.
110
+
111
+ ## Verify
112
+
113
+ Check the state matrix:
114
+
115
+ | Org system enabled | Member override | Admin | Expected result |
116
+ | --- | --- | --- | --- |
117
+ | true | absent | any | Route accessible, sidebar visible |
118
+ | true | false | any | Route redirects, sidebar hidden |
119
+ | false | absent | any | Route redirects, sidebar hidden |
120
+ | true | absent | non-admin | Admin route redirects, admin sidebar hidden |
121
+ | true | absent | admin | Admin route accessible, admin sidebar visible |
@@ -1,50 +1,51 @@
1
- ---
2
- title: Pathway Recipes
3
- description: Terse end-to-end walkthroughs for the three most common authoring tasks -- adding a feature, adding a resource, and gating access.
4
- ---
5
1
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
2
  <!-- Regenerate: pnpm scaffold:sync -->
7
3
 
8
-
9
- # Pathway Recipes
10
-
11
- Three sequential walkthroughs for common authoring tasks. Each recipe links into the reference docs rather than duplicating them.
12
-
13
- Before starting, read [glossary.md](../reference/glossary.md) to disambiguate overloaded terms (Feature, Resource, featureId, Settings asymmetry, Topology).
14
-
15
- ---
16
-
17
- ## Recipes
18
-
19
- **[Add a Feature](add-a-feature.md)**
20
- You want a new shell feature (e.g., `analytics`) with its own nav entry, sidebar, routes, and org-model gate. Covers adding a feature object to the org model, `FeatureModule` manifest authoring, route creation, and gating.
21
-
22
- **[Add a Resource](add-a-resource.md)**
23
- You want a new workflow or agent deployed to the platform. Covers OM Resource descriptor authoring, descriptor-backed `WorkflowDefinition` binding, `DeploymentSpec` assembly, relationship declarations, and CLI verification.
24
-
25
- **[Gate by Feature or Admin](gate-by-feature-or-admin.md)**
26
- You want to restrict a route, nav item, or UI element by feature flag or admin role. Covers the decision table, `FeatureGuard`, `AdminGuard`, nav-entry visibility fields, per-member `MembershipFeatureConfig` overrides, and the settings-asymmetry gotcha.
27
-
28
- **[Build and Extend CRM](extend-crm.md)**
29
- You want to build on the shared CRM without forking it: add CRM routes, compose sidebars/pages, use deal/company/contact hooks, mutate CRM data from workflows, or understand which contracts and adapters form the extension surface.
30
-
31
- **[Build and Extend Lead Gen](extend-lead-gen.md)**
32
- You want to build on the shared lead-gen system without forking it: add lead-gen routes, compose sidebars/pages, use list/company/contact/artifact hooks, mutate list data from workflows, or understand which contracts and adapters form the extension surface.
33
-
34
- **[Customize CRM Actions](customize-crm-actions.md)**
35
- You want to add, hide, or replace CRM deal action buttons, configure the shared `crmActions` provider path, or call a project-owned workflow from custom UI when server-side action dispatch constraints require it. Covers `ActionDef`, `DEFAULT_CRM_ACTIONS`, provider wiring, and the current v1 boundary for custom action dispatch.
36
-
37
- **[Customize Knowledge Browser](customize-knowledge-browser.md)**
38
- You want to mount, extend, or replace the default Knowledge Browser. Covers the three customization tiers (default manifest mount, sidebar composition via `KnowledgeSidebarMiddle` + `KNOWLEDGE_ITEMS`, and direct query access via `@elevasis/core/knowledge`), the one-line `vite.config.ts` plugin add (`knowledgePlugin()` from `@elevasis/ui/vite-plugin-knowledge`), and the CSS import requirement.
39
-
4
+ ---
5
+ title: Pathway Recipes
6
+ description: Terse end-to-end walkthroughs for the three most common authoring tasks -- adding a system, adding a resource, and gating access.
7
+ ---
8
+
9
+ # Pathway Recipes
10
+
11
+ Three sequential walkthroughs for common authoring tasks. Each recipe links into the reference docs rather than duplicating them.
12
+
13
+ Before starting, read [glossary.md](../reference/glossary.md) to disambiguate overloaded terms (System, Resource, systemId, Settings asymmetry, Topology).
14
+
15
+ ---
16
+
17
+ ## Recipes
18
+
19
+ **[Add an OM-Backed System](add-a-feature.md)**
20
+ You want a new system with cohesive Organization Model semantics, executable resources, and optional UI. Covers Systems, System-owned ontology and config, Resource descriptors with `resource.ontology`, `actionKey`, `codeRefs`, runtime assembly, manifests, routes, guards, tests, and compatibility notes for old `System.content` consumers.
21
+
22
+ **[Add a Resource](add-a-resource.md)**
23
+ You want a new workflow or agent deployed to the platform. Covers OM Resource descriptor authoring, descriptor-backed `WorkflowDefinition` binding, `DeploymentSpec` assembly, relationship declarations, and CLI verification.
24
+
25
+ **[Gate by System or Admin](gate-by-feature-or-admin.md)**
26
+ You want to restrict a route, nav item, or UI element by system flag or admin role. Covers the decision table, `SystemGuard`, `AdminGuard`, nav-entry visibility fields, per-member system overrides, and the settings-asymmetry gotcha.
27
+
28
+ **[Build and Extend CRM](extend-crm.md)**
29
+ You want to build on the shared CRM without forking it: add CRM routes, compose sidebars/pages, use deal/company/contact hooks, mutate CRM data from workflows, or understand which contracts and adapters form the extension surface.
30
+
31
+ **[Build and Extend Lead Gen](extend-lead-gen.md)**
32
+ You want to build on the shared lead-gen system without forking it: add lead-gen routes, compose sidebars/pages, use list/company/contact/artifact hooks, mutate list data from workflows, or understand which contracts and adapters form the extension surface.
33
+
34
+ **[Customize CRM Actions](customize-crm-actions.md)**
35
+ You want to add, hide, or replace CRM deal action buttons, configure the shared `crmActions` provider path, or call a project-owned workflow from custom UI when server-side action dispatch constraints require it. Covers `ActionDef`, `DEFAULT_CRM_ACTIONS`, provider wiring, and the current v1 boundary for custom action dispatch.
36
+
37
+ **[Customize Knowledge Browser](customize-knowledge-browser.md)**
38
+ You want to mount, extend, or replace the default Knowledge Browser. Covers the three customization tiers (default manifest mount, sidebar composition via `KnowledgeSidebarMiddle` + `KNOWLEDGE_ITEMS`, and direct query access via `@elevasis/core/knowledge`), the one-line `vite.config.ts` plugin add (`knowledgePlugin()` from `@elevasis/ui/vite-plugin-knowledge`), and the CSS import requirement.
39
+
40
40
  **[Query the Knowledge Graph](query-the-knowledge-graph.md)**
41
- You want to browse, inspect, or traverse the OrganizationModel knowledge graph from the command line. Covers the three verbs (`knowledge:ls`, `knowledge:cat`, `knowledge:graph`), all five mount axes (`/by-feature/`, `/by-kind/`, `/by-owner/`, `/graph/.../governs/`, `/graph/.../governed-by/`), dual-CLI invocation patterns (`elevasis-sdk` for external projects, `elevasis` for the monorepo), and the Windows/MSYS PowerShell gotcha.
42
-
43
- ---
44
-
45
- ## Reference docs these recipes link into
46
-
47
- - [glossary.md](../reference/glossary.md) -- term disambiguation for Feature, Resource, featureId, Topology, Settings asymmetry
48
- - [contracts.md](../reference/contracts.md) -- TypeScript shapes: `FeatureModule`, `FeatureNavEntry`, `OrganizationModel`, `MembershipFeatureConfig`, CRM deal types, lead-gen list/member/artifact types, `CrmToolMap`, `LeadToolMap`, `ListToolMap`, `ActionDef`
49
- - [feature-flags-and-gating.md](../ui/feature-flags-and-gating.md) -- full three-concept gating model
50
- - [workflow-recipes.md](../operations/workflow-recipes.md) -- workflow anatomy, adapters, trigger patterns
41
+ You want to browse, inspect, or traverse the OrganizationModel knowledge graph from the command line. Covers the three verbs (`knowledge:ls`, `knowledge:cat`, `knowledge:graph`), all six mount axes (`/by-system/`, `/by-ontology/`, `/by-kind/`, `/by-owner/`, `/graph/.../governs/`, `/graph/.../governed-by/`), dual-CLI invocation patterns (`elevasis-sdk` for external projects, `elevasis` for the monorepo), JSON output shapes, and the Windows/MSYS PowerShell gotcha.
42
+
43
+ ---
44
+
45
+ ## Reference docs these recipes link into
46
+
47
+ - [glossary.md](../reference/glossary.md) -- term disambiguation for System, Resource, systemId, Topology, Settings asymmetry
48
+ - [contracts.md](../reference/contracts.md) -- TypeScript shapes: `SystemModule`, `OrganizationModel`, CRM deal types, lead-gen list/member/artifact types, `CrmToolMap`, `LeadToolMap`, `ListToolMap`, `ActionDef`
49
+ - [feature-flags-and-gating.md](../ui/feature-flags-and-gating.md) -- full three-concept gating model
50
+ - [workflow-recipes.md](../operations/workflow-recipes.md) -- workflow anatomy, adapters, trigger patterns
51
+
@@ -0,0 +1,227 @@
1
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
2
+ <!-- Regenerate: pnpm scaffold:sync -->
3
+
4
+ ---
5
+ title: Query the Knowledge Graph
6
+ description: Use the `knowledge:*` CLI subcommands on `elevasis-sdk` (external projects) and `elevasis` (monorepo) to browse, inspect, and traverse the OrganizationModel knowledge graph via six mount axes.
7
+ ---
8
+
9
+ # Query the Knowledge Graph
10
+
11
+ The `knowledge:*` subcommands expose the OrganizationModel as a virtual filesystem. Paths are query strings -- `/by-system/sales/crm/` dispatches to a graph query, not a directory on disk. Three verbs cover all access patterns: `ls` (list), `cat` (read a node body), and `graph` (traverse edges).
12
+
13
+ Both CLIs share the same query layer (`@repo/core/knowledge/queries`). The only difference is which OrganizationModel they load:
14
+
15
+ - `elevasis-sdk` -- runs from inside `external/<project>/`, walks up to `.elevasis`, loads the project's `core/config/organization-model.ts`.
16
+ - `elevasis` -- runs from the monorepo root, loads `canonicalOrganizationModel` from `@repo/elevasis-core`.
17
+
18
+ ## Before you start
19
+
20
+ The `knowledge:*` commands require `elevasis-sdk >= 1.4.0`. Check with:
21
+
22
+ ```bash
23
+ pnpm exec elevasis-sdk --version
24
+ ```
25
+
26
+ If you are running on Windows, **use PowerShell** for all `knowledge:*` commands. MSYS Bash rewrites the leading `/by-system/...` path argument to a Windows filesystem path, mangling the query. PowerShell passes the argument through verbatim.
27
+
28
+ ## Three Verbs
29
+
30
+ | Verb | Behavior |
31
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
32
+ | `knowledge:ls <path>` | List nodes or edges for the mount. Default: id + summary table. `--json` for the wrapped envelope. `--ids-only` for piping. |
33
+ | `knowledge:cat <id>` | Print a node's raw MDX `body` to stdout. |
34
+ | `knowledge:graph <id>` | Show outgoing and incoming edges for a node, grouped by edge kind. |
35
+
36
+ All three accept `--json` for machine-readable output. `knowledge:ls` additionally accepts `--ids-only` to print one node ID per line.
37
+
38
+ ## Six Mount Axes
39
+
40
+ The path argument to `knowledge:ls` determines the query. Six axes are available:
41
+
42
+ | Path prefix | Query | Returns |
43
+ | ------------------------------ | ----------------------------- | --------------------------------------------------- |
44
+ | `/by-system/<dotted-id>/` | `bySystem(graph, systemId)` | nodes with incoming `governs` edges to this system |
45
+ | `/by-ontology/<ontology-id>/` | `byOntology(graph, ontologyId)` | nodes with incoming `governs` edges to this ontology record |
46
+ | `/by-kind/<kind>/` | `byKind(graph, kind)` | nodes where `node.kind === kind` |
47
+ | `/by-owner/<id>/` | `byOwner(graph, ownerId)` | nodes where `node.ownerIds.includes(id)` |
48
+ | `/graph/<nodeId>/governs/` | `governs(graph, nodeId)` | outgoing `governs` edges from `nodeId` |
49
+ | `/graph/<nodeId>/governed-by/` | `governedBy(graph, nodeId)` | incoming `governs` edges to `nodeId` |
50
+
51
+ ## Examples
52
+
53
+ Each example is shown for both CLIs.
54
+
55
+ ### 1. List by system (`/by-system/<dotted-id>/`)
56
+
57
+ List all knowledge nodes that govern the `sales.crm` system:
58
+
59
+ ```bash
60
+ # External project (from inside external/<project>/)
61
+ pnpm exec elevasis-sdk knowledge:ls /by-system/sales.crm/
62
+
63
+ # Monorepo (from monorepo root)
64
+ pnpm exec elevasis knowledge:ls /by-system/sales.crm/
65
+ ```
66
+
67
+ Nested system ids use dots, not slashes: `sales.crm`, `sales.lead-gen`, `projects`.
68
+
69
+ ### 2. List by ontology (`/by-ontology/<ontology-id>/`)
70
+
71
+ List all knowledge nodes that govern the CRM deal ontology record:
72
+
73
+ ```bash
74
+ # External project
75
+ pnpm exec elevasis-sdk knowledge:ls /by-ontology/sales.crm:object/deal
76
+
77
+ # Monorepo
78
+ pnpm exec elevasis knowledge:ls /by-ontology/sales.crm:object/deal
79
+ ```
80
+
81
+ Ontology IDs use `system.path:kind/local-id` or `global:kind/local-id`. Slash-containing ontology IDs are part of the query path; use PowerShell on Windows so the leading `/by-ontology/...` path is not rewritten by MSYS Bash.
82
+
83
+ ### 3. List by kind (`/by-kind/<kind>/`)
84
+
85
+ List all nodes of kind `playbook`:
86
+
87
+ ```bash
88
+ # External project
89
+ pnpm exec elevasis-sdk knowledge:ls /by-kind/playbook
90
+
91
+ # Monorepo
92
+ pnpm exec elevasis knowledge:ls /by-kind/playbook
93
+ ```
94
+
95
+ Common kinds: `playbook`, `strategy`, and `reference`. The available kinds are defined on `OrgKnowledgeNode.kind` in `@elevasis/core/knowledge`.
96
+
97
+ Machine-readable output for piping:
98
+
99
+ ```bash
100
+ pnpm exec elevasis knowledge:ls /by-kind/playbook --ids-only
101
+ ```
102
+
103
+ ### 4. List by owner (`/by-owner/<id>/`)
104
+
105
+ List all knowledge nodes owned by a specific member or team:
106
+
107
+ ```bash
108
+ # External project
109
+ pnpm exec elevasis-sdk knowledge:ls /by-owner/operations-team
110
+
111
+ # Monorepo
112
+ pnpm exec elevasis knowledge:ls /by-owner/operations-team
113
+ ```
114
+
115
+ The `<id>` matches against `node.ownerIds`. Owner IDs are declared on each knowledge node in the OrganizationModel.
116
+
117
+ ### 5. Traverse outgoing edges (`/graph/<nodeId>/governs/`)
118
+
119
+ List what a specific node governs (outgoing `governs` edges):
120
+
121
+ ```bash
122
+ # External project
123
+ pnpm exec elevasis-sdk knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governs/
124
+
125
+ # Monorepo
126
+ pnpm exec elevasis knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governs/
127
+ ```
128
+
129
+ Knowledge node IDs use the `knowledge.<slug>` source id. Graph node IDs may be kind-prefixed,
130
+ such as `knowledge:knowledge.new-vertical-launch-playbook` or `system:sales.crm`, when traversing
131
+ graph edges.
132
+
133
+ ### 6. Traverse incoming edges (`/graph/<nodeId>/governed-by/`)
134
+
135
+ List what governs a specific node (incoming `governs` edges):
136
+
137
+ ```bash
138
+ # External project
139
+ pnpm exec elevasis-sdk knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governed-by/
140
+
141
+ # Monorepo
142
+ pnpm exec elevasis knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governed-by/
143
+ ```
144
+
145
+ ## Read a Node Body
146
+
147
+ `knowledge:cat` prints the raw MDX `body` string for a node. The body is not rendered -- it is the source MDX as stored in the OrganizationModel.
148
+
149
+ ```bash
150
+ # External project
151
+ pnpm exec elevasis-sdk knowledge:cat knowledge.new-vertical-launch-playbook
152
+
153
+ # Monorepo
154
+ pnpm exec elevasis knowledge:cat knowledge.new-vertical-launch-playbook
155
+ ```
156
+
157
+ Pipe to a pager for long bodies:
158
+
159
+ ```bash
160
+ pnpm exec elevasis knowledge:cat knowledge.platform-composition-patterns | less
161
+ ```
162
+
163
+ ## Inspect a Node's Edges
164
+
165
+ `knowledge:graph` shows all edges for a node grouped by kind:
166
+
167
+ ```bash
168
+ # External project
169
+ pnpm exec elevasis-sdk knowledge:graph knowledge.new-vertical-launch-playbook
170
+
171
+ # Monorepo
172
+ pnpm exec elevasis knowledge:graph knowledge.new-vertical-launch-playbook
173
+ ```
174
+
175
+ This combines the `governs` and `governed-by` views in one output, useful for understanding a node's full graph position.
176
+
177
+ ## JSON Output
178
+
179
+ All three verbs accept `--json`. `knowledge:ls --json` uses the wrapped envelope format:
180
+
181
+ ```json
182
+ {
183
+ "path": "/by-system/sales.crm",
184
+ "mount": "by-system",
185
+ "args": ["sales.crm"],
186
+ "results": [...]
187
+ }
188
+ ```
189
+
190
+ This is the format consumed by the `/knowledge` agent skill. Use it when scripting or building tooling that reads knowledge graph data programmatically.
191
+
192
+ `knowledge:cat --json` returns the full knowledge node object, including the MDX `body`, links, owners, timestamps, and generated `sourceFilePath` when present.
193
+
194
+ `knowledge:graph --json` returns the same shape in both CLIs:
195
+
196
+ ```json
197
+ {
198
+ "nodeId": "knowledge.new-vertical-launch-playbook",
199
+ "outgoing": [],
200
+ "incoming": []
201
+ }
202
+ ```
203
+
204
+ ```bash
205
+ pnpm exec elevasis knowledge:ls /by-kind/playbook --json | jq '.results[].id'
206
+ ```
207
+
208
+ ## Windows Note
209
+
210
+ On Windows, MSYS Bash rewrites path arguments starting with `/` to Windows filesystem paths before the CLI sees them. Use PowerShell:
211
+
212
+ ```powershell
213
+ # Correct on Windows -- PowerShell leaves the path arg intact
214
+ pnpm exec elevasis knowledge:ls /by-kind/playbook
215
+
216
+ # Wrong on Windows -- MSYS Bash mangles to C:\by-kind\playbook or similar
217
+ bash -c "pnpm exec elevasis knowledge:ls /by-kind/playbook"
218
+ ```
219
+
220
+ All other `elevasis` and `elevasis-sdk` commands are unaffected; this gotcha is specific to path arguments that start with `/`.
221
+
222
+ ## See Also
223
+
224
+ - [Query functions API](../reference/contracts.md) -- `bySystem`, `byOntology`, `byKind`, `byOwner`, `governs`, `governedBy` TypeScript signatures
225
+ - [Glossary](../reference/glossary.md) -- `systemId`, `nodeId`, `kind`, `ownerIds`
226
+ - [Knowledge Browser](../../../../apps/docs/content/docs/in-progress/active-development/sdk-changes/knowledge/index.mdx) -- task doc for the full Knowledge Map bundle
227
+