@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
@@ -1,94 +1,94 @@
1
- # Labels domain
2
-
3
- `label` is an inline display field carried by status entries, stage entries, System entries,
4
- knowledge nodes, registry entries, and sidebar surfaces in the OrganizationModel. Labels control what users see in the UI and what
5
- agents say when narrating state. Editing a label does not change the entry's `id` or
6
- `semanticClass` -- only the human-readable display string. This is Level A only (config-only
7
- edits to `core/config/organization-model.ts`).
8
-
9
- ## What carries labels
10
-
11
- The following model elements have editable inline `label` fields:
12
-
13
- **Status / stage entries.** Each domain that carries an enum-like array exposes per-entry labels:
14
-
15
- - `sales.statuses` -- deal pipeline stages.
16
- - `prospecting.statuses` -- lead lifecycle stages.
17
- - `projects.statuses` -- project and task stages.
18
-
19
- Source of platform defaults: `packages/core/src/organization-model/domains/{sales,prospecting,projects}.ts`.
20
-
21
- Each status entry shape:
22
-
23
- ```typescript
24
- { id: 'new', label: 'New Lead', semanticClass: 'active', color: 'blue' }
25
- ```
26
-
27
- **Systems.** The `label` field on a System entry. Editing it changes agent narration and any
28
- System-derived shell text, but it does not change the System `id`, route path, or graph node id.
29
-
30
- **Sidebar surfaces.** Routeable leaves under `navigation.sidebar.primary` and
31
- `navigation.sidebar.bottom` carry labels. Editing changes nav item and breadcrumb display without
32
- changing the route path or target System refs.
33
-
34
- **Knowledge/domain entries.** Knowledge nodes, customers, offerings, goals, roles, resources,
35
- actions, entities, and policies may carry labels or titles depending on the domain. Edit only the
36
- display field that already exists on the entry.
37
-
38
- ## What is NOT in scope
39
-
40
- `id` and `semanticClass` of any entry must never change in a label edit -- they are structural
41
- anchors used by code, hooks, and workflow adapters. Only `label` (and optionally `color` or
42
- `icon`) are in scope. To rename an `id`, escalate to a separate Level B refactor with explicit
43
- confirmation, because every consumer that references the old `id` must be updated in the same
44
- change.
45
-
46
- ## Validation rules
47
-
48
- - `label` is non-empty, max 120 characters.
49
- - `id` and `semanticClass` are unchanged from the previous state.
50
- - Entries not being edited remain byte-identical in the output -- partial array rewrites are
51
- preferred over wholesale array replacement to minimize diff surface.
52
-
53
- ## Realistic examples
54
-
55
- Rename two sales statuses:
56
-
57
- ```
58
- Domain: sales (deal pipeline)
59
- new: "New Lead" -> "Inbound Lead"
60
- proposal: "Proposal Sent" -> "Proposal Out"
61
- negotiation: (unchanged)
62
- ```
63
-
64
- Rename a System label without changing its ID:
65
-
66
- ```
67
- systems:
68
- sales.crm: label "CRM" -> "Sales Pipeline"
69
- (id stays 'sales.crm'; graph node remains 'system:sales.crm')
70
- ```
71
-
72
- Rename a sidebar surface:
73
-
74
- ```
75
- navigation.sidebar.primary:
76
- sales.crm: label "Pipeline" -> "Deal Pipeline"
77
- ```
78
-
79
- ## Validation gate
80
-
81
- Every label change must pass before codify completes:
82
-
83
- 1. `pnpm -C operations check-types`.
84
- 2. `resolveOrganizationModel()` and `OrganizationModelSchema.parse()` succeed on the merged result.
85
-
86
- On failure, the codify ceremony rolls back. See `operations/codify-level-a.md` for the rollback
87
- procedure.
88
-
89
- ---
90
-
91
- > **Read via `/knowledge`** -- natural-language queries like "what's the label for the proposal
92
- > stage?" or "what do we call the SEO System?" route to this domain via the skill's intent
93
- > classifier. To rename one or more labels, the `/knowledge` skill triggers the codify ceremony
94
- > when intent classifies as Codify.
1
+ # Labels domain
2
+
3
+ `label` is an inline display field carried by status entries, stage entries, System entries,
4
+ knowledge nodes, registry entries, and sidebar surfaces in the OrganizationModel. Labels control what users see in the UI and what
5
+ agents say when narrating state. Editing a label does not change the entry's `id` or
6
+ `semanticClass` -- only the human-readable display string. This is Level A only (config-only
7
+ edits to `core/config/organization-model.ts`).
8
+
9
+ ## What carries labels
10
+
11
+ The following model elements have editable inline `label` fields:
12
+
13
+ **Status / stage entries.** Each domain that carries an enum-like array exposes per-entry labels:
14
+
15
+ - `sales.statuses` -- deal pipeline stages.
16
+ - `prospecting.statuses` -- lead lifecycle stages.
17
+ - `projects.statuses` -- project and task stages.
18
+
19
+ Source of platform defaults: `packages/core/src/organization-model/domains/{sales,prospecting,projects}.ts`.
20
+
21
+ Each status entry shape:
22
+
23
+ ```typescript
24
+ { id: 'new', label: 'New Lead', semanticClass: 'active', color: 'blue' }
25
+ ```
26
+
27
+ **Systems.** The `label` field on a System entry. Editing it changes agent narration and any
28
+ System-derived shell text, but it does not change the System `id`, route path, or graph node id.
29
+
30
+ **Sidebar surfaces.** Routeable leaves under `navigation.sidebar.primary` and
31
+ `navigation.sidebar.bottom` carry labels. Editing changes nav item and breadcrumb display without
32
+ changing the route path or target System refs.
33
+
34
+ **Knowledge/domain entries.** Knowledge nodes, customers, offerings, goals, roles, resources,
35
+ actions, entities, and policies may carry labels or titles depending on the domain. Edit only the
36
+ display field that already exists on the entry.
37
+
38
+ ## What is NOT in scope
39
+
40
+ `id` and `semanticClass` of any entry must never change in a label edit -- they are structural
41
+ anchors used by code, hooks, and workflow adapters. Only `label` (and optionally `color` or
42
+ `icon`) are in scope. To rename an `id`, escalate to a separate Level B refactor with explicit
43
+ confirmation, because every consumer that references the old `id` must be updated in the same
44
+ change.
45
+
46
+ ## Validation rules
47
+
48
+ - `label` is non-empty, max 120 characters.
49
+ - `id` and `semanticClass` are unchanged from the previous state.
50
+ - Entries not being edited remain byte-identical in the output -- partial array rewrites are
51
+ preferred over wholesale array replacement to minimize diff surface.
52
+
53
+ ## Realistic examples
54
+
55
+ Rename two sales statuses:
56
+
57
+ ```
58
+ Domain: sales (deal pipeline)
59
+ new: "New Lead" -> "Inbound Lead"
60
+ proposal: "Proposal Sent" -> "Proposal Out"
61
+ negotiation: (unchanged)
62
+ ```
63
+
64
+ Rename a System label without changing its ID:
65
+
66
+ ```
67
+ systems:
68
+ sales.crm: label "CRM" -> "Sales Pipeline"
69
+ (id stays 'sales.crm'; graph node remains 'system:sales.crm')
70
+ ```
71
+
72
+ Rename a sidebar surface:
73
+
74
+ ```
75
+ navigation.sidebar.primary:
76
+ sales.crm: label "Pipeline" -> "Deal Pipeline"
77
+ ```
78
+
79
+ ## Validation gate
80
+
81
+ Every label change must pass before codify completes:
82
+
83
+ 1. `pnpm -C operations check-types`.
84
+ 2. `resolveOrganizationModel()` and `OrganizationModelSchema.parse()` succeed on the merged result.
85
+
86
+ On failure, the codify ceremony rolls back. See `operations/codify-level-a.md` for the rollback
87
+ procedure.
88
+
89
+ ---
90
+
91
+ > **Read via `/om`** (legacy `/knowledge` alias also accepted) -- natural-language queries like
92
+ > "what's the label for the proposal stage?" or "what do we call the SEO System?" route to this
93
+ > domain via the skill's intent classifier. To rename one or more labels, the `/om` skill triggers
94
+ > the codify ceremony when intent classifies as Codify.
@@ -1,109 +1,110 @@
1
- # Offerings domain
2
-
3
- The `offerings` domain describes what the organization sells or delivers — a catalog of products
4
- and services modeled after the Business Model Canvas "Value Propositions". Agents use offerings
5
- for quoting, proposal generation, and scope-of-work reasoning.
6
-
7
- ## Schema
8
-
9
- Source: `packages/core/src/organization-model/domains/offerings.ts`
10
-
11
- ```typescript
12
- OfferingsDomainSchema = z.object({
13
- products: z.array(ProductSchema).default([])
14
- })
15
-
16
- ProductSchema = z.object({
17
- id: z.string().trim().min(1).max(100), // stable ID, e.g. "product-starter-plan"
18
- name: z.string().trim().max(200).default(''), // display name
19
- description: z.string().trim().max(2000).default(''), // what it delivers
20
- pricingModel: PricingModelSchema.default('custom'), // 'one-time' | 'subscription' | 'usage-based' | 'custom'
21
- price: z.number().min(0).default(0), // base price amount (>= 0)
22
- currency: z.string().trim().max(10).default('USD'),// ISO 4217, e.g. "USD", "EUR"
23
- targetSegmentIds: z.array(z.string()).default([]), // must ref customers.segments[].id
24
- deliverySystemId: z.string().optional() // optional ref to systems[].id
25
- })
26
- ```
27
-
28
- `pricingModel` values:
29
-
30
- - `one-time` -- single purchase (setup fee, project fee)
31
- - `subscription` -- recurring (monthly/annual SaaS, retainer)
32
- - `usage-based` -- metered by consumption (API calls, seats)
33
- - `custom` -- negotiated or bespoke pricing
34
-
35
- ## Field reference
36
-
37
- | Field | Type | Max | Notes |
38
- | ------------------- | -------- | ---- | -------------------------------------------------------- |
39
- | `id` | string | 100 | Stable key, min 1 char; e.g. `"product-starter-plan"` |
40
- | `name` | string | 200 | Display name |
41
- | `description` | string | 2000 | What this product or service delivers |
42
- | `pricingModel` | enum | -- | `one-time`, `subscription`, `usage-based`, or `custom` |
43
- | `price` | number | -- | Base price amount, min 0; use 0 for fully custom pricing |
44
- | `currency` | string | 10 | ISO 4217 code; defaults to `"USD"` |
45
- | `targetSegmentIds` | string[] | -- | Each entry must reference a `customers.segments[].id` |
46
- | `deliverySystemId` | string | -- | Optional reference to a `systems[].id` |
47
-
48
- ## Validation rules
49
-
50
- - `id` is the stable key; changing it after creation is a breaking change for any downstream
51
- references
52
- - `targetSegmentIds` entries must exist in `customers.segments[].id`; the schema enforces this
53
- at parse time — missing references cause `resolveOrganizationModel()` to fail
54
- - `deliverySystemId` (when present) must exist in `systems[].id`; same parse-time enforcement
55
- - `price` must be >= 0; use 0 when pricing is fully custom or not yet set
56
- - `currency` must be a valid ISO 4217 code by convention (the schema only validates length)
57
- - Cross-reference: if a product is removed, surface any `targetSegmentIds` in other products
58
- that reference the removed ID
59
-
60
- ## Examples
61
-
62
- ```typescript
63
- offerings: {
64
- products: [
65
- {
66
- id: "product-full-service-retainer",
67
- name: "Full-Service Retainer",
68
- description: "End-to-end campaign delivery, reporting, and optimization for SMB clients.",
69
- pricingModel: "subscription",
70
- price: 2500,
71
- currency: "USD",
72
- targetSegmentIds: ["segment-smb-agencies"],
73
- deliverySystemId: undefined
74
- },
75
- {
76
- id: "product-one-time-audit",
77
- name: "One-Time Operations Audit",
78
- description: "Single-engagement review of current workflows with a remediation roadmap.",
79
- pricingModel: "one-time",
80
- price: 1500,
81
- currency: "USD",
82
- targetSegmentIds: ["segment-smb-agencies"],
83
- deliverySystemId: undefined
84
- }
85
- ]
86
- }
87
- ```
88
-
89
- ## Where it lives in the adapter
90
-
91
- `core/config/organization-model.ts` under the `offerings` key of
92
- `defineOrganizationModel({...})`.
93
-
94
- To read current products: open the adapter file and inspect the `offerings.products` array, or
95
- use `pnpm exec elevasis-sdk knowledge:cat offerings` (external project).
96
-
97
- ## Write path
98
-
99
- To add, edit, or remove a product, the `/knowledge` skill runs the codify ceremony
100
- (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
101
- rollback on failure. Only the `products` array is written; no other keys in the adapter are
102
- touched. Before writing, the skill verifies all `targetSegmentIds` and `deliverySystemId`
103
- references resolve. When adding, append to the array. When editing, replace by `id`. When
104
- removing, filter out — and surface any dangling references first.
105
-
106
- ---
107
-
108
- **Read via `/knowledge`** — natural-language queries like "what do we sell?" or "what's the
109
- pricing on the retainer?" route to this domain via the skill's intent classifier.
1
+ # Offerings domain
2
+
3
+ The `offerings` domain describes what the organization sells or delivers — a catalog of products
4
+ and services modeled after the Business Model Canvas "Value Propositions". Agents use offerings
5
+ for quoting, proposal generation, and scope-of-work reasoning.
6
+
7
+ ## Schema
8
+
9
+ Source: `packages/core/src/organization-model/domains/offerings.ts`
10
+
11
+ ```typescript
12
+ OfferingsDomainSchema = z.object({
13
+ products: z.array(ProductSchema).default([])
14
+ })
15
+
16
+ ProductSchema = z.object({
17
+ id: z.string().trim().min(1).max(100), // stable ID, e.g. "product-starter-plan"
18
+ name: z.string().trim().max(200).default(''), // display name
19
+ description: z.string().trim().max(2000).default(''), // what it delivers
20
+ pricingModel: PricingModelSchema.default('custom'), // 'one-time' | 'subscription' | 'usage-based' | 'custom'
21
+ price: z.number().min(0).default(0), // base price amount (>= 0)
22
+ currency: z.string().trim().max(10).default('USD'),// ISO 4217, e.g. "USD", "EUR"
23
+ targetSegmentIds: z.array(z.string()).default([]), // must ref customers.segments[].id
24
+ deliverySystemId: z.string().optional() // optional ref to systems[].id
25
+ })
26
+ ```
27
+
28
+ `pricingModel` values:
29
+
30
+ - `one-time` -- single purchase (setup fee, project fee)
31
+ - `subscription` -- recurring (monthly/annual SaaS, retainer)
32
+ - `usage-based` -- metered by consumption (API calls, seats)
33
+ - `custom` -- negotiated or bespoke pricing
34
+
35
+ ## Field reference
36
+
37
+ | Field | Type | Max | Notes |
38
+ | ------------------ | -------- | ---- | -------------------------------------------------------- |
39
+ | `id` | string | 100 | Stable key, min 1 char; e.g. `"product-starter-plan"` |
40
+ | `name` | string | 200 | Display name |
41
+ | `description` | string | 2000 | What this product or service delivers |
42
+ | `pricingModel` | enum | -- | `one-time`, `subscription`, `usage-based`, or `custom` |
43
+ | `price` | number | -- | Base price amount, min 0; use 0 for fully custom pricing |
44
+ | `currency` | string | 10 | ISO 4217 code; defaults to `"USD"` |
45
+ | `targetSegmentIds` | string[] | -- | Each entry must reference a `customers.segments[].id` |
46
+ | `deliverySystemId` | string | -- | Optional reference to a `systems[].id` |
47
+
48
+ ## Validation rules
49
+
50
+ - `id` is the stable key; changing it after creation is a breaking change for any downstream
51
+ references
52
+ - `targetSegmentIds` entries must exist in `customers.segments[].id`; the schema enforces this
53
+ at parse time — missing references cause `resolveOrganizationModel()` to fail
54
+ - `deliverySystemId` (when present) must exist in `systems[].id`; same parse-time enforcement
55
+ - `price` must be >= 0; use 0 when pricing is fully custom or not yet set
56
+ - `currency` must be a valid ISO 4217 code by convention (the schema only validates length)
57
+ - Cross-reference: if a product is removed, surface any `targetSegmentIds` in other products
58
+ that reference the removed ID
59
+
60
+ ## Examples
61
+
62
+ ```typescript
63
+ offerings: {
64
+ products: [
65
+ {
66
+ id: "product-full-service-retainer",
67
+ name: "Full-Service Retainer",
68
+ description: "End-to-end campaign delivery, reporting, and optimization for SMB clients.",
69
+ pricingModel: "subscription",
70
+ price: 2500,
71
+ currency: "USD",
72
+ targetSegmentIds: ["segment-smb-agencies"],
73
+ deliverySystemId: undefined
74
+ },
75
+ {
76
+ id: "product-one-time-audit",
77
+ name: "One-Time Operations Audit",
78
+ description: "Single-engagement review of current workflows with a remediation roadmap.",
79
+ pricingModel: "one-time",
80
+ price: 1500,
81
+ currency: "USD",
82
+ targetSegmentIds: ["segment-smb-agencies"],
83
+ deliverySystemId: undefined
84
+ }
85
+ ]
86
+ }
87
+ ```
88
+
89
+ ## Where it lives in the adapter
90
+
91
+ `core/config/organization-model.ts` under the `offerings` key of
92
+ `defineOrganizationModel({...})`.
93
+
94
+ To read current products: open the adapter file and inspect the `offerings.products` array, or
95
+ use `pnpm exec elevasis-sdk om:cat offerings` (external project).
96
+
97
+ ## Write path
98
+
99
+ To add, edit, or remove a product, the `/om` skill runs the codify ceremony
100
+ (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
101
+ rollback on failure. Only the `products` array is written; no other keys in the adapter are
102
+ touched. Before writing, the skill verifies all `targetSegmentIds` and `deliverySystemId`
103
+ references resolve. When adding, append to the array. When editing, replace by `id`. When
104
+ removing, filter out — and surface any dangling references first.
105
+
106
+ ---
107
+
108
+ **Read via `/om`** (legacy `/knowledge` alias also accepted) — natural-language queries like
109
+ "what do we sell?" or "what's the pricing on the retainer?" route to this domain via the skill's
110
+ intent classifier.
@@ -1,99 +1,100 @@
1
- # Roles domain
2
-
3
- The `roles` domain describes who does what inside the organization — a role chart inspired by the
4
- EOS Accountability Chart but using plain-language field names throughout. Agents use this domain
5
- for HITL routing, escalation logic, and approval-rights reasoning.
6
-
7
- Field names are developer-facing; when narrating to users, say "role", "responsibilities",
8
- "reports to", and "held by". Do not say "seat", "accountability", or "EOS".
9
-
10
- ## Schema
11
-
12
- Source: `packages/core/src/organization-model/domains/roles.ts`
13
-
14
- ```typescript
15
- RolesDomainSchema = z.object({
16
- roles: z.array(RoleSchema).default([])
17
- })
18
-
19
- RoleSchema = z.object({
20
- id: z.string().trim().min(1).max(100), // stable ID, e.g. "role-ceo"
21
- title: z.string().trim().min(1).max(200), // display title, e.g. "CEO"
22
- responsibilities: z.array(z.string().trim().max(500)).default([]),// what this role owns
23
- reportsToId: z.string().trim().min(1).max(100).optional(), // must ref another roles[].id
24
- heldBy: z.string().trim().max(200).optional() // name or email, free-form
25
- })
26
- ```
27
-
28
- ## Field reference
29
-
30
- | Field | Type | Max | Notes |
31
- | ------------------ | -------- | --- | --------------------------------------------------------------- |
32
- | `id` | string | 100 | Stable key, min 1 char; e.g. `"role-ceo"` |
33
- | `title` | string | 200 | Display title; min 1 char required |
34
- | `responsibilities` | string[] | 500 | Each item: one thing this role is accountable for |
35
- | `reportsToId` | string | 100 | Optional; must reference another `roles[].id` in the collection |
36
- | `heldBy` | string | 200 | Optional; name or email of the person holding this role |
37
-
38
- ## Validation rules
39
-
40
- - `reportsToId` (when present) must resolve to another `roles[].id` in the same collection;
41
- enforced at parse time by `OrganizationModelSchema.superRefine()`
42
- - Absence of `reportsToId` indicates a top-level role (no reporting line)
43
- - Cycle detection is not enforced by the schema (known limitation); agents should surface
44
- obvious cycles (e.g. role A reports to role B which reports to role A)
45
- - `heldBy` is free-form; no validation beyond max length
46
- - An empty roles array means no HITL routing or escalation rules are available
47
-
48
- ## Examples
49
-
50
- ```typescript
51
- roles: {
52
- roles: [
53
- {
54
- id: "role-ceo",
55
- title: "CEO",
56
- responsibilities: [
57
- "Set company direction",
58
- "Final approval on deals >$10K",
59
- "Manage investor relations"
60
- ],
61
- reportsToId: undefined,
62
- heldBy: "Alice Johnson"
63
- },
64
- {
65
- id: "role-head-of-client-success",
66
- title: "Head of Client Success",
67
- responsibilities: [
68
- "Own client health scores",
69
- "Lead quarterly business reviews",
70
- "Handle escalations"
71
- ],
72
- reportsToId: "role-ceo",
73
- heldBy: undefined
74
- }
75
- ]
76
- }
77
- ```
78
-
79
- ## Where it lives in the adapter
80
-
81
- `core/config/organization-model.ts` under the `roles` key of
82
- `defineOrganizationModel({...})`.
83
-
84
- To read the current role chart: open the adapter file and inspect the `roles.roles` array, or
85
- use `pnpm exec elevasis-sdk knowledge:cat roles` (external project).
86
-
87
- ## Write path
88
-
89
- To add, edit, or remove a role, the `/knowledge` skill runs the codify ceremony
90
- (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
91
- rollback on failure. Only the `roles` array is written; no other keys in the adapter are touched.
92
- Before writing, the skill verifies all `reportsToId` references resolve to IDs that will exist
93
- after the write. When removing a role, the skill surfaces any other roles that `reportsToId` to it
94
- and asks whether to clear those reporting lines before proceeding.
95
-
96
- ---
97
-
98
- **Read via `/knowledge`** — natural-language queries like "who is responsible for client
99
- escalations?" or "list my roles" route to this domain via the skill's intent classifier.
1
+ # Roles domain
2
+
3
+ The `roles` domain describes who does what inside the organization — a role chart inspired by the
4
+ EOS Accountability Chart but using plain-language field names throughout. Agents use this domain
5
+ for HITL routing, escalation logic, and approval-rights reasoning.
6
+
7
+ Field names are developer-facing; when narrating to users, say "role", "responsibilities",
8
+ "reports to", and "held by". Do not say "seat", "accountability", or "EOS".
9
+
10
+ ## Schema
11
+
12
+ Source: `packages/core/src/organization-model/domains/roles.ts`
13
+
14
+ ```typescript
15
+ RolesDomainSchema = z.object({
16
+ roles: z.array(RoleSchema).default([])
17
+ })
18
+
19
+ RoleSchema = z.object({
20
+ id: z.string().trim().min(1).max(100), // stable ID, e.g. "role-ceo"
21
+ title: z.string().trim().min(1).max(200), // display title, e.g. "CEO"
22
+ responsibilities: z.array(z.string().trim().max(500)).default([]),// what this role owns
23
+ reportsToId: z.string().trim().min(1).max(100).optional(), // must ref another roles[].id
24
+ heldBy: z.string().trim().max(200).optional() // name or email, free-form
25
+ })
26
+ ```
27
+
28
+ ## Field reference
29
+
30
+ | Field | Type | Max | Notes |
31
+ | ------------------ | -------- | --- | --------------------------------------------------------------- |
32
+ | `id` | string | 100 | Stable key, min 1 char; e.g. `"role-ceo"` |
33
+ | `title` | string | 200 | Display title; min 1 char required |
34
+ | `responsibilities` | string[] | 500 | Each item: one thing this role is accountable for |
35
+ | `reportsToId` | string | 100 | Optional; must reference another `roles[].id` in the collection |
36
+ | `heldBy` | string | 200 | Optional; name or email of the person holding this role |
37
+
38
+ ## Validation rules
39
+
40
+ - `reportsToId` (when present) must resolve to another `roles[].id` in the same collection;
41
+ enforced at parse time by `OrganizationModelSchema.superRefine()`
42
+ - Absence of `reportsToId` indicates a top-level role (no reporting line)
43
+ - Cycle detection is not enforced by the schema (known limitation); agents should surface
44
+ obvious cycles (e.g. role A reports to role B which reports to role A)
45
+ - `heldBy` is free-form; no validation beyond max length
46
+ - An empty roles array means no HITL routing or escalation rules are available
47
+
48
+ ## Examples
49
+
50
+ ```typescript
51
+ roles: {
52
+ roles: [
53
+ {
54
+ id: "role-ceo",
55
+ title: "CEO",
56
+ responsibilities: [
57
+ "Set company direction",
58
+ "Final approval on deals >$10K",
59
+ "Manage investor relations"
60
+ ],
61
+ reportsToId: undefined,
62
+ heldBy: "Alice Johnson"
63
+ },
64
+ {
65
+ id: "role-head-of-client-success",
66
+ title: "Head of Client Success",
67
+ responsibilities: [
68
+ "Own client health scores",
69
+ "Lead quarterly business reviews",
70
+ "Handle escalations"
71
+ ],
72
+ reportsToId: "role-ceo",
73
+ heldBy: undefined
74
+ }
75
+ ]
76
+ }
77
+ ```
78
+
79
+ ## Where it lives in the adapter
80
+
81
+ `core/config/organization-model.ts` under the `roles` key of
82
+ `defineOrganizationModel({...})`.
83
+
84
+ To read the current role chart: open the adapter file and inspect the `roles.roles` array, or
85
+ use `pnpm exec elevasis-sdk om:cat roles` (external project).
86
+
87
+ ## Write path
88
+
89
+ To add, edit, or remove a role, the `/om` skill runs the codify ceremony
90
+ (`operations/codify-level-a.md`): snapshot → propose → confirm → write → typecheck → Zod parse →
91
+ rollback on failure. Only the `roles` array is written; no other keys in the adapter are touched.
92
+ Before writing, the skill verifies all `reportsToId` references resolve to IDs that will exist
93
+ after the write. When removing a role, the skill surfaces any other roles that `reportsToId` to it
94
+ and asks whether to clear those reporting lines before proceeding.
95
+
96
+ ---
97
+
98
+ **Read via `/om`** (legacy `/knowledge` alias also accepted) — natural-language queries like
99
+ "who is responsible for client escalations?" or "list my roles" route to this domain via the
100
+ skill's intent classifier.