@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,345 +0,0 @@
1
- ---
2
- name: knowledge
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,
14
- core/config/organization-model.ts, packages/elevasis-core/src/organization-model/index.ts,
15
- or packages/core/src/knowledge/**.
16
- SKIP this skill when the task is purely UI layout, workflow authoring, or infrastructure
17
- work with no reference to org-model or knowledge-graph entities.
18
- metadata:
19
- pathPatterns:
20
- - "core/config/organization-model.ts"
21
- - "core/config/organization-model.ts"
22
- - "packages/elevasis-core/src/organization-model/**"
23
- - "packages/core/src/knowledge/**"
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
- # Knowledge
60
-
61
- Unified intent-inferring skill for all organization-model interaction. Reads org-model state
62
- through the `elevasis knowledge:*` CLI tooling; writes run through the codify ceremony absorbed
63
- from `/configure`. No verb namespace is required -- the skill classifies intent from conversation
64
- context and routes to the appropriate flow internally.
65
-
66
- ---
67
-
68
- ## When to Invoke
69
-
70
- This skill auto-invokes whenever:
71
-
72
- - Conversation references org-model entities (identity, customers, offerings, roles, goals,
73
- techStack, systems, actions, labels, knowledge nodes, governance edges, mounts)
74
- - The user asks to read, list, find, show, query, navigate, describe, codify, add, edit,
75
- update, toggle, enable, or disable any of those
76
- - An agent is editing files matching `core/config/organization-model.ts`,
77
- `core/config/organization-model.ts`, `packages/elevasis-core/src/organization-model/index.ts`,
78
- or `packages/core/src/knowledge/**`
79
-
80
- Auto-invocation is driven by frontmatter `description`, `metadata.pathPatterns`, and
81
- `metadata.promptSignals` -- no explicit `/knowledge` prefix is required.
82
-
83
- ---
84
-
85
- ## Intent Classification
86
-
87
- Once invoked, classify the user's intent into one of five flows. Read natural-language input and
88
- pick a flow. On ambiguous input, default to **Describe** (read intent) and ask the user to
89
- confirm before any write. The codify ceremony has an explicit user-confirm gate -- misclassification
90
- cannot bypass the write gate.
91
-
92
- | Flow | Triggers (examples) | Mechanics |
93
- | -------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
94
- | Read | "what playbooks govern sales.crm?", "show me all reference docs", "list my roles" | Run CLI read commands (monorepo or external); format result |
95
- | Navigate | "what governs this system?", "where does outreach-cadence apply?" | Same CLI; pick mount axis from intent; default to `by-system` for orientation queries |
96
- | Describe | "what is our identity set to?", "what's our timezone?" | Read current values from OM source; narrate |
97
- | Codify | "we're an e-commerce company", "add a customer segment", "our outreach goal is..." | Run codify ceremony with shared-layer impact preview: snapshot -> propose -> confirm -> write -> typecheck -> Zod parse -> rollback on failure |
98
- | Toggle | "enable the lead-gen system", "turn off SEO" | Codify ceremony scoped to the `systems` domain; flip availability/routing state; same validation/rollback |
99
-
100
- ---
101
-
102
- ## Shared Layering Preview
103
-
104
- When opening a domain that uses a closed stage, status, or catalog vocabulary -- especially
105
- prospecting, CRM, outreach, or another pipeline-like domain -- read the scaffold-shipped primer:
106
-
107
- ```bash
108
- node_modules/@elevasis/sdk/reference/spine/spine-primer.md
109
- ```
110
-
111
- Use it to emit a short domain layering preview before the normal read, describe, or codify flow:
112
-
113
- 1. **Catalog:** which `organizationModel.<domain>` catalog owns the keys, labels, descriptions,
114
- ordering, and entity ownership.
115
- 2. **Runtime state:** where record progress is stored as sparse state keyed by those catalog
116
- members.
117
- 3. **Producers:** which templates, automations, or factories write entity-tagged results for those
118
- keys.
119
- 4. **Consumers:** which dashboards, queues, reports, filters, or API reads render or aggregate the
120
- same keys.
121
-
122
- For vibe-coder sessions, translate this into plain language: "business profile", "saved progress",
123
- "automations", and "dashboard or reports". For technical sessions, it is acceptable to name the
124
- catalog, state map, producer, and consumer surfaces directly. External tenants route all follow-ups
125
- through `/knowledge`; do not point them at monorepo-only commands.
126
-
127
- ---
128
-
129
- ## Organization Model Navigation Guide
130
-
131
- Use this map whenever the task asks what something is, where it lives, what governs it, or
132
- what adjacent context may matter:
133
-
134
- | Question | Start here | Then inspect |
135
- | --- | --- | --- |
136
- | What Systems exist? | `core/config/organization-model.ts` | System IDs, parentage, lifecycle, UI metadata, and content |
137
- | What governs a System? | `/by-system/<id>` knowledge read | system entry, governed knowledge, roles, policies, graph `governs` edges |
138
- | What resources belong to a System? | the id-keyed `organizationModel.resources` map and `getResourcesForSystem(model, systemPath)` | use `{ includeDescendants: true }` only for parent-scope rollups |
139
- | What can a System do? | system action refs and the actions domain | `action.resourceId`, invocation metadata, affected entities, policies |
140
- | What data does it own? | entities domain | owning System refs, state catalogs, entity links, emitted/projected events |
141
- | What operational content exists? | system `content` | content helpers and scaffold migration helpers when available |
142
- | What UI surface exposes it? | `navigation.sidebar` plus `SystemModule` manifests | route files, surface targets, route-prefix modules, guards |
143
- | What knowledge applies? | knowledge domain plus graph edges | `knowledge:cat`, `knowledge:graph`, `/graph/<id>/governed-by` |
144
-
145
- Do not treat any one read as a complete system snapshot. The OM is a set of related
146
- domain maps; follow the relationship that matches the work. Prefer structured helpers
147
- from `@elevasis/core/organization-model` over ad hoc string scanning when code access is
148
- available.
149
-
150
- ---
151
-
152
- ## Read Patterns
153
-
154
- ### Monorepo (platform defaults)
155
-
156
- ```bash
157
- pnpm exec elevasis knowledge:ls
158
- pnpm exec elevasis knowledge:cat <node-id>
159
- pnpm exec elevasis knowledge:ls /by-system/<system-id>
160
- pnpm exec elevasis knowledge:ls /by-owner/<owner-id>
161
- pnpm exec elevasis knowledge:ls /by-ontology/<ontology-id> --ids-only
162
- pnpm exec elevasis knowledge:graph <node-id>
163
- ```
164
-
165
- ### External projects (org instance)
166
-
167
- ```bash
168
- pnpm exec elevasis-sdk knowledge:ls
169
- pnpm exec elevasis-sdk knowledge:cat <node-id>
170
- pnpm exec elevasis-sdk knowledge:ls /by-system/<system-id>
171
- pnpm exec elevasis-sdk knowledge:ls /by-owner/<owner-id>
172
- pnpm exec elevasis-sdk knowledge:ls /by-ontology/<ontology-id> --ids-only
173
- pnpm exec elevasis-sdk knowledge:graph <node-id>
174
- ```
175
-
176
- Use `knowledge:ls` to enumerate all knowledge nodes. Use `knowledge:cat` to read a specific
177
- node's content. Use `knowledge:ls /by-system/<system-id>` or
178
- `knowledge:ls /by-owner/<owner-id>` to navigate system and owner groupings. Use
179
- `knowledge:ls /by-ontology/<ontology-id> --ids-only` to find knowledge attached to a public
180
- ontology id, then `knowledge:cat` each returned node. Use `knowledge:graph <node-id>` to
181
- inspect incoming and outgoing graph edges for a specific node.
182
-
183
- When a `/knowledge` query clearly names an ontology id such as
184
- `sales.crm:object/deal`, route through `/by-ontology/<id>` automatically and read the
185
- returned nodes. When the query names an ontology graph node id such as
186
- `ontology:sales.crm:object/deal`, strip the `ontology:` graph prefix for the
187
- `/by-ontology/<id>` path and inspect the graph node only when the user asks for graph
188
- edges or adjacent context.
189
-
190
- ### `/knowledge read-folder` (chat shorthand from the Knowledge Browser)
191
-
192
- The Knowledge Browser's copy button on a top-level system or kind group emits a single
193
- `/knowledge read-folder <axis>:<id>` line instead of N per-node `read` lines. Resolve it by
194
- listing the folder via `knowledge:ls` and reading each child:
195
-
196
- | Copy form | Resolution (external) |
197
- | ------------------------------------ | --------------------------------------------------------------------------------------------- |
198
- | `/knowledge read-folder system:<id>` | `pnpm exec elevasis-sdk knowledge:ls /by-system/<id> --ids-only`, then `knowledge:cat` each |
199
- | `/knowledge read-folder kind:<kind>` | `pnpm exec elevasis-sdk knowledge:ls /by-kind/<kind> --ids-only`, then `knowledge:cat` each |
200
- | `/knowledge read-folder owner:<id>` | `pnpm exec elevasis-sdk knowledge:ls /by-owner/<id> --ids-only`, then `knowledge:cat` each |
201
- | `/knowledge read-folder ontology:<id>` | `pnpm exec elevasis-sdk knowledge:ls /by-ontology/<id> --ids-only`, then `knowledge:cat` each |
202
- | `/knowledge read-folder graph:<id>` | inspect `/graph/<id>/governs` and `/graph/<id>/governed-by`; read returned knowledge ids |
203
-
204
- Dotted system ids may use either dots or slashes (`sales.crm` and `sales/crm` both work
205
- with `knowledge:ls`). Legacy `feature:<id>` copy lines may still appear in older browser
206
- builds; treat them as compatibility aliases for `system:<id>` and resolve through `/by-system/`.
207
- Ontology read-folder ids are public Knowledge axes; route them through `/by-ontology/<id>`.
208
- Per-node leaves still copy as `/knowledge read <node-id>`. Browser group/domain/item folders
209
- usually copy explicit N-line read lists when they contain knowledge nodes; if they fall back to
210
- `group:`, `domain:`, `item:`, or `folder:` route ids, treat those as UI route breadcrumbs, not
211
- CLI mounts. Resolve them from visible child knowledge ids or the corresponding OM/graph context.
212
-
213
- `read-folder system:<id>` is the baseline knowledge read, not a mandatory full-system
214
- snapshot. Start by loading governing knowledge nodes. Broaden into adjacent Organization
215
- Model context only when the current task makes it relevant:
216
-
217
- - Runtime or implementation work: inspect the id-keyed `organizationModel.resources` map with
218
- `getResourcesForSystem(model, id)` or `getResourcesForSystem(model, id, { includeDescendants: true })`.
219
- - Operational configuration: inspect the system entry, `system.content`, `getContent()`,
220
- `resolveSystemContent()`, and scaffold migration helpers when applicable.
221
- - Governance or access work: inspect roles, policies, actions, entities, and graph edges
222
- through the Organization Graph or direct `core/config/organization-model.ts` domain reads.
223
- - Deployment/code work: follow resource ids into `operations/src/**` only when the task
224
- needs executable implementation details.
225
-
226
- There is no first-class CLI mount for "all resources/actions/entities/policies/roles by
227
- system" yet. Use the helpers above or scan the org model plus the relevant domain maps.
228
-
229
- ---
230
-
231
- ## Codify Ceremony
232
-
233
- Every write (Codify or Toggle intent) runs the six-step safety ceremony. This ceremony is
234
- preserved verbatim from `/configure`.
235
-
236
- ### Step 1: Snapshot
237
-
238
- Read `core/config/organization-model.ts` (external) or the appropriate platform OM file
239
- (monorepo) into memory before any edit. This is the rollback target.
240
-
241
- ### Step 2: Propose
242
-
243
- Show the diff in chat. Identify which domain and field changes. Present the proposed new value
244
- in context alongside the current value.
245
-
246
- For stage, status, or catalog vocabulary edits, include the shared-layer impact preview before
247
- asking for confirmation. Name the affected catalog key, whether existing sparse runtime state may
248
- contain the old key, which producers/templates reference it, and which consumers render or filter by
249
- it. If the impact cannot be determined from the local project, say which surface is unknown and keep
250
- the write gated.
251
-
252
- ### Step 3: Confirm
253
-
254
- Pause for explicit user confirmation. Do not proceed without a clear yes. Permission prompts
255
- also gate writes.
256
-
257
- ### Step 4: Write
258
-
259
- Apply the edit using the Edit or Write tool.
260
-
261
- ### Step 5: Validate
262
-
263
- Run both checks:
264
-
265
- ```bash
266
- pnpm -C operations check-types # TypeScript type-check
267
- pnpm -C operations check # Runtime schema validation (Zod parse)
268
- ```
269
-
270
- ### Step 6: Rollback
271
-
272
- If any validation step fails, restore the file from the Step 1 snapshot and report the error.
273
- The rollback is mandatory -- never leave the project in a broken state.
274
-
275
- **Two-level ceremony:**
276
-
277
- - **Level A** -- config-only edits to existing schema fields in `core/config/organization-model.ts`.
278
- Execute: `.claude/skills/knowledge/operations/codify-level-a.md`
279
- - **Level B** -- new Zod extension files in `core/config/extensions/`. Gated to explicit
280
- user ask. On casual second mentions of a new type, suggest Level B and wait for confirmation
281
- rather than scaffolding automatically.
282
- Execute: `.claude/skills/knowledge/operations/codify-level-b.md`
283
-
284
- ---
285
-
286
- ## Domain References
287
-
288
- The following domain reference files document each org-model domain: schema fields, validation
289
- rules, examples, and how to read or edit them. Load the relevant file when the user's intent
290
- classification names a specific domain.
291
-
292
- - `.claude/skills/knowledge/operations/identity.md` -- identity domain
293
- - `.claude/skills/knowledge/operations/customers.md` -- customer segments
294
- - `.claude/skills/knowledge/operations/offerings.md` -- products and services
295
- - `.claude/skills/knowledge/operations/roles.md` -- role chart
296
- - `.claude/skills/knowledge/operations/goals.md` -- organizational goals
297
- - `.claude/skills/knowledge/operations/techStack.md` -- external integration registry
298
- - `.claude/skills/knowledge/operations/features.md` -- legacy compatibility notes for feature wording; current availability/routing work uses Systems and Actions language
299
- - `.claude/skills/knowledge/operations/labels.md` -- inline display labels on enum entries
300
-
301
- These files are populated by Wave B2 and own the domain-specific schema reference content. The
302
- codify ceremony files above own the write pipeline. This SKILL.md owns intent classification
303
- and routing.
304
-
305
- ---
306
-
307
- ## Monorepo vs External
308
-
309
- ### External projects (canonical scope -- full power)
310
-
311
- In external projects (`external/_template`, `external/ZentaraHQ`, etc.) this skill has
312
- full power: read + write + codify + toggle. The org-model file is
313
- `core/config/organization-model.ts` (or `core/config/organization-model.ts` for
314
- `external/_template`-derived projects). Extension files live in `core/config/extensions/`.
315
-
316
- This is the environment where Codify and Toggle intents write. All six ceremony steps apply.
317
-
318
- ### Monorepo (read-only pointer for tenants; direct PR for platform)
319
-
320
- The monorepo-side skill at `.claude/skills/knowledge/SKILL.md` is a read-only pointer. For
321
- tenant agents reading the platform OM, it reads `packages/elevasis-core/src/organization-model/index.ts`
322
- (the workspace-resident platform OM, importable as `@repo/elevasis-core/organization-model`).
323
- It documents read patterns and explicitly declines write operations for tenant contexts.
324
-
325
- To modify the Elevasis runtime/platform OM, edit files under `packages/elevasis-core/src/organization-model/`
326
- via a standard PR in the monorepo -- this is source-controlled workspace code, not an external
327
- project. To modify your own tenant org-model state, work in `external/<your-project>/` where
328
- `/knowledge` has full write power via the codify ceremony.
329
-
330
- Cross-link: `.claude/skills/knowledge/SKILL.md` (monorepo pointer)
331
-
332
- ---
333
-
334
- ## Cross-Links
335
-
336
- - `/configure` -- Legacy org-model editor (pre-absorption). Absorbed into this skill; all
337
- Codify and Toggle intents now route here. `/configure` vocabulary still works as a domain
338
- hint (e.g., "configure identity" is parsed as domain=identity, intent=Describe-or-Codify).
339
- - `node_modules/@elevasis/sdk/reference/spine/spine-primer.md` -- Scaffold-shipped layering
340
- primer for stage/status/catalog vocabularies that coordinate business-profile entries, runtime
341
- progress, producers, and consumers in tenant projects.
342
-
343
- ---
344
-
345
- **Last Updated:** 2026-05-02