@elevasis/sdk 1.6.0 → 1.7.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 (28) hide show
  1. package/dist/cli.cjs +5 -5
  2. package/package.json +2 -2
  3. package/reference/claude-config/hooks/__tests__/pre-edit-vibe-gate.test.mjs +169 -0
  4. package/reference/claude-config/hooks/pre-edit-vibe-gate.mjs +128 -0
  5. package/reference/claude-config/logs/pre-edit-vibe-gate.log +23 -0
  6. package/reference/claude-config/rules/organization-os.md +55 -8
  7. package/reference/claude-config/rules/vibe.md +210 -0
  8. package/reference/claude-config/settings.json +11 -0
  9. package/reference/claude-config/skills/configure/SKILL.md +100 -0
  10. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -0
  11. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -0
  12. package/reference/claude-config/skills/configure/operations/customers.md +150 -0
  13. package/reference/claude-config/skills/configure/operations/features.md +163 -0
  14. package/reference/claude-config/skills/configure/operations/goals.md +147 -0
  15. package/reference/claude-config/skills/configure/operations/identity.md +133 -0
  16. package/reference/claude-config/skills/configure/operations/labels.md +128 -0
  17. package/reference/claude-config/skills/configure/operations/offerings.md +159 -0
  18. package/reference/claude-config/skills/configure/operations/roles.md +153 -0
  19. package/reference/claude-config/skills/configure/operations/techStack.md +139 -0
  20. package/reference/claude-config/skills/setup/SKILL.md +81 -32
  21. package/reference/packages/core/src/organization-model/README.md +16 -12
  22. package/reference/scaffold/core/organization-graph.mdx +1 -0
  23. package/reference/scaffold/core/organization-model.mdx +84 -19
  24. package/reference/scaffold/recipes/add-a-feature.md +1 -1
  25. package/reference/scaffold/recipes/customize-organization-model.md +5 -5
  26. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +3 -3
  27. package/reference/scaffold/reference/contracts.md +115 -7
  28. package/reference/scaffold/reference/glossary.md +25 -4
@@ -1,35 +1,51 @@
1
1
  ---
2
2
  name: setup
3
- description: First-time project setup — detect and replace template placeholders, install dependencies, verify build
3
+ description: First-time project setup — detect and replace template placeholders, install dependencies, verify build, then hand off to /configure for org-model configuration
4
4
  argument-hint: ""
5
5
  ---
6
6
 
7
7
  # Setup
8
8
 
9
- First-time project setup for projects cloned directly from the template.
9
+ First-time project setup for projects cloned directly from the template. Handles placeholder replacement, dependency install, and build verification. After bootstrap, delegates org-model configuration to `/configure`.
10
10
 
11
11
  **Usage:** `/setup`
12
12
 
13
- ## Process
13
+ ---
14
14
 
15
- ### Step 1: Detect State
15
+ ## State Detection (Run Before Anything Else)
16
16
 
17
- Scan these key files for unresolved placeholders:
17
+ Before collecting any information or running any steps, determine which state the project is in. Read these files:
18
18
 
19
19
  - `package.json` — look for `__PROJECT_SLUG__` in the `name` field
20
- - `CLAUDE.md` — look for `TEMPLATE_PROJECT_NAME`
20
+ - `CLAUDE.md` — look for `TEMPLATE_PROJECT_NAME` AND check whether `{CLIENT_CONTEXT}` and `{USER_PREFERENCES}` are still literal placeholder strings
21
21
  - `ui/package.json` — look for `__PROJECT_SLUG__`
22
22
  - `ui/index.html` — look for `__PROJECT_NAME__`
23
23
 
24
- If NO placeholders are found, the project is already configured. Print:
24
+ **State A — Virgin (placeholders present):** One or more of the above placeholder strings is found. Run the full bootstrap flow (Steps 1–7 below), then hand off to `/configure`.
25
+
26
+ **State B — Already bootstrapped, org-model at defaults:** No placeholders found, but `foundations/config/organization-model.ts` contains only the default branding override (just `branding.organizationName`, `branding.productName`, `branding.shortName` — no identity, customers, offerings, roles, goals, or techStack overrides). Print:
27
+
28
+ ```
29
+ This project is already set up. The organization model has not been configured yet.
30
+ Running /configure to set up your organization profile...
31
+ ```
32
+
33
+ Then execute `/configure` (the full layered flow) and stop.
34
+
35
+ **State C — Fully configured:** No placeholders found AND `foundations/config/organization-model.ts` has at least one non-branding domain populated (identity, customers, offerings, roles, goals, or techStack present). Print:
25
36
 
26
37
  ```
27
- Project is already configured. Running verification...
38
+ This project is already configured. To update your organization profile, run /configure.
39
+ To re-verify the build, run the checks below.
28
40
  ```
