@elevasis/sdk 1.5.2 → 1.5.4

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 (63) hide show
  1. package/dist/cli.cjs +899 -57
  2. package/dist/index.d.ts +94 -110
  3. package/package.json +3 -3
  4. package/reference/_navigation.md +11 -1
  5. package/reference/_reference-manifest.json +70 -0
  6. package/reference/claude-config/commands/submit-issue.md +12 -0
  7. package/reference/claude-config/hooks/post-edit-validate.mjs +109 -0
  8. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -0
  9. package/reference/claude-config/rules/deployment.md +57 -0
  10. package/reference/claude-config/rules/docs.md +26 -0
  11. package/reference/claude-config/rules/error-handling.md +56 -0
  12. package/reference/claude-config/rules/execution.md +40 -0
  13. package/reference/claude-config/rules/frontend.md +43 -0
  14. package/reference/claude-config/rules/observability.md +31 -0
  15. package/reference/claude-config/rules/organization-os.md +62 -0
  16. package/reference/claude-config/rules/platform.md +41 -0
  17. package/reference/claude-config/rules/shared-types.md +46 -0
  18. package/reference/claude-config/rules/task-tracking.md +47 -0
  19. package/reference/claude-config/scripts/statusline-command.js +18 -0
  20. package/reference/claude-config/settings.json +30 -0
  21. package/reference/claude-config/skills/deploy/SKILL.md +166 -0
  22. package/reference/claude-config/skills/dsp/SKILL.md +66 -0
  23. package/reference/claude-config/skills/elevasis/SKILL.md +239 -0
  24. package/reference/claude-config/skills/explore/SKILL.md +78 -0
  25. package/reference/claude-config/skills/project/SKILL.md +918 -0
  26. package/reference/claude-config/skills/save/SKILL.md +197 -0
  27. package/reference/claude-config/skills/setup/SKILL.md +210 -0
  28. package/reference/claude-config/skills/status/SKILL.md +60 -0
  29. package/reference/claude-config/skills/submit-issue/SKILL.md +179 -0
  30. package/reference/claude-config/skills/sync/SKILL.md +81 -0
  31. package/reference/cli.mdx +35 -20
  32. package/reference/deployment/index.mdx +6 -5
  33. package/reference/deployment/provided-features.mdx +62 -40
  34. package/reference/deployment/ui-execution.mdx +1 -2
  35. package/reference/framework/agent.mdx +50 -50
  36. package/reference/framework/index.mdx +13 -10
  37. package/reference/framework/project-structure.mdx +76 -70
  38. package/reference/packages/core/src/README.md +24 -17
  39. package/reference/packages/core/src/business/README.md +52 -0
  40. package/reference/packages/core/src/organization-model/README.md +25 -26
  41. package/reference/packages/ui/src/app/README.md +24 -0
  42. package/reference/packages/ui/src/provider/README.md +8 -7
  43. package/reference/platform-tools/type-safety.mdx +0 -10
  44. package/reference/roadmap.mdx +6 -4
  45. package/reference/scaffold/core/organization-graph.mdx +37 -28
  46. package/reference/scaffold/core/organization-model.mdx +34 -36
  47. package/reference/scaffold/index.mdx +14 -9
  48. package/reference/scaffold/operations/propagation-pipeline.md +133 -0
  49. package/reference/scaffold/operations/scaffold-maintenance.md +125 -0
  50. package/reference/scaffold/operations/workflow-recipes.md +18 -1
  51. package/reference/scaffold/recipes/add-a-feature.md +37 -21
  52. package/reference/scaffold/recipes/add-a-resource.md +16 -12
  53. package/reference/scaffold/recipes/customize-organization-model.md +400 -0
  54. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -0
  55. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +18 -12
  56. package/reference/scaffold/recipes/index.md +3 -3
  57. package/reference/scaffold/reference/contracts.md +11 -32
  58. package/reference/scaffold/reference/feature-registry.md +10 -9
  59. package/reference/scaffold/reference/glossary.md +14 -18
  60. package/reference/scaffold/ui/customization.md +2 -2
  61. package/reference/scaffold/ui/feature-flags-and-gating.md +40 -54
  62. package/reference/scaffold/ui/feature-shell.mdx +23 -24
  63. package/reference/scaffold/ui/recipes.md +118 -3
@@ -5,7 +5,7 @@ description: Organization OS Graph layer documentation for the Cytoscape-based o
5
5
 
6
6
  ## Overview
7
7
 
8
- Within Organization OS, the organization graph is the dedicated **Graph** layer. It treats the organization model as the top-level ontology and bridges in Command View runtime topology so one graph can support semantic exploration and operations-oriented tracing. It is not a replacement renderer for Command View; it is a shared graph product that subsumes Command View as one operational lens.
8
+ Within Organization OS, the organization graph is the dedicated **Graph** layer. It treats the organization model as the top-level ontology and bridges in Command View runtime topology so one graph can support semantic exploration and operations-oriented tracing. Command View is now one lens over this shared graph, not a separate live graph renderer.
9
9
 
