@elevasis/sdk 1.22.0 → 1.23.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 (41) hide show
  1. package/dist/cli.cjs +980 -42
  2. package/dist/index.d.ts +1221 -220
  3. package/dist/index.js +390 -15
  4. package/dist/test-utils/index.d.ts +964 -211
  5. package/dist/test-utils/index.js +257 -14
  6. package/dist/worker/index.js +122 -14
  7. package/package.json +3 -3
  8. package/reference/claude-config/rules/operations.md +3 -3
  9. package/reference/claude-config/rules/organization-model.md +88 -85
  10. package/reference/claude-config/rules/organization-os.md +104 -104
  11. package/reference/claude-config/rules/vibe.md +235 -235
  12. package/reference/claude-config/skills/om/SKILL.md +324 -0
  13. package/reference/claude-config/skills/{knowledge → om}/operations/customers.md +110 -109
  14. package/reference/claude-config/skills/{knowledge → om}/operations/features.md +77 -76
  15. package/reference/claude-config/skills/{knowledge → om}/operations/goals.md +119 -118
  16. package/reference/claude-config/skills/{knowledge → om}/operations/identity.md +94 -93
  17. package/reference/claude-config/skills/{knowledge → om}/operations/labels.md +94 -94
  18. package/reference/claude-config/skills/{knowledge → om}/operations/offerings.md +110 -109
  19. package/reference/claude-config/skills/{knowledge → om}/operations/roles.md +100 -99
  20. package/reference/claude-config/skills/{knowledge → om}/operations/techStack.md +30 -30
  21. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  22. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  23. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  24. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  25. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  26. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  27. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +7 -4
  28. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +52 -0
  29. package/reference/examples/organization-model.ts +26 -2
  30. package/reference/scaffold/core/organization-model.mdx +16 -11
  31. package/reference/scaffold/recipes/add-a-feature.md +28 -26
  32. package/reference/scaffold/recipes/add-a-resource.md +26 -16
  33. package/reference/scaffold/recipes/customize-organization-model.md +5 -3
  34. package/reference/scaffold/recipes/extend-lead-gen.md +9 -9
  35. package/reference/scaffold/recipes/index.md +1 -1
  36. package/reference/scaffold/recipes/query-the-knowledge-graph.md +189 -185
  37. package/reference/scaffold/reference/contracts.md +139 -101
  38. package/reference/scaffold/reference/glossary.md +74 -72
  39. package/reference/claude-config/skills/knowledge/SKILL.md +0 -345
  40. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-a.md +0 -0
  41. /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-b.md +0 -0
@@ -4611,6 +4611,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
4611
4611
  "crm",
4612
4612
  "lead-gen",
4613
4613
  "projects",
4614
+ "clients",
4614
4615
  "operations",
4615
4616
  "monitoring",
4616
4617
  "knowledge",
@@ -6167,7 +6168,6 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
6167
6168
  table: entity.table
6168
6169
  }
6169
6170
  } : {},
6170
- legacyEntityId: entity.id,
6171
6171
  ...entity.rowSchema !== void 0 ? { rowSchema: entity.rowSchema } : {},
6172
6172
  ...entity.stateCatalogId !== void 0 ? { stateCatalogId: entity.stateCatalogId } : {}
6173
6173
  };
@@ -6192,8 +6192,7 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
6192
6192
  from: legacyObjectId(entity),
6193
6193
  to: legacyObjectId(targetEntity),
6194
6194
  cardinality: link.kind,
6195
- ...link.via !== void 0 ? { via: link.via } : {},
6196
- legacyEntityId: entity.id
6195
+ ...link.via !== void 0 ? { via: link.via } : {}
6197
6196
  };