29
41
 
30
- Then skip directly to Step 4 (Install) or Step 5 (Verify) as appropriate.
42
+ Offer to run the verification checks (Steps 6b–6e) if the user wants them. Do not re-ask any questions. Do not re-run placeholder replacement. Stop after verification.
43
+
44
+ ---
45
+
46
+ ## Full Bootstrap Flow (State A Only)
31
47
 
32
- ### Step 2: Collect Info
48
+ ### Step 1: Collect Project Info
33
49
 
34
50
  Ask the user for three values:
35
51
 
@@ -49,7 +65,7 @@ Configuring project with:
49
65
  Proceed? (yes/no)
50
66
  ```
51
67
 
52
- ### Step 3: Get to Know the User and Client
68
+ ### Step 2: Get to Know the User and Client
53
69
 
54
70
  Transition naturally after confirming the project values: "Now let me learn a bit about you and the client so I can be more helpful going forward."
55
71
 
@@ -86,7 +102,7 @@ Client: {company}
86
102
  Look good?
87
103
  ```
88
104
 
89
- ### Step 4: Replace Placeholders
105
+ ### Step 3: Replace Placeholders
90
106
 
91
107
  Search ALL files in the project matching these extensions: `.ts`, `.tsx`, `.js`, `.mjs`, `.json`, `.md`, `.mdx`, `.html`, `.yaml`, `.yml`, `.css`, `.env.example`
92
108
 
@@ -105,21 +121,19 @@ For each matching file, replace all occurrences of:
105
121
 
106
122
  Use the Read tool to read each file, then the Edit tool (with `replace_all: true`) or Write tool to apply the replacements. Read each file before writing.
107
123
 
108
- After all replacements, re-scan the four key files from Step 1 to verify zero placeholders remain. If any are still present, report them by file and fix immediately.
124
+ After all replacements, re-scan the four key files from State Detection to verify zero placeholders remain. If any are still present, report them by file and fix immediately.
109
125
 
110
- ### Step 5: Populate Knowledge
126
+ ### Step 4: Populate CLAUDE.md Knowledge Sections
111
127
 
112
- Knowledge is split between `CLAUDE.md` (essentials loaded every turn) and `docs/knowledge/client.md` (detailed context loaded on demand).
128
+ **Idempotency check (MANDATORY before writing):** Read `CLAUDE.md` and check whether `{CLIENT_CONTEXT}` and `{USER_PREFERENCES}` are still literal placeholder strings. Only write if they are still placeholders. If either section is already filled in (user or a previous run already populated it), skip that section entirely — do not overwrite.
113
129
 
114
- #### 5a: CLAUDE.md lightweight summary
115
-
116
- **`{CLIENT_CONTEXT}`** -- replace with a single line:
130
+ **`{CLIENT_CONTEXT}`** -- replace with a single line (only if still a placeholder):
117
131
 
118
132
  ```markdown
119
133
  **{company name}** — {what they do, one sentence}
120
134
  ```
121
135
 
122
- **`{USER_PREFERENCES}`** -- replace with a table:
136
+ **`{USER_PREFERENCES}`** -- replace with a table (only if still a placeholder):
123
137
 
124
138
  ```markdown
125
139
  | Name | Role | Technical Level | Communication |
@@ -129,9 +143,11 @@ Knowledge is split between `CLAUDE.md` (essentials loaded every turn) and `docs/
129
143
 
130
144
  If the user skipped any knowledge questions, fill in what was provided and omit what wasn't -- don't leave placeholder text behind.
131
145
 
132
- #### 5b: docs/knowledge/client.md full client context
146
+ ### Step 5: Create Client Knowledge Doc
147
+
148
+ **Idempotency check:** Check whether `docs/knowledge/client.md` already exists. If it exists and is non-empty, skip this step entirely -- do not overwrite.
133
149
 
134
- Create `docs/knowledge/client.md` with the detailed info:
150
+ If it does not exist, create `docs/knowledge/client.md`:
135
151
 
136
152
  ```markdown
137
153
  ---
@@ -150,7 +166,9 @@ description: Company background, industry, stakeholders, and business goals
150
166
  {any additional context shared -- key stakeholders, business goals, constraints, etc. If nothing was shared, write "No additional context provided yet. Update this as the project evolves."}
151
167
  ```
152
168
 
153
- ### Step 6: Install Dependencies
169
+ ### Step 6: Install and Verify
170
+
171
+ #### Step 6a: Install Dependencies
154
172
 