10
10
  Graph contracts live in `@repo/core` alongside the organization model. Rendering lives in `@repo/ui` with Cytoscape.js. The command-center route is a thin wrapper over the shared page.
11
11
 
@@ -32,7 +32,7 @@ Graph types are intentionally **not** part of the published `@elevasis/core` sur
32
32
  The graph helps users:
33
33
 
34
34
  - orient themselves in the organization model
35
- - discover how domains, capabilities, surfaces, entities, resources, and workflows connect
35
+ - discover how features, capabilities, surfaces, entities, resources, and workflows connect
36
36
  - trace upstream/downstream dependencies
37
37
  - understand ownership and implementation boundaries
38
38
  - assess blast radius before changing a workflow, agent, feature, or integration
@@ -46,21 +46,22 @@ The graph does not replace workflow editors, execution-run visualizers, or build
46
46
 
47
47
  The implementation uses one typed graph, not separate semantic and implementation taxonomies.
48
48
 
49
- - Node kinds: `organization`, `feature`, `domain`, `surface`, `entity`, `capability`, `resource`
49
+ - Node kinds: `organization`, `feature`, `surface`, `entity`, `capability`, `resource`
50
50
  - Edge kinds: `contains`, `references`, `exposes`, `maps_to`
51
51
  - `resource` nodes carry `resourceType` metadata: `workflow`, `agent`, `trigger`, `integration`, `external`, or `human_checkpoint`
52
52
  - `references` edges may also carry `relationshipType`: `triggers`, `uses`, or `approval`
53
53
 
54
- This means runtime topology is represented as bridged `resource` nodes plus relationship metadata on shared edge types, rather than as a second disconnected edge/node vocabulary.
54
+ This means runtime topology is represented as bridged `resource` nodes plus relationship metadata on shared edge types, rather than as a second disconnected edge/node vocabulary. `maps_to` is the main crossover edge: the builder emits it from organization-model resource mappings, and the UI presence helpers also treat it as topology-facing when classifying which non-resource nodes participate in runtime-adjacent views.
55
55
 
56
56
  ### Compatibility rules with the organization model
57
57
 
58
58
  - `OrganizationModelSchema` is the source of truth for semantic structure. The graph does not introduce a second ontology.
59
59
  - Graph node IDs and references reuse organization-model IDs wherever those IDs already exist.
60
- - `domain` nodes derive from `organizationModel.domains`.
61
60
  - `surface` nodes derive from `organizationModel.navigation.surfaces`; graph routing respects surface `path` and `defaultSurfaceId`.
62
61
  - Feature gating and labels respect `organizationModel.features.enabled` and `.labels`.
63
62
  - Implementation-resource bridging prefers `organizationModel.resourceMappings`.
63
+ - Semantic grouping now comes from the unified `organizationModel.features` array. The builder no longer emits separate `domain` nodes.
64
+ - Command View resource `domains` metadata is currently bridged onto `feature` references, not onto a distinct domain-node layer.
64
65
  - Graph defaults remain valid when produced by `resolveOrganizationModel()`.
65
66
  - If the graph needs a concept the model cannot express, extend the model first.
66
67
 
@@ -70,7 +71,6 @@ This means runtime topology is represented as bridged `resource` nodes plus rela
70
71
  type OrganizationGraphNodeKind =
71
72
  | 'organization'
72
73
  | 'feature'
73
- | 'domain'
74
74
  | 'surface'
75
75
  | 'entity'
76
76
  | 'capability'
@@ -86,7 +86,7 @@ interface OrganizationGraph {
86
86
  }