6198
6197
  addRecord(index, diagnostics, sourcesById, "linkTypes", linkType, {
6199
6198
  source: "legacy.entities.links",
@@ -6251,8 +6250,7 @@ function addSystemContentProjections(index, diagnostics, sourcesById, systemPath
6251
6250
  kind: node.type,
6252
6251
  ...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
6253
6252
  ...Object.keys(entries).length > 0 ? { entries } : {},
6254
- ...node.data !== void 0 ? { data: node.data } : {},
6255
- legacyContentId: `${systemPath}:${localId}`
6253
+ ...node.data !== void 0 ? { data: node.data } : {}
6256
6254
  };
6257
6255
  addRecord(index, diagnostics, sourcesById, "catalogTypes", catalogType, {
6258
6256
  source: "legacy.system.content",
@@ -6430,11 +6428,20 @@ EventEmissionDescriptorSchema.extend({
6430
6428
  ownerKind: z.enum(["resource", "entity"]).meta({ label: "Owner kind" })
6431
6429
  });
6432
6430
  var ResourceOntologyBindingSchema = z.object({
6433
- implements: z.array(OntologyIdSchema).optional(),
6431
+ actions: z.array(OntologyIdSchema).optional(),
6432
+ primaryAction: OntologyIdSchema.optional(),
6434
6433
  reads: z.array(OntologyIdSchema).optional(),
6435
6434
  writes: z.array(OntologyIdSchema).optional(),
6436
6435
  usesCatalogs: z.array(OntologyIdSchema).optional(),
6437
6436
  emits: z.array(OntologyIdSchema).optional()
6437
+ }).superRefine((binding, ctx) => {
6438
+ if (binding.primaryAction === void 0) return;
6439
+ if (binding.actions?.includes(binding.primaryAction)) return;
6440
+ ctx.addIssue({
6441
+ code: z.ZodIssueCode.custom,
6442
+ path: ["primaryAction"],
6443
+ message: "Resource ontology primaryAction must be included in actions"
6444
+ });
6438
6445
  });
6439
6446
  var CodeReferenceSchema = z.object({
6440
6447
  path: z.string().trim().min(1).max(500).regex(/^[A-Za-z0-9_./$@()[\] -]+$/, "Code reference paths must be repo-relative paths"),
@@ -6449,6 +6456,10 @@ var ResourceEntryBaseSchema = z.object({
6449
6456
  order: z.number().default(0),
6450
6457
  /** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
6451
6458
  systemPath: SystemPathSchema.meta({ ref: "system" }),
6459
+ /** Executable display title owned by the OM Resource descriptor. */
6460
+ title: LabelSchema.optional(),
6461
+ /** Executable display description owned by the OM Resource descriptor. */
6462
+ description: DescriptionSchema.optional(),
6452
6463
  /** Optional role responsible for maintaining this resource. */
6453
6464
  ownerRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
6454
6465
  status: ResourceGovernanceStatusSchema,
@@ -6463,8 +6474,6 @@ var ResourceEntryBaseSchema = z.object({
6463
6474
  });
6464
6475
  var WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
6465
6476
  kind: z.literal("workflow"),
6466
- /** Mirrors WorkflowConfig.actionKey when the runtime workflow has one. */
6467
- actionKey: z.string().trim().min(1).max(255).optional(),
6468
6477
  emits: z.array(EventEmissionDescriptorSchema).optional()
6469
6478
  });
6470
6479
  var AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
@@ -6606,6 +6615,73 @@ var GoalsDomainSchema = z.record(z.string(), ObjectiveSchema).refine((record) =>
6606
6615
  message: "Each objective entry id must match its map key"
6607
6616
  }).default({});
6608
6617
  var DEFAULT_ORGANIZATION_MODEL_GOALS = {};
6618
+ var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
6619
+ var SecretLikeMetadataValueSchema = /(?:sk-[A-Za-z0-9_-]{12,}|pk_live_[A-Za-z0-9_-]{12,}|eyJ[A-Za-z0-9_-]{20,}|-----BEGIN (?:RSA |OPENSSH |EC )?PRIVATE KEY-----)/;
6620
+ z.enum([
6621
+ "system",
6622
+ "resource",
6623
+ "ontology",
6624
+ "policy",
6625
+ "role",
6626
+ "trigger",
6627
+ "humanCheckpoint",
6628
+ "externalResource"
6629
+ ]);
6630
+ var OmTopologyRelationshipKindSchema = z.enum(["triggers", "uses", "approval"]);
6631
+ var OmTopologyNodeRefSchema = z.discriminatedUnion("kind", [
6632
+ z.object({ kind: z.literal("system"), id: ModelIdSchema }),
6633
+ z.object({ kind: z.literal("resource"), id: ResourceIdSchema }),
6634
+ z.object({ kind: z.literal("ontology"), id: OntologyIdSchema }),
6635
+ z.object({ kind: z.literal("policy"), id: ModelIdSchema }),
6636
+ z.object({ kind: z.literal("role"), id: ModelIdSchema }),
6637
+ z.object({ kind: z.literal("trigger"), id: ResourceIdSchema }),
6638
+ z.object({ kind: z.literal("humanCheckpoint"), id: ResourceIdSchema }),
6639
+ z.object({ kind: z.literal("externalResource"), id: ResourceIdSchema })
6640
+ ]);
6641
+ var OmTopologyMetadataSchema = z.record(z.string().trim().min(1).max(120), JsonValueSchema).superRefine((metadata, ctx) => {
6642
+ function visit(value, path) {
6643
+ if (typeof value === "string" && SecretLikeMetadataValueSchema.test(value)) {
6644
+ ctx.addIssue({
6645
+ code: z.ZodIssueCode.custom,
6646
+ path,
6647
+ message: "Topology metadata must not contain secret-like values"
6648
+ });
6649
+ return;
6650
+ }
6651
+ if (Array.isArray(value)) {
6652
+ value.forEach((entry, index) => visit(entry, [...path, index]));
6653
+ return;
6654
+ }
6655
+ if (typeof value !== "object" || value === null) return;
6656
+ Object.entries(value).forEach(([key, entry]) => {
6657
+ if (SecretLikeMetadataKeySchema.test(key)) {
6658
+ ctx.addIssue({
6659
+ code: z.ZodIssueCode.custom,
6660
+ path: [...path, key],
6661
+ message: `Topology metadata key "${key}" looks secret-like`
6662
+ });
6663
+ }
6664
+ visit(entry, [...path, key]);
6665
+ });
6666
+ }
6667
+ visit(metadata, []);
6668
+ });
6669
+ var OmTopologyRelationshipSchema = z.object({
6670
+ from: OmTopologyNodeRefSchema,
6671
+ kind: OmTopologyRelationshipKindSchema,
6672
+ to: OmTopologyNodeRefSchema,
6673
+ systemPath: SystemPathSchema.optional(),
6674
+ required: z.boolean().optional(),
6675
+ metadata: OmTopologyMetadataSchema.optional()
6676
+ });
6677
+ var OmTopologyDomainSchema = z.object({
6678
+ version: z.literal(1).default(1),
6679
+ relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
6680
+ }).default({ version: 1, relationships: {} });
6681
+ var DEFAULT_ORGANIZATION_MODEL_TOPOLOGY = {
6682
+ version: 1,
6683
+ relationships: {}
6684
+ };
6609
6685
  var PolicyIdSchema = ModelIdSchema;
6610
6686
  var PolicyApplicabilitySchema = z.object({
6611
6687
  systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
@@ -6978,6 +7054,7 @@ z.enum([
6978
7054
  "systems",
6979
7055
  "ontology",
6980
7056
  "resources",
7057
+ "topology",
6981
7058
  "actions",
6982
7059
  "entities",
6983
7060
  "policies",
@@ -6997,6 +7074,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
6997
7074
  systems: { version: 1, lastModified: "2026-05-10" },
6998
7075
  ontology: { version: 1, lastModified: "2026-05-14" },
6999
7076
  resources: { version: 1, lastModified: "2026-05-10" },
7077
+ topology: { version: 1, lastModified: "2026-05-14" },
7000
7078
  actions: { version: 1, lastModified: "2026-05-10" },
7001
7079
  entities: { version: 1, lastModified: "2026-05-10" },
7002
7080
  policies: { version: 1, lastModified: "2026-05-10" },
@@ -7012,6 +7090,7 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
7012
7090
  systems: OrganizationModelDomainMetadataSchema,
7013
7091
  ontology: OrganizationModelDomainMetadataSchema,
7014
7092
  resources: OrganizationModelDomainMetadataSchema,
7093
+ topology: OrganizationModelDomainMetadataSchema,
7015
7094
  actions: OrganizationModelDomainMetadataSchema,
7016
7095
  entities: OrganizationModelDomainMetadataSchema,
7017
7096
  policies: OrganizationModelDomainMetadataSchema,
@@ -7030,6 +7109,7 @@ var OrganizationModelSchemaBase = z.object({
7030
7109
  systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
7031
7110
  ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
7032
7111
  resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
7112
+ topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
7033
7113
  actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
7034
7114
  entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
7035
7115
  policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
@@ -7372,6 +7452,25 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
7372
7452
  surface: ontologyCompilation.ontology.surfaces
7373
7453
  };
7374
7454
  const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
7455
+ function topologyTargetExists(ref) {
7456
+ if (ref.kind === "system") return systemsById.has(ref.id);
7457
+ if (ref.kind === "resource") return resourcesById.has(ref.id);
7458
+ if (ref.kind === "ontology") return ontologyIds.has(ref.id);
7459
+ if (ref.kind === "policy") return policiesById.has(ref.id);
7460
+ if (ref.kind === "role") return rolesById.has(ref.id);
7461
+ return true;
7462
+ }
7463
+ Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
7464
+ ["from", "to"].forEach((side) => {
7465
+ const ref = relationship[side];
7466
+ if (topologyTargetExists(ref)) return;
7467
+ addIssue(
7468
+ ctx,
7469
+ ["topology", "relationships", relationshipId, side],
7470
+ `Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
7471
+ );
7472
+ });
7473
+ });
7375
7474
  const ontologyReferenceKeyKinds = {
7376
7475
  valueType: "value-type",
7377
7476
  catalogType: "catalog",
@@ -7510,11 +7609,18 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
7510
7609
  }
7511
7610
  });
7512
7611
  function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
7513
- ids?.forEach((ontologyId, ontologyIndex) => {
7612
+ const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
7613
+ ontologyIds2.forEach((ontologyId, ontologyIndex) => {
7514
7614
  if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
7515
7615
  addIssue(
7516
7616
  ctx,
7517
- ["resources", resourceId, "ontology", bindingKey, ontologyIndex],
7617
+ [
7618
+ "resources",
7619
+ resourceId,
7620
+ "ontology",
7621
+ bindingKey,
7622
+ ...Array.isArray(ids) ? [ontologyIndex] : []
7623
+ ],
7518
7624
  `Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
7519
7625
  );
7520
7626
  }
@@ -7523,7 +7629,8 @@ OrganizationModelSchemaBase.superRefine((model, ctx) => {
7523
7629
  Object.values(model.resources).forEach((resource) => {
7524
7630
  const binding = resource.ontology;
7525
7631
  if (binding === void 0) return;
7526
- validateResourceOntologyBinding(resource.id, "implements", "action", binding.implements);
7632
+ validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
7633
+ validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
7527
7634
  validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
7528
7635
  validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
7529
7636
  validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
@@ -7657,7 +7764,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
7657
7764
  business: {
7658
7765
  type: "group",
7659
7766
  label: "Business",
7660
- icon: "business",
7767
+ icon: "briefcase",
7661
7768
  order: 20,
7662
7769
  children: {
7663
7770
  sales: {
@@ -7674,7 +7781,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
7674
7781
  label: "Clients",
7675
7782
  path: "/clients",
7676
7783
  surfaceType: "list",
7677
- icon: "projects",
7784
+ icon: "clients",
7678
7785
  order: 20,
7679
7786
  targets: { systems: ["clients"] }
7680
7787
  },
@@ -8048,7 +8155,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
8048
8155
  enabled: true,
8049
8156
  lifecycle: "active",
8050
8157
  color: "orange",
8051
- icon: "projects",
8158
+ icon: "clients",
8052
8159
  path: "/clients"
8053
8160
  },
8054
8161
  operations: {
@@ -8352,6 +8459,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
8352
8459
  },
8353
8460
  ontology: DEFAULT_ONTOLOGY_SCOPE,
8354
8461
  resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
8462
+ topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
8355
8463
  actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
8356
8464
  entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
8357
8465
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -57,9 +57,9 @@
57
57
  "tsup": "^8.0.0",
58
58
  "typescript": "5.9.2",
59
59
  "zod": "^4.1.0",
60
- "@repo/eslint-config": "0.0.0",
60
+ "@repo/core": "0.25.0",
61
61
  "@repo/typescript-config": "0.0.0",
62
- "@repo/core": "0.24.0"
62
+ "@repo/eslint-config": "0.0.0"
63
63
  },
64
64
  "scripts": {
65
65
  "lint": "eslint src --max-warnings 0",
@@ -32,11 +32,11 @@ The workflow is registered in `operations/src/index.ts` as part of the `example`
32
32
 
33
33
  1. **Define the descriptor in `core/config/organization-model.ts`** -- Add the OM Resource descriptor under the id-keyed `resources` map so identity, System membership, owner role, and governance status are authored once.
34
34
 
35
- 2. **Model the semantic surface** -- Add durable business nouns, verbs, catalogs, links, events, and surfaces to the owning System's `ontology`; add system-local defaults/settings to `System.config`; add explanatory or governing material to `knowledge`; and keep transient DTOs and handler internals out of the OM. Top-level `entities`, top-level `actions`, and `System.content` are compatibility mirrors only when current published consumers still need them.
35
+ 2. **Model the semantic surface** -- Add durable business nouns, verbs, catalogs, links, events, and surfaces to the owning System's `ontology`; bind executable Resources through `resource.ontology.actions` and optional `resource.ontology.primaryAction`; add system-local defaults/settings to `System.config`; add explanatory or governing material to `knowledge`; and keep transient DTOs and handler internals out of the OM. Top-level `entities`, top-level `actions`, and `System.content` are compatibility mirrors only when current published consumers still need them.
36
36
 
37
37
  3. **Define the contract in `core/types/`** -- Add Zod schemas and inferred types to `core/types/index.ts` (or a new file under `core/types/`). Use `core/types/entities.ts` when workflows operate on project-specific entity contracts.
38
38
 
39
- 4. **Implement the workflow in `operations/src/`** -- Create a new directory under `operations/src/` for the feature. Import the descriptor, derive runtime `resourceId` / `type` from it, export the workflow from its `index.ts`, and register it in `operations/src/index.ts`.
39
+ 4. **Implement the workflow in `operations/src/`** -- Create a new directory under `operations/src/` for the feature. Import the descriptor, derive runtime `resourceId`, `type`, `name`, and `description` from it, export the workflow from its `index.ts`, and register it in `operations/src/index.ts`.
40
40
 
41
41
  5. **Add the UI in `ui/src/routes/`** -- Create a new route file. Use TanStack Query to call the workflow execution endpoint. Import schemas from `@core/types` for validation and type inference. Read OM resources, ontology, knowledge, and graph data where possible instead of creating page-local semantic registries.
42
42
 
@@ -51,7 +51,7 @@ pnpm -C operations deploy # deploy to dev
51
51
 
52
52
  ## Resource Registry
53
53
 
54
- `operations/src/index.ts` default-exports a `DeploymentSpec` with `version`, `organizationModel`, `workflows`, `agents`, and optional topology-oriented metadata such as `triggers`, `integrations`, `relationships`, `humanCheckpoints`, and `externalResources`. Each feature group exports `workflows` and `agents` arrays from its own `index.ts`, spread into the top-level spec. `DeploymentSpec` assembles deployable behavior; it should not be treated as a second resource identity catalog.
54
+ `operations/src/index.ts` default-exports a `DeploymentSpec` with `version`, `organizationModel`, `workflows`, `agents`, and optional deployment mechanics such as `triggers`, `integrations`, `relationships`, `humanCheckpoints`, and `externalResources`. Durable operational wiring belongs in `organizationModel.topology.relationships`; deployment mechanics, credentials, provider webhook details, and per-run state stay outside the OM. Each feature group exports `workflows` and `agents` arrays from its own `index.ts`, spread into the top-level spec. `DeploymentSpec` assembles deployable behavior; it should not be treated as a second resource identity catalog.
55
55
 
56
56
  When you need breadth first, read:
57
57
 
@@ -1,32 +1,32 @@
1
- ---
2
- description: Edits to the canonical organization model go through /knowledge
3
- paths:
4
- - core/config/organization-model.ts
5
- - core/config/extensions/**/*.ts
6
- ---
7
-
8
- # Organization Model Edit Guide
9
-
10
- `core/config/organization-model.ts` is the single source of truth for this
11
- project's organizational identity -- it encodes customers, offerings, roles, goals,
1
+ ---
2
+ description: Edits to the canonical organization model go through /om
3
+ paths:
4
+ - core/config/organization-model.ts
5
+ - core/config/extensions/**/*.ts
6
+ ---
7
+
8
+ # Organization Model Edit Guide
9
+
10
+ `core/config/organization-model.ts` is the single source of truth for this
11
+ project's organizational identity -- it encodes customers, offerings, roles, goals,
12
12
  Systems, ontology, Policies, Knowledge, config, and Resources
13
13
  descriptors that agents, workflows, and the UI shell all consume at runtime.
14
14
  New semantic authoring should start in system-colocated `ontology` scopes. Top-level
15
15
  `entities`, top-level `actions`, and `System.content` remain compatibility mirrors while
16
16
  published consumers finish moving to compiled ontology indexes.
17
-
18
- ## Preferred Entry Point: `/knowledge`
19
-
20
- Direct edits to `organization-model.ts` are discouraged. Instead, use `/knowledge` (or
21
- `/knowledge <domain>`) to run the read → propose → confirm → write → validate ceremony:
22
-
23
- 1. The skill reads the current model so proposals start from ground truth.
24
- 2. It drafts only the specific block being changed, leaving everything else intact.
25
- 3. The user confirms before any file is written.
26
- 4. After writing, `pnpm -C operations check-types` runs and `OrganizationModelSchema.parse()`
27
- is verified. On failure the file is rolled back automatically.
28
-
29
- Use `/knowledge <domain>` for targeted edits: `identity`, `customers`, `offerings`,
17
+
18
+ ## Preferred Entry Point: `/om`
19
+
20
+ Direct edits to `organization-model.ts` are discouraged. Instead, use `/om` (or
21
+ `/om <domain>`) to run the read → propose → confirm → write → validate ceremony:
22
+
23
+ 1. The skill reads the current model so proposals start from ground truth.
24
+ 2. It drafts only the specific block being changed, leaving everything else intact.
25
+ 3. The user confirms before any file is written.
26
+ 4. After writing, `pnpm -C operations check-types` runs and `OrganizationModelSchema.parse()`
27
+ is verified. On failure the file is rolled back automatically.
28
+
29
+ Use `/om <domain>` for targeted edits: `identity`, `customers`, `offerings`,
30
30
  `roles`, `goals`, `techStack`, `systems`, `actions`, or `labels`. Resource identity and
31
31
  governance metadata belong in the id-keyed `resources` map; operations code derives runtime
32
32
  `resourceId` / `type` from those descriptors.
@@ -36,78 +36,81 @@ Author system-local semantics by boundary:
36
36
  - `System.ontology` owns durable object types, action types, catalog types, link types, event types, and surfaces.
37
37
  - `System.config` owns system-local JSON settings and defaults.
38
38
  - `resources` own executable workflow/agent descriptors, `systemPath`, owners, governance status, code references, and runtime implementation links.
39
- - `resource.ontology` describes implemented actions, reads, writes, catalog use, and emitted events.
39
+ - `resource.ontology.actions` describes the ontology actions a Resource performs; `resource.ontology.primaryAction` names the default/selectable action when a Resource has one.
40
+ - `resource.ontology` also describes reads, writes, catalog use, and emitted events.
41
+ - `topology.relationships` owns durable operational wiring between Systems, Resources, ontology nodes, policies, roles, triggers, checkpoints, and external resources.
40
42
  - `knowledge` owns long-form playbooks, strategies, references, and governance context.
41
43
  - `System.content`, top-level `entities`, and top-level `actions` are compatibility mirrors only. Keep them aligned when current published consumers still need them, but do not treat them as the primary authoring surface.
42
44
 
43
- Keep `actionKey` as the current runtime compatibility bridge to workflow metadata.
44
-
45
- ## Runtime Validation
46
-
47
- The model is validated at startup via `resolveOrganizationModel()` followed by
48
- `OrganizationModelSchema.parse()`. Cross-reference checks (segment ID refs in offerings,
49
- role reporting lines, period ordering in goals) are runtime-only and not caught by tsc
50
- alone -- always let the ceremony run both checks before treating a change as complete.
51
-
52
- ## Extension Files
53
-
54
- New Zod extension files under `core/config/extensions/` are Level B codify
55
- operations. Route these through `/knowledge <domain>` as well -- the skill gates Level B
56
- to explicit user confirmation before scaffolding a new `.ts` file.
57
-
58
- This is a soft guide, not a hard block. The ceremony exists to prevent silent schema
59
- drift and to keep the model's editorial history visible.
60
-
61
- ## Resource System Attachment
62
-
63
- Every resource in the id-keyed `organizationModel.resources` map declares which System it belongs to
64
- via `systemPath` -- a dot-separated path that resolves against the OM system tree
65
- (e.g. `"sys.operations"`, `"sales.crm"`):
66
-
67
- ```ts
68
- {
69
- id: 'apify-website-crawl',
70
- systemPath: 'sys.operations', // canonical system attachment
71
- kind: 'workflow',
72
- ...
73
- }
74
- ```
75
-
76
- `systemPath` is validated at parse time by `SystemPathSchema` and cross-checked by
77
- `OrganizationModelSchema.superRefine` -- an unresolvable path causes a Zod error at
78
- schema validation. Use `getResourcesForSystem(model, path)` (from `@elevasis/core`) to
79
- query resources for a system at runtime. Pass `{ includeDescendants: true }` to include
80
- all descendant systems (segment-aware -- `'sales'` does NOT match `'salesforce.foo'`).
81
-
82
- Some external templates may carry a `systemId` compatibility mirror while published
83
- `@elevasis/core` releases catch up to the current source contract. Treat that field as
84
- legacy adapter data only; author new resource relationships against `systemPath`.
85
-
86
- Do not fetch resources for every system-oriented read by default. For agent workflows, start
87
- with the user's requested OM/knowledge context and query resources only when the task involves
88
- runtime ownership, executable implementation, observability, deployment, or resource governance.
89
- Use the descendant rollup only when parent-system scope is intended.
90
-
91
- `resource.category` and `resource.links[].nodeId` are **runtime filter overlays** -- they
92
- drive UI faceted filtering in the Command Center but do NOT define system membership.
93
- System membership is `systemPath` only.
94
-
95
- ```ts
96
- // category and links power UI filter chips; systemPath is the
97
- // canonical OM attachment used for graph edges and getResourcesForSystem queries.
98
- ```
99
-
45
+ Do not author Resource `actionKey` in the target contract. Runtime/UI routing that needs a single selectable action should read `resource.ontology.primaryAction`.
46
+
47
+ ## Runtime Validation
48
+
49
+ The model is validated at startup via `resolveOrganizationModel()` followed by
50
+ `OrganizationModelSchema.parse()`. Cross-reference checks (segment ID refs in offerings,
51
+ role reporting lines, period ordering in goals) are runtime-only and not caught by tsc
52
+ alone -- always let the ceremony run both checks before treating a change as complete.
53
+
54
+ ## Extension Files
55
+
56
+ New Zod extension files under `core/config/extensions/` are Level B codify
57
+ operations. Route these through `/om <domain>` as well -- the skill gates Level B
58
+ to explicit user confirmation before scaffolding a new `.ts` file.
59
+
60
+ This is a soft guide, not a hard block. The ceremony exists to prevent silent schema
61
+ drift and to keep the model's editorial history visible.
62
+
63
+ ## Resource System Attachment
64
+
65
+ Every resource in the id-keyed `organizationModel.resources` map declares which System it belongs to
66
+ via `systemPath` -- a dot-separated path that resolves against the OM system tree
67
+ (e.g. `"sys.operations"`, `"sales.crm"`):
68
+
69
+ ```ts
70
+ {
71
+ id: 'apify-website-crawl',
72
+ systemPath: 'sys.operations', // canonical system attachment
73
+ kind: 'workflow',
74
+ ...
75
+ }
76
+ ```
77
+
78
+ `systemPath` is validated at parse time by `SystemPathSchema` and cross-checked by
79
+ `OrganizationModelSchema.superRefine` -- an unresolvable path causes a Zod error at
80
+ schema validation. Use `getResourcesForSystem(model, path)` (from `@elevasis/core`) to
81
+ query resources for a system at runtime. Pass `{ includeDescendants: true }` to include
82
+ all descendant systems (segment-aware -- `'sales'` does NOT match `'salesforce.foo'`).
83
+
84
+ Some external templates may carry a `systemId` compatibility mirror while published
85
+ `@elevasis/core` releases catch up to the current source contract. Treat that field as
86
+ legacy adapter data only; author new resource relationships against `systemPath`.
87
+
88
+ Do not fetch resources for every system-oriented read by default. For agent workflows, start
89
+ with the user's requested OM/om context and query resources only when the task involves
90
+ runtime ownership, executable implementation, observability, deployment, or resource governance.
91
+ Use the descendant rollup only when parent-system scope is intended.
92
+
93
+ `resource.category` and `resource.links[].nodeId` are **runtime filter overlays** -- they
94
+ drive UI faceted filtering in the Command Center but do NOT define system membership.
95
+ System membership is `systemPath` only.
96
+
97
+ ```ts
98
+ // category and links power UI filter chips; systemPath is the
99
+ // canonical OM attachment used for graph edges and getResourcesForSystem queries.
100
+ ```
101
+
100
102
  `resource.codeRefs[]` are repo-relative implementation breadcrumbs for agents and
101
103
  operators. Use them to point from a governed OM Resource descriptor to the operations
102
104
  entrypoint, handler, schema, test, docs, or config files that implement it. They do
103
105
  not define resource identity, System membership, runtime execution topology, or graph
104
106
  relationships.
105
107
 
108
+ `topology.relationships` defines durable operational wiring in the OM. Keep credential
109
+ values, provider webhook mechanics, deployment environment settings, execution logs,
110
+ and per-run scheduler state outside the OM.
111
+
106
112
  `System.ontology` owns durable semantic contracts: object types, action types, catalog
107
113
  types, link types, event types, and surfaces. `System.config` owns local settings and
108
114
  defaults. If current UI or runtime code still needs legacy mirrors, keep `entities`,
109
115
  `actions`, or `System.content` aligned with the ontology/config record instead of
110
116
  inventing a separate source of truth.
111
-
112
- See `.claude/rules/system-shaping.md` (in the monorepo) for the substrate-shaping
113
- propagation checklist that governs renames of this shape.