155
173
  ```bash
156
174
  pnpm install
@@ -158,7 +176,7 @@ pnpm install
158
176
 
159
177
  This generates the project's own `pnpm-lock.yaml`. Report success or any errors.
160
178
 
161
- ### Step 7: Verify
179
+ #### Step 6b–6e: Verify Build
162
180
 
163
181
  Run all checks sequentially (stop and report on first failure, but attempt all):
164
182
 
@@ -171,7 +189,7 @@ pnpm -C operations check-types
171
189
 
172
190
  For each check, record PASS or FAIL. If a check fails, read the output and report the error clearly. Do not silently skip failures.
173
191
 
174
- ### Step 8: Report
192
+ ### Step 7: Bootstrap Report
175
193
 
176
194
  ```
177
195
  You're all set, {name}!
@@ -185,16 +203,23 @@ Verification:
185
203
  [PASS/FAIL] Production build (ui)
186
204
  [PASS/FAIL] Resource validation (operations)
187
205
  [PASS/FAIL] Type-check (operations)
206
+ ```
207
+
208
+ If any verification step failed, add an Errors section listing each failure with its output.
209
+
210
+ ### Step 8: Hand Off to /configure
188
211
 
189
- Next steps:
190
- 1. Copy root .env.example to .env and fill in ELEVASIS_PLATFORM_KEY
191
- 2. Copy ui/.env.example to ui/.env and fill in VITE_WORKOS_CLIENT_ID
192
- 3. See TODO.md for WorkOS dashboard setup and branding
193
- 4. pnpm -C ui dev (start dev server on port 4300)
194
- 5. (If client-workspace/ exists) Open it in Claude Code and run /setup
212
+ After a successful bootstrap, transition to the org-model configuration flow. Print:
213
+
214
+ ```
215
+ Bootstrap complete. Now let's set up your organization profile.
195
216
  ```
196
217
 
197
- If any verification step failed, add an Errors section listing each failure with its output before the Next steps.
218
+ Then execute `/configure` (the full layered flow, no argument). This is where identity, customers, offerings, roles, goals, and techStack are configured. Do not attempt to collect or write org-model data here — that ceremony belongs entirely to /configure.
219
+
220
+ If the user wants to skip org-model setup for now, they can stop here and run `/configure` later.
221
+
222
+ ---
198
223
 
199
224
  ## Error Recovery
200
225
 
@@ -207,4 +232,28 @@ Remaining: <list files and placeholders>
207
232
  Action: Re-applying replacements to affected files...
208
233
  ```
209
234
 
210
- Fix each remaining occurrence before proceeding to Step 6.
235
+ Fix each remaining occurrence before proceeding to Step 6a.
236
+
237
+ ---
238
+
239
+ ## Idempotency Guarantees
240
+
241
+ Running `/setup` more than once is safe:
242
+
243
+ - **Placeholder replacement** only runs when placeholders are detected (State A). It is skipped entirely in States B and C.
244
+ - **CLAUDE.md knowledge sections** (`{CLIENT_CONTEXT}`, `{USER_PREFERENCES}`) are checked before writing. If already replaced, the write is skipped.
245
+ - **`docs/knowledge/client.md`** is only created if it does not exist. An existing file is never overwritten by `/setup`.
246
+ - **Org-model fields** (`foundations/config/organization-model.ts`) are never written by `/setup`. All org-model edits go through `/configure`, which has its own diff-preview and confirm ceremony.
247
+
248
+ ---
249
+
250
+ ## Relationship to /configure
251
+
252
+ `/setup` is a thin bootstrap wrapper. It:
253
+
254
+ 1. Replaces scaffold placeholders (project name, slug, description)
255
+ 2. Fills lightweight CLAUDE.md knowledge sections (user and client basics, idempotent)
256
+ 3. Installs dependencies and verifies the build
257
+ 4. Hands off to `/configure` for org-model configuration
258
+
259
+ `/configure` owns all structural org-model editing (identity, customers, offerings, roles, goals, techStack, features, labels). It is idempotent, confirm-before-overwrite, and includes a runtime validation gate. Re-run `/configure` any time organizational reality changes — no need to re-run `/setup`.
@@ -14,7 +14,7 @@ The public entry point exposes:
14
14
  - `resolveOrganizationModel`
15
15
  - `PROJECTS_FEATURE_ID`
16
16
  - `PROJECTS_INDEX_SURFACE_ID`
17
- - `DELIVERY_PROJECTS_VIEW_CAPABILITY_ID`
17
+ - `PROJECTS_VIEW_CAPABILITY_ID`
18
18
  - `OrganizationModel` and the supporting domain types
19
19
 
20
20
  Import it from the published subpath:
@@ -22,7 +22,7 @@ Import it from the published subpath:
22
22
  ```ts
23
23
  import {
24
24
  DEFAULT_ORGANIZATION_MODEL,
25
- DELIVERY_PROJECTS_VIEW_CAPABILITY_ID,
25
+ PROJECTS_VIEW_CAPABILITY_ID,
26
26
  defineOrganizationModel,
27
27
  PROJECTS_FEATURE_ID,
28
28
  PROJECTS_INDEX_SURFACE_ID,
@@ -41,30 +41,34 @@ Top-level fields:
41
41
  - `branding` - organization branding defaults and overrides.
42
42
  - `features` - unified feature entries that combine enablement, labels, and semantic references.
43
43
  - `navigation` - navigation model for the product shell.
44
- - `crm` - CRM-specific contract data.
45
- - `leadGen` - lead generation contract data.
46
- - `delivery` - delivery and project contract data.
47
- - `resourceMappings` - cross-surface resource mappings.
44
+ - `sales` - sales pipeline and relationship management.
45
+ - `prospecting` - lists, companies, and contacts.
46
+ - `projects` - projects, milestones, and tasks.
47
+ - `identity`, `customers`, `offerings`, `roles`, `goals` - reality domains (2026-04 expansion).
48
+ - `statuses` - unified status registry across delivery / hitl / execution / request / schedule.
49
+ - `operations` - catalog of stateful runtime entities (HITL queue, sessions, executions, notifications, schedules).
50
+ - `resourceMappings` - cross-surface resource mappings (includes techStack subsection).
48
51
 
49
52
  ## Default Feature Set
50
53
 
51
- The default model includes seven feature IDs:
54
+ The default model includes eight feature IDs:
52
55
 
53
- - `crm` - deal pipeline and relationship management.
54
- - `lead-gen` - lists, companies, and contacts.
56
+ - `sales` - deal pipeline and relationship management.
57
+ - `prospecting` - lists, companies, and contacts.
55
58
  - `projects` - projects, milestones, and tasks.
56
59
  - `operations` - organization graph and command-view surfaces.
57
60
  - `monitoring` - monitoring surfaces.
58
61
  - `settings` - organization settings.
59
62
  - `seo` - SEO surfaces (disabled by default).
63
+ - `configure` - `/configure` skill entry point (external projects).
60
64
 
61
65
  ## Project Bridge Constants
62
66
 
63
- The organization-model surface now exports a narrow set of canonical IDs for the shared Projects bridge:
67
+ The organization-model surface exports a narrow set of canonical IDs for the shared Projects bridge:
64
68
 
65
69
  - `PROJECTS_FEATURE_ID` -> `projects`
66
70
  - `PROJECTS_INDEX_SURFACE_ID` -> `projects.index`
67
- - `DELIVERY_PROJECTS_VIEW_CAPABILITY_ID` -> `delivery.projects.view`
71
+ - `PROJECTS_VIEW_CAPABILITY_ID` -> `delivery.projects.view`
68
72
 
69
73
  Use these when wiring shared UI manifests, template adapters, or other consumers that need to agree on the same Projects contract without repeating raw literals.
70
74
 
@@ -89,5 +93,5 @@ Use these when wiring shared UI manifests, template adapters, or other consumers
89
93
 
90
94
  - Use `resolveOrganizationModel()` when you need a runtime-safe model for rendering or policy checks.
91
95
  - Use `defineOrganizationModel()` when authoring a static partial model in source.
92
- - Treat feature IDs such as `crm`, `lead-gen`, and `projects` as the canonical shell-level contract in new organization-model authoring.
96
+ - Treat feature IDs such as `sales`, `prospecting`, and `projects` as the canonical shell-level contract in new organization-model authoring.
93
97
  - Keep feature IDs, surface IDs, and capability IDs stable because downstream UI and policy code depend on them.
@@ -62,6 +62,7 @@ This means runtime topology is represented as bridged `resource` nodes plus rela
62
62
  - Implementation-resource bridging prefers `organizationModel.resourceMappings`.
63
63
  - Semantic grouping now comes from the unified `organizationModel.features` array. The builder no longer emits separate `domain` nodes.
64
64
  - Command View resource `domains` metadata is currently bridged onto `feature` references, not onto a distinct domain-node layer.
65
+ - The 2026-04-20 reality-domain expansion (identity, customers, offerings, roles, goals, statuses, operations, techStack) does not introduce new graph node kinds. Those domains are model-layer data; they are not independently represented as graph nodes. They can be surfaced as metadata on the organization root node when a consumer needs to expose them through a graph lens.
65
66
  - Graph defaults remain valid when produced by `resolveOrganizationModel()`.
66
67
  - If the graph needs a concept the model cannot express, extend the model first.
67
68
 
@@ -5,7 +5,7 @@ description: Organization OS Model layer documentation for the semantic organiza
5
5
 
6
6
  ## Overview
7
7
 
8
- Within Organization OS, the organization model is the **Model** layer and part of the cross-cutting **Public API** layer. It is the semantic contract that maps an organization's product shape to domains, features, navigation surfaces and groups, domain-specific semantics (CRM pipeline, lead-gen lifecycle, delivery status), and resource mappings. It is schema-first, versioned, and validated.
8
+ Within Organization OS, the organization model is the **Model** layer and part of the cross-cutting **Public API** layer. It is the semantic contract that maps an organization's full organizational reality to domains, features, navigation surfaces and groups, domain-specific semantics (sales pipeline, prospecting lifecycle, projects status), and resource mappings. It is schema-first, versioned, and validated.
9
9
 
10
10
  The model is authored in `@repo/core` and published as a curated external package `@elevasis/core`. It is consumed by:
11
11
 
@@ -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 schema, navigation surfaces, CRM/lead-gen/delivery semantics
24
+ - `packages/core/src/organization-model/domains/*.ts` -- feature schema, navigation surfaces, sales/prospecting/projects semantics, and the 8 reality domains (identity, customers, offerings, roles, goals, statuses, operations, shared/techStack)
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
@@ -32,12 +32,31 @@ Top-level fields on `OrganizationModel`:
32
32
 
33
33
  - `version`
34
34
  - `features` -- unified feature array (`OrganizationModelFeature[]`); each entry combines access gating, semantic grouping, and display metadata
35
- - `branding`
35
+ - `branding` -- display identity (org name, product name, logos)
36
36
  - `navigation` -- surfaces, groups, `defaultSurfaceId`
37
- - `crm` -- pipeline stages and stage semantics
38
- - `leadGen` -- company/contact lifecycle stages
39
- - `delivery` -- project/milestone/task statuses
40
- - `resourceMappings`
37
+ - `sales` -- pipeline stages and stage semantics (formerly `crm`)
38
+ - `prospecting` -- company/contact lifecycle stages (formerly `leadGen`)
39
+ - `projects` -- project/milestone/task statuses (formerly `delivery`)
40
+ - `identity` -- legal identity, mission/vision, industry, geography, and temporal anchors
41
+ - `customers` -- customer segments with jobs-to-be-done, firmographics, and value propositions
42
+ - `offerings` -- products and services with pricing model and segment/feature references
43
+ - `roles` -- role chart with responsibilities, reporting lines, and role holders
44
+ - `goals` -- organizational goals with period and measurable outcomes
45
+ - `statuses` -- flat registry of all status entries across delivery, queue, execution, schedule, and request semantic classes
46
+ - `operations` -- catalog of stateful runtime entities (HITL queue, executions, sessions, notifications, schedules)
47
+ - `resourceMappings` -- deployable resource links, each optionally extended with `techStack` metadata
48
+
49
+ ### Domain Rename Wave
50
+
51
+ Three legacy domain names were renamed in the 2026-04-20 expansion to align developer-facing code with user-visible labels:
52
+
53
+ | Old name | New name | Notes |
54
+ | ---------- | ------------- | ------------------------------------------------------------------------------------ |
55
+ | `crm` | `sales` | Domain files, feature IDs, surface IDs, imports, and sidebar labels all updated |
56
+ | `leadGen` | `prospecting` | Same scope as above |
57
+ | `delivery` | `projects` | Aligns with the "Projects" sidebar label; `projects` feature ID was already in place |
58
+
59
+ Any reference to `crm`, `leadGen`, or `delivery` in domain files, imports, or surface IDs should be treated as a historical artifact unless explicitly annotated otherwise.
41
60
 
42
61
  ### Branding Shape
43
62
 
@@ -56,22 +75,25 @@ All `id` fields, `parentId`, `defaultSurfaceId`, and reference ID arrays use `Mo
56
75
  - Regex: `/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/`
57
76
  - Max length: 100 chars
58
77
  - Allowed separators: `-`, `_`, `.`
59
- - Examples: `crm.pipeline`, `lead-gen.lists`, `operations.organization-graph`
78
+ - Examples: `sales.pipeline`, `prospecting.lists`, `operations.organization-graph`
60
79
 
61
80
  This applies to domain IDs, surface IDs, navigation group IDs, and resource mapping IDs.
62
81
 
63
82
  ### Default Features
64
83
 
65
- Seven features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
84
+ Eight features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
66
85
 
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`)
86
+ - `crm` -- enabled; sales pipeline and deal management (feature ID unchanged; domain renamed to `sales`)
87
+ - `lead-gen` -- enabled; prospecting, qualification, and outreach (feature ID unchanged; domain renamed to `prospecting`)
88
+ - `projects` -- enabled; projects, milestones, and client work execution
70
89
  - `operations` -- enabled; organizational topology and orchestration visibility
71
90
  - `monitoring` -- enabled; execution monitoring
72
91
  - `settings` -- enabled; organization settings
92
+ - `submitted-requests` -- enabled; submitted-request lifecycle surface
73
93
  - `seo` -- disabled by default; SEO surface
74
94
 
95
+ Note: the feature IDs (`crm`, `lead-gen`) are consumer-facing identifiers that have not changed. The underlying domain key on `OrganizationModel` was renamed (`crm` → `sales`, `leadGen` → `prospecting`). Adapters that already use the feature ID constants (`CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`) require no change.
96
+
75
97
  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.
76
98
 
77
99
  `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.
@@ -88,18 +110,30 @@ Each feature entry (`OrganizationModelFeature`) combines what were previously th
88
110
  - `entityIds` -- entities this resource operates on
89
111
  - `surfaceIds` -- surfaces this resource is exposed in
90
112
  - `capabilityIds` -- capabilities this resource fulfills
113
+ - `techStack` (optional) -- external-SaaS integration metadata; see TechStack Extension below
91
114
 
92
115
  All four ID arrays are bidirectionally validated against their counterparts (see Referential Integrity).
93
116
 
117
+ ### TechStack Extension
118
+
119
+ `techStack` is an optional nested object on `ResourceMappingSchema` defined in `domains/shared.ts`. It captures external-SaaS integration metadata without introducing a tenth top-level domain. Fields:
120
+
121
+ - `platform` -- name of the external platform (e.g. "HubSpot", "Stripe", "Notion")
122
+ - `purpose` -- free-form description of what this integration does
123
+ - `credentialStatus` -- one of `'configured' | 'pending' | 'expired' | 'missing'`
124
+ - `isSystemOfRecord` -- boolean; whether this integration is the primary source of truth for its domain (defaults to `false`)
125
+
126
+ Backward-compatible: existing resource mappings without `techStack` parse cleanly. The extension flows through `ResourceMappingSchema` automatically with no changes to `schema.ts` composition.
127
+
94
128
  ### Default Navigation
95
129
 
96
- Surfaces such as `crm.pipeline`, `lead-gen.lists`, `projects.index`, `operations.organization-graph`, and `operations.command-view`. Groups include `primary-workspace` and `primary-operations`. The model can shape shell meaning even when route files stay app-local.
130
+ Surfaces such as `sales.pipeline`, `prospecting.lists`, `projects.index`, `operations.organization-graph`, and `operations.command-view`. Groups include `primary-workspace` and `primary-operations`. The model can shape shell meaning even when route files stay app-local.
97
131
 
98
132
  ### SurfaceDefinition Shape
99
133
 
100
134
  `OrganizationModelSurface` (inferred from `SurfaceDefinitionSchema`) defines a navigable view:
101
135
 
102
- - `id` -- ModelId (e.g. `crm.pipeline`)
136
+ - `id` -- ModelId (e.g. `sales.pipeline`)
103
137
  - `label` -- display name
104
138
  - `path` -- route path, must start with `/`, max 300 chars
105
139
  - `surfaceType` -- `'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'`
@@ -124,14 +158,36 @@ The default groups (`primary-workspace`, `primary-operations`) both use `placeme
124
158
 
125
159
  ### Feature-Specific Semantics
126
160
 
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:
161
+ Three renamed top-level domain fields carry feature-specific semantic shapes (pipeline stages, lifecycle stages, project statuses). These are named fields on `OrganizationModel`, not embedded in per-feature config:
128
162
 
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)
163
+ - `sales` -- pipeline stages and stage semantics (formerly `crm`)
164
+ - `prospecting` -- company and contact lifecycle stages (formerly `leadGen`)
165
+ - `projects` -- project, milestone, and task statuses (formerly `delivery`)
132
166
 
133
167
  This is why the organization model is semantic, not just nav config -- it owns product meaning for the business objects the shell surfaces expose.
134
168
 
169
+ ### Reality Domains (New in 2026-04-20 Expansion)
170
+
171
+ Five new domains capture organizational reality that was absent from the original model. They sit alongside the existing platform-configuration domains and follow the same `domains/*.ts` pattern:
172
+
173
+ **`identity`** -- legal identity distinct from `branding` (which is display identity). Fields: `mission`, `vision`, `legalName`, `entityType`, `jurisdiction`, `industryCategory`, `geographicFocus`, `timeZone`, `businessHours`. All fields default to empty strings; `timeZone` defaults to `'UTC'`; `businessHours` defaults to `{}`.
174
+
175
+ **`customers`** -- customer segments. Each `CustomerSegment` entry has: `id`, `name`, `description`, `jobsToBeDone`, `pains`, `gains`, `valueProp` (all plain-language strings), and `firmographics` (optional object with `companySize`, `industry`, `revenue`, `geography`). Domain defaults to `{ segments: [] }`.
176
+
177
+ **`offerings`** -- products and services. Each `Product` entry has: `id`, `name`, `description`, `pricingModel` (enum: `'one-time' | 'subscription' | 'usage-based' | 'custom'`), `price` (optional number), `currency` (optional string), `targetSegmentIds` (cross-ref validated against `customers.segments[].id`), `deliveryFeatureId` (optional cross-ref validated against `features[].id`). Domain defaults to `{ products: [] }`.
178
+
179
+ **`roles`** -- role chart. Each `Role` entry has: `id`, `title`, `responsibilities` (string array, default `[]`), `reportsToId` (optional, cross-ref validated within the same collection), `heldBy` (optional name or email string). All field names are plain-language; no EOS jargon (`seats`, `accountabilities`) survives. Domain defaults to `{ roles: [] }`.
180
+
181
+ **`goals`** -- organizational goals. Each `Objective` entry has: `id`, `description`, `periodStart` (ISO 8601 date), `periodEnd` (ISO 8601 date, must be strictly after `periodStart`), `keyResults` (array of `{ id, description, targetValue?, currentValue?, unit? }`). User-facing text uses "goals" and "measurable outcomes" -- never "OKR" or "key results". Domain defaults to `{ objectives: [] }`.
182
+
183
+ ### Statuses and Operations Domains (Vibe Layer)
184
+
185
+ Two domains support the ambient vibe layer's plain-language rendering:
186
+
187
+ **`statuses`** -- flat registry of `StatusEntry` objects. Each entry: `id`, `label`, `semanticClass` (one of `'delivery.task' | 'delivery.project' | 'delivery.milestone' | 'queue' | 'execution' | 'schedule' | 'schedule.run' | 'request'`), optional `category`. Labels are vibe-readable: the ambient classifier narrates state using `label` from the model, never hardcoded strings. `QueueTaskStatus` in the queue domain routes through this registry. Defaults to a seed set covering all semantic classes.
188
+
189
+ **`operations`** -- catalog of stateful runtime entities. Each `OperationEntry`: `id`, `label`, `semanticClass` (one of `'queue' | 'executions' | 'sessions' | 'notifications' | 'schedules'`), optional `featureId`, optional `supportedStatusSemanticClass` (ties an operation entry back to which status semantic classes apply). Default entries: `operations.queue` (HITL queue), `operations.executions`, `operations.sessions`, `operations.notifications`, `operations.schedules`.
190
+
135
191
  ## Authoring & Resolution
136
192
 
137
193
  - `defineOrganizationModel()` -- typed authoring helper; returns the input unchanged but constrains the type.
@@ -179,6 +235,13 @@ Merge semantics:
179
235
 
180
236
  This bidirectional enforcement is what keeps the organization model semantically consistent rather than loosely structured config.
181
237
 
238
+ **Reality domain cross-refs** (validated in the same `superRefine` pass):
239
+
240
+ - each `offerings.products[].targetSegmentIds[]` must resolve to a `customers.segments[].id`
241
+ - each `offerings.products[].deliveryFeatureId` (when present) must resolve to a `features[].id`
242
+ - each `roles.roles[].reportsToId` (when present) must resolve to another `roles.roles[].id` in the same collection
243
+ - each `goals.objectives[].periodEnd` must be strictly after `periodStart` (ISO 8601 string comparison)
244
+
182
245
  ## Provider Integration
183
246
 
184
247
  `ElevasisFeaturesProvider` uses the organization model in three ways:
@@ -236,7 +299,9 @@ Exports the foundations module provides to consumers:
236
299
  - `FoundationFeatureKey`, `FoundationSurfaceIcon`, `FoundationNavigationSurface`, `FoundationOrganizationModel`
237
300
  - `homeLabel`, `quickAccessSurfaceIds`, `getOrganizationSurface(surfaceId)`
238
301
 
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.
302
+ Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Feature IDs are direct matches -- `crm`, `lead-gen`, `projects` in the org model correspond directly to the same IDs on `FeatureModule.featureId`. No alias layer is needed. The domain rename wave (crm→sales, leadGen→prospecting, delivery→projects) affects the schema field names, not the feature ID constants; adapters using `CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`, etc. require no changes.
303
+
304
+ Adapters that override the new reality domains (`identity`, `customers`, `offerings`, `roles`, `goals`) or add `techStack` metadata to resource mappings should use `/configure` as the structured entry point for those edits in external projects. `/configure` runs a layered QA flow, proposes changes, and gates the write through `resolveOrganizationModel()` + `OrganizationModelSchema.parse()` before committing.
240
305
 
241
306
  Derivative projects (`external/nirvana-marketing`, `external/ZentaraHQ`) follow the same adapter + provider-wiring baseline with their own project-local customizations.
242
307
 
@@ -34,7 +34,7 @@ Add a new feature object to the `features[]` array passed to `defineOrganization
34
34
  import { defineOrganizationModel } from '@elevasis/core/organization-model'
35
35
  ```
36
36
 
37
- Use typed constants for the 7 platform features (`CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`, `PROJECTS_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, `MONITORING_FEATURE_ID`, `SETTINGS_FEATURE_ID`, `SEO_FEATURE_ID`); use string literals for project-specific features you invent.
37
+ Use typed constants for the 7 platform features (`SALES_FEATURE_ID`, `PROSPECTING_FEATURE_ID`, `PROJECTS_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, `MONITORING_FEATURE_ID`, `SETTINGS_FEATURE_ID`, `SEO_FEATURE_ID`); use string literals for project-specific features you invent.
38
38
 
39
39
  ```ts
40
40
  const foundationOrganizationModelOverride = defineOrganizationModel({
@@ -163,12 +163,12 @@ for the full resource authoring workflow.
163
163
 
164
164
  ### Domain-specific config
165
165
 
166
- The `crm`, `leadGen`, and `delivery` top-level keys configure pipeline stages, entity ID bindings,
166
+ The `sales`, `prospecting`, and `projects` top-level keys configure pipeline stages, entity ID bindings,
167
167
  and status vocabularies for those domains. These are consumed by the platform adapters and UI
168
168
  components -- they are not just labels.
169
169
 
170
170
  ```ts
171
- crm: {
171
+ sales: {
172
172
  entityId: 'crm.deal',
173
173
  defaultPipelineId: 'default',
174
174
  pipelines: [
@@ -184,7 +184,7 @@ crm: {
184
184
  }
185
185
  ]
186
186
  },
187
- leadGen: {
187
+ prospecting: {
188
188
  listEntityId: 'leadgen.list',
189
189
  companyEntityId: 'leadgen.company',
190
190
  contactEntityId: 'leadgen.contact',
@@ -197,7 +197,7 @@ leadGen: {
197
197
  { id: 'uploaded', label: 'Uploaded', order: 4 }
198
198
  ]
199
199
  },
200
- delivery: {
200
+ projects: {
201
201
  projectEntityId: 'delivery.project',
202
202
  milestoneEntityId: 'delivery.milestone',
203
203
  taskEntityId: 'delivery.task',
@@ -207,7 +207,7 @@ delivery: {
207
207
  }
208
208
  ```
209
209
 
210
- `semanticClass` on CRM stages is significant: the platform uses `closed_won`, `closed_lost`,
210
+ `semanticClass` on sales pipeline stages is significant: the platform uses `closed_won`, `closed_lost`,
211
211
  `nurturing`, `open`, and `active` for funnel analytics and workflow triggers. Do not rename these
212
212
  to arbitrary strings.
213
213
 
@@ -30,7 +30,7 @@ Do not substitute one for the other. `FeatureGuard` reads feature flags; `AdminG
30
30
  Ensure a feature object with the matching `id` exists in the org model. File: `foundations/config/organization-model.ts`.
31
31
 
32
32
  ```ts
33
- import { defineOrganizationModel, OPERATIONS_FEATURE_ID, CRM_FEATURE_ID } from '@elevasis/core/organization-model'
33
+ import { defineOrganizationModel, OPERATIONS_FEATURE_ID, SALES_FEATURE_ID } from '@elevasis/core/organization-model'
34
34
 
35
35
  // In the features[] array inside defineOrganizationModel:
36
36
  features: [
@@ -39,7 +39,7 @@ features: [
39
39
  ]
40
40
  ```
41
41
 
42
- Use typed constants for the 7 platform features (`CRM_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, etc.); use string literals for project-specific features you invent. In this example, `'analytics'` is a project-local feature and stays as a string literal.
42
+ Use typed constants for the 7 platform features (`SALES_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, etc.); use string literals for project-specific features you invent. In this example, `'analytics'` is a project-local feature and stays as a string literal.
43
43
 
44
44
  See [add-a-feature.md](add-a-feature.md) step 2 for the full feature object shape.
45
45
 
@@ -119,7 +119,7 @@ navEntry: {
119
119
  { label: 'Admin', icon: IconShield, link: '/admin', requiresAdmin: true }
120
120
  ```
121
121
 
122
- `featureKey` on a nav entry is a display hint only -- it does not protect the route. Always pair with a route-level `FeatureGuard`. See [glossary.md](../reference/glossary.md) under **accessFeatureKey vs featureKey** for the distinction. When the `featureKey` is one of the 7 platform features, prefer the typed constant (e.g., `featureKey: CRM_FEATURE_ID`) over a string literal to catch renames at compile time.
122
+ `featureKey` on a nav entry is a display hint only -- it does not protect the route. Always pair with a route-level `FeatureGuard`. See [glossary.md](../reference/glossary.md) under **accessFeatureKey vs featureKey** for the distinction. When the `featureKey` is one of the 7 platform features, prefer the typed constant (e.g., `featureKey: SALES_FEATURE_ID`) over a string literal to catch renames at compile time.
123
123
 
124
124
  ---
125
125