@elevasis/sdk 1.22.1 → 1.24.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 (70) hide show
  1. package/dist/cli.cjs +5738 -6283
  2. package/dist/index.d.ts +187 -242
  3. package/dist/index.js +1830 -2912
  4. package/dist/node/index.d.ts +3722 -2
  5. package/dist/node/index.js +163 -1
  6. package/dist/test-utils/index.d.ts +61 -72
  7. package/dist/test-utils/index.js +240 -1479
  8. package/dist/types/worker/index.d.ts +2 -0
  9. package/dist/types/worker/utils.d.ts +9 -0
  10. package/dist/worker/index.js +261 -1487
  11. package/package.json +5 -4
  12. package/reference/_navigation.md +1 -0
  13. package/reference/claude-config/rules/active-change-index.md +11 -80
  14. package/reference/claude-config/rules/agent-start-here.md +11 -277
  15. package/reference/claude-config/rules/deployment.md +11 -57
  16. package/reference/claude-config/rules/error-handling.md +11 -56
  17. package/reference/claude-config/rules/execution.md +11 -40
  18. package/reference/claude-config/rules/frontend.md +11 -43
  19. package/reference/claude-config/rules/observability.md +11 -31
  20. package/reference/claude-config/rules/operations.md +11 -80
  21. package/reference/claude-config/rules/organization-model.md +7 -115
  22. package/reference/claude-config/rules/organization-os.md +8 -112
  23. package/reference/claude-config/rules/package-taxonomy.md +11 -33
  24. package/reference/claude-config/rules/platform.md +11 -42
  25. package/reference/claude-config/rules/shared-types.md +10 -48
  26. package/reference/claude-config/rules/task-tracking.md +11 -47
  27. package/reference/claude-config/rules/ui.md +11 -200
  28. package/reference/claude-config/rules/vibe.md +11 -235
  29. package/reference/claude-config/skills/om/SKILL.md +324 -0
  30. package/reference/claude-config/skills/{knowledge → om}/operations/customers.md +110 -109
  31. package/reference/claude-config/skills/{knowledge → om}/operations/features.md +77 -76
  32. package/reference/claude-config/skills/{knowledge → om}/operations/goals.md +119 -118
  33. package/reference/claude-config/skills/{knowledge → om}/operations/identity.md +94 -93
  34. package/reference/claude-config/skills/{knowledge → om}/operations/labels.md +94 -94
  35. package/reference/claude-config/skills/{knowledge → om}/operations/offerings.md +110 -109
  36. package/reference/claude-config/skills/{knowledge → om}/operations/roles.md +100 -99
  37. package/reference/claude-config/skills/{knowledge → om}/operations/techStack.md +30 -30
  38. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  39. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  40. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  41. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  42. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  43. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  44. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  45. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +52 -0
  46. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +33 -0
  47. package/reference/rules/active-change-index.md +83 -0
  48. package/reference/rules/agent-start-here.md +280 -0
  49. package/reference/rules/deployment.md +60 -0
  50. package/reference/rules/error-handling.md +59 -0
  51. package/reference/rules/execution.md +43 -0
  52. package/reference/rules/frontend.md +46 -0
  53. package/reference/rules/observability.md +34 -0
  54. package/reference/rules/operations.md +85 -0
  55. package/reference/rules/organization-model.md +119 -0
  56. package/reference/rules/organization-os.md +118 -0
  57. package/reference/rules/package-taxonomy.md +36 -0
  58. package/reference/rules/platform.md +45 -0
  59. package/reference/rules/shared-types.md +52 -0
  60. package/reference/rules/task-tracking.md +50 -0
  61. package/reference/rules/ui.md +203 -0
  62. package/reference/rules/vibe.md +238 -0
  63. package/reference/scaffold/core/organization-graph.mdx +4 -5
  64. package/reference/scaffold/core/organization-model.mdx +1 -1
  65. package/reference/scaffold/recipes/query-the-knowledge-graph.md +189 -185
  66. package/reference/scaffold/reference/contracts.md +108 -96
  67. package/reference/scaffold/reference/glossary.md +71 -69
  68. package/reference/claude-config/skills/knowledge/SKILL.md +0 -345
  69. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-a.md +0 -0
  70. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-b.md +0 -0
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: om
3
+ description: |
4
+ TRIGGER this skill when any of the following apply:
5
+ - The user references organization-model entities by name or concept: identity, customers,
6
+ offerings, roles, goals, techStack, systems, actions, labels, knowledge nodes, governance edges,
7
+ mounts, playbook, outreach cadence, or any domain in the org model.
8
+ - The user asks to read, list, find, show, query, navigate, describe, codify, add, edit,
9
+ update, toggle, enable, or disable any organization-model domain or knowledge node.
10
+ - The user asks "what governs X?", "what does X control?", "system governs", "what is our
11
+ identity set to?", "what's our timezone?", "show me all reference docs", "list my roles",
12
+ "where does outreach-cadence apply?", or similar.
13
+ - An agent is editing files matching: core/config/organization-model.ts or
14
+ core/config/knowledge/**.
15
+ SKIP this skill when the task is purely UI layout, workflow authoring, or infrastructure
16
+ work with no reference to org-model or knowledge-graph entities.
17
+
18
+ /knowledge is preserved as a permanent alias for muscle memory; both names route here.
19
+ metadata:
20
+ pathPatterns:
21
+ - "core/config/organization-model.ts"
22
+ - "core/config/knowledge/**"
23
+ - "core/config/extensions/**"
24
+ promptSignals:
25
+ phrases:
26
+ - playbook
27
+ - knowledge node
28
+ - system governs
29
+ - outreach cadence
30
+ - identity
31
+ - customer segment
32
+ - codify
33
+ - enable system
34
+ - toggle system
35
+ - what governs
36
+ - org model
37
+ - organization model
38
+ - offerings
39
+ - techStack
40
+ - roles
41
+ - goals
42
+ - labels
43
+ - knowledge map
44
+ - governance edge
45
+ - knowledge mount
46
+ - knowledge graph
47
+ - knowledge browser
48
+ - ontology
49
+ - by-ontology
50
+ - list my roles
51
+ - what is our
52
+ - show me all reference docs
53
+ - where does
54
+ - apply
55
+ context: fork
56
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
57
+ ---
58
+
59
+ # OM (Organization Model)
60
+
61
+ Unified intent-inferring skill for all organization-model interaction in this tenant project.
62
+ Reads OM state through the `elevasis-sdk om:*` CLI surface (or the legacy `knowledge:*` aliases
63
+ that still work); writes run through the Codify/Toggle ceremony. No verb namespace is required --
64
+ the skill classifies intent from conversation context and routes internally.
65
+
66
+ The slash command was renamed from `/knowledge` to `/om`; `/knowledge` is preserved as a permanent
67
+ alias. Both invocations land here.
68
+
69
+ ---
70
+
71
+ ## When to Invoke
72
+
73
+ This skill auto-invokes whenever:
74
+
75
+ - Conversation references org-model entities (identity, customers, offerings, roles, goals,
76
+ techStack, systems, actions, labels, knowledge nodes, governance edges, mounts)
77
+ - The user asks to read, list, find, show, query, navigate, describe, codify, add, edit,
78
+ update, toggle, enable, or disable any of those
79
+ - An agent is editing files matching `core/config/organization-model.ts`,
80
+ `core/config/extensions/**`, or `core/config/knowledge/**`
81
+
82
+ Auto-invocation is driven by frontmatter `description`, `metadata.pathPatterns`, and
83
+ `metadata.promptSignals` -- no explicit prefix is required.
84
+
85
+ ---
86
+
87
+ ## 5-Bucket Decision Tree
88
+
89
+ Once invoked, classify the user's input into ONE of these buckets and dispatch the matching
90
+ primitive. When two buckets fit, prefer the higher one (more specific → more general).
91
+
92
+ | # | Bucket | Trigger | Dispatch |
93
+ | --- | ------------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
94
+ | 1 | Named knowledge/role/policy id | User names `knowledge.<id>`, `role.<id>`, `policy.<id>` directly | `om:cat <id>` for body, `om:describe <id>` for neighborhood |
95
+ | 2 | Named system | User names a system path (`sales.crm`, `sales.lead-gen`) | `om:describe <id>` |
96
+ | 3 | Named ontology id | Id contains `:object/`, `:action/`, `:event/`, `:catalog/`, `:link/`, `:surface/` | `om:describe <id>` (or `om:ls /by-ontology/<id> --ids-only` then `om:cat` each) |
97
+ | 4 | Kind keyword | "playbooks", "strategies", "all references", "list policies" | `om:ls /by-kind/<kind> --ids-only` then `om:cat` each |
98
+ | 5 | Free-text discovery | Anything else ("lead gen", "outreach", "what governs X?") | `om:search "<query>"` then drill into top hit with `om:describe` |
99
+
100
+ On ambiguous input, default to **bucket 5 (search)** and surface the top hits. Codify and Toggle
101
+ intents are write paths -- see "Write Power" below.
102
+
103
+ ---
104
+
105
+ ## CLI Surface
106
+
107
+ All commands run with `pnpm exec elevasis-sdk <cmd>` (or the `om:` alias of the legacy `knowledge:` name).
108
+
109
+ | Command | Alias | Purpose |
110
+ | ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
111
+ | `om:search <q>` | `knowledge:search` | Universal keyword search across all 6 OM surfaces |
112
+ | `om:describe <id>` | `knowledge:describe` | Structured neighborhood view; kind auto-detected from id shape |
113
+ | `om:cat <id>` | `knowledge:cat` | Raw MDX body of a knowledge node |
114
+ | `om:ls <path>` | `knowledge:ls` | List nodes by mount path (`/by-system/`, `/by-kind/`, `/by-ontology/`, `/by-owner/`, `/graph/<id>/{governs,governed-by}`) |
115
+ | `om:graph <id>` | `knowledge:graph` | Show outgoing + incoming graph edges |
116
+ | `om:skills <id>` | `knowledge:skills` | Show callable invocations on graph neighbors |
117
+ | `om:generate` | `knowledge:generate` | Regenerate `_generated/nodes.ts` from MDX sources |
118
+
119
+ Common flags: `--json`, `--ids-only`, `--limit <n>`, `--kinds <list>`.
120
+
121
+ ---
122
+
123
+ ## Read Patterns (Tenant Project)
124
+
125
+ ### Free-text discovery (default for natural-language queries)
126
+
127
+ ```bash
128
+ pnpm exec elevasis-sdk om:search "lead gen"
129
+ pnpm exec elevasis-sdk om:search outreach --kinds knowledge --limit 5
130
+ pnpm exec elevasis-sdk om:search apollo --ids-only
131
+ ```
132
+
133
+ ### Neighborhood view for any OM node
134
+
135
+ ```bash
136
+ pnpm exec elevasis-sdk om:describe sales.crm
137
+ pnpm exec elevasis-sdk om:describe knowledge.outreach-playbook
138
+ pnpm exec elevasis-sdk om:describe sales.crm:object/deal
139
+ ```
140
+
141
+ ### Read a single knowledge node body
142
+
143
+ ```bash
144
+ pnpm exec elevasis-sdk om:cat knowledge.outreach-playbook
145
+ ```
146
+
147
+ ### Mount-path listings
148
+
149
+ ```bash
150
+ pnpm exec elevasis-sdk om:ls /by-system/sales.crm
151
+ pnpm exec elevasis-sdk om:ls /by-kind/playbook --ids-only
152
+ pnpm exec elevasis-sdk om:ls /by-ontology/sales.crm:object/deal --ids-only
153
+ pnpm exec elevasis-sdk om:ls /by-owner/role.ops-lead --ids-only
154
+ pnpm exec elevasis-sdk om:graph knowledge.outreach-playbook
155
+ ```
156
+
157
+ When a query clearly names an ontology id such as `sales.crm:object/deal`, route through
158
+ `/by-ontology/<id>` automatically. When the query names a graph node id such as
159
+ `ontology:sales.crm:object/deal`, strip the `ontology:` graph prefix for the
160
+ `/by-ontology/<id>` path.
161
+
162
+ ### `/om read-folder` (chat shorthand from the Knowledge Browser)
163
+
164
+ The Knowledge Browser's copy button on a top-level system or kind group emits a single
165
+ `/om read-folder <axis>:<id>` line (or the legacy `/knowledge read-folder ...` form) instead of
166
+ N per-node `read` lines. Resolve it by listing the folder via `om:ls` and reading each child:
167
+
168
+ | Copy form | Resolution |
169
+ | ------------------------------- | ---------------------------------------------------------------------------------------- |
170
+ | `/om read-folder system:<id>` | `pnpm exec elevasis-sdk om:ls /by-system/<id> --ids-only`, then `om:cat` each |
171
+ | `/om read-folder kind:<kind>` | `pnpm exec elevasis-sdk om:ls /by-kind/<kind> --ids-only`, then `om:cat` each |
172
+ | `/om read-folder owner:<id>` | `pnpm exec elevasis-sdk om:ls /by-owner/<id> --ids-only`, then `om:cat` each |
173
+ | `/om read-folder ontology:<id>` | `pnpm exec elevasis-sdk om:ls /by-ontology/<id> --ids-only`, then `om:cat` each |
174
+ | `/om read-folder graph:<id>` | inspect `/graph/<id>/governs` and `/graph/<id>/governed-by`; read returned knowledge ids |
175
+
176
+ Dotted system ids may use either dots or slashes (`sales.crm` and `sales/crm` both work).
177
+ Legacy `feature:<id>` copy lines from older browser builds are compatibility aliases for
178
+ `system:<id>`; resolve through `/by-system/`. Per-node leaves still copy as
179
+ `/om read <node-id>` (or `/knowledge read <node-id>`).
180
+
181
+ `read-folder system:<id>` is the baseline knowledge read, not a mandatory full-system snapshot.
182
+ Start by loading governing knowledge nodes; broaden into adjacent OM context only when the
183
+ current task makes it relevant.
184
+
185
+ ---
186
+
187
+ ## Organization Model Navigation Guide
188
+
189
+ Use this map whenever the task asks what something is, where it lives, what governs it, or
190
+ what adjacent context may matter:
191
+
192
+ | Question | Start here | Then inspect |
193
+ | ---------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
194
+ | What Systems exist? | `om:ls /by-kind/system` or `core/config/organization-model.ts` | System IDs, parentage, lifecycle, UI metadata, and content |
195
+ | What governs a System? | `om:describe <system-id>` or `om:ls /by-system/<id>` | system entry, governed knowledge, roles, policies, graph `governs` edges |
196
+ | What resources belong to a System? | the id-keyed `organizationModel.resources` map and `getResourcesForSystem(model, systemPath)` | use `{ includeDescendants: true }` only for parent-scope rollups |
197
+ | What can a System do? | system action refs and the actions domain | `action.resourceId`, invocation metadata, affected entities, policies |
198
+ | What data does it own? | entities domain | owning System refs, state catalogs, entity links, emitted/projected events |
199
+ | What UI surface exposes it? | `navigation.sidebar` plus `SystemModule` manifests | route files, surface targets, route-prefix modules, guards |
200
+ | What knowledge applies? | `om:ls /by-system/<id>` plus graph edges | `om:cat`, `om:graph`, `/graph/<id>/governed-by` |
201
+
202
+ Do not treat any one read as a complete system snapshot. The OM is a set of related domain maps;
203
+ follow the relationship that matches the work. Prefer structured helpers from
204
+ `@elevasis/core/organization-model` over ad hoc string scanning when code access is available.
205
+
206
+ ---
207
+
208
+ ## Shared Layering Preview
209
+
210
+ When opening a domain that uses a closed stage, status, or catalog vocabulary -- especially
211
+ prospecting, CRM, outreach, or another pipeline-like domain -- read the scaffold-shipped primer:
212
+
213
+ ```bash
214
+ node_modules/@elevasis/sdk/reference/spine/spine-primer.md
215
+ ```
216
+
217
+ Use it to emit a short domain layering preview before the normal read, describe, or codify flow:
218
+
219
+ 1. **Catalog:** which `organizationModel.<domain>` catalog owns the keys, labels, descriptions,
220
+ ordering, and entity ownership.
221
+ 2. **Runtime state:** where record progress is stored as sparse state keyed by those catalog
222
+ members.
223
+ 3. **Producers:** which templates, automations, or factories write entity-tagged results for those
224
+ keys.
225
+ 4. **Consumers:** which dashboards, queues, reports, filters, or API reads render or aggregate the
226
+ same keys.
227
+
228
+ For vibe-coder sessions, translate this into plain language: "business profile", "saved progress",
229
+ "automations", and "dashboard or reports". For technical sessions, it is acceptable to name the
230
+ catalog, state map, producer, and consumer surfaces directly.
231
+
232
+ ---
233
+
234
+ ## Write Power (Codify + Toggle Ceremony)
235
+
236
+ This tenant skill owns the full Codify and Toggle write surface. Every write runs the six-step
237
+ safety ceremony preserved verbatim from the legacy `/configure` flow.
238
+
239
+ ### Step 1: Snapshot
240
+
241
+ Read `core/config/organization-model.ts` into memory before any edit. This is the rollback target.
242
+
243
+ ### Step 2: Propose
244
+
245
+ Show the diff in chat. Identify which domain and field changes. Present the proposed new value
246
+ in context alongside the current value.
247
+
248
+ For stage, status, or catalog vocabulary edits, include the shared-layer impact preview before
249
+ asking for confirmation. Name the affected catalog key, whether existing sparse runtime state may
250
+ contain the old key, which producers/templates reference it, and which consumers render or filter
251
+ by it.
252
+
253
+ ### Step 3: Confirm
254
+
255
+ Pause for explicit user confirmation. Do not proceed without a clear yes. Permission prompts also
256
+ gate writes.
257
+
258
+ ### Step 4: Write
259
+
260
+ Apply the edit using the Edit or Write tool.
261
+
262
+ ### Step 5: Validate
263
+
264
+ Run both checks:
265
+
266
+ ```bash
267
+ pnpm -C operations check-types # TypeScript type-check
268
+ pnpm -C operations check # Runtime schema validation (Zod parse)
269
+ ```
270
+
271
+ ### Step 6: Rollback
272
+
273
+ If any validation step fails, restore the file from the Step 1 snapshot and report the error.
274
+ The rollback is mandatory -- never leave the project in a broken state.
275
+
276
+ **Two-level ceremony:**
277
+
278
+ - **Level A** -- config-only edits to existing schema fields in `core/config/organization-model.ts`.
279
+ Execute: `.claude/skills/om/operations/codify-level-a.md`
280
+ - **Level B** -- new Zod extension files in `core/config/extensions/`. Gated to explicit user
281
+ ask. On casual second mentions of a new type, suggest Level B and wait for confirmation rather
282
+ than scaffolding automatically.
283
+ Execute: `.claude/skills/om/operations/codify-level-b.md`
284
+
285
+ ---
286
+
287
+ ## Domain References
288
+
289
+ The following domain reference files document each org-model domain: schema fields, validation
290
+ rules, examples, and how to read or edit them. Load the relevant file when the user's intent
291
+ classification names a specific domain.
292
+
293
+ - `.claude/skills/om/operations/identity.md` -- identity domain
294
+ - `.claude/skills/om/operations/customers.md` -- customer segments
295
+ - `.claude/skills/om/operations/offerings.md` -- products and services
296
+ - `.claude/skills/om/operations/roles.md` -- role chart
297
+ - `.claude/skills/om/operations/goals.md` -- organizational goals
298
+ - `.claude/skills/om/operations/techStack.md` -- external integration registry
299
+ - `.claude/skills/om/operations/features.md` -- legacy compatibility notes for feature wording
300
+ - `.claude/skills/om/operations/labels.md` -- inline display labels on enum entries
301
+
302
+ ---
303
+
304
+ ## When NOT to Use This Skill
305
+
306
+ - Pure UI layout (no OM, no org-model entities, no knowledge graph)
307
+ - Workflow authoring or infrastructure work that doesn't reference org-model entities
308
+ - Status checks / ops questions about deployed resources -- those route through `/elevasis`
309
+ - Project/task management -- those route through `/project`
310
+
311
+ ---
312
+
313
+ ## Cross-Links
314
+
315
+ - `/configure` -- legacy org-model editor (pre-absorption). Absorbed into this skill; all Codify
316
+ and Toggle intents now route here. `/configure` vocabulary still works as a domain hint
317
+ (e.g. "configure identity" is parsed as domain=identity, intent=Describe-or-Codify).
318
+ - `node_modules/@elevasis/sdk/reference/spine/spine-primer.md` -- scaffold-shipped layering primer
319
+ for stage/status/catalog vocabularies that coordinate business-profile entries, runtime progress,
320
+ producers, and consumers in tenant projects.
321
+
322
+ ---
323
+
324
+ **Last Updated:** 2026-05-14
@@ -1,109 +1,110 @@
1
- # Customers domain
2
-
3
- The `customers` domain describes who the organization serves — distinct buyer archetypes modeled
4
- after the Value Proposition Canvas (BMC / VPC). Each segment captures jobs-to-be-done, pains,
5
- gains, firmographics, and a value proposition. Agents use these segments for targeting, outreach
6
- context, and personalization.
7
-
8
- ## Schema
9
-
10
- Source: `packages/core/src/organization-model/domains/customers.ts`
11
-
12
- ```typescript
13
- CustomersDomainSchema = z.object({
14
- segments: z.array(CustomerSegmentSchema).default([])
15
- })
16
-
17
- CustomerSegmentSchema = z.object({
18
- id: z.string().trim().min(1).max(100), // stable ID, e.g. "segment-smb-agencies"
19
- name: z.string().trim().max(200).default(''), // display name
20
- description: z.string().trim().max(2000).default(''), // who this segment is
21
- jobsToBeDone: z.string().trim().max(2000).default(''), // the goal they hire you to accomplish
22
- pains: z.array(z.string().trim().max(500)).default([]),
23
- gains: z.array(z.string().trim().max(500)).default([]),
24
- firmographics: FirmographicsSchema.default({}), // industry, companySize, region
25
- valueProp: z.string().trim().max(2000).default('') // why your offering fits this segment
26
- })
27
-
28
- FirmographicsSchema = z.object({
29
- industry: z.string().trim().max(200).optional(), // e.g. "Marketing Agency"
30
- companySize: z.string().trim().max(100).optional(), // e.g. "11–50"
31
- region: z.string().trim().max(200).optional() // e.g. "North America"
32
- })
33
- ```
34
-
35
- ## Field reference
36
-
37
- | Field | Type | Max | Notes |
38
- | --------------- | -------- | ---- | ------------------------------------------------------------ |
39
- | `id` | string | 100 | Stable key, min 1 char; e.g. `"segment-smb-agencies"` |
40
- | `name` | string | 200 | Display name |
41
- | `description` | string | 2000 | Who this segment is in one or two sentences |
42
- | `jobsToBeDone` | string | 2000 | The goal they hire you to accomplish, in their terms |
43
- | `pains` | string[] | 500 | Each item: a frustration or obstacle |
44
- | `gains` | string[] | 500 | Each item: an outcome or benefit they hope for |
45
- | `firmographics` | object | -- | Optional industry, companySize, region filters for targeting |
46
- | `valueProp` | string | 2000 | Why your offering uniquely addresses this segment's needs |
47
-
48
- ## Validation rules
49
-
50
- - `id` is the stable key used by `offerings.products[].targetSegmentIds` references; once set,
51
- changing the `id` of a segment breaks any offering that references it
52
- - `firmographics` is optional; all three sub-fields (`industry`, `companySize`, `region`) are
53
- individually optional
54
- - `pains` and `gains` default to empty arrays; agents should treat an empty array as unconfigured
55
- - There is no uniqueness constraint enforced by the schema on `id`, but agents must treat it as
56
- unique and surface duplicates if found
57
- - Cross-reference: if a segment is removed, any `offerings.products[].targetSegmentIds` that
58
- reference its `id` become dangling references; surface a warning before removing
59
-
60
- ## Examples
61
-
62
- ```typescript
63
- customers: {
64
- segments: [
65
- {
66
- id: "segment-smb-agencies",
67
- name: "SMB Marketing Agencies",
68
- description: "Owner-operated agencies with 1–15 employees running campaign delivery for SMB clients.",
69
- jobsToBeDone: "Deliver consistent client results without adding headcount.",
70
- pains: [
71
- "Manual campaign QA eats time",
72
- "Client reporting takes hours each week",
73
- "Hard to scale without hiring"
74
- ],
75
- gains: [
76
- "More client capacity without more staff",
77
- "Predictable delivery timelines"
78
- ],
79
- firmographics: {
80
- industry: "Marketing Agency",
81
- companySize: "1–15",
82
- region: "North America"
83
- },
84
- valueProp: "Automates the repetitive delivery and reporting work so agencies can take on more clients."
85
- }
86
- ]
87
- }
88
- ```
89
-
90
- ## Where it lives in the adapter
91
-
92
- `core/config/organization-model.ts` under the `customers` key of
93
- `defineOrganizationModel({...})`.
94
-
95
- To read current segments: open the adapter file and inspect the `customers.segments` array, or
96
- use `pnpm exec elevasis-sdk knowledge:cat customers` (external project).
97
-
98
- ## Write path
99
-
100
- To add, edit, or remove a segment, the `/knowledge` skill runs the codify ceremony
101
- (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
102
- rollback on failure. Only the `segments` array is written; no other keys in the adapter are
103
- touched. When adding, append to the array. When editing, replace the matching entry by `id`.
104
- When removing, filter it out — and surface any dangling `targetSegmentIds` references first.
105
-
106
- ---
107
-
108
- **Read via `/knowledge`** — natural-language queries like "who are our customer segments?" or
109
- "what pains does the agency segment have?" route to this domain via the skill's intent classifier.
1
+ # Customers domain
2
+
3
+ The `customers` domain describes who the organization serves — distinct buyer archetypes modeled
4
+ after the Value Proposition Canvas (BMC / VPC). Each segment captures jobs-to-be-done, pains,
5
+ gains, firmographics, and a value proposition. Agents use these segments for targeting, outreach
6
+ context, and personalization.
7
+
8
+ ## Schema
9
+
10
+ Source: `packages/core/src/organization-model/domains/customers.ts`
11
+
12
+ ```typescript
13
+ CustomersDomainSchema = z.object({
14
+ segments: z.array(CustomerSegmentSchema).default([])
15
+ })
16
+
17
+ CustomerSegmentSchema = z.object({
18
+ id: z.string().trim().min(1).max(100), // stable ID, e.g. "segment-smb-agencies"
19
+ name: z.string().trim().max(200).default(''), // display name
20
+ description: z.string().trim().max(2000).default(''), // who this segment is
21
+ jobsToBeDone: z.string().trim().max(2000).default(''), // the goal they hire you to accomplish
22
+ pains: z.array(z.string().trim().max(500)).default([]),
23
+ gains: z.array(z.string().trim().max(500)).default([]),
24
+ firmographics: FirmographicsSchema.default({}), // industry, companySize, region
25
+ valueProp: z.string().trim().max(2000).default('') // why your offering fits this segment
26
+ })
27
+
28
+ FirmographicsSchema = z.object({
29
+ industry: z.string().trim().max(200).optional(), // e.g. "Marketing Agency"
30
+ companySize: z.string().trim().max(100).optional(), // e.g. "11–50"
31
+ region: z.string().trim().max(200).optional() // e.g. "North America"
32
+ })
33
+ ```
34
+
35
+ ## Field reference
36
+
37
+ | Field | Type | Max | Notes |
38
+ | --------------- | -------- | ---- | ------------------------------------------------------------ |
39
+ | `id` | string | 100 | Stable key, min 1 char; e.g. `"segment-smb-agencies"` |
40
+ | `name` | string | 200 | Display name |
41
+ | `description` | string | 2000 | Who this segment is in one or two sentences |
42
+ | `jobsToBeDone` | string | 2000 | The goal they hire you to accomplish, in their terms |
43
+ | `pains` | string[] | 500 | Each item: a frustration or obstacle |
44
+ | `gains` | string[] | 500 | Each item: an outcome or benefit they hope for |
45
+ | `firmographics` | object | -- | Optional industry, companySize, region filters for targeting |
46
+ | `valueProp` | string | 2000 | Why your offering uniquely addresses this segment's needs |
47
+
48
+ ## Validation rules
49
+
50
+ - `id` is the stable key used by `offerings.products[].targetSegmentIds` references; once set,
51
+ changing the `id` of a segment breaks any offering that references it
52
+ - `firmographics` is optional; all three sub-fields (`industry`, `companySize`, `region`) are
53
+ individually optional
54
+ - `pains` and `gains` default to empty arrays; agents should treat an empty array as unconfigured
55
+ - There is no uniqueness constraint enforced by the schema on `id`, but agents must treat it as
56
+ unique and surface duplicates if found
57
+ - Cross-reference: if a segment is removed, any `offerings.products[].targetSegmentIds` that
58
+ reference its `id` become dangling references; surface a warning before removing
59
+
60
+ ## Examples
61
+
62
+ ```typescript
63
+ customers: {
64
+ segments: [
65
+ {
66
+ id: "segment-smb-agencies",
67
+ name: "SMB Marketing Agencies",
68
+ description: "Owner-operated agencies with 1–15 employees running campaign delivery for SMB clients.",
69
+ jobsToBeDone: "Deliver consistent client results without adding headcount.",
70
+ pains: [
71
+ "Manual campaign QA eats time",
72
+ "Client reporting takes hours each week",
73
+ "Hard to scale without hiring"
74
+ ],
75
+ gains: [
76
+ "More client capacity without more staff",
77
+ "Predictable delivery timelines"
78
+ ],
79
+ firmographics: {
80
+ industry: "Marketing Agency",
81
+ companySize: "1–15",
82
+ region: "North America"
83
+ },
84
+ valueProp: "Automates the repetitive delivery and reporting work so agencies can take on more clients."
85
+ }
86
+ ]
87
+ }
88
+ ```
89
+
90
+ ## Where it lives in the adapter
91
+
92
+ `core/config/organization-model.ts` under the `customers` key of
93
+ `defineOrganizationModel({...})`.
94
+
95
+ To read current segments: open the adapter file and inspect the `customers.segments` array, or
96
+ use `pnpm exec elevasis-sdk om:cat customers` (external project).
97
+
98
+ ## Write path
99
+
100
+ To add, edit, or remove a segment, the `/om` skill runs the codify ceremony
101
+ (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
102
+ rollback on failure. Only the `segments` array is written; no other keys in the adapter are
103
+ touched. When adding, append to the array. When editing, replace the matching entry by `id`.
104
+ When removing, filter it out — and surface any dangling `targetSegmentIds` references first.
105
+
106
+ ---
107
+
108
+ **Read via `/om`** (legacy `/knowledge` alias also accepted) — natural-language queries like
109
+ "who are our customer segments?" or "what pains does the agency segment have?" route to this
110
+ domain via the skill's intent classifier.