87
87
  ```
88
88
 
89
- `OrganizationGraphNode` also includes optional `sourceId`, `description`, `enabled`, `featureKey`, `surfaceType`, and `resourceType`. `OrganizationGraphEdge` includes optional `label` and `relationshipType`.
89
+ `OrganizationGraphNode` also includes optional `sourceId`, `description`, `enabled`, `featureId`, `surfaceType`, and `resourceType`. `OrganizationGraphEdge` includes optional `label` and `relationshipType`.
90
90
 
91
91
  ### Build pipeline
92
92
 
@@ -100,9 +100,9 @@ interface BuildOrganizationGraphInput {
100
100
  `buildOrganizationGraph` accepts optional topology input so the semantic graph still renders when operational bridging is sparse. The derivation flow is additive and upsert-oriented:
101
101
 
102
102
  1. Resolve the active organization model.
103
- 2. Derive semantic nodes and edges from domains, features, surfaces, entities, capabilities, and resource mappings.
103
+ 2. Derive semantic nodes and edges from features, surfaces, entities, capabilities, and resource mappings.
104
104
  3. Upsert bridged runtime resources from Command View data into shared `resource` nodes.
105
- 4. Merge topology relationships onto the same DTO using `references` or `maps_to` edges plus optional `relationshipType`.
105
+ 4. Bridge Command View runtime topology onto the same DTO as `references` edges between `resource` nodes, using `relationshipType` for runtime relationship labels.
106
106
  5. Hand the resulting graph to UI-level lensing, filtering, and Cytoscape projection.
107
107
 
108
108
  Keeping assembly outside the renderer keeps graph semantics testable without UI and prevents Cytoscape concepts from leaking into business logic.
@@ -110,7 +110,7 @@ Keeping assembly outside the renderer keeps graph semantics testable without UI
110
110
  ### Ownership split
111
111
 
112
112
  - `@repo/core` owns normalized node/edge types, schemas, and build/derivation helpers.
113
- - `@repo/ui` owns Cytoscape element conversion, layout presets, selection/hover/expansion/viewport state, detail panels, and presentation helpers.
113
+ - `@repo/ui` owns Cytoscape element conversion, layout presets, selection state, path tracing, viewport mechanics, detail panels, and presentation helpers.
114
114
  - `apps/command-center` owns route wiring and page-level integration.
115
115
 
116
116
  ## Interaction Model
@@ -124,6 +124,8 @@ The graph ships with two lens presets in UI code:
124
124
 
125
125
  Lenses do not change the core DTO. They configure how the shared graph is initially presented.
126
126
 
127
+ The command-view preset is intentionally narrow. It starts from topology-focused `resource` nodes so runtime traces stay readable, even though the underlying graph still contains semantic nodes and bridge edges.
128
+
127
129
  ### Modes
128
130
 
129
131
  - **Map mode** -- clustered for broad graph orientation
@@ -138,18 +140,13 @@ Layouts are deterministic presets, not unconstrained force simulation:
138
140
 
139
141
  ### Interactions
140
142
 
141
- Primary set, kept small and high-value:
143
+ Primary set in the current shared page:
142
144
 
143
145
  - click node for detail panel
144
146
  - click edge for relationship meaning
145
- - hover for adjacency preview
146
- - search and jump to node
147
- - expand immediate neighbors
148
- - isolate selected node + N-hop neighborhood
149
147
  - switch mode
150
- - pin selected nodes
151
- - highlight shortest or most relevant path between two nodes
152
- - filter by node kind, domain, capability, feature, status, environment
148
+ - highlight shortest directed paths between two visible nodes in trace mode
149
+ - filter by node kind, topology presence, and free-text search
153
150
 
154
151
  Deferred: freeform node placement, collaborative annotations, graph editing/authoring, arbitrary canvas drawing.
155
152
 
@@ -163,13 +160,15 @@ Filter inputs:
163
160
  - `nodeKinds`
164
161
  - `topologyPresence: 'all' | 'semantic-only' | 'topology-only'`
165
162
 
166
- Presence is derived per node:
163
+ Presence is derived per node in UI helpers:
167
164
 
168
165
  - `resource` nodes are `topology-only`
169
- - nodes with only semantic edges are `semantic-only`
170
- - nodes with both semantic and topology edges are treated as bridge nodes internally
166
+ - non-resource nodes with only semantic edges are `semantic-only`
167
+ - non-resource nodes with `maps_to` edges or runtime relationship edges alongside semantic edges are treated as `bridge` nodes internally
168
+
169
+ `bridge` is an internal classification used by the filtering helpers. The public filter control only exposes `all`, `semantic-only`, and `topology-only`, so bridge nodes appear when presence is `all`.
171
170
 
172
- Search matches node IDs, labels, descriptions, source IDs, feature keys, surface/resource types, edge labels, edge kinds, and `relationshipType`.
171
+ Search matches node IDs, labels, descriptions, source IDs, feature IDs, surface/resource types, edge labels, edge kinds, and `relationshipType`.
173
172
 
174
173
  The page applies `useDeferredValue()` to the active filters so graph search stays responsive while typing.
175
174
 
@@ -188,19 +187,28 @@ The graph is exposed through `ElevasisFeaturesProvider` rather than as app-local
188
187
  - The provider resolves that against `organizationModel.navigation.surfaces` and exposes the result as `organizationGraph` in context.
189
188
  - Shared UI/operations code stays manifest-driven while remaining aware of semantic organization topology.
190
189
 
190
+ This provider bridge resolves the canonical shared graph surface, not a Command View-specific surface. Command View still has its own navigation surface (`operations.command-view`), but the live page delegates into the shared graph renderer.
191
+
191
192
  ## Command View Integration
192
193
 
193
- `CommandViewPage` now delegates to `OrganizationGraphPage` through a command-view lens preset. The lens restores high-value operational context through:
194
+ `CommandViewPage` now delegates to `OrganizationGraphPage` through a command-view lens preset. The shared page adds command-view operational context through:
194
195
 
195
- - route-level execution-health cards
196
+ - command-view summary cards rendered in `OrganizationGraphPage`
196
197
  - selection-aware resource and human-checkpoint summaries inside the shared graph detail panel
197
198
  - follow-up actions for recent executions and pending tasks inside the detail panel
198
- - dedicated command-view sidebar content (`Command View` labeling and node filters live in the subshell sidebar, not on the graph canvas)
199
+ - dedicated command-view sidebar content alongside the shared graph controls
199
200
 
200
201
  Operational summary and drill-down derivation is covered by tests under `packages/ui/src/features/operations/organization-graph/__tests__/`.
201
202
 
202
203
  The detail experience is shared through `OrganizationGraphDetailPanel`, which can render both semantic context and command-view-specific follow-up sections.
203
204
 
205
+ Keep the current seam explicit:
206
+
207
+ - The graph canvas, selection model, path tracing, shared filters, and detail panel all live in `OrganizationGraphPage`.
208
+ - `OperationsSidebarMiddle` still renders `CommandViewSidebarContent` for `/operations/command-view`.
209
+ - That sidebar remains a companion operational panel with some legacy store/filter assumptions and is not the source of truth for the shared graph's filter state.
210
+ - Older React Flow Command View code still exists in the repo, but it is no longer the live renderer for the current Command View route.
211
+
204
212
  ## Cytoscape Responsibility Split
205
213
 
206
214
  Cytoscape owns:
@@ -217,16 +225,17 @@ React owns:
217
225
 
218
226
  - mode switching
219
227
  - side panels and inspectors
220
- - search and command-palette entry
228
+ - filter toolbar search and trace controls
221
229
  - route state and deep-linking
222
230
  - server data fetching
223
- - persistence of saved filters and views
224
231
 
225
232
  ## Package Boundary
226
233
 
227
234
  - `packages/ui/package.json` declares Cytoscape on the published UI surface.
228
235
  - `packages/ui/tsup.config.ts` and `packages/ui/rollup.dts.config.mjs` keep Cytoscape **externalized** for publish output.
229
- - Graph DTO types are internal to `@repo/core`. The published `@elevasis/core` wrapper still exposes only the narrow organization-model API. External graph adoption should not be assumed.
236
+ - Graph DTO types, schemas, and builders live in monorepo `@repo/core` organization-model modules.
237
+ - Cytoscape rendering, lens presets, filtering helpers, and detail/runtime presentation live in `@repo/ui`.
238
+ - The published `@elevasis/core` wrapper still exposes only the narrow organization-model API; this graph contract should be treated as monorepo-internal for now.
230
239
 
231
240
  ## Theming
232
241
 
@@ -21,7 +21,7 @@ The model does **not** replace the shared feature-provider system. It enriches a
21
21
  - `packages/core/src/organization-model/types.ts` -- exported TypeScript types
22
22
  - `packages/core/src/organization-model/defaults.ts` -- `DEFAULT_ORGANIZATION_MODEL`
23
23
  - `packages/core/src/organization-model/resolve.ts` -- `defineOrganizationModel`, `resolveOrganizationModel`
24
- - `packages/core/src/organization-model/domains/*.ts` -- feature keys, navigation surfaces, CRM/lead-gen/delivery semantics
24
+ - `packages/core/src/organization-model/domains/*.ts` -- feature schema, navigation surfaces, CRM/lead-gen/delivery semantics
25
25
  - `packages/core/src/published.ts` -- curated root barrel for the published package
26
26
  - `packages/core/src/organization-model/published.ts` -- curated organization-model barrel
27
27
  - `packages/core/src/__tests__/template-foundations-compatibility.test.ts` -- adapter-baseline guard
@@ -31,9 +31,8 @@ The model does **not** replace the shared feature-provider system. It enriches a
31
31
  Top-level fields on `OrganizationModel`:
32
32
 
33
33
  - `version`
34
- - `domains` -- semantic domains (`crm`, `lead-gen`, `delivery`, `operations`)
34
+ - `features` -- unified feature array (`OrganizationModelFeature[]`); each entry combines access gating, semantic grouping, and display metadata
35
35
  - `branding`
36
- - `features` -- `enabled` map and `labels` overrides
37
36
  - `navigation` -- surfaces, groups, `defaultSurfaceId`
38
37
  - `crm` -- pipeline stages and stage semantics
39
38
  - `leadGen` -- company/contact lifecycle stages
@@ -61,24 +60,21 @@ All `id` fields, `parentId`, `defaultSurfaceId`, and reference ID arrays use `Mo
61
60
 
62
61
  This applies to domain IDs, surface IDs, navigation group IDs, and resource mapping IDs.
63
62
 
64
- ### Default Feature Keys
63
+ ### Default Features
65
64
 
66
- ```ts
67
- type OrganizationModelFeatureKey =
68
- | 'acquisition'
69
- | 'delivery'
70
- | 'operations'
71
- | 'monitoring'
72
- | 'settings'
73
- | 'seo'
74
- | 'calibration'
75
- ```
65
+ Seven features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
76
66
 
77
- These are the **grouped** published access/visibility keys. They differ from shell feature-module keys (`crm`, `lead-gen`, `delivery`). See [Feature Shell](../ui/feature-shell.mdx) for how the provider bridges the two.
67
+ - `crm` -- enabled; CRM pipeline and deal management
68
+ - `lead-gen` -- enabled; prospecting, qualification, and outreach
69
+ - `projects` -- enabled; projects, milestones, and client work execution (formerly `delivery`)
70
+ - `operations` -- enabled; organizational topology and orchestration visibility
71
+ - `monitoring` -- enabled; execution monitoring
72
+ - `settings` -- enabled; organization settings
73
+ - `seo` -- disabled by default; SEO surface
78
74
 
79
- ### Default Semantic Domains
75
+ Each feature entry (`OrganizationModelFeature`) combines what were previously three separate concepts: an access/gating key (the former `OrganizationModelFeatureKey`), a semantic domain (the former `SemanticDomainSchema` entry), and display metadata. The `features` field is now `z.array(FeatureSchema)` -- there is no separate `domains` array and no separate `enabled`/`labels` map.
80
76
 
81
- Four domains ship by default -- `crm`, `lead-gen`, `delivery`, `operations`. Each binds together entity IDs, surface IDs, resource IDs, and capability IDs. Domains are semantic, not purely navigational -- they describe what area of the business or resource model a thing belongs to, not which access key gates it.
77
+ `FeatureModule.featureId` on the UI side maps directly to one of these IDs. No alias layer is needed. See [Feature Shell](../ui/feature-shell.mdx) for how the provider resolves feature access from this array.
82
78
 
83
79
  ### ResourceMapping Shape
84
80
 
@@ -88,7 +84,7 @@ Four domains ship by default -- `crm`, `lead-gen`, `delivery`, `operations`. Eac
88
84
  - `resourceId` -- the actual resource identifier (string, max 255 chars)
89
85
  - `resourceType` -- one of `'workflow' | 'agent' | 'trigger' | 'integration' | 'external' | 'human_checkpoint'`
90
86
  - `label`, `description`, `color`, `icon` -- display metadata (from `DisplayMetadataSchema`)
91
- - `domainIds` -- domains this resource belongs to
87
+ - `featureIds` -- features this resource belongs to (replaces the former `domainIds`)
92
88
  - `entityIds` -- entities this resource operates on
93
89
  - `surfaceIds` -- surfaces this resource is exposed in
94
90
  - `capabilityIds` -- capabilities this resource fulfills
@@ -109,9 +105,9 @@ Surfaces such as `crm.pipeline`, `lead-gen.lists`, `projects.index`, `operations
109
105
  - `surfaceType` -- `'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'`
110
106
  - `description` -- optional
111
107
  - `icon` -- optional icon name token (max 80 chars)
112
- - `featureKey` -- optional `OrganizationModelFeatureKey` that gates this surface
108
+ - `featureId` -- optional feature ID that gates this surface (replaces the former `featureKey` field); must match a feature `id` in the features array
113
109
  - `parentId` -- optional ModelId referencing a parent surface; validated to exist
114
- - `domainIds` -- domains this surface belongs to (bidirectionally validated)
110
+ - `featureIds` -- features this surface belongs to (bidirectionally validated; replaces the former `domainIds`)
115
111
  - `entityIds` -- entity IDs relevant to this surface
116
112
  - `resourceIds` -- resources exposed on this surface (bidirectionally validated against resource mappings)
117
113
  - `capabilityIds` -- capabilities this surface fulfills
@@ -126,11 +122,13 @@ Surfaces such as `crm.pipeline`, `lead-gen.lists`, `projects.index`, `operations
126
122
 
127
123
  The default groups (`primary-workspace`, `primary-operations`) both use `placement: 'primary'`.
128
124
 
129
- ### Domain-Specific Semantics
125
+ ### Feature-Specific Semantics
130
126
 
131
- - **CRM** -- pipeline stages and stage semantics
132
- - **Lead-gen** -- company and contact lifecycle stages
133
- - **Delivery** -- project, milestone, and task statuses
127
+ The top-level `crm`, `leadGen`, and `delivery` fields on `OrganizationModel` remain as named fields (not moved into per-feature config) and carry domain-specific semantic shapes:
128
+
129
+ - `crm` -- pipeline stages and stage semantics
130
+ - `leadGen` -- company and contact lifecycle stages
131
+ - `delivery` -- project, milestone, and task statuses (used by the `projects` feature)
134
132
 
135
133
  This is why the organization model is semantic, not just nav config -- it owns product meaning for the business objects the shell surfaces expose.
136
134
 
@@ -152,7 +150,7 @@ Merge semantics:
152
150
 
153
151
  **Uniqueness checks** -- IDs must be unique within their respective collections:
154
152
 
155
- - `domains[].id`
153
+ - `features[].id`
156
154
  - `navigation.surfaces[].id`
157
155
  - `navigation.groups[].id`
158
156
  - `resourceMappings[].id`
@@ -162,20 +160,20 @@ Merge semantics:
162
160
 
163
161
  - `navigation.defaultSurfaceId` must point at a declared surface
164
162
  - every `surfaceId` in a navigation group must resolve to a declared surface
165
- - every `surfaceId` in a domain must resolve to a declared surface
166
- - every `resourceId` in a domain must resolve to a declared resource mapping (by `resourceId`)
163
+ - every `surfaceId` in a feature must resolve to a declared surface
164
+ - every `resourceId` in a feature must resolve to a declared resource mapping (by `resourceId`)
167
165
  - surface `parentId` must reference an existing surface
168
- - every `domainId` on a surface must resolve to a declared domain
166
+ - every `featureId` on a surface must resolve to a declared feature
169
167
  - every `resourceId` on a surface must resolve to a declared resource mapping
170
- - every `domainId` on a resource mapping must resolve to a declared domain
168
+ - every `featureId` on a resource mapping must resolve to a declared feature
171
169
  - every `surfaceId` on a resource mapping must resolve to a declared surface
172
170
 
173
171
  **Bidirectional reference enforcement** -- cross-references must be mutual, not one-sided:
174
172
 
175
- - a domain listing `surfaceId` S requires surface S to list that domain's ID in its `domainIds`
176
- - a surface listing `domainId` D requires domain D to list that surface's ID in its `surfaceIds`
177
- - a domain listing `resourceId` R requires resource mapping R to list that domain's ID in its `domainIds`
178
- - a resource mapping listing `domainId` D requires domain D to list that resource's `resourceId` in its `resourceIds`
173
+ - a feature listing `surfaceId` S requires surface S to list that feature's ID in its `featureIds`
174
+ - a surface listing `featureId` F requires feature F to list that surface's ID in its `surfaceIds`
175
+ - a feature listing `resourceId` R requires resource mapping R to list that feature's ID in its `featureIds`
176
+ - a resource mapping listing `featureId` F requires feature F to list that resource's `resourceId` in its `resourceIds`
179
177
  - a surface listing `resourceId` R requires resource mapping R to list that surface's ID in its `surfaceIds`
180
178
  - a resource mapping listing `surfaceId` S requires surface S to list that resource's `resourceId` in its `resourceIds`
181
179
 
@@ -185,8 +183,8 @@ This bidirectional enforcement is what keeps the organization model semantically
185
183
 
186
184
  `ElevasisFeaturesProvider` uses the organization model in three ways:
187
185
 
188
- 1. **Feature resolution** -- provider first checks `useFeatureAccess()`, then refines through organization-model feature state when the model knows the key.
189
- 2. **Nav label and path resolution** -- when `organizationModel` is present, feature labels resolve from `organizationModel.features.labels`, and surface labels and paths resolve from `organizationModel.navigation.surfaces`. Semantic customization without changing manifest code.
186
+ 1. **Feature resolution** -- the provider looks up each manifest's `featureId` in `organizationModel.features` to determine `access.enabled`. If no matching feature entry is found, `access.enabled` defaults to `false`.
187
+ 2. **Nav label and path resolution** -- when `organizationModel` is present, feature labels resolve from the matching feature entry's `label` field, and surface labels and paths resolve from `organizationModel.navigation.surfaces`. Semantic customization without changing manifest code.
190
188
  3. **Organization-graph bridge** -- the `operationsManifest` declares `organizationGraph.surfaceId = 'operations.organization-graph'`. The provider resolves that against organization-model surfaces and exposes the result as `organizationGraph` in context. See [Organization Graph](./organization-graph.mdx).
191
189
 
192
190
  ## Published Package: `@elevasis/core`
@@ -238,7 +236,7 @@ Exports the foundations module provides to consumers:
238
236
  - `FoundationFeatureKey`, `FoundationSurfaceIcon`, `FoundationNavigationSurface`, `FoundationOrganizationModel`
239
237
  - `homeLabel`, `quickAccessSurfaceIds`, `getOrganizationSurface(surfaceId)`
240
238
 
241
- Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Grouped core features map onto template vocabulary -- `crm` and `lead-gen` project from `acquisition`, `projects` from `delivery`.
239
+ Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Feature IDs are now direct matches -- `crm`, `lead-gen`, `projects` in the org model correspond directly to the same IDs on `FeatureModule.featureId`. No alias layer is needed.
242
240
 
243
241
  Derivative projects (`external/nirvana-marketing`, `external/ZentaraHQ`) follow the same adapter + provider-wiring baseline with their own project-local customizations.
244
242
 
@@ -19,6 +19,7 @@ This scaffold reference contains universal documentation that applies to all Ele
19
19
 
20
20
  - [Add a Feature](./recipes/add-a-feature.md) -- end-to-end from org model key through manifest, routes, gating
21
21
  - [Add a Resource](./recipes/add-a-resource.md) -- author and deploy a workflow or agent
22
+ - [Extend a Base Entity](./recipes/extend-a-base-entity.md) -- add project-specific metadata to canonical entity shapes via the TMeta slot
22
23
  - [Gate by Feature or Admin](./recipes/gate-by-feature-or-admin.md) -- decision table for access control patterns
23
24
 
24
25
  ### UI Patterns
@@ -37,6 +38,8 @@ This scaffold reference contains universal documentation that applies to all Ele
37
38
  ### Operations
38
39
 
39
40
  - [Workflow Recipes](./operations/workflow-recipes.md) -- workflow anatomy, adapter patterns, trigger patterns
41
+ - [Propagation Pipeline](./operations/propagation-pipeline.md) -- three-layer sync pipeline, verification checks, integration points
42
+ - [Scaffold Maintenance](./operations/scaffold-maintenance.md) -- content placement, auto-generation, adding new scaffold docs
40
43
 
41
44
  ### Reference
42
45
 
@@ -48,12 +51,14 @@ This scaffold reference contains universal documentation that applies to all Ele
48
51
 
49
52
  Content is co-located with its owning package and copied here during SDK build:
50
53
 
51
- | Bundle Path | Source Location | Owner |
52
- | ---------------------------------------- | --------------------------------------------------------- | --------------- |
53
- | `scaffold/recipes/` | `packages/sdk/docs/scaffold/recipes/` | SDK |
54
- | `scaffold/operations/` | `packages/sdk/docs/scaffold/operations/` | SDK |
55
- | `scaffold/ui/` | `packages/ui/src/scaffold/` | UI |
56
- | `scaffold/core/` | `packages/core/src/organization-model/` | Core |
57
- | `scaffold/reference/glossary.md` | `packages/core/src/reference/glossary.md` | Core |
58
- | `scaffold/reference/contracts.md` | `packages/core/src/reference/_generated/contracts.md` | Core (auto-gen) |
59
- | `scaffold/reference/feature-registry.md` | `packages/ui/src/scaffold/_generated/feature-registry.md` | UI (auto-gen) |
54
+ | Bundle Path | Source Location | Owner |
55
+ | --------------------------------------------- | --------------------------------------------------------- | --------------- |
56
+ | `scaffold/recipes/` | `packages/sdk/docs/scaffold/recipes/` | SDK |
57
+ | `scaffold/operations/` | `packages/sdk/docs/scaffold/operations/` | SDK |
58
+ | `scaffold/operations/propagation-pipeline.md` | `packages/sdk/docs/scaffold/operations/` | SDK |
59
+ | `scaffold/operations/scaffold-maintenance.md` | `packages/sdk/docs/scaffold/operations/` | SDK |
60
+ | `scaffold/ui/` | `packages/ui/src/scaffold/` | UI |
61
+ | `scaffold/core/` | `packages/core/src/organization-model/` | Core |
62
+ | `scaffold/reference/glossary.md` | `packages/core/src/reference/glossary.md` | Core |
63
+ | `scaffold/reference/contracts.md` | `packages/core/src/reference/_generated/contracts.md` | Core (auto-gen) |
64
+ | `scaffold/reference/feature-registry.md` | `packages/ui/src/scaffold/_generated/feature-registry.md` | UI (auto-gen) |
@@ -0,0 +1,133 @@
1
+ ---
2
+ title: Propagation Pipeline
3
+ description: Three-layer pipeline that keeps Organization OS artifacts current across the monorepo and all template-derived external projects -- source generation, template sync, and verification.
4
+ ---
5
+
6
+ # Propagation Pipeline
7
+
8
+ `🟢 Stable` -- These pipelines run automatically. Understand them when debugging sync issues or extending the scaffold.
9
+
10
+ ---
11
+
12
+ ## Architecture
13
+
14
+ The Organization OS propagation pipeline has three layers. Each has its own scripts, triggers, and failure modes.
15
+
16
+ ```
17
+ Layer 1: Source Generation (pnpm scaffold:sync)
18
+ Regenerates derived docs from TypeScript types and manifests
19
+
20
+ Layer 2: Template Sync (/external sync)
21
+ Propagates template to downstream external projects
22
+
23
+ Layer 3: Sync Verification (pnpm sync:verify)
24
+ Asserts correctness across all template-derived projects
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Layer 1: Source Generation
30
+
31
+ `pnpm scaffold:sync` is the meta-script that regenerates all derived documentation and validates the output. It chains three sub-scripts:
32
+
33
+ | Script | Input | Output |
34
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
35
+ | `generate-scaffold-contracts.js` | `packages/core/src/organization-model/types.ts`, `packages/ui/src/features/registry/types.ts`, `packages/core/src/platform/registry/types.ts` | `packages/core/src/reference/_generated/contracts.md` |
36
+ | `generate-scaffold-feature-registry.js` | `packages/ui/src/features/*/manifest.ts`, `packages/core/src/organization-model/domains/features.ts` | `packages/ui/src/scaffold/_generated/feature-registry.md` |
37
+ | `generate-reference-artifacts.js` | SDK manifest, navigation sources | `packages/sdk/reference/_reference-manifest.json`, `_navigation.md`, `external/_template/docs/platform-navigation-map.md` |
38
+
39
+ After generation, `validate-reference-artifacts.js` checks that the outputs are consistent. Exit 1 if drifted.
40
+
41
+ ### Trigger Points
42
+
43
+ - **`/external sync` Phase 0 (Scaffold Sync Preflight):** Runs before any writes. Generated file changes fold into the sync scope so they propagate naturally to `_template` and downstream projects.
44
+ - **`/sdk release` Step 1 (Shared Reference Preflight):** Runs before publish. Generated changes must be committed; validator failure is a hard blocker.
45
+ - **Manual:** `pnpm scaffold:sync` is idempotent and safe to run anytime.
46
+ - **Opt-out:** `--skip-scaffold-sync` on `/external sync` (rare).
47
+
48
+ ### Design: Regenerate-on-Propagation
49
+
50
+ Drift is healed at the moment it would otherwise leak downstream. This is cheaper and more reliable than CI-only checks. The single meta-script gives one command to reason about, while the chained sub-scripts remain individually callable for debugging.
51
+
52
+ ---
53
+
54
+ ## Layer 2: Template Sync
55
+
56
+ `/external sync` propagates the `external/_template` to downstream projects. It uses a three-tier model:
57
+
58
+ | Tier | Policy | Examples |
59
+ | ------------------------------ | ----------------------------------------- | ------------------------------------------------------------------- |
60
+ | **Tier 1 (Infrastructure)** | Always replaced from template | Configs, shared runtime surfaces, `lib/`, `test-utils/`, entry points |
61
+ | **Tier 2 (Standard Features)** | Synced unless project has customized them | Standard UI features, common patterns |
62
+ | **Tier 3 (Project-Specific)** | Never touched | `nav-items.ts`, `operations/src/`, `docs/`, `CLAUDE.md` |
63
+
64
+ The sync skill doc (`.claude/skills/external/SKILL.md`) defines the full tier model and phase sequence.
65
+
66
+ ---
67
+
68
+ ## Layer 3: Sync Verification
69
+
70
+ `pnpm sync:verify` runs 86+ automated checks to assert propagation correctness. The script lives at `scripts/external/verify-sync.js`.
71
+
72
+ ### Per-Project Checks (auto-discovered)
73
+
74
+ | Category | What It Checks |
75
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | `deps` | `@elevasis/ui`, `@elevasis/sdk`, `@elevasis/core` versions match template |
77
+ | `tier1` | 9 config files match template (with placeholder resolution for project slug/name) |
78
+ | `org-os` | Organization model exists, exports canonical symbols, imports from `@elevasis/core/organization-model`, calls `defineOrganizationModel` + `resolveOrganizationModel`, app-config references org model, `__root.tsx` uses `ElevasisFeaturesProvider` + `canonicalOrganizationModel`, `main.tsx` uses `ElevasisUIProvider`, all 3 CSS subpath imports present |
79
+ | `placeholders` | No unresolved `__PROJECT_SLUG__`, `__PROJECT_NAME__`, `__PROJECT_DESCRIPTION__` in key config files |
80
+ | `scripts` | `ui` and `operations` `package.json` have required npm scripts |
81
+ | `generated-docs` | `docs/index.md` and `docs/resources.md` are current with `pnpm exec elevasis-sdk generate-docs` and `pnpm exec elevasis-sdk generate-resources`; `pnpm exec elevasis-sdk validate-docs` passes |
82
+ | `lib` | `ui/src/lib/`, `lib/`, `test-utils/` exist with minimum file counts |
83
+ | `tier3` | `nav-items.ts` has project-specific customization (not overwritten by template) |
84
+ | `conflicts` | No merge conflict markers in source files |
85
+ | `git` | Working tree is clean |
86
+ | `lockfile` | `pnpm-lock.yaml` and `node_modules` exist |
87
+
88
+ ### Monorepo-Level Checks
89
+
90
+ | Category | What It Checks |
91
+ | ----------- | ----------------------------------------------- |
92
+ | `scaffold` | `pnpm scaffold:sync` passes (artifacts current) |
93
+ | `artifacts` | 5 generated artifacts exist and have content |
94
+
95
+ ### Usage
96
+
97
+ ```bash
98
+ pnpm sync:verify # Post-sync assertion (exit 1 on failures)
99
+ pnpm sync:verify --pre # Pre-sync drift report (always exit 0)
100
+ pnpm sync:verify -- ZentaraHQ # Single project
101
+ ```
102
+
103
+ ### Integration Points
104
+
105
+ - **`/external sync` Phase 0:** Runs `pnpm sync:verify --pre` to show drift before writes
106
+ - **`/external sync` Phase 5/7:** Runs `pnpm sync:verify` to assert correctness after sync
107
+ - **Vitest suite:** Tests at `scripts/external/__tests__/verify-sync.test.js` (project: `scripts-external`)
108
+
109
+ ### Known Acceptable Drifts
110
+
111
+ Some failures are expected and intentional:
112
+
113
+ - **`style.css` in nirvana-marketing:** Project-specific sidebar logo rounding customization
114
+ - **`.gitignore` in ZentaraHQ:** Minor project-specific additions
115
+ - **SDK patch versions:** Template may bump to a patch ahead of downstream projects between syncs
116
+
117
+ These do not indicate sync failures.
118
+
119
+ ### Tier Ownership Note
120
+
121
+ Local `.claude/` guidance remains valuable inside the template, but it is project-owned documentation and agent configuration rather than a Tier 1 sync contract. Template propagation should treat the generated docs, published package surfaces, and runtime entrypoints as the authoritative shared scaffold surface.
122
+
123
+ ---
124
+
125
+ ## Remaining Gaps (Future Work)
126
+
127
+ | Gap | Priority |
128
+ | ------------------------------------------------------------------------- | -------- |
129
+ | Feature manifest validation (all manifests imported in `__root.tsx`) | Medium |
130
+ | TypeScript verification (`check-types` per project) | Medium |
131
+ | Template docs surface validation (`docs/index.md`, `agent-start-here.md`) | Medium |
132
+ | Environment variable template validation (`.env.example` completeness) | Low |
133
+ | CI drift check (fail if worktree dirty after `scaffold:sync`) | Low |